/* Design tokens — clean modern SaaS (Linear/Notion-ish) */
:root {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-muted: #f5f5f4;
  --surface: #ffffff;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --text: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #a8a29e;

  --brand: #5b5bd6;
  --brand-hover: #4f4fc9;
  --brand-soft: #eeeefc;
  --brand-text: #3838b8;

  --green: #16a34a;
  --green-soft: #dcfce7;
  --green-text: #15803d;

  --amber: #d97706;
  --amber-soft: #fef3c7;
  --amber-text: #b45309;

  --red: #dc2626;
  --red-soft: #fee2e2;
  --red-text: #b91c1c;

  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --blue-text: #1d4ed8;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.04);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-display: 'Instrument Serif', 'Iowan Old Style', 'Georgia', serif;
  --font-sans: 'Manrope', ui-sans-serif, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-subtle);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.011em;
  font-weight: 400;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ── Layout ────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* App bar — brand + nav + search + role + user. Replaces sidebar. */
.appbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  height: 56px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.appbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 14px;
  margin-right: 4px;
  border-right: 1px solid var(--border);
  height: 28px;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #5b5bd6, #8a4fd6);
  display: grid; place-items: center;
  color: white; font-weight: 500; font-size: 17px;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.18);
  font-family: var(--font-display);
  font-style: italic;
  line-height: 1;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.005em;
}
.brand-sub { font-size: 11px; color: var(--text-muted); }

/* Nav in app bar */
.nav { display: inline-flex; align-items: center; gap: 1px; height: 36px; }
.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg-muted); color: var(--text); }
.nav-item.active { background: var(--bg-muted); color: var(--text); }
.nav-item svg { color: var(--text-muted); flex: 0 0 auto; }
.nav-item.active svg { color: var(--brand); }
.nav-badge {
  background: var(--brand);
  color: white;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 9px;
  font-weight: 600;
  min-width: 16px;
  text-align: center;
  line-height: 1.4;
  font-family: var(--font-mono);
}

.appbar .spacer { flex: 1; }

