/* ============================================================
   Subject Access — application design system
   Matches the marketing site (Canvas theme): Source Sans Pro
   body, Roboto headings, brand green #06873c, white surfaces.
   ============================================================ */

:root {
  --ink:        #222222;
  --ink-2:      #05502a;
  --ink-3:      #044323;
  --paper:      #f7f9f7;
  --card:       #ffffff;
  --line:       #e6e8e6;
  --line-soft:  #eef0ee;
  --text:       #555555;
  --muted:      #777f7a;
  --faint:      #9aa29d;

  --green:      #06873c;
  --green-deep: #056530;
  --green-dark: #044d25;
  --green-tint: #e2f3e8;
  --green-line: #b9e0c8;

  --amber:      #92650a;
  --amber-tint: #faf0d6;
  --amber-line: #e8d49a;
  --red:        #ad2a20;
  --red-tint:   #fbe9e6;
  --red-line:   #eec4bd;
  --blue:       #1d5e8e;
  --blue-tint:  #e4eef6;
  --blue-line:  #bcd6e8;
  --violet:     #5b4a8f;
  --violet-tint:#ebe7f6;
  --violet-line:#cdc4e6;

  --font-display: "Roboto", -apple-system, sans-serif;
  --font-body: "Source Sans Pro", -apple-system, sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --shadow-sm: 0 1px 2px rgba(20, 40, 28, 0.06);
  --shadow-md: 0 2px 10px rgba(20, 40, 28, 0.08), 0 1px 3px rgba(20, 40, 28, 0.05);
  --shadow-lg: 0 18px 50px -12px rgba(10, 45, 26, 0.3);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  --sidebar-w: 264px;
}

* { box-sizing: border-box; }

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

body.sa-app {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 .4em;
}

a { color: var(--green-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--font-mono); font-size: 0.85em; letter-spacing: -0.02em; }

/* ------------------------------------------------------------
   Shell: sidebar + topbar + main
   ------------------------------------------------------------ */
.sa-shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sa-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--green) 0%, var(--green-deep) 100%);
  color: #eaf6ee;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 16px;
}

.sa-sidebar .sa-logo {
  display: block;
  padding: 4px 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.09);
  margin-bottom: 18px;
}
.sa-sidebar .sa-logo img { width: 168px; height: auto; display: block; }

.sa-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.sa-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #d8efe1;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease;
}
.sa-nav a svg { width: 19px; height: 19px; flex: 0 0 auto; opacity: .85; }
.sa-nav a:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.sa-nav a.active {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.22);
  color: #fff;
  font-weight: 700;
}
.sa-nav a.active svg { opacity: 1; }

.sa-nav .sa-nav-label {
  margin: 18px 12px 6px;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #bfe4cd;
  font-weight: 700;
  font-family: var(--font-display);
}

