/*
 * Smart Employee Agent — SPA styles (GitHub Primer aesthetic, light mode)
 * Pattern C auth, SSE chat, CIBA consent widget.
 * No build step. No preprocessor.
 */

/* Force `hidden` attribute to win over ID-level `display:` rules below
   (ID specificity beats UA stylesheet's [hidden] without !important). */
[hidden] { display: none !important; }

/* ── Design tokens ─────────────────────────────────────────────────────────── */

:root {
  /* Canvas / surfaces */
  --bg:            #f6f8fa;
  --surface:       #ffffff;
  --surface-alt:   #f6f8fa;
  --border:        #d1d9e0;
  --border-strong: #c2c8cf;
  --border-muted:  #d8dee4;

  /* UAE palette */
  --uae-red:       #EF3F26;
  --uae-green:     #00843D;

  /* Foreground */
  --text:          #1f2328;
  --text-muted:    #59636e;
  --text-subtle:   #818b98;

  /* Accent (GitHub blue) */
  --primary:       #0969da;
  --primary-hover: #0860ca;
  --primary-soft:  #ddf4ff;
  --primary-border:#54aeff;

  /* Success (GitHub green) */
  --success:       #1a7f37;
  --success-emph:  #1f883d;
  --success-soft:  #dafbe1;
  --success-border:#4ac26b;

  /* Danger (GitHub red) */
  --danger:        #cf222e;
  --danger-hover:  #a40e26;
  --danger-soft:   #ffebe9;
  --danger-border: #ff818a;

  /* Attention / amber (write-action consent, expired) */
  --amber:         #9a6700;
  --amber-soft:    #fff8c5;
  --amber-border:  #d4a72c;
  --warning:       #9a6700;
  --warning-soft:  #fff8c5;

  /* Agent colors — Primer-ish palette */
  --color-hr:           #1f883d;
  --color-hr-soft:      #dafbe1;
  --color-it:           #8250df;
  --color-it-soft:      #fbefff;
  --color-orchestrator: #59636e;

  /* Red for error widget */
  --red-border:    #ff818a;
  --red-soft:      #ffebe9;

  /* Layout */
  --header-h:      56px;
  --radius:        6px;
  --radius-sm:     6px;
  --radius-lg:     12px;
  --shadow-sm:     0 1px 0 rgba(31,35,40,0.04);
  --shadow:        0 1px 3px rgba(31,35,40,0.12), 0 1px 2px rgba(31,35,40,0.08);
  --shadow-lg:     0 8px 24px rgba(66,74,83,0.12);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Composer */
  --composer-h: auto;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }

button {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

textarea, input {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

/* ── Accessibility ──────────────────────────────────────────────────────────── */

.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;
}

/* ── Sign-in page ───────────────────────────────────────────────────────────── */

#signin-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #EF3F26 0%, #00843D 35%, #f0f0f0 65%, #1a1a1a 100%);
}

.signin-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
  text-align: center;
  overflow: hidden;
}

.signin-heading {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text);
}

.signin-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.signin-notice {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--amber);
  margin-bottom: 0.875rem;
  text-align: left;
}

.cert-hint {
  text-align: left;
  margin-bottom: 0.875rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.375rem 0.625rem;
  background: var(--surface-alt);
}

.cert-hint summary { cursor: pointer; font-weight: 500; }
.cert-hint p { margin-top: 0.375rem; color: var(--text-muted); }

