/*
 * Hunaru Portal style guide, expressed as plain CSS.
 *
 * The guide defines its palette as Tailwind 4 theme tokens. This app has no
 * build step, so the same token names live here as custom properties and the
 * component classes below hard-code the guide's exact utility values. A new
 * screen should be indistinguishable from an old one — when in doubt, copy the
 * nearest existing page rather than inventing.
 */

/*
 * Read off the live portal (hunaru.online, assets/index-*.css) rather than
 * eyeballed, so the two applications cannot drift apart. brand, accent and sky
 * are Hunaru's own ramps; slate and the meaning colours are Tailwind 4's, kept
 * in oklch exactly as Tailwind emits them.
 */
:root {
  /* Brand */
  --brand-50: #fff3ee;
  --brand-100: #ffe0d0;
  --brand-200: #ffbfa0;
  --brand-300: #ff9468;
  --brand-400: #ff6a35;
  --brand-500: #f45724;
  --brand-600: #ff5600;
  --brand-700: #cc4400;

  --accent-50: #fff8ee;
  --accent-100: #ffeece;
  --accent-200: #ffd98d;
  --accent-400: #ffa630;
  --accent-500: #f08c00;
  --accent-600: #c07000;

  /* Sky is a custom ramp around #00A7E1, not Tailwind's. */
  --sky-50: #e6f6fd;
  --sky-100: #b3e5f9;
  --sky-200: #66ccf3;
  --sky-400: #00a7e1;
  --sky-500: #008ec0;
  --sky-600: #0267a1;
  --sky-700: #025080;

  /* Structure */
  --slate-50: oklch(98.4% .003 247.858);
  --slate-100: oklch(96.8% .007 247.896);
  --slate-200: oklch(92.9% .013 255.508);
  --slate-300: oklch(86.9% .022 252.894);
  --slate-400: oklch(70.4% .04 256.788);
  --slate-500: oklch(55.4% .046 257.417);
  --slate-600: oklch(44.6% .043 257.281);
  --slate-700: oklch(37.2% .044 257.287);
  --slate-800: oklch(27.9% .041 260.031);

  /* Meaning — green approved/paid/active, rose rejected/destructive,
     amber pending, sky in progress. Badge owns the status→colour map. */
  --green-50: oklch(98.2% .018 155.826);
  --green-100: oklch(96.2% .044 156.743);
  --green-500: oklch(72.3% .219 149.579);
  --green-600: oklch(62.7% .194 149.214);
  --green-700: oklch(52.7% .154 150.069);

  --rose-50: oklch(96.9% .015 12.422);
  --rose-100: oklch(94.1% .03 12.58);
  --rose-200: oklch(89.2% .058 10.001);
  --rose-500: oklch(64.5% .246 16.439);
  --rose-600: oklch(58.6% .253 17.585);

  --amber-50: oklch(98.7% .022 95.277);
  --amber-100: oklch(96.2% .059 95.617);
  --amber-600: oklch(66.6% .179 58.318);
  --amber-700: oklch(55.5% .163 48.998);

  --cream: #f6f4ef;

  /* The sidebar's own gradient, read off the live portal:
     linear-gradient(#0f2b46 0%, sky-600 130%). */
  --navy-900: #0f2b46;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* The same stack the live portal serves. Inter is loaded from the system
     rather than a CDN, so the app still renders correctly with no network. */
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--cream);
  color: var(--slate-700);
}

h1, h2, h3 { color: var(--slate-800); }

/* An SVG is a replaced element with an intrinsic ratio, and Chrome will shrink
   one inside a flex row all the way to zero width. Every icon here sits in a
   flex container, so pin them all rather than chasing it per component. */
svg { flex-shrink: 0; }

/* ── Shell ────────────────────────────────────────────────────────── */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--sky-600) 130%);
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 20px;
  color: #fff;
}
.brand .name { display: block; font-size: 16px; font-weight: 700; line-height: 1.2; }
.brand .tagline { display: block; font-size: 12px; color: rgba(255, 255, 255, .55); }
.brand-divider { margin: 0 20px 16px; border-top: 1px solid rgba(255, 255, 255, .1); }
/* The house mark is a corner-to-corner gradient from brand-600 to accent-400.
   Sampled from the Hunaru app icon, whose diagonal runs #ff5600 -> #ffa530. */
