@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Hanken+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --paper:        #f6f8fc;
  --paper-tint:   #eef1f7;
  --surface:      #ffffff;
  --surface-2:    #ffffff;

  --ink:          #0d1734;
  --ink-2:        #44507a;
  --ink-3:        #7c88ad;

  --line:         rgba(13, 23, 52, 0.14);
  --line-soft:    rgba(13, 23, 52, 0.10);
  --shadow-col:   rgba(13, 23, 52, 0.10);

  --vermilion:    #d63c8f;
  --vermilion-bg: #fce0ef;
  --vermilion-tx: #9c1f63;

  --amber:        #fcb631;
  --amber-bg:     #fef1d6;
  --amber-tx:     #8a5f07;

  --pine:         #1f9d76;
  --pine-bg:      #d4f1e6;
  --pine-tx:      #10614a;

  --steel:        #0e97d6;
  --steel-bg:     #ddf1fb;
  --steel-tx:     #0a5c85;

  --plum:         #8b5cf6;
  --plum-bg:      #ebe2fe;
  --plum-tx:      #5b2fb8;

  --grad:         linear-gradient(100deg, #8b5cf6 0%, #c341c7 45%, #f472b6 100%);
  --grad-warm:    linear-gradient(100deg, #fcb631 0%, #f472b6 100%);

  --status-new-bg: var(--steel-bg);     --status-new-text: var(--steel-tx);
  --status-progress-bg: var(--amber-bg);--status-progress-text: var(--amber-tx);
  --status-resolved-bg: var(--pine-bg); --status-resolved-text: var(--pine-tx);
  --status-closed-bg: var(--paper-tint);--status-closed-text: var(--ink-2);

  --priority-low-bg: var(--pine-bg);    --priority-low-text: var(--pine-tx);
  --priority-medium-bg: var(--steel-bg);--priority-medium-text: var(--steel-tx);
  --priority-high-bg: var(--amber-bg);  --priority-high-text: var(--amber-tx);
  --priority-urgent-bg: var(--vermilion-bg); --priority-urgent-text: var(--vermilion-tx);

  --source-local-bg: var(--steel-bg);   --source-local-text: var(--steel-tx);
  --source-gemini-bg: var(--plum-bg);   --source-gemini-text: var(--plum-tx);

  --accent: var(--plum);
  --accent-dark: var(--plum-tx);
  --accent-bright: var(--vermilion);
  --accent-soft: var(--plum-bg);
  --accent-ring: rgba(139, 92, 246, 0.32);
  --coral: var(--vermilion);
  --gold: var(--amber);

  --sidebar-bg:   #0b1330;
  --sidebar-panel:#141d42;
  --sidebar-text: #d3dbf2;
  --sidebar-dim:  #8792bb;
  --sidebar-line: #26305c;
  --cream:        #ffffff;

  --radius: 8px;
  --block:      0 1px 3px rgba(13,23,52,0.06), 0 4px 12px rgba(13,23,52,0.05);
  --block-sm:   0 1px 2px rgba(13,23,52,0.06), 0 2px 6px rgba(13,23,52,0.04);
  --block-lg:   0 2px 6px rgba(13,23,52,0.07), 0 12px 28px rgba(13,23,52,0.08);

  --font-display: 'Bricolage Grotesque', 'Arial Black', sans-serif;
  --font-body: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, 'SFMono-Regular', monospace;

  --ease: cubic-bezier(0.22, 1.28, 0.36, 1);
}

[data-theme="dark"] {
  --paper:        #070b1c;
  --paper-tint:   #0d1430;
  --surface:      #121a3a;
  --surface-2:    #18224a;

  --ink:          #eaeefb;
  --ink-2:        #aab6dd;
  --ink-3:        #7c88ad;

  --line:         rgba(234, 238, 251, 0.16);
  --line-soft:    rgba(234, 238, 251, 0.10);
  --shadow-col:   rgba(0, 0, 0, 0.4);

  --vermilion:    #f472b6;
  --vermilion-bg: #45153a;
  --vermilion-tx: #fbc0dd;

  --amber:        #fcb631;
  --amber-bg:     #4a370a;
  --amber-tx:     #fdd98d;

  --pine:         #34d399;
  --pine-bg:      #10402f;
  --pine-tx:      #8fe8c6;

  --steel:        #3fb4ea;
  --steel-bg:     #0d3a55;
  --steel-tx:     #a3ddf5;

  --plum:         #a78bfa;
  --plum-bg:      #2f2263;
  --plum-tx:      #d3c2fd;

  --sidebar-bg:   #050818;
  --sidebar-panel:#101736;
  --sidebar-line: #232c56;
  --cream:        #eaeefb;

  --block:      0 1px 3px rgba(13,23,52,0.06), 0 4px 12px rgba(13,23,52,0.05);
  --block-sm:   0 1px 2px rgba(13,23,52,0.06), 0 2px 6px rgba(13,23,52,0.04);
  --block-lg:   0 2px 6px rgba(13,23,52,0.07), 0 12px 28px rgba(13,23,52,0.08);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

::selection { background: var(--vermilion); color: var(--cream); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: var(--ink-3); border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 262px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 2px solid var(--line);
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding: 4px 8px 0;
}

.brand-mark { flex-shrink: 0; }
.brand-mark .stub { animation: stamp 0.7s var(--ease) both; transform-origin: 16px 16px; }
.brand-mark .orbit-dot { transform-origin: 16px 16px; animation: orbit 4.5s linear infinite; }
@keyframes stamp {
  0%   { transform: scale(0.55) rotate(-10deg); opacity: 0; }
  60%  { transform: scale(1.1) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes orbit { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.sidebar .tagline {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--sidebar-dim);
  padding: 0 8px;
  margin-bottom: 28px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.12s var(--ease), background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.sidebar nav a svg { flex-shrink: 0; opacity: 0.9; }
.sidebar nav a:hover { background: var(--sidebar-panel); color: var(--cream); transform: translateX(3px); }
.sidebar nav a.active {
  background: var(--vermilion);
  color: var(--cream);
  border-color: var(--cream);
  font-weight: 700;
  box-shadow: var(--block-sm);
}
.sidebar nav a.active svg { opacity: 1; }

.sidebar .nav-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--sidebar-dim);
  padding: 22px 12px 8px;
  border-bottom: 1px dashed var(--sidebar-line);
  margin-bottom: 6px;
}

.sidebar-spacer { flex: 1; min-height: 20px; }

.sidebar .user-card {
  border-top: 2px solid var(--sidebar-line);
  padding-top: 16px;
  margin-top: 12px;
}

.user-card .who { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }

.user-avatar {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  background: var(--amber);
  color: #17130e;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.25);
}
.who .name { color: var(--cream); font-size: 14px; font-weight: 700; line-height: 1.25; }
.who .role { font-family: var(--font-mono); font-size: 10.5px; color: var(--sidebar-dim); text-transform: uppercase; letter-spacing: 0.06em; }

.theme-toggle {
  width: 100%;
  background: var(--sidebar-panel);
  border: 1px solid var(--sidebar-line);
  color: var(--sidebar-text);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  transition: transform 0.1s var(--ease), background 0.12s ease, color 0.12s ease;
}
.theme-toggle:hover { background: var(--amber); border-color: var(--cream); color: #17130e; transform: translate(1px, 1px); }
.theme-toggle .ico-moon { display: none; }
.theme-toggle .lbl::after { content: 'Dark'; }
[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
[data-theme="dark"] .theme-toggle .ico-moon { display: inline-flex; }
[data-theme="dark"] .theme-toggle .lbl::after { content: 'Light'; }

.logout-form { padding: 0 6px; }
.logout-btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--sidebar-line);
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: transform 0.1s var(--ease), background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.logout-btn:hover { background: var(--vermilion); border-color: var(--cream); color: var(--cream); transform: translate(1px, 1px); }

.main {
  flex: 1;
  padding: 40px 48px 72px;
  max-width: 1240px;
  animation: rise 0.4s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes snap { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
  gap: 20px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 42px;
  line-height: 0.98;
  margin: 0 0 10px;
  color: var(--ink);
  letter-spacing: -0.03em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-header .subtitle {
  color: var(--ink-2);
  font-size: 15px;
  max-width: 60ch;
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--vermilion);
  color: var(--cream);
  border: 1px solid var(--line-soft);
  padding: 11px 20px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--block);
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease), background 0.12s ease;
}
.btn:hover { transform: translate(2px, 2px); box-shadow: var(--block-sm); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--shadow-col); }

.btn-secondary { background: var(--surface); color: var(--ink); }
.btn-secondary:hover { background: var(--amber); color: #17130e; }

.btn-danger { background: var(--vermilion); color: var(--cream); }

.btn-sm { padding: 8px 14px; font-size: 13px; box-shadow: var(--block-sm); }
.btn-sm:hover { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--shadow-col); }

.export-group {
  display: inline-flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--block-sm);
}
.export-group .export-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 0 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-right: 2px solid var(--line);
}
.export-group a {
  padding: 0 14px;
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  border-right: 2px solid var(--line);
  transition: background 0.1s ease, color 0.1s ease;
}
.export-group a:last-child { border-right: none; }
.export-group a:hover { background: var(--vermilion); color: var(--cream); }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px 22px 20px 26px;
  box-shadow: var(--block);
  position: relative;
  overflow: hidden;
  opacity: 0;
  animation: snap 0.5s var(--ease) forwards;
}
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 8px;
  background: var(--ink-3);
  border-right: 2px dashed var(--paper);
}
.stat-card:nth-child(1) { animation-delay: 0.04s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.16s; }
.stat-card:nth-child(4) { animation-delay: 0.22s; }
.stat-card:nth-child(5) { animation-delay: 0.28s; }