.signin-btn {
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.signin-btn-uaepass {
  background: none;
  border: none;
  padding: 0;
  margin: 10px auto;
  cursor: pointer;

  display: flex;
  justify-content: center;
  align-items: center;

  width: 100%;
}

.signin-btn-uaepass:hover {
  opacity: 0.88;
}

.signin-btn-uaepass:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.uae-pass-btn-img {
  display: block;
  width: 250px;
  height: 50px;
  max-width: 100%;
}

.signin-powered-by {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 1rem;
  color: var(--text-subtle);
  margin-bottom: 0;
}

.signin-powered-by strong {
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.uae-pass-attr-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.signin-powered-arabic {
  opacity: 0.65;
  font-size: 0.7rem;
}

.signin-error {
  margin-top: 0.875rem;
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--danger);
  text-align: left;
}

.btn-link {
  background: none; border: none;
  color: var(--primary); cursor: pointer;
  font-size: inherit; text-decoration: none;
  padding: 0; margin-left: 0.25rem;
}
.btn-link:hover { text-decoration: underline; }

/* ── Sign-in page layout (S6 — public info assistant below sign-in box) ─────── */

/* Keep existing gradient + flex centering; add padding for scroll safety */
#signin-page {
  padding: 2rem 1rem;
}

.signin-col {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Ensure the sign-in box fills the column */
.signin-col .signin-box {
  max-width: 100%;
  width: 100%;
}

/* ── Public Information Assistant (collapsible widget) ───────────────────────── */

.pia-widget {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Toggle header — deep UAE green for visual harmony with flag gradient and sign-in button */
.pia-toggle {
  position: relative; /* anchors the absolute chevron */
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2.5rem; /* side padding leaves room for chevron */
  background: #006430;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-lg); /* full rounding when collapsed */
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: center;
  transition: background 0.15s, border-radius 0.01s 0.3s;
}
.pia-toggle:hover { background: #00843D; }

.pia-widget--open .pia-toggle {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: background 0.15s, border-radius 0s;
}

.pia-toggle-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.pia-toggle-icon { flex-shrink: 0; opacity: 0.75; }

.pia-toggle-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.pia-toggle-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

.pia-toggle-subtitle {
  font-size: 0.7rem;
  opacity: 0.65;
  line-height: 1.3;
}

/* Chevron pinned to right edge */
.pia-chevron {
  position: absolute;
  right: 1rem;
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform 0.3s ease;
}

.pia-widget--open .pia-chevron {
  transform: rotate(180deg);
}

/* Collapsible body */
.pia-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.pia-widget--open .pia-body {
  max-height: 500px;
}

/* ── Public chat messages & form ────────────────────────────────────────────── */

.public-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  scroll-behavior: smooth;
  min-height: 120px;
  max-height: 280px;
}

.public-chat-msg {
  max-width: 88%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.public-chat-msg--bot {
  background: #f0f4f8;
  color: var(--text);
  border-bottom-left-radius: 2px;
  align-self: flex-start;
}

.public-chat-msg--user {
  background: #00843D;
  color: #fff;
  border-bottom-right-radius: 2px;
  align-self: flex-end;
}

.public-chat-msg--error {
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  align-self: flex-start;
  max-width: 100%;
}

.public-chat-typing {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.75rem;
  background: #f0f4f8;
  border-radius: var(--radius);
  border-bottom-left-radius: 2px;
  align-self: flex-start;
}
.public-chat-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-subtle);
  animation: public-chat-bounce 1.2s ease-in-out infinite;
}
.public-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.public-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes public-chat-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

.public-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.public-chat-input {
  flex: 1;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  line-height: 1.5;
  padding: 0.4rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: none;
  max-height: 80px;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
}
.public-chat-input:focus {
  outline: none;
  border-color: #00843D;
  box-shadow: 0 0 0 3px rgba(0,132,61,0.18);
}

.public-chat-send {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: #00843D;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.public-chat-send:hover   { background: #006d32; }
.public-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.public-chat-footer {
  font-size: 0.7rem;
  color: var(--text-subtle);
  text-align: center;
  padding: 0.3rem 0.75rem 0.6rem;
  flex-shrink: 0;
}

/* ── App shell ─────────────────────────────────────────────────────────────── */

#app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */

#app-header {
  height: var(--header-h);
  /* Subtle warmth: a barely-there top-to-bottom lift instead of flat white. */
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--uae-red);
  box-shadow: 0 1px 0 rgba(31, 35, 40, 0.04), 0 1px 3px rgba(31, 35, 40, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  flex-shrink: 0;
  gap: 0.75rem;
  position: relative;
  z-index: 10;
}

/* Brand accent strip — a thin two-tone bar in the product's own blue→green.
   Muted brand colors, 3px: a polished-product signature, not a flashy band. */
#app-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--success-emph) 100%);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Mini app mark — a small rounded square in the accent blue. Gives the
   header a warm focal point of colour without shouting. */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, #1f6feb 100%);
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(9, 105, 218, 0.25);
}