.brand .mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--accent-400) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .25);
}

.nav-group { margin-bottom: 18px; padding: 0 12px; }
.nav-group h4 {
  margin: 0 0 6px;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .4);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  margin-bottom: 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(102, 204, 243, .8); /* sky-200/80 */
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, background-color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-item.active {
  background: rgba(255, 255, 255, .15);
  color: #fff;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .05);
}
/* The active row is marked by a short brand bar on the sidebar's edge. */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  border-radius: 0 999px 999px 0;
  background: var(--brand-600);
}

.main { flex: 1; min-width: 0; padding: 24px; }

/* Sticky, translucent, and blurred over the page as it scrolls under. */
.topbar {
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, .6);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.topbar .app-title { font-size: 20px; font-weight: 700; color: var(--slate-800); }
.topbar .user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  background: #fff;
}
.topbar .avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--accent-400) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.topbar .who { line-height: 1.2; }
.topbar .who b { font-size: 13px; color: var(--slate-800); }
.topbar .who span { display: block; font-size: 11px; color: var(--slate-500); }

#drawer-toggle { display: none; }
.drawer-backdrop { display: none; }

@media (min-width: 640px) { .topbar { padding: 0 24px; } }

/* ── Page skeleton ───────────────────────────────────────────────── */

.page { display: flex; flex-direction: column; gap: 24px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.page-head .titles { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.page-head .subtitle { margin: 2px 0 0; font-size: 13px; color: var(--slate-500); }

/* 40px rounded square, bg-{colour}-100 with a matching text-{colour}-600 icon.
   Each page picks one colour and keeps it. */
.icon-tile {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
}
.icon-tile.brand { background: var(--brand-100); color: var(--brand-600); }
.icon-tile.green { background: var(--green-100); color: var(--green-600); }
.icon-tile.amber { background: var(--amber-100); color: var(--amber-600); }
.icon-tile.sky   { background: var(--sky-100);   color: var(--sky-600); }

.panel {
  background: #fff;
  border: 1px solid var(--slate-100);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  padding: 20px;
}
.panel > h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--slate-700);
}
/* A panel wrapping only a list lets the table meet its rounded edges. */
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush .mobile-only { padding: 14px; }

@media (min-width: 640px) {
  .panel { padding: 32px; }
  .panel.flush { padding: 0; }
}

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ── Stat tiles ──────────────────────────────────────────────────── */

/* Icon tile on the left, number and label on the right. */
.stat {
  background: #fff;
  border: 1px solid var(--slate-100);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat .tile {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat .tile.brand { background: var(--brand-50); color: var(--brand-600); }
.stat .tile.accent { background: var(--accent-50); color: var(--accent-500); }
.stat .tile.green { background: var(--green-50); color: var(--green-600); }
.stat .tile.sky { background: var(--sky-100); color: var(--sky-600); }
.stat .tile.rose { background: var(--rose-50); color: var(--rose-600); }

.stat .body { min-width: 0; }
.stat .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--slate-800);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stat .value.good { color: var(--green-600); }
.stat .value.bad { color: var(--rose-600); }
.stat .label { font-size: 14px; color: var(--slate-500); margin-top: 2px; }
.stat .sub { font-size: 12px; color: var(--slate-400); margin-top: 2px; }

@media (min-width: 640px) {
  .stat { gap: 24px; padding: 28px 32px; }
  .stat .tile { width: 56px; height: 56px; flex-basis: 56px; }
  .stat .value { font-size: 30px; }
}

/* ── Tabs and toggles ────────────────────────────────────────────── */

/* flex-wrap not overflow-x-auto: the strip wraps onto a second line on a phone
   rather than scrolling sideways, and must never be wider than the page. */
.tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--slate-100);
  padding: 4px;
  border-radius: 8px;
  width: 100%;
}
@media (min-width: 1024px) { .tab-strip { width: fit-content; } }