.stat-card .value {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 800;
  color: var(--ink);
  line-height: 0.9;
  letter-spacing: -0.03em;
}
.stat-card .label {
  font-family: var(--font-mono);
  color: var(--ink-2);
  font-size: 11px;
  margin-top: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.stat-card.accent-new::before { background: var(--steel); }
.stat-card.accent-new .value { color: var(--steel); }
.stat-card.accent-progress::before { background: var(--amber); }
.stat-card.accent-progress .value { color: var(--amber-tx); }
.stat-card.accent-done::before { background: var(--pine); }
.stat-card.accent-done .value { color: var(--pine); }
.stat-card.accent-urgent::before { background: var(--vermilion); }
.stat-card.accent-urgent .value { color: var(--vermilion); }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.barlist { display: flex; flex-direction: column; gap: 14px; }
.barlist-row {
  display: grid;
  grid-template-columns: 150px 1fr 52px;
  align-items: center;
  gap: 14px;
}
.barlist-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.barlist-track {
  height: 18px;
  background: var(--paper-tint);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.barlist-fill {
  height: 100%;
  background: var(--vermilion);
  transform-origin: left;
  animation: bar-grow 0.7s var(--ease) both;
}
@keyframes bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.barlist-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.daychart-scroll { overflow-x: auto; padding-bottom: 4px; }
.daychart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
  min-width: 560px;
  padding-top: 22px;
  border-bottom: 1px solid var(--line-soft);
}
.daychart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}
.daychart-bar {
  width: 100%;
  max-width: 26px;
  background: var(--steel);
  border: 1px solid var(--line-soft);
  border-bottom: none;
  transform-origin: bottom;
  animation: bar-rise 0.6s var(--ease) both;
}
@keyframes bar-rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.daychart-bar:hover { background: var(--vermilion); }
.daychart-cap {
  position: absolute;
  top: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--vermilion-tx);
}
.daychart-axis {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  margin-top: 6px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--block-sm);
}
.toolbar .search-field { position: relative; flex: 1 1 240px; }
.toolbar .search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.toolbar .search-field input { padding-left: 38px; }

.toolbar select, .toolbar input[type="text"], .toolbar input[type="search"], .toolbar input[type="date"] {
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
.toolbar select { width: auto; min-width: 138px; font-family: var(--font-mono); font-size: 12px; }

.toolbar-daterange {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0;
}
.toolbar-daterange input[type="date"] { width: auto; }

.toolbar-clear {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  padding: 9px 10px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.toolbar-clear:hover { color: var(--vermilion); border-bottom-color: var(--vermilion); }

.result-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 14px 2px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--block);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: left;
  padding: 13px 16px;
  color: var(--cream);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border-bottom: 1px solid var(--line-soft);
  background: var(--ink);
}
[data-theme="dark"] th { background: var(--surface-2); color: var(--ink); }
th a { text-decoration: none; color: inherit; display: inline-flex; align-items: center; gap: 5px; }
th a:hover { color: var(--amber); }

