/* Bridge & Build QIR — dashboard styles */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --teal-600: hsl(170 45% 28%);
  --teal-700: hsl(170 45% 22%);
  --teal-050: hsl(170 40% 95%);
  --coral-500: hsl(16 85% 65%);
  --ink-900: hsl(200 15% 15%);
  --paper: hsl(40 20% 98%);
  --line: #e2e5e3;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  background: var(--paper);
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.5;
}

.topbar {
  background: var(--teal-600);
  color: white;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.topbar .brand img { height: 30px; width: auto; background: white; border-radius: 4px; padding: 2px; }

.topbar nav { display: flex; gap: 4px; flex: 1; }

.topbar nav a {
  color: hsl(170 30% 85%);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 500;
}

.topbar nav a.active, .topbar nav a:hover { background: var(--teal-700); color: white; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

h2 { font-size: 20px; margin-bottom: 16px; }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--teal-600); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar .spacer { flex: 1; }

input, select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: inherit;
}

input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-600); outline-offset: -1px; }

input[type="search"] { min-width: 260px; }

button, .btn {
  font: inherit;
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid var(--teal-600);
  border-radius: 6px;
  background: var(--teal-600);
  color: white;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button:hover, .btn:hover { background: var(--teal-700); }

button.ghost, .btn.ghost { background: white; color: var(--teal-600); }
button.ghost:hover, .btn.ghost:hover { background: var(--teal-050); }

button.danger { background: white; border-color: #c0392b; color: #c0392b; }
button.danger:hover { background: #fdf1ef; }

button.small, .btn.small { padding: 4px 10px; font-size: 12.5px; font-weight: 500; }

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

table.list { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.list th {
  background: var(--teal-050);
  color: var(--teal-700);
  text-align: left;
  padding: 10px 12px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.list td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.list tr:hover td { background: hsl(170 40% 98%); }
td.num, th.num { text-align: right; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
  background: #eee;
  color: #444;
}

.badge.draft    { background: #ececec; color: #555; }
.badge.sent     { background: hsl(205 70% 92%); color: hsl(205 70% 30%); }
.badge.accepted, .badge.paid, .badge.issued { background: hsl(145 45% 90%); color: hsl(145 60% 24%); }
.badge.overdue, .badge.expired, .badge.rejected { background: hsl(8 75% 93%); color: hsl(8 70% 38%); }
.badge.void, .badge.cancelled { background: #f2f2f2; color: #999; text-decoration: line-through; }
.badge.quoting  { background: hsl(45 90% 90%); color: hsl(40 80% 28%); }
.badge.invoiced { background: hsl(205 70% 92%); color: hsl(205 70% 30%); }
.badge.closed   { background: #e8e8e8; color: #666; }

.badge.type-quotation { background: hsl(45 90% 90%); color: hsl(40 80% 28%); }
.badge.type-invoice   { background: hsl(205 70% 92%); color: hsl(205 70% 30%); }
.badge.type-receipt   { background: hsl(145 45% 90%); color: hsl(145 60% 24%); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: #555; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }

.items-editor table { width: 100%; border-collapse: collapse; }
.items-editor th { text-align: left; font-size: 12px; color: #666; padding: 4px 6px; }
.items-editor td { padding: 4px 6px; vertical-align: top; }
.items-editor input, .items-editor textarea { width: 100%; }
.items-editor .num input { text-align: right; }

.totals { text-align: right; margin-top: 12px; font-size: 15px; }
.totals strong { font-size: 18px; color: var(--teal-600); }

.muted { color: #888; font-size: 12.5px; }
.error-banner { background: #fdf1ef; border: 1px solid #e5b8b0; color: #8c2f22; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal-600);
  border-radius: 8px;
  padding: 12px 16px;
}
.stat .n { font-size: 22px; font-weight: 700; color: var(--teal-600); }
.stat .l { font-size: 12px; color: #777; }
.stat.warn { border-left-color: var(--coral-500); }
.stat.warn .n { color: hsl(8 70% 45%); }

a.doclink { color: var(--teal-600); font-weight: 600; text-decoration: none; }
a.doclink:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar { overflow-x: auto; }
}