.product-name,
.product-name-btn {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.product-name-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.12s ease;
}
.product-name-btn:hover {
  color: var(--primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Connection indicator */
.conn-indicator {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
  cursor: default;
}

.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  transition: background 0.3s;
}

.conn-dot.conn-healthy    { background: var(--success); }
.conn-dot.conn-reconnecting { background: var(--warning); animation: pulse-dot 1s infinite; }
.conn-dot.conn-lost       { background: var(--danger); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.user-display {
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sign-out dialog (inline, below header) ─────────────────────────────────── */

.signout-dialog {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.875rem;
  font-size: 0.875rem;
  position: relative;
  z-index: 9;
}

.signout-dialog .dialog-title {
  font-weight: 600;
  margin: 0;
  flex: 0 0 auto;
  color: var(--text);
}

.signout-dialog .dialog-body {
  color: var(--text-muted);
  flex: 1 1 200px;
  margin: 0;
}

.signout-dialog .dialog-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-danger-primary {
  background: var(--danger) !important;
  border-color: var(--danger-hover) !important;
  color: #fff !important;
}
.btn-danger-primary:hover {
  background: var(--danger-hover) !important;
  border-color: var(--danger-hover) !important;
}

.signout-progress {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Home layout (sidebar + chat pane) ─────────────────────────────────────── */

.home-layout {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
}

/* ── Left sidebar ───────────────────────────────────────────────────────────── */

.left-sidebar {
  flex: 0 0 330px;
  min-width: 180px;
  max-width: 520px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Sidebar cards — Primer card style */
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.sidebar-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.sidebar-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.sidebar-card-body {
  padding: 0.625rem 0.75rem;
}

.sidebar-card-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  padding: 0.5rem 0;
  text-align: center;
}

/* Cubicle card body */
.cubicle-assigned {
  font-size: 0.8125rem;
  color: var(--text);
  line-height: 1.5;
}

.cubicle-id {
  font-weight: 600;
}

.cubicle-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* Assets list */
.asset-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.asset-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text);
  line-height: 1.4;
}

.asset-info {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-id {
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}

/* Asset status pills */
.asset-status {
  flex-shrink: 0;
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.6;
  border: 1px solid transparent;
}

.asset-status--outstanding {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber-border);
}

.asset-status--returned {
  background: var(--surface-alt);
  color: var(--text-muted);
  border-color: var(--border);
}

/* Narrow-context overrides for the leaves card inside the sidebar.
   The full 6-column table is too wide at 260px; show a compact 4-column
   variant (Request ID and End date columns hidden via the HTML change). */
.sidebar-card .my-leaves-table {
  font-size: 0.8125rem;
  /* Let the browser size each column to its content — no clipping. */
  table-layout: auto;
  width: 100%;
  border-spacing: 0;
}

.sidebar-card .my-leaves-table thead th,
.sidebar-card .my-leaves-table tbody td {
  padding: 0.4rem 0.625rem;
  white-space: nowrap;
}
.sidebar-card .my-leaves-table thead th {
  font-size: 0.75rem;
}

/* Days column: centre-align the number */
.sidebar-card .my-leaves-table th:nth-child(3),
.sidebar-card .my-leaves-table td:nth-child(3) { text-align: center; }

.sidebar-card .my-leaves-empty {
  font-size: 0.8125rem;
  padding: 0.625rem 0;
  text-align: left;
}

/* Pull the leaves card header into the sidebar-card-header style */
.sidebar-card .my-leaves-header {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.sidebar-card .my-leaves-body {
  padding: 0.25rem 0.75rem 0.75rem;
}

/* On narrow viewports (below 720px) stack sidebar above chat */
@media (max-width: 720px) {
  .home-layout {
    flex-direction: column;
    overflow: auto;
  }
  .left-sidebar {
    flex: 0 0 auto;
    max-width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
    gap: 8px;
    overflow-y: visible;
  }
  #chat-main {
    flex: 1 1 auto;
  }
}

/* ── Sidebar resize handle ──────────────────────────────────────────────────── */

.sidebar-resize-handle {
  flex: 0 0 5px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 5;
  transition: background 0.15s;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle--dragging {
  background: var(--primary-border);
}
/* Widen the hit-target without changing visual width */
.sidebar-resize-handle::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -4px; right: -4px;
}

/* ── Main chat area ─────────────────────────────────────────────────────────── */

#chat-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-width: 0;
}

/* ── Service banner ─────────────────────────────────────────────────────────── */

.service-banner {
  background: var(--warning-soft);
  border-bottom: 1px solid var(--amber-border);
  padding: 0.4375rem 1rem;
  font-size: 0.8125rem;
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}

.banner-dismiss {
  font-size: 1rem;
  line-height: 1;
  color: var(--amber);
  opacity: 0.7;
  padding: 0 0.125rem;
}
.banner-dismiss:hover { opacity: 1; }

/* ── Chat transcript ────────────────────────────────────────────────────────── */

.chat-transcript {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  scroll-behavior: smooth;
}

/* Empty state */
.empty-state {
  max-width: 480px;
  margin: 2.5rem auto 0;
  text-align: center;
}

.empty-heading {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.empty-body {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.example-chips-docked {
  justify-content: flex-start;
  padding: 0.5rem 0 0.625rem;
  margin: 0 auto;
  max-width: var(--composer-max-w, 760px);
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3125rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
}

/* Routing line */
.routing-line {
  font-size: 0.78rem;
  color: var(--text-subtle);
  font-style: italic;
  text-align: center;
  padding: 0.25rem 0;
}

/* Chat messages */
.msg {
  max-width: 72%;
  padding: 0.5625rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.msg-assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 2px;
  box-shadow: var(--shadow-sm);
}

.msg-error {
  align-self: center;
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 0.8125rem;
  max-width: 90%;
  text-align: center;
}

.msg-status {
  align-self: flex-start;
  background: transparent;
  border: none;
  padding: 0.125rem 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 100%;
  box-shadow: none;
}

.status-done {
  color: var(--success);
  font-weight: 500;
}

.status-denied {
  color: var(--text-subtle);
}

/* ── Consent Widget ─────────────────────────────────────────────────────────── */

.consent-widget {
  flex-shrink: 0;
  margin: 0 1.25rem 0.75rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  position: relative;
  z-index: 5;
}

.consent-widget--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Full card */
.cw-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow-sm);
}

.consent-widget--awaiting .cw-card {
  border-color: var(--primary-border);
}

/* Write-tier amber tint (UC-11, hr_assets_write_rest) */
.consent-widget--write .cw-card {
  border-color: var(--amber-border);
  background: var(--amber-soft);
}

.consent-widget--expired .cw-card {
  border-color: var(--amber-border);
  background: var(--amber-soft);
}

.consent-widget--error .cw-card {
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.cw-card-header {
  margin-bottom: 0.625rem;
}

.cw-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
}

/* Session-refresh amber banner */
.cw-refresh-banner {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
  border-radius: var(--radius);
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Mid-flight resume banner */
.cw-resume-banner {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius);
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  color: var(--amber);
  margin-bottom: 0.5rem;
}

.cw-agent-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.cw-agent-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.cw-agent-label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.cw-prior-consent {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  margin-left: 1.5rem;
}

.cw-action-row {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  margin-left: 1.5rem;
}

.cw-action-prefix {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.cw-action-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.cw-binding-row {
  margin-left: 1.5rem;
  margin-bottom: 0.625rem;
}

.cw-binding-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-subtle);
}

