/* 雲林縣縣購軟體申請平台 —— 公部門風格：清楚、對比足、可長時間閱讀 */

:root {
  --navy:        #0f5c8c;
  --navy-dark:   #0b4468;
  --navy-light:  #e8f1f7;
  --teal:        #0f7b8a;
  --ink:         #1f2933;
  --ink-soft:    #52606d;
  --ink-faint:   #9aa5b1;
  --line:        #e0e6ed;
  --bg:          #f4f6f9;
  --surface:     #ffffff;
  --green:       #1b7a44;
  --green-bg:    #e7f5ed;
  --amber:       #a05e03;
  --amber-bg:    #fdf3e2;
  --red:         #b42318;
  --red-bg:      #fdeceb;
  --grey-bg:     #eef1f5;
  --radius:      10px;
  --shadow:      0 1px 3px rgba(16, 42, 67, .08), 0 1px 2px rgba(16, 42, 67, .04);
  --shadow-lg:   0 4px 16px rgba(16, 42, 67, .1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 版面 ---------- */

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }

header.site {
  background: var(--navy);
  color: #fff;
  border-bottom: 4px solid var(--teal);
}
header.site .wrap { display: flex; align-items: center; gap: 16px; height: 68px; }
.brand { display: flex; flex-direction: column; line-height: 1.25; }
.brand a { color: #fff; font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.brand a:hover { text-decoration: none; }
.brand small { color: #b9d6e8; font-size: 12px; font-weight: 400; }
.spacer { flex: 1; }

nav.top { display: flex; gap: 4px; align-items: center; }
nav.top a {
  color: #d7e8f4; padding: 7px 13px; border-radius: 6px;
  font-size: 14px; font-weight: 500;
}
nav.top a:hover { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
nav.top a.on { background: rgba(255, 255, 255, .18); color: #fff; }
nav.top .who { color: #b9d6e8; font-size: 13px; padding-left: 8px; }

.adminbar {
  background: var(--navy-dark); border-bottom: 1px solid rgba(255,255,255,.1);
}
.adminbar .wrap { display: flex; gap: 2px; overflow-x: auto; }
.adminbar a {
  color: #cfe3f0; padding: 10px 14px; font-size: 13.5px; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.adminbar a:hover { color: #fff; text-decoration: none; }
.adminbar a.on { color: #fff; border-bottom-color: var(--teal); font-weight: 600; }

main { padding: 28px 0 64px; }

footer.site {
  border-top: 1px solid var(--line); background: #fff;
  padding: 22px 0; font-size: 13px; color: var(--ink-faint);
}

/* ---------- 標題 ---------- */

h1 { font-size: 25px; margin: 0 0 6px; letter-spacing: -.2px; }
h2 { font-size: 18px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 0 0 10px; color: var(--ink-soft); }
.lede { color: var(--ink-soft); margin: 0 0 24px; font-size: 14.5px; }
.pagehead { margin-bottom: 22px; }
.pagehead .row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.pagehead .row .spacer { flex: 1; }

/* ---------- 卡片 ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card.pad-sm { padding: 16px; }
.card h2 { display: flex; align-items: center; gap: 8px; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
}

/* ---------- 名額卡 ---------- */

.quota {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.quota .name { font-weight: 700; font-size: 16px; }
.quota .vendor { font-size: 12px; color: var(--ink-faint); margin-bottom: 12px; }
.quota .desc { font-size: 13px; color: var(--ink-soft); margin: 0 0 14px; flex: 1; }
.quota .nums { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.quota .big { font-size: 30px; font-weight: 700; color: var(--navy); line-height: 1; }
.quota .of { font-size: 13px; color: var(--ink-faint); }
.quota.full .big { color: var(--red); }

.bar { height: 7px; background: var(--grey-bg); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.bar > i.warn { background: var(--amber); }
.bar > i.full { background: var(--red); }
.quota .foot {
  display: flex; justify-content: space-between; font-size: 12px;
  color: var(--ink-faint); margin-top: 7px;
}

/* ---------- 統計數字 ---------- */

.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .k { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 4px; }
.stat .v { font-size: 27px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.stat .v.warn { color: var(--amber); }
.stat .v.ok { color: var(--green); }

/* ---------- 表單 ---------- */

label.field { display: block; margin-bottom: 17px; }
label.field > .lab {
  display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink);
}
label.field .hint { font-weight: 400; color: var(--ink-faint); font-size: 12.5px; }
.req { color: var(--red); margin-left: 2px; }

input[type=text], input[type=email], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; font-size: 14.5px; font-family: inherit;
  border: 1px solid #cbd3dd; border-radius: 7px; background: #fff; color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15, 92, 140, .13);
}
textarea { resize: vertical; min-height: 92px; }
input[readonly] { background: var(--grey-bg); color: var(--ink-soft); }

.code-input {
  font-size: 26px; letter-spacing: 11px; text-align: center; font-weight: 700;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; font-size: 14.5px; font-weight: 600; font-family: inherit;
  border-radius: 7px; border: 1px solid transparent; cursor: pointer;
  background: var(--navy); color: #fff; transition: background .12s;
}
.btn:hover { background: var(--navy-dark); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; border-color: #cbd3dd; color: var(--ink); }
.btn.ghost:hover { background: var(--grey-bg); color: var(--ink); }
.btn.ok { background: var(--green); }
.btn.ok:hover { background: #146034; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #8f1c12; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; }

/* ---------- 提示訊息 ---------- */

.msg {
  padding: 12px 15px; border-radius: 8px; font-size: 14px;
  margin-bottom: 18px; border-left: 3px solid;
}
.msg.err  { background: var(--red-bg);   border-color: var(--red);   color: #8f1c12; }
.msg.ok   { background: var(--green-bg); border-color: var(--green); color: #146034; }
.msg.info { background: var(--navy-light); border-color: var(--navy); color: var(--navy-dark); }
.msg.warn { background: var(--amber-bg); border-color: var(--amber); color: #7d4a02; }
.msg b { font-weight: 700; }

/* ---------- 標籤 ---------- */

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag.pending   { background: var(--amber-bg); color: var(--amber); }
.tag.approved  { background: var(--green-bg); color: var(--green); }
.tag.rejected  { background: var(--red-bg);   color: var(--red); }
.tag.cancelled { background: var(--grey-bg);  color: var(--ink-soft); }
.tag.revoked   { background: var(--grey-bg);  color: var(--ink-soft); }
.tag.muted     { background: var(--grey-bg);  color: var(--ink-soft); }
.tag.info      { background: var(--navy-light); color: var(--navy); }

/* ---------- 表格 ---------- */

.tablewrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: #f7f9fb; text-align: left; padding: 11px 13px; font-weight: 600;
  color: var(--ink-soft); border-bottom: 1px solid var(--line); white-space: nowrap;
  font-size: 12.5px;
}
tbody td { padding: 11px 13px; border-bottom: 1px solid #f0f3f6; vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-faint); font-size: 14px; }

/* ---------- 篩選列 ---------- */

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-soft); }
.filters select, .filters input { min-width: 130px; padding: 7px 10px; font-size: 13.5px; }
.filters .grow { flex: 1; min-width: 180px; }

/* ---------- 明細列表 ---------- */

.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 20px; font-size: 14px; }
.dl dt { color: var(--ink-soft); font-size: 13px; }
.dl dd { margin: 0; }

/* ---------- 時間軸 ---------- */

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--line);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--navy); border: 2px solid #fff;
}
.timeline li.ok::before  { background: var(--green); }
.timeline li.bad::before { background: var(--red); }
.timeline .when { font-size: 12px; color: var(--ink-faint); }
.timeline .what { font-size: 14px; font-weight: 600; }
.timeline .who  { font-size: 12.5px; color: var(--ink-soft); }
.timeline .note {
  font-size: 13px; color: var(--ink-soft); background: #f7f9fb;
  padding: 7px 10px; border-radius: 6px; margin-top: 5px;
}

/* ---------- 雜項 ---------- */

.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }
.muted { color: var(--ink-faint); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex.wrap { flex-wrap: wrap; }
.notice-box {
  background: var(--navy-light); border-radius: 8px; padding: 14px 16px;
  font-size: 13.5px; line-height: 1.75; color: var(--navy-dark);
}
.notice-box ol, .notice-box ul { margin: 6px 0 0; padding-left: 20px; }
.notice-box li { margin-bottom: 3px; }

@media print {
  header.site, .adminbar, footer.site, .actions, .filters { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}