td { padding: 15px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

tbody tr { animation: fade 0.4s ease both; }
tbody tr:nth-child(1) { animation-delay: 0.02s; }
tbody tr:nth-child(2) { animation-delay: 0.06s; }
tbody tr:nth-child(3) { animation-delay: 0.10s; }
tbody tr:nth-child(4) { animation-delay: 0.14s; }
tbody tr:nth-child(5) { animation-delay: 0.18s; }
tbody tr:nth-child(6) { animation-delay: 0.22s; }
tbody tr:nth-child(7) { animation-delay: 0.26s; }
tbody tr:nth-child(8) { animation-delay: 0.30s; }

tr.ticket-row { transition: background 0.1s ease; }
tr.ticket-row:hover { background: var(--amber-bg); cursor: pointer; }

.ticket-title { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.ticket-title:hover { color: var(--vermilion); text-decoration: underline; text-decoration-thickness: 2px; }

.cell-muted { color: var(--ink-2); font-size: 13px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1.5px solid currentColor;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.pill-status-new { background: var(--status-new-bg); color: var(--status-new-text); }
.pill-status-in-progress { background: var(--status-progress-bg); color: var(--status-progress-text); }
.pill-status-resolved { background: var(--status-resolved-bg); color: var(--status-resolved-text); }
.pill-status-closed { background: var(--status-closed-bg); color: var(--status-closed-text); }

.pill-priority-low { background: var(--priority-low-bg); color: var(--priority-low-text); }
.pill-priority-medium { background: var(--priority-medium-bg); color: var(--priority-medium-text); }
.pill-priority-high { background: var(--priority-high-bg); color: var(--priority-high-text); }
.pill-priority-urgent { background: var(--priority-urgent-bg); color: var(--priority-urgent-text); }

.pill-source-local { background: var(--source-local-bg); color: var(--source-local-text); }
.pill-source-gemini { background: var(--source-gemini-bg); color: var(--source-gemini-text); }

.pill-role-superadmin { background: var(--plum-bg); color: var(--plum-tx); }
.pill-role-agent { background: var(--pine-bg); color: var(--pine-tx); }
.pill-role-requester { background: var(--status-closed-bg); color: var(--status-closed-text); }

.pill-muted { background: transparent; color: var(--ink-3); border: 1.5px dashed var(--ink-3); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 24px; }
.pagination a, .pagination span {
  min-width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line-soft);
  background: var(--surface);
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease);
}
.pagination a:hover { box-shadow: var(--block-sm); transform: translate(-1px, -1px); background: var(--amber); color: #17130e; }
.pagination .current { background: var(--vermilion); color: var(--cream); box-shadow: var(--block-sm); }
.pagination .disabled { color: var(--ink-3); border-color: var(--line-soft); background: transparent; }

.empty-state { text-align: center; padding: 72px 20px; color: var(--ink-2); }
.empty-state svg { margin-bottom: 16px; color: var(--ink-3); }
.empty-state a { color: var(--vermilion); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; }

.form-card, .auth-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 34px;
  max-width: 640px;
  box-shadow: var(--block-lg);
}
.form-card.narrow { max-width: 480px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }

.form-group { margin-bottom: 18px; }

label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.field-hint { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; font-family: var(--font-body); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-size: 14.5px;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  transition: box-shadow 0.1s var(--ease), transform 0.1s var(--ease), background 0.12s ease;
}
textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  background: var(--surface-2);
  box-shadow: var(--block-sm);
  transform: translate(-1px, -1px);
  border-color: var(--vermilion);
}
input:disabled, input[readonly] { background: var(--paper-tint); color: var(--ink-3); box-shadow: none; }

.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; accent-color: var(--vermilion); width: 18px; height: 18px; }
.checkbox-row label { margin: 0; }

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
  font-weight: 600;
  box-shadow: var(--block-sm);
}
.alert-error { background: var(--vermilion-bg); color: var(--vermilion-tx); }
.alert-success { background: var(--pine-bg); color: var(--pine-tx); }

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.auth-wrap { position: relative; width: 100%; max-width: 440px; animation: snap 0.55s var(--ease) both; }

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  line-height: 0.98;
  margin: 0 0 8px;
}
.auth-card .subtitle { color: var(--ink-2); font-size: 14.5px; margin-bottom: 26px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }

.auth-switch { text-align: center; margin-top: 22px; font-size: 13.5px; color: var(--ink-2); }
.auth-switch a { color: var(--vermilion); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; }


.step-rail {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.step { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.step b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-size: 10px;
  background: var(--paper);
  color: var(--ink-3);
}
.step.is-current { color: var(--ink); font-weight: 700; }
.step.is-current b { background: var(--amber); border-color: var(--line); color: #17130e; }
.step.is-done { color: var(--ink-2); }
.step.is-done b { background: var(--pine-bg); border-color: var(--line); color: var(--pine-tx); }
.step-rule { flex: 1; height: 2px; background: var(--line-soft); }
.step-rule.is-done { background: var(--line); }

.code-boxes { display: flex; gap: 10px; }
.code-box {
  width: 100%;
  max-width: 56px;
  aspect-ratio: 3 / 4;
  padding: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--block-sm);
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease);
}
.code-box:focus {
  outline: none;
  background: var(--amber-bg);
  transform: translate(-1px, -1px);
  box-shadow: var(--block);
}

.resend-form { margin-top: 14px; text-align: center; }
.btn-link {
  background: none;
  border: none;
  padding: 4px 2px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--vermilion);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.btn-link:hover:not(:disabled) { color: var(--ink); }
.btn-link:disabled { color: var(--ink-3); cursor: default; text-decoration-color: var(--line-soft); }

.note-strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px dashed var(--line-soft);
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.note-strip svg { flex-shrink: 0; margin-top: 2px; color: var(--ink-3); }
.note-strip a { color: var(--vermilion); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; }