.cw-binding-message-row {
  margin: 0 1.5rem 0.625rem;
  padding: 0.4375rem 0.6875rem;
  background: var(--amber-soft);
  border-left: 3px solid var(--amber-border);
  border-radius: 4px;
}

.cw-binding-message-text {
  font-size: 0.8125rem;
  color: var(--amber);
}

.cw-footer-text {
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-bottom: 0.625rem;
  line-height: 1.4;
}

.cw-expired-body,
.cw-error-body {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
  line-height: 1.5;
}

.cw-actions-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cw-approve-btn {
  animation: approve-pulse 2s ease-in-out infinite;
}

@keyframes approve-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(9, 105, 218, 0.3); }
  50%       { box-shadow: 0 0 0 5px rgba(9, 105, 218, 0); }
}

.consent-widget--expired .cw-approve-btn,
.consent-widget--error .cw-approve-btn {
  animation: none;
}

.cw-deny-btn {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.3125rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1;
}
.cw-deny-btn:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
}

.cw-countdown {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

.countdown-amber {
  color: var(--amber) !important;
  font-weight: 500;
}

/* Slim row: VERIFYING / WORKING
   .consent-widget--slim is set by JS alongside --verifying or --working;
   it hides the full card and shows the slim row instead. */
.consent-widget--slim .cw-card { display: none !important; }
.consent-widget--slim .cw-slim { display: flex !important; }

.cw-slim {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5625rem 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.consent-widget--verifying .cw-slim {
  border-color: var(--primary-border);
}

.consent-widget--working .cw-slim {
  border-color: var(--border);
  background: var(--surface-alt);
}

.cw-slim-icon {
  font-size: 0.9375rem;
  flex-shrink: 0;
}

/* 3-dot animated indicator */
.cw-slim-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.cw-slim-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--primary);
  animation: dots-bounce 1.2s ease-in-out infinite;
}
.cw-slim-dots span:nth-child(2) { animation-delay: 0.2s; }
.cw-slim-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dots-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.6; }
  40%           { transform: scale(1.2); opacity: 1; }
}