.sa-user-card {
  border-top: 1px solid rgba(255,255,255,0.09);
  padding-top: 14px;
  margin-top: 14px;
}
.sa-user-card .name { font-weight: 700; color: #fff; font-size: 14px; font-family: var(--font-display); }
.sa-user-card .alias {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #c8ead5;
  word-break: break-all;
  margin-top: 2px;
}
.sa-user-card .signout {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  color: #d8efe1;
}
.sa-user-card .signout:hover { color: #fff; }

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

.sa-topbar { display: none; }

.sa-content {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 40px 80px;
}

/* Page headers */
.sa-page-head { margin-bottom: 26px; }
.sa-page-head .eyebrow {
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--green-deep);
  font-weight: 700;
  margin-bottom: 6px;
}
.sa-page-head h1 { font-size: clamp(26px, 4vw, 36px); }
.sa-page-head .sub { color: var(--muted); max-width: 640px; margin: 4px 0 0; }

/* ------------------------------------------------------------
   Cards, tables, lists
   ------------------------------------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card.pad { padding: 22px; }

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
}

.ledger-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line-soft);
  transition: background .12s ease;
}
.ledger-row:first-child { border-top: 0; }
a.ledger-row { color: inherit; text-decoration: none; }
a.ledger-row:hover { background: #f4f8f5; text-decoration: none; }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, transform .06s ease, box-shadow .15s ease, border-color .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--green); color: #fff; box-shadow: 0 1px 0 rgba(4,77,37,.4), var(--shadow-sm); }
.btn-primary:hover { background: var(--green-deep); color: #fff; }

.btn-ink { background: var(--green-deep); color: #fff; }
.btn-ink:hover { background: var(--green-dark); color: #fff; }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--green); color: var(--green-deep); background: var(--green-tint); }

.btn-subtle { background: #eef1ee; color: var(--ink); }
.btn-subtle:hover { background: #e2e7e3; }

.btn-danger { background: transparent; color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-tint); }

.btn-sm { padding: 8px 14px; font-size: 13.5px; border-radius: 8px; }
.btn-lg { padding: 15px 26px; font-size: 16px; }

.btn .spinner { width: 15px; height: 15px; border-width: 2px; }

/* ------------------------------------------------------------
   Status pills (rubber-stamp flavour)
   ------------------------------------------------------------ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1.5px solid;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.pill.draft        { color: #5d6b61; border-color: #c4ccc6; background: #eef1ee; }
.pill.sent         { color: var(--blue); border-color: var(--blue-line); background: var(--blue-tint); }
.pill.acknowledged { color: var(--violet); border-color: var(--violet-line); background: var(--violet-tint); }
.pill.responded    { color: var(--green-deep); border-color: var(--green-line); background: var(--green-tint); }
.pill.overdue      { color: var(--red); border-color: var(--red-line); background: var(--red-tint); }
.pill.completed    { color: var(--green-dark); border-color: var(--green-deep); background: var(--green-tint); }
.pill.withdrawn    { color: #6d6d6d; border-color: #d4d4d4; background: #efefec; }
.pill.escalated    { color: var(--amber); border-color: var(--amber-line); background: var(--amber-tint); }

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 6px;
}
.field .hint { font-size: 13px; color: var(--muted); margin-top: 5px; }

.input, textarea.input, select.input {
  width: 100%;
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 15.5px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, textarea.input:focus, select.input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(6, 135, 60, 0.14);
}
.input.err { border-color: var(--red); box-shadow: 0 0 0 3px rgba(173,42,32,.12); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }

.input-mono { font-family: var(--font-mono); font-size: 14px; }

.field-error { color: var(--red); font-size: 13.5px; font-weight: 600; margin-top: 5px; }

.checkline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14.5px;
  color: var(--text);
  cursor: pointer;
}
.checkline input { margin-top: 3px; accent-color: var(--green); width: 17px; height: 17px; flex: 0 0 auto; }

/* ------------------------------------------------------------
   Chips (selectable)
   ------------------------------------------------------------ */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: all .13s ease;
}
.chip:hover { border-color: var(--green); color: var(--green-deep); }
.chip.on {
  background: var(--green-tint);
  border-color: var(--green);
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px var(--green);
}

/* ------------------------------------------------------------
   Stat tiles
   ------------------------------------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.stat-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-tile .k {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-tile .v {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.stat-tile .d { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.stat-tile.accent { border-top: 3px solid var(--green); }
.stat-tile.warn   { border-top: 3px solid var(--amber); }
.stat-tile.danger { border-top: 3px solid var(--red); }

/* ------------------------------------------------------------
   Stepper
   ------------------------------------------------------------ */