.auth-theme {
  position: absolute;
  top: 26px;
  right: 24px;
  z-index: 2;
  width: auto;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  color: var(--ink);
  box-shadow: var(--block-sm);
}
.auth-theme:hover { background: var(--amber); color: #17130e; border-color: var(--line); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  color: var(--ink-2);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 8px 12px;
  border-radius: var(--radius);
  box-shadow: var(--block-sm);
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease), background 0.12s ease;
}
.back-link:hover { background: var(--amber); color: #17130e; transform: translate(-1px, -1px); box-shadow: var(--block); }

.detail-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.detail-field {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--block-sm);
}
.detail-field.full { grid-column: 1 / -1; }
.detail-field .field-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 8px;
  font-weight: 700;
}
.detail-field .field-value { font-size: 15px; color: var(--ink); line-height: 1.55; white-space: pre-line; }

.side-panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--block);
  margin-bottom: 18px;
}
.side-panel h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline-form select, .inline-form input { margin-bottom: 12px; }
.inline-form .btn { width: 100%; justify-content: center; }

.thread { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.msg { display: flex; gap: 12px; animation: snap 0.4s var(--ease) both; }
.msg-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  background: var(--steel-bg);
  color: var(--steel-tx);
  border: 1px solid var(--line-soft);
}
.msg.role-requester .msg-avatar { background: var(--vermilion-bg); color: var(--vermilion-tx); }
.msg.role-superadmin .msg-avatar { background: var(--plum-bg); color: var(--plum-tx); }
.msg.role-agent .msg-avatar { background: var(--pine-bg); color: var(--pine-tx); }
.msg.role-ai .msg-avatar { background: var(--amber); color: #17130e; }
.msg.role-ai .msg-avatar svg { stroke-width: 1.6; fill: currentColor; }

.msg-body { flex: 1; min-width: 0; }
.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.msg-author { font-weight: 700; font-size: 14px; }
.msg-time { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.msg-text {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.msg.role-ai .msg-text {
  background: var(--surface);
  border-left-width: 6px;
  border-left-color: var(--amber);
  box-shadow: var(--block-sm);
}
.msg.kind-suggestion .msg-text { border-left-color: var(--pine); background: var(--pine-bg); }
.msg.kind-handoff    .msg-text { border-left-color: var(--vermilion); }
.msg.kind-guide      .msg-text { border-left-color: var(--steel); }

.msg-foot {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}

.badge-ai {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: var(--amber);
  color: #17130e;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge-ai svg { fill: currentColor; stroke-width: 1.4; }
.badge-ai.sm { padding: 1px 5px; font-size: 9px; border-width: 1.5px; vertical-align: 1px; }

.badge-kind {
  display: inline-block;
  padding: 3px 7px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.badge-kind-suggestion  { background: var(--pine-bg); color: var(--pine-tx); }
.badge-kind-acknowledge { background: var(--steel-bg); color: var(--steel-tx); }
.badge-kind-guide       { background: var(--amber-bg); color: var(--amber-tx); }
.badge-kind-handoff     { background: var(--vermilion-bg); color: var(--vermilion-tx); }

.msg-thinking .msg-text.typing {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 13px;
  background: var(--surface);
  border-left-width: 6px;
  border-left-color: var(--amber);
}
.typing .dots { display: inline-flex; gap: 4px; }
.typing .dots i {
  width: 6px; height: 6px;
  background: var(--amber);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  animation: bob 1.1s var(--ease) infinite;
}
.typing .dots i:nth-child(2) { animation-delay: 0.15s; }
.typing .dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bob {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

.thread-empty {
  color: var(--ink-2);
  font-size: 13.5px;
  padding: 14px;
  border: 1px dashed var(--line-soft);
  border-radius: var(--radius);
  font-family: var(--font-mono);
}

.composer {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--block-sm);
  padding: 12px 14px 10px;
}
.composer textarea {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin: 0;
  resize: vertical;
  min-height: 62px;
}
.composer textarea:focus { outline: none; box-shadow: none; }
.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.composer-hint { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); line-height: 1.6; }
.btn.is-busy { opacity: 0.55; pointer-events: none; }

.composer-rich {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--block-sm);
  overflow: hidden;
}

.rt-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--paper-tint);
  border-bottom: 1px solid var(--line-soft);
}
.rt-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  margin: 0;
  padding: 5px 9px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s var(--ease);
}
.rt-toolbar button:hover { background: var(--amber); color: #17130e; transform: translateY(-1px); }
.rt-toolbar button:active { transform: translateY(0); }
.rt-sep { width: 2px; align-self: stretch; background: var(--line-soft); margin: 0 4px; }
.rt-spacer { flex: 1; }
.rt-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rt-surface {
  min-height: 190px;
  max-height: 520px;
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  outline: none;
}
.rt-surface:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-3);
  pointer-events: none;
}
.rt-surface.is-dropping { background: var(--amber-bg); box-shadow: inset 0 0 0 3px var(--amber); }
.rt-surface:focus-visible { box-shadow: inset 0 0 0 3px var(--amber); }

.rt-surface img, .rich-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 10px 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--block-sm);
  background: var(--paper);
}
.rt-surface ul, .rt-surface ol, .rich-body ul, .rich-body ol { margin: 8px 0 8px 22px; }
.rt-surface li, .rich-body li { margin-bottom: 4px; }
.rt-surface a, .rich-body a { color: var(--vermilion); text-decoration: underline; text-decoration-thickness: 2px; }
.rt-surface pre, .rich-body pre {
  background: var(--paper-tint);
  border: 1.5px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-x: auto;
}
.rt-surface code, .rich-body code { font-family: var(--font-mono); font-size: 13px; }
.rt-surface blockquote, .rich-body blockquote {
  margin: 8px 0;
  padding-left: 12px;
  border-left: 4px solid var(--line-soft);
  color: var(--ink-2);
}

.rich-body { font-size: 15px; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }
.rich-body > *:first-child { margin-top: 0; }
.rich-body > *:last-child { margin-bottom: 0; }

.field-hint.is-error { color: var(--vermilion-tx); font-weight: 600; }
.field-hint.is-busy { color: var(--amber-tx); font-weight: 600; }