.cw-slim-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  flex: 1 1 auto;
}

.cw-cancel-link {
  font-size: 0.78rem;
  color: var(--text-subtle);
  text-decoration: underline;
  cursor: pointer;
  background: none; border: none;
  padding: 0;
  flex-shrink: 0;
}
.cw-cancel-link:hover { color: var(--danger); }

/* ── Composer ────────────────────────────────────────────────────────────────── */

.composer-wrap {
  flex-shrink: 0;
  padding: 0 1.25rem 1rem;
  background: var(--bg);
}

.composer {
  display: flex;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.4375rem 0.4375rem 0.4375rem 0.75rem;
  gap: 0.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within {
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.composer-input {
  flex: 1 1 auto;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 0.875rem;
  line-height: 1.5;
  max-height: 160px;
  overflow-y: auto;
  padding: 0;
}

.composer-input::placeholder { color: var(--text-subtle); }
.composer-input:disabled { opacity: 0.6; }

.composer-send {
  flex-shrink: 0;
  width: 32px; height: 32px;
  background: var(--success-emph);
  color: #fff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  align-self: flex-end;
  border: 1px solid rgba(27,31,36,0.15);
}
.composer-send:hover  { background: #1a7f37; }
.composer-send:disabled { background: var(--border-strong); cursor: not-allowed; border-color: var(--border-strong); }

.composer-hints {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  padding: 0 0.1rem;
}

.composer-hint {
  font-size: 0.6875rem;
  color: var(--text-subtle);
}

.char-counter {
  font-size: 0.6875rem;
  color: var(--text-subtle);
}

.char-counter-red {
  color: var(--danger);
  font-weight: 500;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */

.btn-primary {
  background: var(--success-emph);
  color: #fff;
  border: 1px solid rgba(27,31,36,0.15);
  border-radius: var(--radius);
  padding: 0.3125rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1.5;
}
.btn-primary:hover { background: #1a7f37; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-outline {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.3125rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.5;
}
.btn-outline:hover { background: var(--surface-alt); }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.5;
}
.btn-ghost:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
  color: var(--text);
}

/* Header view-toggle (Reports <> Home) */
.nav-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.5;
}
.nav-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-sm {
  padding: 0.1875rem 0.5rem;
  font-size: 0.75rem;
}

/* ── Toast ───────────────────────────────────────────────────────────────────── */

#toast-container {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  z-index: 50;
  pointer-events: none;
  max-width: 320px;
}