.tab-strip button {
  padding: 6px 16px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--slate-500);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: color .15s, background-color .15s;
}
.tab-strip button:hover { color: var(--slate-700); }
.tab-strip button.active {
  background: #fff;
  color: var(--slate-800);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

/* ── Tables ──────────────────────────────────────────────────────── */

.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: var(--slate-50); border-bottom: 1px solid var(--slate-100); }
th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: .025em;
  padding: 12px;
  white-space: nowrap;
}
tbody tr { border-top: 1px solid var(--slate-50); }
tbody tr:hover { background: var(--slate-50); }
td { padding: 12px 16px; white-space: nowrap; vertical-align: middle; }
td:first-child { font-weight: 500; color: var(--slate-800); }
td.num, th.num { text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
th.num { font-family: inherit; }
td.wrap { white-space: normal; min-width: 220px; }

.table-empty { padding: 40px 16px; text-align: center; color: var(--slate-400); }
.loading { padding: 48px; text-align: center; color: var(--slate-400); }

@media (min-width: 640px) {
  th { padding: 18px 28px; }
}

/* Cards below 640px, table from 640px up — never a horizontally scrolling
   table as the only option. */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.mobile-card {
  border: 1px solid var(--slate-100);
  border-radius: 12px;
  padding: 14px;
}
.mobile-card .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mobile-card .title { font-weight: 600; color: var(--slate-800); }
.mobile-card .subtitle { font-size: 12px; color: var(--slate-500); margin-top: 2px; }
.mobile-card dl { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.mobile-card dt { color: var(--slate-500); }
.mobile-card dd { margin: 0; text-align: right; color: var(--slate-700); }
.mobile-card dd.num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.mobile-card .actions { display: flex; gap: 8px; margin-top: 12px; }

.desktop-only { display: none; }
.mobile-only { display: block; }
@media (min-width: 640px) {
  .desktop-only { display: block; }
  .mobile-only { display: none; }
}

/* ── Forms ───────────────────────────────────────────────────────── */

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--slate-600);
  margin-bottom: 4px;
}

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 14px 20px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--slate-800);
}
/* focus:outline-none focus:ring-2 focus:ring-brand-300 */
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-300);
}
.helper { font-size: 12px; color: var(--slate-400); margin: 4px 0 0; }

/* The filter row sits on the page above the panel: a search box with the
   magnifier inside it, then selects sized to their content. */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.filters .search { position: relative; flex: 1 1 320px; max-width: 420px; }
.filters .search svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
  pointer-events: none;
}
.filters .search input { padding-left: 44px; }
.filters select { width: auto; min-width: 170px; }

button {
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: color .15s, background-color .15s, border-color .15s;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--brand-600);
  background: var(--brand-600);
  color: #fff;
  font-weight: 500;
}
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn-primary:disabled { opacity: .5; cursor: default; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-700);
}
.btn-secondary:hover { background: var(--slate-50); }

/* Icon buttons always carry a title. */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 0;
  background: transparent;
  color: var(--slate-400);
  border-radius: 6px;
}
.btn-icon:hover { color: var(--slate-700); background: var(--slate-100); }
.btn-icon.destructive:hover { color: var(--rose-600); background: var(--rose-50); }
.btn-icon.approve { color: var(--green-500); }
.btn-icon.approve:hover { background: var(--green-50); }

.card-btn {
  padding: 6px 12px;
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-700);
  font-size: 13px;
}
.card-btn:hover { background: var(--slate-50); }
.card-btn.destructive:hover { color: var(--rose-600); border-color: var(--rose-200); background: var(--rose-50); }

/* ── Badges ──────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--slate-100);
  color: var(--slate-600);
}
.badge.green { background: var(--green-100); color: var(--green-700); }
.badge.rose  { background: var(--rose-100);  color: var(--rose-600); }
.badge.amber { background: var(--amber-100); color: var(--amber-700); }
.badge.sky   { background: var(--sky-100);   color: var(--sky-700); }
.badge.brand { background: var(--brand-100); color: var(--brand-700); }

/* ── Bars and charts ─────────────────────────────────────────────── */

.bar-track { background: var(--slate-100); border-radius: 999px; height: 8px; overflow: hidden; min-width: 80px; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--brand-600); }
.bar-fill.green { background: var(--green-500); }
.bar-fill.amber { background: var(--accent-400); }
.bar-fill.rose { background: var(--rose-500); }
.bar-fill.sky { background: var(--sky-400); }

.ranked-row {
  display: grid;
  grid-template-columns: 1fr 110px 96px;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}
.ranked-row .amount {
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--slate-700);
}

