/* ==========================================================================
   Blessing ERP — design system

   One stylesheet, no framework, no build step. The visual language follows
   the dashboard references the owner supplied: a light page, white cards on
   a soft grey ground, generous radii, tinted icon chips, soft status pills
   and airy tables.

   It replaces the earlier flat/navy treatment. The *rules* underneath are
   unchanged — a cost figure a role may not see is still absent from the
   response, not merely painted over.
   ========================================================================== */

/* --------------------------------------------------------------- Tokens  */

:root {
  /* Brand */
  --brand-50:  #E8F6F1;
  --brand-100: #CDEBE1;
  --brand-200: #A3DCC9;
  --brand-400: #35A57F;
  --brand:     #0B7A5A;
  --brand-600: #096A4E;
  --brand-700: #07543E;

  /* Neutrals */
  --ink:        #101828;
  --ink-2:      #344054;
  --muted:      #667085;
  --muted-2:    #98A2B3;
  --line:       #EAECF0;
  --line-soft:  #F2F4F7;
  --surface:    #FFFFFF;
  --page:       #F5F6FA;
  --raised:     #FAFBFC;

  /* Semantic */
  --green:     #12B76A;
  --green-bg:  #E7F8F0;
  --green-ink: #05683C;
  --amber:     #F79009;
  --amber-bg:  #FEF3E2;
  --amber-ink: #93500B;
  --red:       #F04438;
  --red-bg:    #FEECEB;
  --red-ink:   #98211A;
  --blue:      #2E90FA;
  --blue-bg:   #E7F1FE;
  --blue-ink:  #10457F;
  /* The accent chip: landed cost, add-on percentage, exchange rate and the
     dozen others that are neither good news nor bad and so cannot borrow a
     semantic colour. Violet is the one hue nothing else here uses - navy
     collides with --blue on the same card strips, and any warm tint with
     --amber - so it stays violet, softened well away from the indigo the
     brand used to be. It is never a button or a link, only a chip. */
  --violet-bg: #F1EDFB;
  --violet-ink:#5B3FA8;
  --teal:      #14B8A6;
  --teal-bg:   #E4F8F5;
  --teal-ink:  #0B6B60;
  --pink-bg:   #FDECF3;
  --pink-ink:  #A2144B;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .06), 0 2px 4px rgba(16, 24, 40, .03);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .10), 0 4px 8px rgba(16, 24, 40, .04);
  --shadow-pop: 0 16px 40px rgba(16, 24, 40, .16);

  /* Shape */
  --r-sm: 8px;
  --r:    10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  --sidebar-w: 256px;
  --topbar-h: 68px;

  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; color: var(--ink); }

svg { display: block; }
.icon { width: 20px; height: 20px; stroke-width: 1.7; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ------------------------------------------------------------- Layout    */

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

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
}
.sidebar__mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-400) 100%);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  letter-spacing: .5px;
  box-shadow: 0 3px 8px rgba(91, 95, 233, .28);
}
.sidebar__name { font-size: 15px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.sidebar__tag  { font-size: 11px; color: var(--muted-2); line-height: 1.2; }

.sidebar__scroll { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.sidebar__scroll::-webkit-scrollbar { width: 6px; }
.sidebar__scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.nav-section {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 16px 10px 6px;
}
.nav-section:first-child { padding-top: 4px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background .12s ease, color .12s ease;
}
.nav-link .icon { width: 18px; height: 18px; color: var(--muted); stroke-width: 1.8; }
.nav-link:hover { background: var(--line-soft); color: var(--ink); }
.nav-link:hover .icon { color: var(--ink-2); }
.nav-link.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nav-link.active .icon { color: var(--brand); }
.nav-link__count {
  margin-left: auto;
  background: var(--red-bg); color: var(--red-ink);
  font-size: 11px; font-weight: 650;
  border-radius: var(--r-full);
  padding: 1px 7px;
}
.nav-link.active .nav-link__count { background: #fff; color: var(--brand-700); }

.sidebar__user {
  border-top: 1px solid var(--line);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar__user .who { min-width: 0; flex: 1; }
.sidebar__user .who strong {
  display: block; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar__user .who span { font-size: 11.5px; color: var(--muted); }
.icon-btn-plain {
  background: none; border: 0; padding: 6px; cursor: pointer;
  color: var(--muted); border-radius: var(--r-sm); display: grid; place-items: center;
}
.icon-btn-plain:hover { background: var(--line-soft); color: var(--ink); }

.avatar {
  width: 36px; height: 36px; border-radius: var(--r-full);
  background: var(--brand-50); color: var(--brand-700);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 650; flex: none;
  border: 1px solid var(--brand-100);
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }

/* ------------------------------------------------------------- Main      */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  background: rgba(245, 246, 250, .88);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar__search {
  position: relative;
  flex: 1;
  max-width: 420px;
}
.topbar__search .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); width: 17px; height: 17px;
}
.topbar__search input {
  width: 100%; height: 40px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  font-family: inherit; font-size: 13.5px; color: var(--ink);
}
.topbar__search input::placeholder { color: var(--muted-2); }
.topbar__search input:focus {
  outline: none; border-color: var(--brand-200);
  box-shadow: 0 0 0 3px var(--brand-50);
}
.topbar__kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--muted-2);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; background: var(--raised);
}
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.icon-btn__dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--surface);
}

.content { padding: 24px 28px 56px; flex: 1; }

/* ------------------------------------------------------- Page header     */

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
.page-head__text { min-width: 0; flex: 1; }
.page-head h1 { font-size: 24px; line-height: 1.25; }
.page-head .subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 720px;
}
.page-head__actions { display: flex; gap: 8px; align-items: center; flex: none; }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted); margin-bottom: 8px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--ink-2); }
.breadcrumb .icon { width: 14px; height: 14px; color: var(--muted-2); }

.back-link {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--ink-2);
}
.back-link:hover { background: var(--line-soft); }

/* ------------------------------------------------------------- Buttons   */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: var(--brand); color: #fff;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .12s ease, box-shadow .12s ease, transform .06s ease;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.btn:hover { background: var(--brand-600); color: #fff; }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-100); }
.btn .icon { width: 17px; height: 17px; }

.btn.secondary {
  background: var(--surface); color: var(--ink-2); border-color: var(--line);
}
.btn.secondary:hover { background: var(--line-soft); color: var(--ink); }

.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: none; }
.btn.ghost:hover { background: var(--line-soft); }