.ai-tags {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-left: 6px solid var(--amber);
  border-radius: var(--radius);
  box-shadow: var(--block-sm);
  padding: 14px 18px 16px;
  margin-bottom: 4px;
}
.ai-tags-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.ai-tags-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
}
.ai-tags-grid > div, .stand-list > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ai-tags-grid .k, .stand-list .k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
}
.ai-tags-grid .v, .stand-list .v { font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.stand-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }

.ticket-ref {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink-2);
  margin-right: 4px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 36px 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.section-title:first-child { margin-top: 0; }

.badge-outline {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--paper);
}

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

@media (max-width: 900px) {
  .main { padding: 28px 22px 60px; }
  .page-header h1 { font-size: 32px; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 220px; }
  .ai-tags-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .ai-tags-grid { grid-template-columns: 1fr; }

  .composer-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .composer-foot .btn { justify-content: center; }

  .code-boxes { gap: 6px; }
  .code-box { font-size: 20px; }
  .msg-avatar { width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .brand-mark .orbit-dot { animation: none; }
}

.btn, .btn-primary, .stat-card .value, .brand {
  border-color: transparent;
}
.btn {
  background: var(--grad);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px var(--accent-ring);
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 8px 22px var(--accent-ring); }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--line-soft);
  box-shadow: var(--block-sm);
}
.btn-secondary:hover { background: var(--plum-bg); color: var(--plum-tx); filter: none; }