.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.2s ease;
  line-height: 1.4;
}

.toast-success {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: var(--success);
}
.toast-error {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}
.toast-warn {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber);
}

.toast-fade {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .product-name, .product-name-btn { font-size: 0.875rem; }
  .user-display { display: none; }
  .conn-label   { display: none; }
  .chat-transcript { padding: 0.875rem; }
  .composer-wrap { padding: 0 0.75rem 0.75rem; }
  .consent-widget { margin: 0 0.75rem 0.75rem; }
  .msg { max-width: 88%; }
}

@media (max-width: 400px) {
  .signin-box { padding: 1.5rem 1.25rem; }
  .example-chips .chip { font-size: 0.78rem; padding: 0.3125rem 0.625rem; }
}

/* ── Trace panel (in-app audit-correlation debug view) ──────────────────────── */

.trace-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.trace-toggle-count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 0.6875rem;
  line-height: 1.5;
  text-align: center;
}
[aria-expanded="true"].trace-toggle .trace-toggle-count {
  background: var(--primary-soft);
  color: var(--primary);
}

.trace-panel {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 0;
  width: min(540px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 16px rgba(31,35,40,0.08);
  display: flex;
  flex-direction: column;
  z-index: 50;
  font-size: 0.8125rem;
}
.trace-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.375rem 0.875rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.trace-header .trace-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}
.trace-header .trace-help {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.45;
}
.trace-header code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--border-muted);
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--text);
}

.trace-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem 1rem;
}
.trace-empty {
  color: var(--text-muted);
  font-style: italic;
  margin: 1rem 0;
}

.trace-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  background: var(--surface);
}
.trace-row > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.4375rem 0.625rem;
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
}
.trace-row > summary::-webkit-details-marker { display: none; }
.trace-row[open] > summary {
  border-bottom: 1px solid var(--border-muted);
}

.trace-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.trace-status-ok   { background: var(--success); }
.trace-status-err  { background: var(--danger); }
.trace-status-live { background: var(--primary); animation: trace-pulse 1.4s ease-in-out infinite; }