.stepper {
  display: flex;
  gap: 0;
  margin-bottom: 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 18px;
  border-left: 1px solid var(--line-soft);
  color: var(--muted);
  background: transparent;
  border-top: none; border-right: none; border-bottom: none;
  font-family: var(--font-body);
  cursor: pointer;
  text-align: left;
  transition: background .15s ease;
  min-width: 0;
}
.step:first-child { border-left: 0; }
.step:hover:not([disabled]) { background: #f4f8f5; }
.step[disabled] { cursor: not-allowed; opacity: .55; }
.step .n {
  width: 28px; height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  background: #fff;
  transition: all .2s ease;
}
.step .t { display: flex; flex-direction: column; min-width: 0; }
.step .t b { font-size: 14.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step .t span { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.current { background: var(--green-tint); box-shadow: inset 0 -3px 0 var(--green); }
.step.current .n { background: var(--green); border-color: var(--green); color: #fff; }
.step.done .n { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Builder step panels */
.step-panel { display: none; animation: panelIn .28s ease both; }
.step-panel.on { display: block; }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------
   Date range picker
   ------------------------------------------------------------ */
.drp { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.drp-cal {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  user-select: none;
}
.drp-cal .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.drp-cal .head b { font-family: var(--font-display); font-size: 15px; color: var(--ink); }
.drp-cal .head button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  width: 30px; height: 30px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: var(--ink);
  transition: all .12s;
}
.drp-cal .head button:hover { border-color: var(--green); color: var(--green-deep); }
.drp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.drp-grid .dow {
  text-align: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--faint);
  padding: 4px 0;
  text-transform: uppercase;
}
.drp-grid .day {
  aspect-ratio: 1.15;
  border: 0;
  background: transparent;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background .1s;
  padding: 0;
}
.drp-grid .day:hover:not([disabled]) { background: var(--green-tint); }
.drp-grid .day[disabled] { color: #c4ccc6; cursor: default; }
.drp-grid .day.out { color: #c4ccc6; }
.drp-grid .day.inrange { background: var(--green-tint); border-radius: 0; }
.drp-grid .day.edge { background: var(--green); color: #fff; border-radius: 7px; position: relative; z-index: 1; }
.drp-grid .day.today { box-shadow: inset 0 0 0 1.5px var(--green); }

/* ------------------------------------------------------------
   Medium cards / identifier rows
   ------------------------------------------------------------ */
.medium-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.medium-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  padding: 15px 16px;
  cursor: pointer;
  transition: all .14s ease;
  position: relative;
}
.medium-card:hover { border-color: var(--green); box-shadow: var(--shadow-md); }
.medium-card.on { border-color: var(--green); background: var(--green-tint); box-shadow: inset 0 0 0 1px var(--green); }
.medium-card .tick {
  position: absolute;
  top: 12px; right: 12px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: all .14s;
}
.medium-card.on .tick { background: var(--green); border-color: var(--green); }
.medium-card.on .tick::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 900; }
.medium-card b { display: block; font-size: 15px; color: var(--ink); padding-right: 26px; }
.medium-card p { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }

.medium-detail {
  border: 1px dashed var(--green-line);
  background: #f7fbf8;
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-top: 12px;
}
.medium-detail > b { font-size: 14px; color: var(--ink); }

/* Value token list (multi-entry) */
.tokens { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.token {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--green-line);
  color: var(--green-dark);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.token button {
  border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 15px; line-height: 1; padding: 0;
}
.token button:hover { color: var(--red); }

/* ------------------------------------------------------------
   Timeline
   ------------------------------------------------------------ */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 8px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--line);
}
.tl-item { position: relative; padding: 0 0 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -26px; top: 5px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--green);
  box-shadow: 0 0 0 3px var(--card);
  z-index: 1;
}
.tl-item.muted::before { border-color: #c4ccc6; }
.tl-item.bad::before { border-color: var(--red); }
.tl-item .when { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.tl-item .what { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.tl-item .detail { font-size: 13.5px; color: var(--muted); }

/* ------------------------------------------------------------
   Email thread
   ------------------------------------------------------------ */
.mail-item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  margin-bottom: 14px;
  overflow: hidden;
}
.mail-item .mail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  background: #f4f8f5;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.mail-item.outbound .mail-head { background: var(--green-tint); }
.mail-item .avatar {
  width: 34px; height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  background: var(--ink-3);
}
.mail-item.outbound .avatar { background: var(--green); }
.mail-item .mail-meta { min-width: 0; flex: 1; }
.mail-item .mail-meta .from { font-weight: 700; font-size: 14.5px; color: var(--ink); word-break: break-all; }
.mail-item .mail-meta .to { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.mail-item .mail-when { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.mail-item .mail-subject { padding: 14px 18px 0; font-weight: 700; color: var(--ink); }
.mail-item .mail-body {
  padding: 12px 18px 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14.5px;
  color: var(--text);
  max-height: 480px;
  overflow: auto;
}
.mail-item .mail-badges { display: flex; gap: 6px; }

/* ------------------------------------------------------------
   Feedback console (live progress — the PoC's DNA, refined)
   ------------------------------------------------------------ */
.console {
  background: linear-gradient(180deg, var(--green-deep), var(--green-dark));
  border-radius: var(--r-md);
  padding: 18px 20px;
  color: #d9f0e1;
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
}
.console h5 {
  color: #fff;
  font-family: var(--font-display);
  font-size: 15px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.console h5::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #35d073;
  box-shadow: 0 0 8px #35d073;
  animation: consolePulse 2s infinite;
}
@keyframes consolePulse { 50% { opacity: .4; } }
.console ol { list-style: none; margin: 0; padding: 0; }
.console li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 5px 0;
  opacity: 0;
  transform: translateY(6px);
  animation: consoleIn .3s ease forwards;
  line-height: 1.4;
}
@keyframes consoleIn { to { opacity: 1; transform: none; } }
.console li .st { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 1px; position: relative; }
.console li.run .st::before {
  content: "";
  position: absolute; inset: 0;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #35d073;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.console li.ok .st::before { content: "✓"; color: #35d073; font-weight: 900; font-size: 13px; }
.console li.bad .st::before { content: "✕"; color: #ff8f85; font-weight: 900; font-size: 13px; }
.console li.info .st::before { content: "·"; color: #9fc4ab; font-weight: 900; font-size: 18px; line-height: 10px; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 3px solid rgba(6,135,60,.18);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: -3px;
}
.btn-primary .spinner, .btn-ink .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; }

/* ------------------------------------------------------------
   Toasts
   ------------------------------------------------------------ */
#sa-toasts {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 44px));
}
.toast {
  background: var(--green-dark);
  color: #fff;
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: toastIn .25s cubic-bezier(.2,.9,.3,1.2) both;
  border-left: 4px solid #35d073;
}
.toast.err { border-left-color: #ff8f85; }
.toast.out { animation: toastOut .25s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.sa-modal-back {
  position: fixed; inset: 0;
  background: rgba(10,40,24,.55);
  backdrop-filter: blur(3px);
  z-index: 11000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 18px 18px;
  overflow-y: auto;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.sa-modal {
  background: var(--card);
  border-radius: var(--r-lg);
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: panelIn .22s ease both;
  border: 1px solid var(--line);
}
.sa-modal.w-md { max-width: 560px; }
.sa-modal.w-lg { max-width: 820px; }
.sa-modal .m-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 0;
}
.sa-modal .m-head h3 { margin: 0; font-size: 21px; }
.sa-modal .m-close {
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted); padding: 4px;
}
.sa-modal .m-close:hover { color: var(--ink); }
.sa-modal .m-body { padding: 16px 24px 24px; }

/* ------------------------------------------------------------
   Misc
   ------------------------------------------------------------ */
.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: var(--r-md);
  padding: 14px 17px;
  font-size: 14.5px;
  border: 1px solid;
  margin-bottom: 18px;
}
.banner.info  { background: var(--blue-tint);  border-color: var(--blue-line);  color: #17425f; }
.banner.good  { background: var(--green-tint); border-color: var(--green-line); color: var(--green-dark); }
.banner.warn  { background: var(--amber-tint); border-color: var(--amber-line); color: #6a4a06; }
.banner.bad   { background: var(--red-tint);   border-color: var(--red-line);   color: #7c1d15; }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}
.empty-state .glyph {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--green-tint);
  border: 1px solid var(--green-line);
  display: flex; align-items: center; justify-content: center;
}
.empty-state .glyph svg { width: 32px; height: 32px; color: var(--green-deep); }
.empty-state h3 { font-size: 21px; }
.empty-state p { max-width: 400px; margin: 0 auto 18px; }

.divider { border: 0; border-top: 1px solid var(--line-soft); margin: 20px 0; }

.due-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.due-chip.close { color: var(--amber); font-weight: 700; }
.due-chip.past { color: var(--red); font-weight: 700; }

.skeleton {
  background: linear-gradient(90deg, #e9ece9 25%, #f7f9f7 50%, #e9ece9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
  color: transparent !important;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.reveal { opacity: 0; transform: translateY(10px); animation: revealIn .5s ease forwards; }
.reveal.d1 { animation-delay: .06s; } .reveal.d2 { animation-delay: .12s; }
.reveal.d3 { animation-delay: .18s; } .reveal.d4 { animation-delay: .24s; }
@keyframes revealIn { to { opacity: 1; transform: none; } }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-31 { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr); gap: 22px; align-items: start; }

.right-rail { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }

.letter-paper {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  padding: clamp(20px, 4vw, 44px);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  position: relative;
}
.letter-paper::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--green), var(--green-deep));
  border-radius: 4px 4px 0 0;
}

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }

/* Upload dropzone */
.dropzone {
  border: 2px dashed var(--green-line);
  border-radius: var(--r-md);
  background: #f7fbf8;
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--green); background: var(--green-tint); }
.dropzone b { color: var(--green-deep); }

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin-top: 10px;
  font-size: 14px;
}
.file-row .fname { font-weight: 700; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fsize { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* Search result org cards */
.org-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  padding: 16px;
  transition: box-shadow .15s ease, border-color .15s;
}
.org-card:hover { box-shadow: var(--shadow-md); }
.org-card.selected { border-color: var(--green); box-shadow: inset 0 0 0 1.5px var(--green), var(--shadow-md); }
.org-logo {
  width: 38px; height: 38px;
  border-radius: 9px;
  object-fit: contain;
  background: #f1f3f1;
  border: 1px solid var(--line-soft);
  flex: 0 0 auto;
}
.org-logo-fallback {
  width: 38px; height: 38px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-tint);
  border: 1px solid var(--green-line);
  color: var(--green-deep);
  font-weight: 700;
  font-family: var(--font-display);
  flex: 0 0 auto;
}

.email-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 13px;
  margin-top: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all .13s;
}
.email-pick:hover { border-color: var(--green); background: #f7fbf8; }
.email-pick.picked { border-color: var(--green); background: var(--green-tint); box-shadow: inset 0 0 0 1px var(--green); }
.email-pick .addr { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--ink); word-break: break-all; flex: 1; }
.email-pick .why { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.email-pick.ico-verified .why { color: var(--green-deep); }

/* ------------------------------------------------------------
   Auth screens
   ------------------------------------------------------------ */
.auth-split { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.auth-brand {
  flex: 1;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(255,255,255,0.10), transparent 60%),
    linear-gradient(165deg, var(--green) 0%, var(--green-deep) 70%, var(--green-dark) 100%);
  color: #eaf6ee;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
}
.auth-brand .logo img { width: 190px; }
.auth-brand h2 {
  color: #fff;
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 700;
  max-width: 480px;
}
.auth-brand h2 em { font-style: normal; color: #a9e8c1; }
.auth-brand .points { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-direction: column; gap: 13px; }
.auth-brand .points li { display: flex; gap: 11px; align-items: flex-start; font-size: 15.5px; color: #d8efe1; max-width: 460px; }
.auth-brand .points svg { width: 20px; height: 20px; color: #fff; flex: 0 0 auto; margin-top: 2px; }
.auth-brand .foot { font-size: 13px; color: #bfe4cd; }

.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .m-logo { display: none; margin-bottom: 28px; }
.auth-card .m-logo img { width: 170px; }
.auth-card h1 { font-size: 30px; }
.auth-card .lead { color: var(--muted); margin: 0 0 26px; }
.auth-swap { margin-top: 22px; font-size: 14.5px; color: var(--muted); }

/* ------------------------------------------------------------
   Print (letter download)
   ------------------------------------------------------------ */
@media print {
  body.sa-app::before, .sa-sidebar, .sa-topbar, .no-print, #sa-toasts { display: none !important; }
  body.sa-app { background: #fff; }
  .sa-content { padding: 0; max-width: none; }
  .letter-paper { border: 0; box-shadow: none; padding: 0; font-size: 12px; }
  .letter-paper::before { display: none; }
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 1080px) {
  .grid-31 { grid-template-columns: 1fr; }
  .right-rail { position: static; }
}

@media (max-width: 900px) {
  .sa-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    height: 100dvh;
    z-index: 10050;
    transform: translateX(-104%);
    transition: transform .25s cubic-bezier(.3,.8,.4,1);
    box-shadow: var(--shadow-lg);
    width: min(300px, 84vw);
  }
  body.nav-open .sa-sidebar { transform: none; }
  .sa-scrim {
    position: fixed; inset: 0;
    background: rgba(16,35,26,.45);
    z-index: 10040;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  body.nav-open .sa-scrim { opacity: 1; pointer-events: auto; }

  .sa-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--green);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 10000;
  }
  .sa-topbar img { height: 30px; width: auto; }
  .sa-topbar .burger {
    border: 1px solid rgba(255,255,255,.2);
    background: transparent;
    border-radius: 9px;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
  }
  .sa-topbar .burger span, .sa-topbar .burger span::before, .sa-topbar .burger span::after {
    display: block; content: ""; width: 17px; height: 2px; background: #fff; border-radius: 2px; position: relative;
  }
  .sa-topbar .burger span::before { position: absolute; top: -5px; }
  .sa-topbar .burger span::after { position: absolute; top: 5px; }

  .sa-content { padding: 22px 16px 70px; }
  .drp { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }

  .stepper { flex-direction: column; }
  .step { border-left: 0; border-top: 1px solid var(--line-soft); }
  .step:first-child { border-top: 0; }
  .step.current { box-shadow: inset 3px 0 0 var(--green); }
  .step .t b, .step .t span { white-space: normal; }

  .auth-split { flex-direction: column; }
  .auth-brand { display: none; }
  .auth-card .m-logo { display: block; }
  .auth-card .m-logo img { filter: none; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-tile .v { font-size: 27px; }

  .ledger-row { flex-wrap: wrap; row-gap: 8px; padding: 14px 16px; }

  .sa-modal-back { padding: 12px; align-items: flex-end; }
  .sa-modal { border-radius: 16px 16px 12px 12px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .medium-grid { grid-template-columns: 1fr; }
  .sa-page-head h1 { font-size: 24px; }
  .btn-lg { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .console li { opacity: 1; transform: none; }
}