/* Search */
.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-wrap > svg.search-icon {
  position: absolute;
  left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
input.search {
  height: 32px;
  width: 220px;
  padding: 0 36px 0 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  outline: none;
  font-size: 13px;
  transition: width 0.18s, border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
input.search:focus {
  width: 280px;
  border-color: var(--brand);
  background: white;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.search-wrap .kbd {
  position: absolute;
  right: 7px; top: 50%; transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-muted);
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-weight: 500;
  pointer-events: none;
  line-height: 1.3;
}

/* Role toggle (kept for profile page) */
.role-toggle {
  display: inline-flex;
  background: var(--bg-muted);
  padding: 3px;
  border-radius: 7px;
  border: 1px solid var(--border);
  height: 32px;
  align-items: center;
}
.role-toggle button {
  background: transparent;
  border: 0;
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.role-toggle button.on {
  background: white;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* User chip (in app bar) */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px 0 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.user-chip:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
.user-chip.open { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.user-chip .user-chip-text { display: flex; flex-direction: column; align-items: flex-start; }
.user-chip .name { font-size: 12px; font-weight: 500; line-height: 1.1; }
.user-chip .sub {
  font-size: 10px; color: var(--text-muted); line-height: 1.1;
  font-family: var(--font-mono); letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 4px;
}
.user-chip .preview-dot { color: var(--amber); font-size: 8px; }

/* Preview mode badge (when viewing as employee) */
.preview-banner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--amber-text);
  background: var(--amber-soft);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* User dropdown menu */
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
  z-index: 50;
  animation: ddIn 0.13s ease-out;
}
.user-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 9px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
}
.user-menu-name { font-size: 13px; font-weight: 600; }
.user-menu-email { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.user-menu-section {
  padding: 8px 9px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}
.user-menu-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px;
  border: 0;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  width: 100%;
  text-align: left;
}
.user-menu-item:hover { background: var(--bg-subtle); }
.user-menu-item svg { color: var(--text-secondary); }
.user-menu-item .user-menu-check { margin-left: auto; color: var(--brand); }
.user-menu-divider { height: 1px; background: var(--border); margin: 5px 0; }

/* Collapse the app bar gracefully at narrow widths */
@media (max-width: 1180px) {
  .appbar input.search { width: 160px; }
  .appbar input.search:focus { width: 220px; }
  .user-chip .user-chip-text { display: none; }
  .preview-banner { display: none; }
}
@media (max-width: 1024px) {
  .appbar { gap: 10px; padding: 0 14px; }
  .appbar .nav-item span { display: none; }
  .appbar .nav-item { padding: 0 8px; }
  .search-wrap .kbd { display: none; }
  .appbar input.search { width: 130px; padding-right: 10px; }
}

.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: white;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  font-family: var(--font-sans);
}
.avatar.admin { background: linear-gradient(135deg, #5b5bd6, #8a4fd6); }

/* ── Main canvas ────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.page { padding: 22px 28px 80px; max-width: 1440px; width: 100%; margin: 0 auto; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.018em;
  line-height: 1.05;
}
.page-head .sub {
  color: var(--text-secondary);
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: -0.005em;
}
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  transition: background 0.1s;
  letter-spacing: -0.005em;
}
.btn:hover { background: var(--bg-muted); }
.btn.primary {
  background: var(--text);
  color: white;
  border-color: var(--text);
}
.btn.primary:hover { background: #000; }
.btn.brand {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.btn.brand:hover { background: var(--brand-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg-muted); }
.btn.danger { color: var(--red-text); }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 4px 8px; font-size: 12px; }
.btn.icon { padding: 6px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.card-head .sub { color: var(--text-secondary); font-size: 12px; }
.card-body { padding: 16px; }

/* ── Stat cards ─────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
button.stat {
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
button.stat:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
button.stat:hover .stat-arrow { opacity: 1; transform: translateX(2px); }
button.stat:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.stat-arrow {
  margin-left: auto;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.12s, transform 0.15s;
}
.stat-label { font-size: 11px; color: var(--text-secondary); display: flex; align-items: center; gap: 7px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.045em; }
.stat-value {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-top: 2px;
}
.stat-trend { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.stat-icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand-text);
}
.stat-icon.red { background: var(--red-soft); color: var(--red-text); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber-text); }
.stat-icon.green { background: var(--green-soft); color: var(--green-text); }
.stat-icon.blue { background: var(--blue-soft); color: var(--blue-text); }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
}
table.data th.no-sort { cursor: default; }
table.data th .sort-arrow { color: var(--text-muted); font-size: 10px; margin-left: 4px; }
table.data th.sorted { color: var(--text); }
table.data th.sorted .sort-arrow { color: var(--brand); }
table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tr:hover td { background: var(--bg-subtle); }
table.data tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.cell-primary { font-weight: 500; color: var(--text); letter-spacing: -0.005em; }
.cell-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 400; }
.mono { font-family: var(--font-mono); font-size: 12px; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.badge.dot::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.green { background: var(--green-soft); color: var(--green-text); border-color: transparent; }
.badge.amber { background: var(--amber-soft); color: var(--amber-text); border-color: transparent; }
.badge.red { background: var(--red-soft); color: var(--red-text); border-color: transparent; }
.badge.blue { background: var(--blue-soft); color: var(--blue-text); border-color: transparent; }
.badge.brand { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }

.kind-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.kind-pill.domain { color: var(--brand-text); background: var(--brand-soft); border-color: transparent; }
.kind-pill.server { color: var(--blue-text); background: var(--blue-soft); border-color: transparent; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 2px;
  margin-bottom: 16px;
}
.tab {
  background: transparent;
  border: 0;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab .count { font-size: 11px; color: var(--text-muted); background: var(--bg-muted); padding: 1px 6px; border-radius: 10px; }
.tab.active .count { background: var(--bg-muted); color: var(--text); }

/* ── Filters ────────────────────────────────────────────── */
.filters {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.filter-input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  font-size: 13px;
  outline: none;
}
.filter-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
select.filter-input { padding-right: 26px; }

/* Styled dropdown — replaces native <select> for filters */
.dd { position: relative; display: inline-flex; }
.dd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px 6px 11px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  min-height: 32px;
  transition: border-color 0.1s, background 0.1s;
}
.dd-trigger:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
.dd-trigger.open { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.dd-trigger .dd-label { color: var(--text-muted); font-weight: 500; }
.dd-trigger .dd-value { color: var(--text); font-weight: 500; }
.dd-trigger .dd-chev { color: var(--text-muted); margin-left: 2px; transition: transform 0.15s; }
.dd-trigger.open .dd-chev { transform: rotate(180deg); }
.dd-trigger .dd-leading {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-secondary);
}
.dd-trigger .dd-leading.brand { background: var(--brand-soft); color: var(--brand-text); }
.dd-trigger .dd-clear {
  display: inline-flex;
  width: 16px; height: 16px;
  align-items: center; justify-content: center;
  border-radius: 4px;
  color: var(--text-muted);
  margin-left: 2px;
}
.dd-trigger .dd-clear:hover { background: var(--bg-muted); color: var(--text); }
.dd-trigger.placeholder .dd-value { color: var(--text-muted); font-weight: 500; }

.dd-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 100%;
  z-index: 50;
  background: white;
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow-md);
  padding: 4px;
  max-height: 320px;
  overflow-y: auto;
  animation: ddIn 0.13s ease-out;
}
.dd-menu.align-right { left: auto; right: 0; }
@keyframes ddIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
.dd-menu-section {
  padding: 6px 9px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
.dd-option {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 9px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  min-width: 160px;
}
.dd-option:hover { background: var(--bg-subtle); }
.dd-option.selected { background: var(--brand-soft); color: var(--brand-text); font-weight: 500; }
.dd-option .dd-opt-meta { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.dd-option.selected .dd-opt-meta { color: var(--brand-text); }
.dd-option .dd-opt-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 4px;
  color: var(--text-secondary);
}
.dd-option.selected .dd-opt-icon { color: var(--brand-text); }
.dd-option .dd-check { margin-left: auto; color: var(--brand); opacity: 0; }
.dd-option.selected .dd-check { opacity: 1; }
.dd-option .dd-swatch { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dd-divider { height: 1px; background: var(--border); margin: 4px 0; }

.view-segment {
  display: inline-flex;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.view-segment button {
  background: transparent;
  border: 0;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 5px;
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer;
}
.view-segment button:hover { color: var(--text); }
.view-segment button.on {
  background: white;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ── Forms / modal ────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: grid; place-items: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 560px;
  max-width: 100%;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.modal-head .sub { font-size: 12px; color: var(--text-secondary); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--bg-subtle);
}

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field.row { flex-direction: row; gap: 10px; align-items: flex-start; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 12px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.field .hint { font-size: 11px; color: var(--text-muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  background: white;
  font-size: 13px;
  outline: none;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field.check input { width: auto; }

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-icon {
  width: 44px; height: 44px;
  margin: 0 auto 10px;
  background: var(--bg-muted);
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--text-muted);
}
.empty h4 { margin: 0 0 4px; color: var(--text); font-size: 14px; font-weight: 600; }
.empty p { margin: 0; font-size: 13px; }

/* ── Approval-specific ─────────────────────────────────── */
.diff-row {
  display: grid;
  grid-template-columns: 140px 1fr 24px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
  align-items: center;
}
.diff-row:last-child { border-bottom: 0; }
.diff-label { color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.diff-old { color: var(--text-muted); text-decoration: line-through; }
.diff-new { color: var(--text); font-weight: 500; background: var(--green-soft); padding: 2px 6px; border-radius: 4px; display: inline-block; }
.diff-arrow { color: var(--text-muted); text-align: center; }

.approval-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: white;
  margin-bottom: 12px;
  overflow: hidden;
}
.approval-head {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.approval-head .who { font-size: 12px; color: var(--text-secondary); }
.approval-head .what { font-weight: 600; font-size: 13px; }
.approval-body { padding: 12px 14px; }
.approval-foot { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: white; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--amber-soft);
  color: var(--amber-text);
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 14px;
}
.notice.brand { background: var(--brand-soft); color: var(--brand-text); }
.notice.blue { background: var(--blue-soft); color: var(--blue-text); }
.notice.red { background: var(--red-soft); color: var(--red-text); }

/* ── Group/section view ───────────────────────────────── */
.client-group { margin-bottom: 22px; }
.client-group-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  padding: 0 2px;
}
.client-group-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.client-group-head .sub { font-size: 12px; color: var(--text-muted); }
.subgroup {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: white;
}
.subgroup-head {
  padding: 9px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Detail page ─────────────────────────────────────── */
.kv-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}
.kv-grid .k { color: var(--text-secondary); font-size: 12px; }
.kv-grid .v { color: var(--text); }

.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--text);
  color: white;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease-out;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Row highlight when pending */
tr.has-pending td { background: linear-gradient(90deg, rgba(217,119,6,0.05), transparent 40%); }
tr.has-pending td:first-child { box-shadow: inset 3px 0 0 var(--amber); }

.section-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 20px 0 8px;
}
.section-head .line { flex: 1; height: 1px; background: var(--border); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
}