@keyframes trace-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.trace-rid {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--surface-alt);
  border: 1px solid var(--border-muted);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--primary);
}
.trace-msg {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.trace-meta {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.trace-copy {
  font-size: 0.6875rem;
  padding: 2px 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
}
.trace-copy:hover { background: var(--surface-alt); }

.trace-events {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}
.trace-events td {
  padding: 0.25rem 0.625rem;
  border-top: 1px solid var(--border-muted);
  vertical-align: top;
}
.trace-events tr:first-child td { border-top: none; }
.trace-events .te-time    { color: var(--text-muted); white-space: nowrap; }
.trace-events .te-delta   { color: var(--text-subtle); white-space: nowrap; font-size: 0.6875rem; }
.trace-events .te-type    { color: var(--primary); white-space: nowrap; }
.trace-events .te-summary { color: var(--text); word-break: break-word; }

@media (max-width: 700px) {
  .trace-panel { width: 100vw; top: 56px; }
  .trace-row > summary { grid-template-columns: auto 1fr auto; }
  .trace-rid { display: none; }
}


/* ── My Leaves panel ────────────────────────────────────────────────────────── */

/* Base panel styles — used inside .sidebar-card; margins/padding are
   handled by the sidebar-card shell, not this rule. */
.my-leaves-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.my-leaves-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.my-leaves-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.my-leaves-status {
  font-size: 0.75rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.my-leaves-status--error {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.my-leaves-empty {
  margin: 0.375rem 0 0.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 1rem 0;
  text-align: center;
}

.my-leaves-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.my-leaves-table thead th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  cursor: pointer;
  user-select: none;
}

.my-leaves-table thead th:hover {
  color: var(--text);
}

.my-leaves-table tbody td {
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--border-muted);
  color: var(--text);
}

.my-leaves-table tbody tr:last-child td {
  border-bottom: none;
}

.my-leaves-table tbody tr:hover td {
  background: var(--surface-alt);
}

/* Status pills — Primer Label style */
.leave-status {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.75;
  border: 1px solid transparent;
}

.leave-status--pending {
  background: var(--surface-alt);
  color: var(--text-muted);
  border-color: var(--border);
}

.leave-status--approved {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-border);
}

.leave-status--rejected {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}

/* ── Reports view ───────────────────────────────────────────────────────────── */

.reports-view {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem 3rem;
}

.reports-header {
  margin-bottom: 1rem;
}

.reports-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--text);
}

.reports-subtitle {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin: 0;
}

/* Primer underline tabs */
.reports-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.reports-tab {
  appearance: none;
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  font-weight: 400;
}
.reports-tab:hover {
  color: var(--text);
  border-bottom-color: var(--border-strong);
}

.reports-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.reports-tabpanel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.reports-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  min-height: 32px;
  gap: 0.5rem;
}

.reports-status {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.reports-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  padding: 2rem 1rem;
}

.reports-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.reports-table th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.reports-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-muted);
  color: var(--text);
}

.reports-table tbody tr:last-child td {
  border-bottom: none;
}

.reports-table tbody tr:hover td {
  background: var(--surface-alt);
}

/* Devices tab filter + inline drilldown */
.reports-filter {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.reports-filter select {
  font-size: 0.8125rem;
  padding: 0.1875rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.reports-filter select:focus {
  outline: none;
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.devices-username-cell {
  cursor: pointer;
  text-decoration: underline dotted;
  color: var(--primary);
}

.drilldown-row td {
  background: var(--surface-alt);
  padding: 0.625rem 1.125rem;
  border-bottom: 1px solid var(--border-muted);
}

.drilldown-wrap {
  padding-left: 0.75rem;
}

.drilldown-heading {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.drilldown-table {
  width: auto;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.drilldown-table th,
.drilldown-table td {
  padding: 0.25rem 0.75rem 0.25rem 0;
  text-align: left;
  border-bottom: 1px solid var(--border-muted);
  color: var(--text);
}

.drilldown-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.drilldown-table tbody tr:last-child td,
.drilldown-table tbody tr:last-child th {
  border-bottom: none;
}

/* Action buttons in reports table */
.btn-action {
  appearance: none;
  border-radius: var(--radius);
  padding: 0.1875rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  margin-right: 0.375rem;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.btn-approve {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-border);
}
.btn-approve:hover {
  background: var(--success-border);
  color: #fff;
  border-color: var(--success);
}

.btn-reject {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-reject:hover {
  background: var(--danger-border);
  color: #fff;
  border-color: var(--danger);
}

/* Reports modal / reject reason dialog */
.reports-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(420px, 92vw);
  height: fit-content;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.reports-modal .dialog-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.reports-modal .dialog-body {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
}

.reports-modal input {
  width: 100%;
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reports-modal input:focus {
  outline: none;
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.reports-modal .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ── App footer ─────────────────────────────────────────────────────────────── */

.app-footer {
  flex-shrink: 0;
  height: 36px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
  z-index: 5;
}

.app-footer-brand {
  letter-spacing: 0.01em;
}

.app-footer-idp {
  color: var(--text-subtle);
  opacity: 0.8;
}