.sidebar { border-right: 1px solid var(--sidebar-line); }
.brand svg .stub path[fill] { fill: #a855f7; }
.brand { background: linear-gradient(100deg, #c084fc, #f472b6); -webkit-background-clip: text; background-clip: text; color: transparent; }

.badge-ai {
  background: var(--grad);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px var(--accent-ring);
}
.badge-solution {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--pine-bg);
  color: var(--pine-tx);
  border: 1.5px solid var(--pine);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.msg.is-solution .msg-text, .msg-text:has(+ .msg-foot) { }

.solution-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink-2);
  padding: 6px 10px;
  border: 1.5px dashed var(--line-soft);
  border-radius: var(--radius);
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.solution-toggle:hover { border-color: var(--pine); color: var(--pine-tx); }
.solution-toggle input { width: auto; margin: 0; accent-color: var(--pine); }
.solution-toggle:has(input:checked) { background: var(--pine-bg); color: var(--pine-tx); border-style: solid; border-color: var(--pine); }

.by-user {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.ai-tags { border-left: 4px solid transparent; border-image: var(--grad) 1; }
.msg.role-ai .msg-avatar { background: var(--grad); color: #fff; }
.msg.role-ai .msg-text { border-left: 4px solid var(--plum); }
.msg.kind-suggestion .msg-text { border-left-color: var(--pine); }
.msg.kind-handoff .msg-text { border-left-color: var(--amber); }
.msg.kind-guide .msg-text { border-left-color: var(--steel); }

.code-box:focus { background: var(--plum-bg); }
.rt-toolbar button:hover { background: var(--plum-bg); color: var(--plum-tx); }
.auth-theme:hover, .back-link:hover { background: var(--plum-bg); color: var(--plum-tx); }

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.row-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.row-form input[type="text"] { margin: 0; width: auto; min-width: 220px; flex: 1; }
.row-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-actions form { margin: 0; }

.btn-danger {
  background: var(--vermilion);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.btn-danger:hover { filter: brightness(1.08); }
.btn-link.is-danger { color: var(--vermilion-tx); }

.dept-card {
  background: var(--surface);
  border: 1.5px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--block-sm);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.dept-card.is-off { opacity: 0.6; }
.dept-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1.5px dashed var(--line-soft);
}
.dept-meta { display: flex; align-items: center; gap: 12px; }
.dept-meta form { margin: 0; }

.role-list { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
.role-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.role-row form { margin: 0; }
.role-row input[type="text"] { min-width: 200px; }
.role-empty { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.role-add { margin-top: 6px; padding-top: 10px; border-top: 1.5px dashed var(--line-soft); }

.mention-pop {
  position: absolute;
  z-index: 30;
  min-width: 260px;
  max-width: 340px;
  margin-top: 4px;
  background: var(--surface-2);
  border: 1.5px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--block);
  overflow: hidden;
}
.composer { position: relative; }
.mention-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 9px 13px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}
.mention-item:hover, .mention-item.is-active { background: var(--plum-bg); }
.mention-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.mention-meta { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }

.mention { color: var(--plum-tx); background: var(--plum-bg); padding: 1px 5px; border-radius: 4px; font-weight: 700; }

.notif-list { display: flex; flex-direction: column; }
.notif {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--line-soft);
  text-decoration: none;
  color: var(--ink);
}
.notif:last-child { border-bottom: none; }
.notif:hover { background: var(--paper-tint); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: transparent; flex-shrink: 0; }
.notif.is-unread .notif-dot { background: var(--grad); }
.notif.is-unread .notif-actor { color: var(--plum-tx); }
.notif-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notif-actor { font-weight: 700; font-size: 14px; }
.notif-text { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.notif-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }

.card, .form-card, .auth-card, .side-panel, .detail-field, .stat-card,
.dept-card, .composer, .composer-rich, .ai-tags, .toolbar, .msg-text {
  border-color: var(--line-soft);
}

.stat-card, .card, .form-card, .auth-card, .side-panel, .detail-field, .dept-card {
  background: var(--surface-2);
}

.auth-card { box-shadow: var(--block-lg); }

table thead th {
  background: var(--paper-tint);
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
table td { border-bottom: 1px solid var(--line-soft); }
.ticket-row:hover { background: var(--paper-tint); }

.pill, .badge-outline, .badge-kind, .badge-solution, .nav-badge {
  border-radius: 999px;
  border-width: 0;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  text-transform: none;
  font-size: 11.5px;
}
.badge-outline { background: var(--paper-tint); color: var(--ink-2); border: 1px solid var(--line-soft); }
.badge-solution { border: 1px solid var(--pine); }
.badge-ai { border-radius: 999px; text-transform: none; letter-spacing: 0.01em; font-family: var(--font-body); font-size: 11px; }

.msg-avatar, .user-avatar { border-radius: 50%; border: none; }
.msg-text { border-radius: var(--radius); box-shadow: none; }
.msg.role-ai .msg-text { background: var(--paper-tint); }
.msg.kind-suggestion .msg-text { background: var(--pine-bg); }

.btn {
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  box-shadow: 0 1px 2px rgba(13,23,52,0.10);
}
.btn:hover { transform: none; filter: brightness(1.06); box-shadow: 0 2px 8px var(--accent-ring); }
.btn-secondary { box-shadow: none; }

input, select, textarea {
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  box-shadow: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--plum);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.back-link, .auth-theme {
  border: 1px solid var(--line-soft);
  box-shadow: none;
  text-transform: none;
  font-family: var(--font-body);
  letter-spacing: 0;
}
.back-link:hover { transform: none; box-shadow: none; }

.section-title {
  border-bottom: 1px solid var(--line-soft);
  text-transform: none;
  letter-spacing: -0.01em;
  font-size: 19px;
}
.page-header h1 { letter-spacing: -0.02em; }

.field-label, .ai-tags-head, .ai-tags-grid .k, .stand-list .k, .composer-hint, .rt-hint {
  font-family: var(--font-body);
  letter-spacing: 0.02em;
}

.ai-tags { border-left: 3px solid var(--plum); border-image: none; }
.code-box { border-radius: var(--radius); box-shadow: none; }
.code-box:focus { transform: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.rt-toolbar { background: var(--paper-tint); border-bottom: 1px solid var(--line-soft); }
.rt-toolbar button { border: 1px solid var(--line-soft); border-radius: 6px; font-family: var(--font-body); }
.rt-toolbar button:hover { transform: none; }
.solution-toggle { border-radius: var(--radius); font-family: var(--font-body); letter-spacing: 0; }
.alert { border-radius: var(--radius); border-width: 1px; box-shadow: none; }
.thread-empty, .note-strip { border-radius: var(--radius); border: 1px solid var(--line-soft); }

.dept-brain { width: 100%; margin-top: 12px; }
.dept-brain summary {
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--plum-tx);
  padding: 6px 0;
  list-style: none;
}
.dept-brain summary::-webkit-details-marker { display: none; }
.dept-brain summary::before { content: '▸ '; color: var(--ink-3); }
.dept-brain[open] summary::before { content: '▾ '; }
.dept-brain label {
  display: block;
  margin-top: 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.dept-brain textarea { width: 100%; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }

.badge-lead {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--amber-bg);
  color: var(--amber-tx);
  border: 1px solid var(--amber);
  font-size: 10.5px;
  font-weight: 700;
}
.pill-role-supervisor { background: var(--plum-bg); color: var(--plum-tx); }
.pill-role-team_leader { background: var(--amber-bg); color: var(--amber-tx); }

.dept-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.dept-name { flex: 1; min-width: 220px; }
.dept-name input { font-size: 17px; font-weight: 700; margin: 0; }
.dept-stats { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.field { display: flex; flex-direction: column; margin-bottom: 16px; }
.field > label,
.dept-name > label,
.dept-roles > label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.field select, .field input, .field textarea { margin: 0; }
.field textarea { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }

.dept-roles { padding-top: 14px; border-top: 1px solid var(--line-soft); }
.role-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.role-chip {
  display: inline-flex;
  align-items: center;
  background: var(--paper-tint);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 2px 4px 2px 12px;
}
.role-chip input {
  border: none; background: none; box-shadow: none; margin: 0;
  width: auto; min-width: 90px; max-width: 190px;
  font-size: 13px; padding: 4px 0;
}
.role-chip input:focus { outline: none; box-shadow: none; }
.chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-left: 4px;
  border-radius: 50%; color: var(--ink-3); text-decoration: none; font-size: 15px;
}
.chip-x:hover { background: var(--vermilion-bg); color: var(--vermilion-tx); }
.role-new {
  width: auto; min-width: 130px; margin: 0;
  border: 1px dashed var(--line-soft); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; background: transparent;
}

.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: 0 -4px 16px var(--shadow-col);
}
.save-note { font-size: 13px; color: var(--ink-3); }
.save-note.is-dirty { color: var(--amber-tx); font-weight: 700; }
.hidden-form { display: none; }

.role-chip > span { font-size: 13px; padding: 4px 0; }
button.chip-x { border: none; background: none; padding: 0; cursor: pointer; line-height: 1; }
.role-row .role-handles { flex: 1; min-width: 240px; }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }

  .sidebar {
    width: auto;
    height: auto;
    position: static;
    padding: 12px 14px 10px;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-line);
  }
  .sidebar .brand { font-size: 16px; margin: 0 0 10px; padding: 0; }
  .sidebar .brand .brand-mark { width: 26px; height: 26px; }
  .sidebar .tagline,
  .sidebar .nav-section-label,
  .sidebar-spacer { display: none; }

  .sidebar nav {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    margin: 0 -14px;
    padding: 0 14px 4px;
    scrollbar-width: none;
  }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav a { flex-shrink: 0; white-space: nowrap; padding: 8px 11px; gap: 7px; font-size: 13px; }
  .sidebar nav a:hover { transform: none; }

  .sidebar .user-card {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 10px;
  }
  .user-card .who { flex: 1; min-width: 0; padding: 0; }
  .user-card .who > div:last-child { min-width: 0; }
  .who .name, .who .role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .user-avatar { width: 30px; height: 30px; font-size: 13px; }
  .theme-toggle { width: auto; margin: 0; padding: 8px 10px; }
  .theme-toggle .lbl { display: none; }
  .logout-form { padding: 0; }
  .logout-btn { width: auto; padding: 8px 10px; }

  .main { width: 100%; max-width: 100%; min-width: 0; padding: 20px 14px 56px; }
  .page-header { margin-bottom: 20px; gap: 12px; }
  .page-header h1 { font-size: 26px; }

  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card table { min-width: 640px; }
  th, td { padding: 11px 12px; }

  .toolbar { padding: 10px; }
  .toolbar .search-field { flex-basis: 100%; }
  .toolbar select { flex: 1 1 140px; min-width: 0; }

  .form-card, .auth-card { padding: 18px 16px; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }

  .barlist-row { grid-template-columns: 100px 1fr 40px; gap: 10px; }

  .row-form input[type="text"],
  .role-row input[type="text"],
  .role-row .role-handles,
  .dept-name { min-width: 0; flex: 1 1 100%; }
  .dept-card { padding: 14px; }
  .dept-grid { grid-template-columns: 1fr; gap: 0; }

  .mention-pop { min-width: 0; max-width: calc(100vw - 28px); }
  .pagination { flex-wrap: wrap; }
}