.chart { width: 100%; height: 220px; display: block; }
.chart .grid-line { stroke: var(--slate-100); stroke-width: 1; }
.chart .axis { stroke: var(--slate-200); stroke-width: 1; }
.chart text { fill: var(--slate-400); font-size: 10px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--slate-500); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ── Modal ───────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: min(680px, 100%);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
.modal h3 { margin: 0 0 18px; font-size: 18px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 8px; margin-top: 18px; }

/* Feedback is a tinted strip, not an alert. */
.notice { border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-top: 14px; }
.notice.error { background: var(--rose-50); color: var(--rose-600); border: 1px solid var(--rose-200); }
.notice.success { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }

.line-items { grid-column: 1 / -1; margin-top: 4px; }
.line-items .row { display: grid; grid-template-columns: 1fr 88px 120px 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.line-items .row input { padding: 8px 12px; }
.line-items .totals { text-align: right; font-weight: 600; color: var(--slate-700); margin-top: 10px; font-variant-numeric: tabular-nums; }

/* ── Toast ───────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-left: 4px solid var(--green-500);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--slate-700);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .1);
  z-index: 100;
  max-width: 380px;
}
.toast.error { border-left-color: var(--rose-500); color: var(--rose-600); }

/* ── Phones ──────────────────────────────────────────────────────── */

@media (max-width: 1023px) {
  /* The sidebar is a drawer under lg, with a backdrop and a body scroll lock. */
  #drawer-toggle { display: inline-flex; }
  .shell { flex-direction: column; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 45;
    width: 264px;
    flex: none;
    height: 100%;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .15);
  }
  .sidebar.open { transform: translateX(0); }
  .drawer-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(15, 23, 42, .4);
  }
  body.drawer-open { overflow: hidden; }
  .main { padding: 16px 14px 48px; }
  .page { gap: 24px; }
}

@media (min-width: 640px) {
  .page { gap: 48px; }
}

@media (max-width: 639px) {
  .filters .search, .filters select { flex: 1 1 100%; width: 100%; max-width: none; min-width: 0; }
  .ranked-row { grid-template-columns: 1fr 80px; }
  .ranked-row .bar-track { display: none; }

  /* iOS zooms the page in on a focused control smaller than 16px. This is a
     platform workaround, not a design choice — do not "clean it up". */
  input, select, textarea { font-size: 16px !important; }
}

/* ── Sign in ─────────────────────────────────────────────────────── */

/* The portal's own sign-in treatment: the brand gradient behind a white card. */
.signin {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(150deg, var(--navy-900) 0%, var(--sky-600) 100%);
}
.signin-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .3);
}
.signin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.signin-brand .mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--accent-400) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.signin-brand .name { font-size: 18px; font-weight: 700; color: var(--slate-800); line-height: 1.2; }
.signin-brand .tagline { font-size: 13px; color: var(--slate-500); }
.signin-card label { margin-top: 14px; }
.signin-card .btn-primary { width: 100%; justify-content: center; margin-top: 20px; }
.signin-hint { font-size: 12px; color: var(--slate-400); margin-top: 18px; text-align: center; }

.topbar .user { cursor: pointer; }
.topbar .user:hover { background: var(--slate-50); }
.user-menu {
  position: absolute;
  right: 16px;
  top: 58px;
  z-index: 40;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .15);
  padding: 6px;
  min-width: 200px;
}
.user-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--slate-700);
}
.user-menu button:hover { background: var(--slate-50); }
.user-menu .who { padding: 8px 12px; border-bottom: 1px solid var(--slate-100); margin-bottom: 4px; }
.user-menu .who b { display: block; font-size: 14px; color: var(--slate-800); }
.user-menu .who span { font-size: 12px; color: var(--slate-500); }

@media (max-width: 639px) {
  /* Dropdown panels pin to the screen edges on a phone. */
  .user-menu { left: 8px; right: 8px; top: 64px; min-width: 0; }
}

/* ── Audit trail ─────────────────────────────────────────────────── */

.changes { display: grid; gap: 4px; }
.change {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  gap: 10px;
  font-size: 13px;
  align-items: baseline;
}
.change .field { color: var(--slate-500); }
.change .from {
  color: var(--rose-600);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--rose-600) 45%, transparent);
}
/* A deleted record's values are what it was, not something struck out. */
.change > span.from { text-decoration: none; color: var(--slate-600); }
.change .to { color: var(--green-700); }
.change .arrow { color: var(--slate-400); margin: 0 4px; }
.change .empty { color: var(--slate-400); font-style: italic; }