.btn.danger { background: var(--red); }
.btn.danger:hover { background: #D92D20; }

.btn.dark { background: var(--ink); }
.btn.dark:hover { background: #1D2939; }

.btn.small { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.small .icon { width: 15px; height: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* --------------------------------------------------------------- Cards   */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.stat__top { display: flex; align-items: center; gap: 11px; }
.stat__chip {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: grid; place-items: center; flex: none;
  background: var(--violet-bg); color: var(--violet-ink);
}
.stat__chip .icon { width: 20px; height: 20px; }
.stat__chip.green  { background: var(--green-bg);  color: var(--green-ink); }
.stat__chip.amber  { background: var(--amber-bg);  color: var(--amber-ink); }
.stat__chip.red    { background: var(--red-bg);    color: var(--red-ink); }
.stat__chip.blue   { background: var(--blue-bg);   color: var(--blue-ink); }
.stat__chip.teal   { background: var(--teal-bg);   color: var(--teal-ink); }
.stat__chip.pink   { background: var(--pink-bg);   color: var(--pink-ink); }
.stat__label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat__value {
  font-size: 26px; font-weight: 700; letter-spacing: -.02em;
  line-height: 1.15; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat__value.sm { font-size: 20px; }
.stat__foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat__sub { font-size: 12px; color: var(--muted); }

.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600;
  padding: 2px 7px 2px 5px; border-radius: var(--r-full);
}
.delta .icon { width: 13px; height: 13px; }
.delta.up   { background: var(--green-bg); color: var(--green-ink); }
.delta.down { background: var(--red-bg);   color: var(--red-ink); }
.delta.flat { background: var(--line-soft); color: var(--muted); }

/* --------------------------------------------------------------- Panels  */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.panel__head h2 { font-size: 15px; font-weight: 650; }
.panel__head .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.panel__head .spacer { margin-left: auto; }
.panel__head--plain { border-bottom: 0; padding-bottom: 4px; }
.panel__body { padding: 18px; }
.panel__foot {
  padding: 12px 18px; border-top: 1px solid var(--line-soft);
  background: var(--raised); font-size: 12.5px; color: var(--muted);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
/* With no import pipeline beside it - the sales role does not see one -
   the remaining panel takes the whole width rather than leaving a gap. */
.grid-main--single { grid-template-columns: minmax(0, 1fr); }

/* --------------------------------------------------------------- Tables  */

/* A wide table scrolls inside its card, and says so: the soft shadow at an
   edge appears only while there is more table beyond it.                 */
.table-wrap {
  width: 100%; overflow-x: auto;
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(255,255,255,0)) left center,
    linear-gradient(to left,  var(--surface) 30%, rgba(255,255,255,0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(16,24,40,.10), rgba(16,24,40,0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(16,24,40,.10), rgba(16,24,40,0)) right center;
  background-repeat: no-repeat;
  background-size: 44px 100%, 44px 100%, 13px 100%, 13px 100%;
  background-attachment: local, local, scroll, scroll;
}

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th {
  background: var(--raised);
  color: var(--muted);
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase;
  text-align: left; white-space: nowrap;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
table.data tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--raised); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td:first-child { color: var(--ink); font-weight: 550; }
table.data a { font-weight: 600; }
table.data .sub { display: block; font-size: 12px; color: var(--muted-2); font-weight: 400; }
table.data tfoot td, table.data tfoot th {
  padding: 13px 16px; font-weight: 650; color: var(--ink);
  background: var(--raised); border-top: 1px solid var(--line);
  text-align: left; text-transform: none; letter-spacing: 0; font-size: 13.5px;
  position: static;
}
table.data tfoot th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A subtotal or total line inside the body of a statement. */
table.data tbody tr.is-total td {
  background: var(--raised); color: var(--ink);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-weight: 650;
}
table.data.compact tbody td { padding: 9px 16px; }
/* A generated list keeps one row to one line: a table of eleven columns
   that wraps every cell turns into a wall of ragged text. Anything too
   long is trimmed with an ellipsis and the row scrolls sideways instead. */
table.data.list td, table.data.list th { white-space: nowrap; }
table.data.list tbody td { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
table.data tr.is-void td { color: var(--muted-2); text-decoration: line-through; }
table.data tr.is-selected { background: var(--brand-50); }

/* A sentence belonging to the row above it. Columns are for figures; an
   explanation in the last column of a wide table wraps one word to a line. */
table.data tr.row-note > td {
  padding-top: 0;
  border-top: 0;
  line-height: 1.5;
}
table.data tr.row-note + tr > td { border-top: 1px solid var(--line); }

.cell-lead { display: flex; align-items: center; gap: 10px; }
.cell-lead__text { min-width: 0; }

/* --------------------------------------------------------------- Badges  */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
  background: var(--line-soft); color: var(--ink-2);
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .75; flex: none;
}
.badge.no-dot::before { display: none; }
.badge.green  { background: var(--green-bg);  color: var(--green-ink); }
.badge.amber  { background: var(--amber-bg);  color: var(--amber-ink); }
.badge.red    { background: var(--red-bg);    color: var(--red-ink); }
.badge.blue   { background: var(--blue-bg);   color: var(--blue-ink); }
.badge.violet { background: var(--violet-bg); color: var(--violet-ink); }
.badge.teal   { background: var(--teal-bg);   color: var(--teal-ink); }
.badge.gray   { background: var(--line-soft); color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border-radius: var(--r-sm);
  background: var(--line-soft); color: var(--ink-2);
  font-size: 12.5px; font-weight: 550;
}
.chip .icon { width: 14px; height: 14px; }

/* ------------------------------------------------------ Filters / tabs   */

.toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar__search { position: relative; flex: 1; min-width: 220px; max-width: 340px; }
.toolbar__search .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); width: 16px; height: 16px;
}
.toolbar__search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); font-family: inherit; font-size: 13px; color: var(--ink);
}
.toolbar__search input:focus {
  outline: none; border-color: var(--brand-200); box-shadow: 0 0 0 3px var(--brand-50);
}
.toolbar select, .toolbar input[type=text], .toolbar input[type=date] {
  height: 38px; padding: 0 32px 0 12px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none; appearance: none;
  font-family: inherit; font-size: 13px; color: var(--ink-2);
  cursor: pointer;
}
.toolbar input[type=text], .toolbar input[type=date] {
  background-image: none; padding-right: 12px; cursor: text;
}
.toolbar select:focus, .toolbar input:focus {
  outline: none; border-color: var(--brand-200); box-shadow: 0 0 0 3px var(--brand-50);
}
.toolbar__spacer { margin-left: auto; }
/* A switch that sits in the filter bar rather than in a form. */
.toolbar__check {
  height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  font-size: 13px; color: var(--ink-2); white-space: nowrap;
  align-items: center;
}
.toolbar__check:hover { border-color: var(--brand-200); }
.toolbar__check input[type=checkbox] { margin: 0; }

.filter-count {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted); font-weight: 550;
}
.filter-count b {
  background: var(--brand); color: #fff;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px;
}

.tabs {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--line-soft);
  border-radius: var(--r);
  padding: 3px;
}
.tabs a {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 550; color: var(--muted);
}
.tabs a:hover { color: var(--ink-2); }
.tabs a.active {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-xs); font-weight: 600;
}
.tabs .pill {
  background: var(--line); color: var(--ink-2);
  border-radius: var(--r-full); padding: 0 6px;
  font-size: 11px; font-weight: 650; min-width: 18px; text-align: center;
}
.tabs a.active .pill { background: var(--brand); color: #fff; }

.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs-line a {
  padding: 10px 14px; font-size: 13.5px; font-weight: 550;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs-line a:hover { color: var(--ink-2); }
.tabs-line a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* --------------------------------------------------------------- Forms   */

.form { max-width: 780px; }
.form-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: 24px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.field { margin-bottom: 0; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 6px;
}
.field .req { color: var(--red); }

.form input[type=text], .form input[type=number], .form input[type=date],
.form input[type=email], .form input[type=password], .form input[type=url],
.form select, .form textarea, .form input[type=file] {
  width: 100%; min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.form select {
  -webkit-appearance: none; appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  cursor: pointer;
}
.form textarea { min-height: 88px; resize: vertical; }
.form input::placeholder, .form textarea::placeholder { color: var(--muted-2); }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-50);
}
.form input[type=file] { padding: 8px 12px; font-size: 12.5px; color: var(--muted); }
.form .help { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.form .errors { font-size: 12.5px; color: var(--red-ink); margin-top: 5px; font-weight: 500; }
.field.has-error input, .field.has-error select, .field.has-error textarea {
  border-color: var(--red); background: #FFFBFA;
}
.field.has-error input:focus, .field.has-error select:focus, .field.has-error textarea:focus {
  box-shadow: 0 0 0 3px var(--red-bg);
}

/* A field that carries its unit inside the box: 30 %, 24,500.00 USD,
   179.0000 ETB / USD. The number and its unit belong together.          */
.control { position: relative; display: block; }
.control__unit {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 12.5px; font-weight: 600; color: var(--muted-2);
  pointer-events: none; white-space: nowrap;
}
.control.has-unit input {
  padding-right: calc(var(--unit-width, 3ch) + 24px);
}
.control.has-unit input:focus + .control__unit { color: var(--ink-2); }

.check {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.check input[type=checkbox] {
  width: 17px; height: 17px; margin: 1px 0 0; flex: none;
  accent-color: var(--brand); cursor: pointer;
}
/* Help text under a checkbox is a second line, not a continuation of the
   label - otherwise a long rule reads as part of the option's name.      */
.check .help { display: block; margin-top: 3px; font-weight: 400; }

.form-errors {
  display: flex; gap: 10px;
  background: var(--red-bg); color: var(--red-ink);
  border: 1px solid #FDD9D6;
  border-radius: var(--r-md);
  padding: 12px 14px; margin-bottom: 18px;
  font-size: 13px;
}
.form-errors .icon { color: var(--red); flex: none; }

.form-actions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 22px; padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

fieldset { border: 0; margin: 0 0 22px; padding: 0; }
fieldset legend {
  font-size: 12px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted-2); padding: 0 0 12px;
}

/* ------------------------------------------------------------- Messages  */

.messages { margin-bottom: 18px; display: grid; gap: 8px; }
.message {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
}
.message .icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.message.success { background: var(--green-bg); color: var(--green-ink); border-color: #C4EDD9; }
.message.error   { background: var(--red-bg);   color: var(--red-ink);   border-color: #FDD9D6; }
.message.warning { background: var(--amber-bg); color: var(--amber-ink); border-color: #FCE3BC; }
.message.info    { background: var(--blue-bg);  color: var(--blue-ink);  border-color: #CFE3FD; }

.note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r-md);
  font-size: 13px; line-height: 1.5;
  background: var(--raised); border: 1px solid var(--line); color: var(--ink-2);
}
.note .icon { flex: none; margin-top: 1px; color: var(--muted); }
.note.amber { background: var(--amber-bg); border-color: #FCE3BC; color: var(--amber-ink); }
.note.amber .icon { color: var(--amber); }
.note.red { background: var(--red-bg); border-color: #FDD9D6; color: var(--red-ink); }
.note.red .icon { color: var(--red); }
.note.violet { background: var(--violet-bg); border-color: #E1D7F5; color: var(--violet-ink); }
.note.violet .icon { color: var(--violet-ink); }
.note.green { background: var(--green-bg); border-color: #C4EDD9; color: var(--green-ink); }
.note.green .icon { color: var(--green); }

/* --------------------------------------------------------- Empty/loading */

.empty {
  text-align: center;
  padding: 52px 24px;
}
.empty__art {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: var(--r-lg);
  background: var(--brand-50); color: var(--brand);
  display: grid; place-items: center;
}
.empty__art .icon { width: 26px; height: 26px; }
.empty h3 { font-size: 15px; margin-bottom: 5px; }
.empty p { color: var(--muted); font-size: 13px; margin: 0 auto; max-width: 420px; line-height: 1.55; }
.empty .btn { margin-top: 16px; }

.skeleton {
  background: linear-gradient(90deg, var(--line-soft) 25%, #E9EBF0 37%, var(--line-soft) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-row { height: 14px; margin: 12px 16px; }

.spinner {
  width: 16px; height: 16px; flex: none;
  border: 2px solid var(--brand-100);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* HTMX request indicators */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.htmx-indicator { display: inline-flex; }
.htmx-swapping { opacity: .45; transition: opacity .15s ease; }
.is-busy { position: relative; }
.is-busy::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(255, 255, 255, .55);
  border-radius: inherit;
}

/* ----------------------------------------------------------- Detail grid */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px 24px;
}
.detail-grid .item .label {
  font-size: 12px; color: var(--muted); margin-bottom: 3px;
}
.detail-grid .item .value { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.detail-grid .item .value.big { font-size: 17px; }

.kv { display: grid; gap: 12px; }
.kv__row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.kv__row .k { font-size: 13px; color: var(--muted); }
.kv__row .v { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv__row.total {
  border-top: 1px solid var(--line); padding-top: 12px; margin-top: 2px;
}
.kv__row.total .k { color: var(--ink); font-weight: 600; }
.kv__row.total .v { font-size: 17px; font-weight: 700; }

/* --------------------------------------------------------------- Hero    */

.hero {
  background: linear-gradient(135deg, var(--brand) 0%, #7B5CF0 55%, #8E63F2 100%);
  border-radius: var(--r-lg);
  color: #fff;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(91, 95, 233, .25);
}
.hero h2 { color: #fff; font-size: 17px; }
.hero .muted, .hero .stat__label, .hero .kv__row .k { color: rgba(255,255,255,.78); }
.hero .kv__row .v, .hero .stat__value { color: #fff; }
.hero__tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.hero__tile {
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--r-md);
  padding: 13px 14px;
}
.hero__tile .l { font-size: 11.5px; color: rgba(255,255,255,.8); }
.hero__tile .v { font-size: 18px; font-weight: 700; margin-top: 3px; }

/* -------------------------------------------------------------- Charts   */

/* A chart scales as a whole picture: the box is sized by its own aspect
   ratio, never stretched, or the axis type smears.                       */
.chart { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart--wide { width: 100%; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .bar { fill: var(--brand-100); rx: 4; transition: fill .12s ease; }
.chart .bar.is-peak { fill: var(--brand); }
.chart g:hover > .bar { fill: var(--brand-400); }
.chart .axis-label { fill: var(--muted-2); font-size: 10px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: url(#areaFade); }
.chart .dot { fill: #fff; stroke: var(--brand); stroke-width: 2; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 50%; display: block; }

.donut__wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut__wrap > .chart { flex: none; }

/* The key beside a donut. Long cost-type names truncate rather than push
   the figure off the edge of the card.                                    */
.legend { display: grid; gap: 6px; flex: 1 1 180px; min-width: 0; }
.legend__row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--ink-2); min-width: 0;
}
.legend__name {
  display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1;
}
.legend__name span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.legend__value {
  margin-left: auto; flex: none;
  font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink);
}
.donut__center { font-size: 18px; font-weight: 700; fill: var(--ink); }
.donut__caption { font-size: 11px; fill: var(--muted); }

.meter {
  height: 8px; border-radius: var(--r-full);
  background: var(--line-soft); overflow: hidden;
}
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.meter.green > span { background: var(--green); }
.meter.amber > span { background: var(--amber); }
.meter.red > span   { background: var(--red); }
.meter-row { display: flex; align-items: center; gap: 10px; }
.meter-row .meter { flex: 1; min-width: 60px; }
.meter-row .pct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; }

/* -------------------------------------------------------------- Alerts   */

.alert-row {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.alert-row:last-child { border-bottom: 0; }
.alert-row:hover { background: var(--raised); }
.alert-row__chip {
  width: 34px; height: 34px; border-radius: var(--r); flex: none;
  display: grid; place-items: center;
}
.alert-row__chip.red   { background: var(--red-bg);   color: var(--red); }
.alert-row__chip.amber { background: var(--amber-bg); color: var(--amber); }
.alert-row__chip.yellow{ background: var(--blue-bg);  color: var(--blue); }
.alert-row__body { min-width: 0; flex: 1; }
.alert-row__title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.alert-row__detail { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }

/* --------------------------------------------------------------- Timeline */

.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line);
}
.timeline__item { position: relative; padding-bottom: 18px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
  position: absolute; left: -22px; top: 3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--brand-200);
}
.timeline__item.is-done .timeline__dot { background: var(--green); border-color: var(--green); }
.timeline__item.is-override .timeline__dot { background: var(--red); border-color: var(--red); }
.timeline__title { font-size: 13px; font-weight: 600; }
.timeline__meta { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* --------------------------------------------------------------- Modal   */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16, 24, 40, .45);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  padding: 24px;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  width: 100%; max-width: 520px;
  max-height: 88vh; overflow: auto;
}
.modal__head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 20px 22px 0;
}
.modal__head h2 { font-size: 16px; }
.modal__head p { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.modal__body { padding: 18px 22px; }
.modal__foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 0 22px 22px;
}
.modal__close { margin-left: auto; }

/* A dialogue addressed by the URL fragment: closed until something links to
   it, which means it works with the keyboard, the back button, and with no
   JavaScript at all.                                                      */
/* The dialogue carries the `hidden` attribute as well, so it stays hidden
   even if this stylesheet is late, cached or missing altogether. A class
   plus :target outranks the browser's own rule for [hidden], so opening it
   still works.                                                            */
.modal-target { display: none; }
.modal-target:target { display: grid; }
.modal-target[hidden]:target { display: grid; }
.modal-dismiss { position: absolute; inset: 0; cursor: default; }
.modal-target .modal { position: relative; }

/* Two or three small buttons at the end of a table row. */
.row-actions { display: inline-flex; align-items: center; gap: 4px; }
.row-actions .btn.small { padding: 0 9px; }
.danger-text { color: var(--red-ink); }
.danger-text:hover { background: var(--red-bg); color: var(--red-ink); }

/* The bar that appears when rows are selected for a bulk action. */
.bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--brand-50);
  border-bottom: 1px solid var(--brand-100);
}
.bulk-bar__count { font-size: 13px; font-weight: 650; color: var(--brand-700); }
.bulk-bar .spacer { margin-left: auto; }
table.data td.tick, table.data th.tick { width: 34px; padding-right: 0; }
table.data input[type=checkbox] {
  width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer;
}

details.disclosure > summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  padding: 10px 0;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary .icon { transition: transform .15s ease; color: var(--muted); }
details.disclosure[open] > summary .icon { transform: rotate(90deg); }

/* ----------------------------------------------------------- Pagination  */

.pagination {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px; color: var(--muted);
  flex-wrap: wrap;
}
.pagination__pages { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.pagination__pages a, .pagination__pages span {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 550; color: var(--ink-2);
  border: 1px solid transparent;
}
.pagination__pages a:hover { background: var(--line-soft); }
.pagination__pages .current { background: var(--brand); color: #fff; font-weight: 650; }
.pagination__pages .disabled { color: var(--muted-2); pointer-events: none; }

/* --------------------------------------------------------------- Utils   */

.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }

/* The paperclip beside a record that has a document attached. It sits on the
   baseline of the text it follows rather than floating above it, and darkens
   on hover so it reads as a link and not as decoration. */
.attach {
  display: inline-flex;
  vertical-align: text-bottom;
  margin-left: 6px;
}
.attach:hover { color: var(--brand); }

/* The current file on an edit form, above the "choose a file" input. */
.file-current {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 13px;
}
.file-current a { display: inline-flex; align-items: center; gap: 4px; }
.file-clear { font-size: 12px; color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 20px; }
.mt-sm { margin-top: 10px; }
.mt-xs { margin-top: 3px; }
.mb { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.spacer { margin-left: auto; }
.stack { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 8px; }
.hr { height: 1px; background: var(--line-soft); margin: 18px 0; border: 0; }
.pos { color: var(--green-ink); }
.neg { color: var(--red-ink); }

/* A table cell sets its own colour, so the tone utilities have to reach past
   it. Money still owed is red on the row wherever it appears - a balance you
   have to read to notice is a balance that gets missed. */
table.data tbody td.pos, table.data tfoot td.pos, table.data tfoot th.pos,
table.data tbody td:first-child.pos { color: var(--green-ink); }
table.data tbody td.neg, table.data tfoot td.neg, table.data tfoot th.neg,
table.data tbody td:first-child.neg { color: var(--red-ink); }
table.data tbody td.muted, table.data tbody td.muted-2 { color: var(--muted-2); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.strike { text-decoration: line-through; color: var(--muted-2); }

.split-line {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.split-line:last-child { border-bottom: 0; }

/* ------------------------------------------------------------ Ageing bar */
/* One bar split into the ageing bands, in the same six colours the donut
   and its legend use, so a band means the same colour everywhere.        */

.ageing-bar {
  display: flex; height: 12px; width: 100%;
  border-radius: var(--r-full); overflow: hidden;
  background: var(--line-soft);
}
.ageing-bar__seg { display: block; height: 100%; transition: opacity .12s ease; }
.ageing-bar__seg:hover { opacity: .82; }
/* Same series, same order as DONUT_COLOURS in erp_extras.py. Change one and
   change the other, or a chart and its ageing bar stop agreeing. */
.ageing-bar__seg.tone-0 { background: #0B7A5A; }
.ageing-bar__seg.tone-1 { background: #2E90FA; }
.ageing-bar__seg.tone-2 { background: #F79009; }
.ageing-bar__seg.tone-3 { background: #12B76A; }
.ageing-bar__seg.tone-4 { background: #F04438; }
.ageing-bar__seg.tone-5 { background: #14B8A6; }

/* ------------------------------------------------------ Inline row forms */
/* A table row that carries its own small form - the document checklist, a
   duty payment. The controls are deliberately smaller than the ones in a
   full form so a row still reads as a row.                                */

.inline-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* The controls keep their own width: squeezed into whatever the column
   leaves them, a select and a reason box both become unreadable. The row
   scrolls sideways instead.                                              */
.inline-form > * { flex: none; }
.mini-select, .mini-input {
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface);
  font-family: inherit; font-size: 12.5px; color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.mini-select {
  -webkit-appearance: none; appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.mini-input { width: 150px; }
.mini-input.narrow { width: 104px; }
.mini-select:focus, .mini-input:focus {
  outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-50);
}
.mini-file {
  font-size: 11.5px; color: var(--muted); width: 132px;
}
.mini-file::file-selector-button {
  height: 24px; padding: 0 8px; margin-right: 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--raised); color: var(--ink-2);
  font-family: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.mini-file::file-selector-button:hover { background: var(--line-soft); }

/* A row of small facts under a panel head, used where a detail-grid would
   be too heavy - transport particulars, a customs declaration.            */
.fact-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px 22px; padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.fact-row:last-child { border-bottom: 0; }
.fact .l {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted-2); margin-bottom: 4px;
}
.fact .v { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.fact .v.plain { font-weight: 500; color: var(--ink-2); }

/* ---------------------------------------------------------------- Login   */

.login-page {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(1000px 520px at 12% -8%, rgba(91,95,233,.20), transparent 60%),
    radial-gradient(900px 460px at 108% 108%, rgba(142,99,242,.20), transparent 55%),
    var(--page);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}
.login-card .sidebar__mark { width: 44px; height: 44px; border-radius: 12px; font-size: 17px; }
.login-card h1 { font-size: 20px; margin: 16px 0 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.login-foot { text-align: center; margin-top: 20px; font-size: 12px; color: var(--muted-2); }

/* ------------------------------------------------------------ Responsive */

.sidebar-toggle { display: none; }

@media (max-width: 1200px) {
  .grid-main { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .content { padding: 20px; }
  .topbar { padding: 0 20px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
    width: 264px; min-width: 264px;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; z-index: 55;
    background: rgba(16, 24, 40, .4);
  }
  .sidebar-toggle { display: grid; }
  .topbar__search { max-width: none; }
  .topbar__kbd { display: none; }
  .page-head { flex-direction: column; gap: 14px; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
  .stat { padding: 15px; }
  .stat__value { font-size: 22px; }
  .content { padding: 16px; }
}

@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .topbar__actions .icon-btn:not(.keep) { display: none; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
}

@media print {
  .sidebar, .topbar, .page-head__actions, .toolbar, .btn, .pagination { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .panel, .card, .stat { box-shadow: none; border-color: #DDD; break-inside: avoid; }
}

/* ------------------------------------------------------------ Branding */
/* An uploaded logo takes the place of the lettered mark, at the same size,
   without the gradient behind it. */
.sidebar__mark--logo {
  background: var(--surface);
  object-fit: contain;
  box-shadow: none;
  border: 1px solid var(--line-soft);
  padding: 2px;
}

/* ------------------------------------------------------------ File picker */
/* Choosing one import file or several for a report. A <details> dropdown,
   so it opens and closes without script; the list scrolls inside it. */
.picker__bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.picker__drop { position: relative; }
.picker__drop > summary { list-style: none; cursor: pointer; }
.picker__drop > summary::-webkit-details-marker { display: none; }
.picker__drop[open] > summary { border-color: var(--brand-200); box-shadow: 0 0 0 3px var(--brand-50); }
.picker__panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  width: min(520px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  padding: 10px;
}
.picker__search { display: flex; max-width: none; margin-bottom: 8px; }
.picker__list { max-height: 300px; overflow-y: auto; margin: 0 -4px; }
.picker__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px; border-radius: var(--r-sm); cursor: pointer;
}
.picker__item:hover { background: var(--line-soft); }
.picker__item[hidden] { display: none; }
.picker__item input { width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.picker__text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.picker__text .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker__foot {
  display: flex; align-items: center; gap: 6px;
  border-top: 1px solid var(--line-soft); margin-top: 8px; padding-top: 8px;
}
.chip a { display: inline-grid; place-items: center; color: var(--muted); margin-left: 2px; }
.chip a:hover { color: var(--red-ink); }
@media print { .picker { display: none; } }

/* The removal panel under an edit form lines up with the form above it. */
.form + .removal-panel { max-width: 780px; }
.form + .change-history, .form + .change-history + .removal-panel { max-width: 780px; }

/* --------------------------------------------------------------- Search */
.search-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.search-group .panel__head { gap: 10px; }
.search-group .stat__chip { width: 30px; height: 30px; border-radius: 8px; }
.search-list { list-style: none; margin: 0; padding: 6px; }
.search-list li > a, .search-list li > span {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink);
}
.search-list li > a:hover { background: var(--line-soft); }
.search-list strong { font-weight: 600; font-size: 13.5px; }
@media (max-width: 480px) { .search-groups { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- KPI cards */
/* The period switch above a list's cards, and cards that open a filter. */
.kpi-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--line-soft); border-radius: var(--r);
}
.seg a {
  height: 30px; padding: 0 12px; display: inline-flex; align-items: center;
  border-radius: var(--r-sm); font-size: 13px; font-weight: 550; color: var(--muted);
}
.seg a:hover { color: var(--ink-2); }
.seg a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); font-weight: 600; }
a.stat--link { color: inherit; transition: border-color .12s ease, box-shadow .12s ease; }
a.stat--link:hover { border-color: var(--brand-200); box-shadow: var(--shadow-md); color: inherit; }
.stat__unit { font-size: 15px; font-weight: 600; color: var(--muted); }
@media (max-width: 640px) {
  .tabs { display: flex; flex-wrap: wrap; }
  .seg { display: flex; flex-wrap: wrap; }
}

/* Which dates a list is limited to */
.period-notice {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: -4px 0 14px; padding: 8px 12px; border-radius: 10px;
  background: var(--brand-50, #eef2ff); color: var(--ink-2); font-size: 13px;
}
.period-notice a { font-weight: 600; margin-left: auto; }

/* Account menu in the top bar (a <details>, so it opens without script) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.menu[open] > summary { box-shadow: 0 0 0 3px var(--brand-100); }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 260px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md, 12px); box-shadow: var(--shadow-lg); padding: 6px;
}
.menu__head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft);
}
.menu__head .who { min-width: 0; display: flex; flex-direction: column; }
.menu__head .who strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu__head .who span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: var(--r-sm); border: 0; background: none;
  font: inherit; font-size: 13.5px; color: var(--ink-2); text-align: left; cursor: pointer; text-decoration: none;
}
.menu__item:hover { background: var(--line-soft); color: var(--ink); }
.menu form { margin: 0; }

/* The chosen date written out under a date box */
.date-echo { font-size: 12px; color: var(--muted); margin-top: 4px; min-height: 0; }
.date-echo:empty { display: none; }

/* The next step offered after a save */
.message__link { font-weight: 650; white-space: nowrap; margin-left: 4px; }

/* Sortable column headers */
.icon-xs { width: 13px; height: 13px; }
.data.list th a.th-sort {
  display: inline-flex; align-items: center; gap: 4px;
  color: inherit; text-decoration: none; white-space: nowrap;
}
.data.list th a.th-sort:hover { color: var(--ink); }
.data.list th.num a.th-sort { flex-direction: row-reverse; }
.th-sort__hint { opacity: 0; transition: opacity .12s ease; }
.data.list th a.th-sort:hover .th-sort__hint { opacity: .45; }
.data.list th.sorted { color: var(--ink); }

/* Type-to-filter dropdown (built over the ordinary select) */
.combo { position: relative; }
.combo__native {
  /* Kept in the form and still focusable, so the browser can point at it
     when it complains about a required field - just not seen. */
  position: absolute; left: 0; bottom: 6px; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; border: 0; padding: 0; margin: 0;
}
.combo__list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 260px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.combo__item {
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 13.5px; color: var(--ink-2);
}
.combo__item:hover, .combo__item.is-active { background: var(--brand-50); color: var(--ink); }
.combo__item.is-chosen { font-weight: 650; color: var(--ink); }
.combo__empty { padding: 10px; font-size: 13px; color: var(--muted); }

/* Where an import file has got to, and what to do next */
.stepper {
  display: flex; flex-wrap: wrap; gap: 4px 0; align-items: flex-start;
  margin: 4px 0 14px; padding: 12px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.stepper__step {
  position: relative; flex: 1 1 0; min-width: 84px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
}
.stepper__step::before {
  content: ''; position: absolute; top: 9px; right: 50%; left: -50%; height: 2px;
  background: var(--line);
}
.stepper__step:first-child::before { display: none; }
.stepper__step.is-done::before, .stepper__step.is-current::before { background: var(--brand-200); }
.stepper__dot {
  position: relative; z-index: 1; width: 20px; height: 20px; border-radius: var(--r-full);
  background: var(--surface); border: 2px solid var(--line); color: #fff;
  display: grid; place-items: center;
}
.stepper__step.is-done .stepper__dot { background: var(--brand); border-color: var(--brand); }
.stepper__step.is-current .stepper__dot {
  border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50);
}
.stepper__label { font-size: 11.5px; color: var(--muted); line-height: 1.3; padding: 0 4px; }
.stepper__step.is-current .stepper__label { color: var(--ink); font-weight: 650; }
.stepper__step.is-done .stepper__label { color: var(--ink-2); }

.next-step {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--brand-50); border: 1px solid var(--brand-100);
}
.next-step--blocked { background: #FFF7E8; border-color: #F6D9A8; }
.next-step__chip {
  width: 34px; height: 34px; border-radius: var(--r-full); flex: none;
  display: grid; place-items: center; background: var(--surface); color: var(--brand-700);
}
.next-step--blocked .next-step__chip { color: #B54708; }
.next-step__text { display: flex; flex-direction: column; gap: 2px; min-width: 200px; flex: 1; }
.next-step__text strong { font-size: 14px; }
.next-step__text span { font-size: 13px; color: var(--ink-2); }
.next-step .btn { margin-left: auto; }
@media (max-width: 860px) {
  .stepper { overflow-x: auto; flex-wrap: nowrap; }
  .stepper__step { min-width: 96px; flex: 0 0 auto; }
}

/* ----------------------------------------------------- Management overview */
.overview-filter {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 10px;
}
.overview-filter__row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.overview-filter__dates { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.overview-filter__dates label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.overview-filter__dates input {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-size: 13px; color: var(--ink); background: var(--surface);
}
.overview-filter__field { display: flex; flex-direction: column; gap: 4px; min-width: 190px; flex: 1 1 190px; }
.overview-filter__field > span { font-size: 12px; color: var(--muted); }
.overview-filter__field select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-size: 13.5px; color: var(--ink); background: var(--surface); width: 100%;
}

.overview-scope {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; margin-bottom: 16px; border-radius: var(--r-md);
  background: var(--brand-50); font-size: 13px; color: var(--ink-2);
}
.overview-scope__stamp { margin-left: auto; }

.overview-band {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin: 22px 0 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}

.overview-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 14px; align-items: start;
}
.overview-panel .panel__head h2 { display: flex; align-items: center; gap: 8px; }
.overview-panel__scope {
  padding: 8px 16px; font-size: 12px; color: var(--muted);
  background: var(--line-soft); border-bottom: 1px solid var(--line);
}
.overview-table { width: 100%; }
.overview-table th[scope="row"] {
  text-align: left; font-weight: 500; color: var(--ink-2); font-size: 13.5px;
  padding: 9px 16px; border-bottom: 1px solid var(--line-soft);
}
.overview-table td { padding: 9px 16px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.overview-table tr:last-child th, .overview-table tr:last-child td { border-bottom: 0; }
.overview-table tr:hover th, .overview-table tr:hover td { background: var(--line-soft); }
.overview-table__hint { display: block; font-size: 11.5px; color: var(--muted-2); }
.overview-table td.amber { color: var(--amber-ink); font-weight: 650; }
.overview-table td.red { color: var(--red-ink); font-weight: 650; }

.attention-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px; padding: 14px 16px;
}
.attention {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink-2); text-decoration: none;
}
.attention:hover { border-color: var(--brand-200); box-shadow: var(--shadow-xs); }
.attention__count { font-size: 22px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.attention__label { font-size: 12.5px; line-height: 1.35; }
.attention--amber { background: var(--amber-bg); border-color: transparent; }
.attention--amber .attention__count { color: var(--amber-ink); }
.attention--red { background: var(--red-bg); border-color: transparent; }
.attention--red .attention__count { color: var(--red-ink); }

@media print {
  .overview-filter, .overview-scope__stamp { display: none; }
  .overview-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .overview-grid { grid-template-columns: 1fr; }
  .overview-scope__stamp { margin-left: 0; }
}

/* A figure's tone wins over the link colour: red money stays red. */
.overview-table td a { color: var(--brand-700); text-decoration: none; }
.overview-table td a:hover { text-decoration: underline; }
.overview-table td.amber a { color: var(--amber-ink); }
.overview-table td.red a { color: var(--red-ink); }
.overview-table tr.is-total th, .overview-table tr.is-total td {
  font-weight: 700; color: var(--ink); background: var(--line-soft);
}

/* What the goods cost, while a sale line is being written */
.cost-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-top: 18px; padding: 14px 16px;
  background: var(--brand-50); border: 1px solid var(--brand-100);
  border-radius: var(--r-md);
}
.cost-readout__cell { display: flex; flex-direction: column; gap: 2px; }
.cost-readout__label { font-size: 11.5px; color: var(--muted); }
.cost-readout__value { font-size: 18px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.cost-readout__value.pos { color: var(--green-ink); }
.cost-readout__value.warn { color: var(--amber-ink); }
.cost-readout__value.neg { color: var(--red-ink); }
.cost-readout__sub { font-size: 11.5px; color: var(--muted); }
.cost-readout__note { grid-column: 1 / -1; margin: 2px 0 0; font-size: 12px; color: var(--ink-2); }

/* A temporary password, shown once */
code.reveal {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px; font-weight: 650; letter-spacing: .02em; color: var(--ink);
}

/* ------------------------------------------------------------ Sign in    */
/* A split screen: the company on the left over deep emerald, the form on
   the right over warm ivory. The palette here is its own - deeper and
   warmer than the application behind it - because a sign-in screen is the
   one place the system gets to look like somewhere rather than something.
   Everything is drawn: no images, and the only outside font is Amiri, loaded
   so it can never hold the page up. */
.auth {
  --ivory:        #FAF8F3;
  --ivory-2:      #FFFDFA;
  --charcoal:     #16211E;
  --charcoal-2:   #44534E;
  --charcoal-3:   #7A8781;
  --emerald-deep: #07231E;
  --emerald:      #0B4A3C;
  --gold:         #C8A951;
  --gold-soft:    #E3CB8E;
  --hairline:     #E7E2D8;

  min-height: 100vh;
  display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  background: var(--ivory);
  color: var(--charcoal);
}

/* --------------------------------------------------------- The left side */
.auth__stage {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 54px 56px;
  color: #fff;
  background:
    radial-gradient(820px 620px at 18% 8%, rgba(31,110,92,.55), transparent 62%),
    linear-gradient(158deg, #0C3B31 0%, var(--emerald-deep) 58%, #051915 100%);
}
/* An eight-point star lattice, at the faintest weight that still reads as a
   pattern rather than as dirt on the screen. */
.auth__stage::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23C8A951' stroke-opacity='0.085' stroke-width='1'%3E%3Crect x='15' y='15' width='42' height='42'/%3E%3Crect x='15' y='15' width='42' height='42' transform='rotate(45 36 36)'/%3E%3C/g%3E%3C/svg%3E");
}
.auth__ribbons {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: .72;
}
.auth__stage-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 40px; min-height: 100%;
}
.auth__stage-top { display: flex; align-items: center; gap: 14px; }
.auth__stage-name {
  margin: 2px 0 0; font-size: 19px; font-weight: 650; letter-spacing: -.01em;
}
.auth__stage-body { max-width: 30ch; }
.auth__stage-body h2 {
  margin: 0 0 14px; font-size: clamp(30px, 3.1vw, 42px); line-height: 1.12;
  font-weight: 600; letter-spacing: -.02em; color: #fff;
}
.auth__stage-lead {
  margin: 0; font-size: 15px; line-height: 1.65; color: rgba(255,255,255,.7);
  max-width: 38ch;
}
.auth__stage-foot {
  position: relative; margin: 0; max-width: 26ch;
  font-size: 12px; line-height: 1.6; color: rgba(255,255,255,.5);
  text-shadow: 0 1px 6px rgba(5,25,21,.9);
}

/* ------------------------------------------------------------- The marks */
.auth__mark {
  flex: none; display: grid; place-items: center;
  font-weight: 700; color: #fff;
  width: 46px; height: 46px; border-radius: 14px; font-size: 19px;
  background: linear-gradient(150deg, var(--emerald) 0%, #0B7A5A 100%);
}
.auth__mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.auth__mark--onDark {
  background: linear-gradient(150deg, rgba(255,255,255,.17), rgba(255,255,255,.06));
  border: 1px solid rgba(200,169,81,.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.auth__mark--sm {
  width: 38px; height: 38px; border-radius: 11px; font-size: 16px;
  background: linear-gradient(150deg, var(--emerald) 0%, #0B7A5A 100%);
  box-shadow: 0 4px 12px rgba(11,74,60,.24);
}

.auth__eyebrow {
  margin: 0; font-size: 11px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--charcoal-3);
}
.auth__eyebrow--onDark { color: var(--gold-soft); }

/* -------------------------------------------------------- The right side */
.auth__panel {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 32px;
  background: var(--ivory);
  /* The same lattice, fainter still, so the two halves belong together. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%230B4A3C' stroke-opacity='0.045' stroke-width='1'%3E%3Crect x='15' y='15' width='42' height='42'/%3E%3Crect x='15' y='15' width='42' height='42' transform='rotate(45 36 36)'/%3E%3C/g%3E%3C/svg%3E");
}
.auth__card {
  width: 100%; max-width: 468px;
  background: var(--ivory-2);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  padding: 36px 40px 30px;
  box-shadow: 0 1px 2px rgba(22,33,30,.04), 0 18px 48px -18px rgba(22,33,30,.18);
}

/* -------------------------------------------------------------- The dua  */
/* Present and respected, not shouting. Amiri where it is available, the
   system Naskh face where it is not. The line height is structural: the text
   is fully vowelled and anything tighter clips the tashkeel. */
.auth__dua { text-align: center; margin: 4px 0 30px; }
.auth__dua-text {
  margin: 0;
  font-family: 'Amiri', 'Noto Naskh Arabic', 'Scheherazade New', serif;
  /* Amiri sets small for its point size, so this is larger than it looks
     written down. The dua should be read at a glance, not squinted at. */
  font-size: clamp(20px, 1.85vw, 26px);
  /* Still generous: the text is fully vowelled and anything tighter than
     about 1.8 starts clipping the tashkeel. */
  line-height: 1.95;
  /* A quieter green than the interface uses. This is not a brand mark. */
  color: #33453C;
  /* Two even lines rather than a long one and an orphan. */
  text-wrap: balance;
}
.auth__ornament {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 22px; color: rgba(200,169,81,.9);
}
.auth__ornament svg { width: 17px; height: 17px; flex: none; }
.auth__rule {
  display: block; height: 1px; flex: 1; max-width: 108px;
  background: linear-gradient(90deg, transparent, rgba(200,169,81,.62));
}
.auth__ornament .auth__rule:last-child {
  background: linear-gradient(90deg, rgba(200,169,81,.62), transparent);
}

/* ------------------------------------------------------------- The form  */
.auth__head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth__title {
  margin: 0 0 6px; font-size: 26px; line-height: 1.2;
  letter-spacing: -.022em; font-weight: 650; color: var(--charcoal);
}
.auth__lead { margin: 0 0 26px; font-size: 14px; color: var(--charcoal-2); }

.auth .field label { color: var(--charcoal-2); }
.auth .field input[type="text"],
.auth .field input[type="password"] {
  background: #fff; border-color: var(--hairline); border-radius: 12px;
  height: 46px;
}
.auth .field input:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(11,74,60,.11);
}

/* The eye sits inside the field, not under it. These rules were lost when
   this block was rewritten and the toggle fell out of the input; keep them
   with the auth styles that are the only thing using them. */
.control--password { position: relative; display: block; }
.control--password input { padding-right: 46px; width: 100%; }
.control__eye {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center; border-radius: 9px;
  color: var(--charcoal-3);
}
.control__eye:hover { color: var(--charcoal); background: rgba(11,74,60,.07); }
.control__eye.is-on { color: var(--emerald); }
.control__eye:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }

.auth__caps {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; font-size: 12.5px; color: var(--amber-ink);
}
.auth__caps[hidden] { display: none; }

.auth__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin: 18px 0 22px; flex-wrap: wrap;
}
.auth__check {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: 13.5px; color: var(--charcoal-2); user-select: none;
}
.auth__check input {
  width: 17px; height: 17px; margin: 0; cursor: pointer;
  accent-color: var(--emerald);
}
.auth__link {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--emerald); font-weight: 550;
  border-bottom: 1px solid transparent;
}
.auth__link:hover { border-bottom-color: rgba(11,74,60,.4); }
.auth__link:focus-visible {
  outline: 2px solid var(--emerald); outline-offset: 3px; border-radius: 3px;
}

.auth__submit.btn {
  height: 50px; font-size: 15px; font-weight: 600; border-radius: 13px;
  gap: 10px;
  background: linear-gradient(140deg, #0E5A49 0%, var(--emerald) 55%, #093B30 100%);
  border: 1px solid rgba(200,169,81,.28);
  box-shadow: 0 8px 20px -8px rgba(9,59,48,.6);
  transition: transform .14s ease, box-shadow .18s ease, filter .18s ease;
}
.auth__submit.btn:hover {
  background: linear-gradient(140deg, #126B57 0%, #0C5344 55%, #0A4437 100%);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -10px rgba(9,59,48,.66);
}
.auth__submit.btn:active { transform: translateY(0); }
.auth__submit.btn:disabled { filter: saturate(.6); transform: none; }
.auth__submit .icon { transition: transform .16s ease; }
.auth__submit.btn:hover .icon { transform: translateX(3px); }

.auth__help {
  display: flex; gap: 10px; margin-top: 20px;
  padding: 14px 16px; border-radius: 13px;
  background: rgba(200,169,81,.09);
  border: 1px solid rgba(200,169,81,.3);
  font-size: 12.5px; line-height: 1.6; color: var(--charcoal-2);
}
.auth__help[hidden] { display: none; }
.auth__help .icon { flex: none; margin-top: 1px; color: #96792C; }
.auth__help strong { color: var(--charcoal); }

.auth__foot {
  margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--hairline);
  font-size: 11.5px; text-align: center; color: var(--charcoal-3);
}

/* ------------------------------------------------------------ Narrower   */
@media (max-width: 1040px) {
  /* The stage becomes a header: enough of it to set the tone, none of the
     height that would push the password field off a phone screen. */
  .auth { grid-template-columns: 1fr; }
  .auth__stage {
    padding: 26px 26px 30px; min-height: 0;
  }
  .auth__stage-inner { gap: 18px; }
  .auth__stage-body, .auth__stage-foot { display: none; }
  .auth__ribbons { opacity: .6; }
  .auth__panel { padding: 30px 20px 40px; align-items: flex-start; }
  .auth__card { padding: 28px 24px 24px; border-radius: 18px; }
  .auth__rule { max-width: 74px; }
}
/* ------------------------------------------------- A second job for a person

   One tick box per job, each with a line saying what it opens and whether it
   shows what the goods cost. The money line is the one somebody must not have
   to guess at, so it is a badge rather than a sentence to read past.        */

.hats {
  margin-top: 6px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 10px;
}
.hats__head h2 { margin: 0; font-size: 15px; }
.hats__head p {
  margin: 4px 0 6px; font-size: 12.5px; line-height: 1.55; color: var(--muted);
  max-width: 70ch;
}
.hat {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .12s ease, background .12s ease;
}
.hat:hover { border-color: var(--brand-soft, var(--line-strong)); background: var(--line-soft); }
.hat input { margin-top: 3px; flex: none; }
.hat__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hat__name {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-weight: 600; font-size: 13.5px; color: var(--ink);
}
.hat__work { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.hat.is-locked { cursor: not-allowed; opacity: .6; }
.hat.is-locked:hover { border-color: var(--line); background: var(--surface); }