.main { min-width: 0; }
.card { overflow-x: auto; }

@media (max-width: 760px) {
  .stat-cards { gap: 8px; }
  .stat-card { padding: 12px 12px 12px 20px; }
  .stat-card::before { width: 6px; }
  .stat-card .value { font-size: 28px; }
  .stat-card .label { font-size: 9.5px; margin-top: 6px; letter-spacing: 0.06em; }

  .toolbar { gap: 8px; }
  .toolbar select, .toolbar input[type="search"] { font-size: 13px; padding-top: 8px; padding-bottom: 8px; }

  .card .ticket-table { display: block; min-width: 0; }
  .ticket-table thead { display: none; }
  .ticket-table tbody { display: block; }
  .ticket-table tr.ticket-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 14px;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
  }
  .ticket-table tr.ticket-row:last-child { border-bottom: none; }
  .ticket-table tr.ticket-row::after { content: ""; flex-basis: 100%; height: 0; order: 5; }
  .ticket-table td { display: block; padding: 0; border: none; }
  .ticket-table td:nth-child(1) { order: 1; flex-basis: 100%; }
  .ticket-table td:nth-child(1) .ticket-title { font-size: 15px; line-height: 1.35; }
  .ticket-table td:nth-child(6) { order: 2; }
  .ticket-table td:nth-child(5) { order: 3; }
  .ticket-table td:nth-child(2) { order: 4; }
  .ticket-table td:nth-child(4) { order: 6; }
  .ticket-table td:nth-child(3) { order: 7; }
  .ticket-table td:nth-child(8) { order: 8; }
  .ticket-table td:nth-child(7) { order: 9; }
  .ticket-table td:nth-child(3) { display: none; }
  .ticket-table td:nth-child(4),
  .ticket-table td:nth-child(7),
  .ticket-table td:nth-child(8) { font-size: 12.5px; }
  .ticket-table td:nth-child(8)::before { content: "· "; }
  .ticket-table td:nth-child(7)::before { content: "· Assigned: "; }
}

/* service desk additions: sla, approvals, queues, notes, activity */
.team-pick[hidden], #resolve-note[hidden] { display: none !important; }
.service-fields:empty { display: none; }
.pill-status-waiting { background: var(--amber-bg); color: var(--amber-tx); }
.pill-confidential { background: var(--paper-tint); color: var(--ink); border: 1px solid var(--line); }
.sla-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding: 12px 16px; margin: 0 0 18px; background: var(--surface); border: 1px solid var(--line-soft); border-left: 4px solid var(--pine); border-radius: var(--radius); }
.sla-strip .k { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.sla-strip .v { display: block; font-size: 14px; color: var(--ink); font-weight: 600; }
.sla-strip.sla-at-risk { border-left-color: var(--amber); }
.sla-strip.sla-breached { border-left-color: #d32f2f; }
.sla-strip.sla-paused, .sla-strip.sla-none { border-left-color: var(--ink-3); }
.sla-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--paper-tint); color: var(--ink-2); }
.sla-chip.sla-ok, .sla-chip.sla-met { background: var(--pine-bg); color: var(--pine-tx); }
.sla-chip.sla-at-risk { background: var(--amber-bg); color: var(--amber-tx); }
.sla-chip.sla-breached { background: var(--priority-urgent-bg); color: var(--priority-urgent-text); }
.approval-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 18px; }
.approval-steps { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.approval-steps li { padding: 8px 12px; border-radius: var(--radius); background: var(--paper-tint); display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.approval-steps .step-approved { background: var(--pine-bg); color: var(--pine-tx); }
.approval-steps .step-rejected { background: var(--priority-urgent-bg); color: var(--priority-urgent-text); }
.approval-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.approval-form input { flex: 1 1 220px; min-width: 0; }
.queue-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 2px; }
.queue-tabs a { white-space: nowrap; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-soft); text-decoration: none; }
.queue-tabs a.active { background: var(--vermilion); color: #fff; border-color: transparent; }
.activity-log { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.activity-log li { padding: 6px 0 6px 14px; font-size: 13px; color: var(--ink-2); }
.activity-log .when { color: var(--ink-3); margin-right: 6px; }
.composer textarea.is-internal { background: var(--amber-bg); border-color: var(--amber); }
.internal-toggle input:checked + span { color: var(--amber-tx); font-weight: 700; }
.canned-pick { max-width: 200px; font-size: 13px; }
.msg.is-internal .msg-text { background: var(--amber-bg); border-left: 3px solid var(--amber); }
.label, .stat-card .label, .field-label, .sla-strip .k { letter-spacing: 0; }
@media (max-width: 1280px) { .col-optional { display: none; } }
/* reports page */
.reports-page { container-type: inline-size; }
.report-exports { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.reports-page .export-group .export-label,
.reports-page .export-group a {
  font-family: var(--font-body);
  font-size: 13.5px;
  letter-spacing: 0;
  text-transform: none;
}
.reports-page .export-group a { padding: 8px 14px; }

.report-filters { gap: 12px 16px; }
.report-range { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.report-range-opt { margin: 0; cursor: pointer; position: relative; }
.report-range-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.report-range-opt span {
  display: block;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  border-right: 1px solid var(--line-soft);
}
.report-range-opt:last-child span { border-right: none; }
.report-range-opt input:checked + span { background: var(--accent-soft); color: var(--accent-dark); }
.report-range-opt input:focus-visible + span { outline: 2px solid var(--accent-ring); outline-offset: -2px; }
.report-custom { display: flex; gap: 12px; flex-wrap: wrap; }
.report-custom[hidden] { display: none; }
.report-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.report-field input[type="date"], .report-field select { width: auto; font-family: var(--font-body); font-size: 14px; }
.report-reset { font-size: 14px; color: var(--ink-2); }

.report-section-title {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 6px 0 12px;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 16px;
  margin-bottom: 26px;
}
/* four cards never split three plus one */
@container (min-width: 662px) and (max-width: 887.98px) {
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.report-kpis .stat-card { opacity: 1; animation: none; }
.report-kpis .stat-card .value { font-size: 38px; }
.report-kpis .stat-card .value.is-text { font-size: 28px; line-height: 1.1; }
.report-kpis .stat-card .value.is-note {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--ink-2);
}
.report-kpis .stat-card .value-unit { font-size: 18px; color: var(--ink-2); }
.report-kpis .stat-card .label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-2);
  margin-top: 10px;
}
.report-kpis .stat-card .sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; line-height: 1.4; }

.reports-page .side-panel h3 { text-transform: none; }
.reports-page .barlist-row { grid-template-columns: minmax(110px, 170px) 1fr 52px; }
.reports-page .daychart-col { min-width: 34px; }
.reports-page .daychart-axis { font-family: var(--font-body); font-size: 11.5px; }
.report-hint { margin: -6px 0 14px; }

.report-table-wrap { overflow-x: auto; }
.report-table { font-size: 14px; }
.report-table th, .report-table td { padding: 10px 12px; }
.reports-page .report-table thead th {
  background: var(--paper-tint);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.reports-page .report-table tbody th {
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  border-bottom: 1px solid var(--line-soft);
}
.report-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table tbody tr { animation: none; }
/* room bookings */
.main { min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.room-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.room-tabs a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-decoration: none; background: var(--surface);
}
.room-tabs a:hover { color: var(--ink); border-color: var(--ink-2); }
.room-tabs a.is-on { background: var(--ink); border-color: var(--ink); color: var(--surface); }

.room-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.room-dates { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.room-day-label { font-family: var(--font-display); font-size: 18px; color: var(--ink); }
.room-next svg { transform: rotate(180deg); }
.room-jump { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.room-jump input[type="date"], .room-jump select { width: auto; padding: 8px 10px; font-size: 13.5px; }

.room-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.room-legend span { display: inline-flex; align-items: center; gap: 6px; }
.room-legend .sw { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); display: inline-block; }
.sw-free { background: var(--surface); }
.sw-taken { background: var(--paper-tint); box-shadow: inset 3px 0 0 var(--ink-2); }
.sw-mine { background: var(--pine-bg); box-shadow: inset 3px 0 0 var(--pine); }
.sw-pending { background: var(--amber-bg); box-shadow: inset 3px 0 0 var(--amber); }

.room-grid-wrap {
  max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--block-sm);
}
.room-grid-wrap:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 2px; }
.room-grid { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.room-grid tbody tr { animation: none; }
.room-grid thead th {
  position: sticky; top: 0; z-index: 2;
  min-width: 170px; padding: 10px 12px; vertical-align: top;
  text-transform: none; letter-spacing: 0; font-family: var(--font-body);
  background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line-soft);
}
.room-grid .rg-time {
  position: sticky; left: 0; z-index: 1;
  width: 76px; min-width: 76px; padding: 0 10px; vertical-align: top;
  background: var(--surface); color: var(--ink-2);
  font-family: var(--font-body); font-size: 11.5px; font-weight: 600; text-transform: none; letter-spacing: 0;
  border-bottom: none; text-align: right; white-space: nowrap;
}
.room-grid thead .rg-time { z-index: 3; text-align: right; }
.room-grid td { padding: 0; height: 26px; border-bottom: 1px dashed var(--line-soft); border-left: 1px solid var(--line-soft); vertical-align: top; }
.room-grid tr.is-hour td, .room-grid tr.is-hour .rg-time { border-top: 1px solid var(--line); }
.room-grid tr.is-hour .rg-time { padding-top: 3px; }

.rg-room, .rg-day { display: flex; flex-direction: column; gap: 3px; text-decoration: none; color: inherit; }
.rg-room-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.rg-room-meta { font-weight: 500; font-size: 12px; color: var(--ink-2); white-space: normal; }
.rg-room-tag { align-self: flex-start; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--amber-bg); color: var(--amber-tx); }
.rg-room-issue { font-size: 12px; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.rg-room-issue:hover { color: var(--vermilion); }
.rg-day.is-today .rg-room-name { color: var(--vermilion); }
.rg-day:hover .rg-room-name { text-decoration: underline; }

.rg-free a { display: flex; align-items: center; height: 100%; min-height: 26px; padding: 0 10px; text-decoration: none; color: transparent; font-size: 12px; font-weight: 700; }
.rg-free a:hover, .rg-free a:focus-visible { background: var(--vermilion-bg); color: var(--vermilion-tx); outline: none; }
.rg-free.is-past { background: var(--paper-tint); opacity: 0.6; }

.rg-booking { padding: 0; }
.rg-booking.is-taken { background: var(--paper-tint); box-shadow: inset 3px 0 0 var(--ink-2); }
.rg-booking.is-mine { background: var(--pine-bg); box-shadow: inset 3px 0 0 var(--pine); }
.rg-booking.is-pending { background: var(--amber-bg); box-shadow: inset 3px 0 0 var(--amber); }
.rg-chip { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px 6px 12px; max-width: 220px; }
.rg-title { font-weight: 700; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
a.rg-title:hover { text-decoration: underline; }
.rg-meta { font-size: 11.5px; color: var(--ink-2); }

.room-foot { font-size: 12.5px; color: var(--ink-2); margin: 12px 2px 0; }
.room-h2 { font-family: var(--font-display); font-size: 20px; color: var(--ink); margin: 26px 0 12px; }
.room-manage-add .room-h2 { margin-top: 0; }
.room-form { max-width: 640px; }
.room-form .note-strip { margin: 4px 0 18px; }

.room-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.room-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--block-sm);
}
.room-item.is-off { opacity: 0.65; }
.room-item-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 260px; }
.room-item-main strong { color: var(--ink); }
.room-edit { flex-direction: column; align-items: stretch; }
.room-edit-form { margin: 0; }
.room-edit-grid { display: grid; grid-template-columns: 2fr 2fr 1fr 3fr; gap: 12px; }
.room-edit-grid input { padding: 9px 11px; font-size: 14px; }
.room-edit-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.room-edit-foot .btn { margin-left: auto; }

@media (max-width: 900px) {
  .room-edit-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .room-edit-grid { grid-template-columns: 1fr; }
  .room-grid thead th { min-width: 140px; }
  .room-grid .rg-time { width: 60px; min-width: 60px; padding: 0 6px; }
}
