/* Email Actions: same look as the other Gins apps (Plus Jakarta Sans, brand #0B6B4E). Coral #E4572E only on the icon tile and avatar. */
:root {
  --bg: #F4F7F5; --card: #FFFFFF; --line: #E1E8E4; --line2: #EEF2F0; --fg: #0E1C17; --muted: #52625C;
  --brand: #0B6B4E; --brand-fg: #FFFFFF; --hero: #0B3D2E; --hero-2: #072B20; --hero-sub: #CFE6DC; --soft: #E3ECE7;
  --ok-fg: #166534; --ok-bg: #DCFCE7; --warn-fg: #92400E; --warn-bg: #FEF3C7; --bad-fg: #991B1B; --bad-bg: #FEE2E2; --none-fg: #475569; --none-bg: #EEF2F6;
  --input: #C9D4CF; --accent: #E4572E; --shadow: 0 1px 2px rgba(7, 43, 32, .06), 0 6px 18px rgba(7, 43, 32, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1310; --card: #121E19; --line: #23332C; --line2: #1A2822; --fg: #E6EFEA; --muted: #9DB2A9;
    --brand: #3CC58F; --brand-fg: #062117; --hero: #0F3B2D; --hero-2: #0A2A20; --hero-sub: #BFDCCF; --soft: #1C2B25;
    --ok-fg: #6EE7A0; --ok-bg: #11291C; --warn-fg: #FCD34D; --warn-bg: #2C220B; --bad-fg: #FCA5A5; --bad-bg: #2E1515; --none-fg: #B4C0CC; --none-bg: #1E2630;
    --input: #33463E; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1310; --card: #121E19; --line: #23332C; --line2: #1A2822; --fg: #E6EFEA; --muted: #9DB2A9;
  --brand: #3CC58F; --brand-fg: #062117; --hero: #0F3B2D; --hero-2: #0A2A20; --hero-sub: #BFDCCF; --soft: #1C2B25;
  --ok-fg: #6EE7A0; --ok-bg: #11291C; --warn-fg: #FCD34D; --warn-bg: #2C220B; --bad-fg: #FCA5A5; --bad-bg: #2E1515; --none-fg: #B4C0CC; --none-bg: #1E2630;
  --input: #33463E; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
h1, h2, h3, p { margin: 0; }
svg { flex: none; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-weight: 600; letter-spacing: .04em; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- shell: bottom tabs on a phone, icon rail on iPad, sidebar on desktop ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.main { width: 100%; max-width: 760px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; align-items: flex-end;
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 60px; min-height: 48px; padding: 4px 0; color: var(--muted);
  font-size: 11px; font-weight: 600; text-decoration: none; border-radius: 12px; }
.nav a svg { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.nav .addic { width: 54px; height: 54px; margin-top: -24px; border-radius: 18px; background: var(--brand); color: var(--brand-fg); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(11, 107, 78, .35); }
.nav .addic svg { width: 26px; height: 26px; }
.nav .addbtn { color: var(--fg); }
.nav .brand, .nav .wideonly { display: none; }
@media (min-width: 700px) {
  .main { padding: 24px 28px 40px calc(104px + 28px); max-width: 980px; }
  .nav { top: 0; right: auto; width: 96px; flex-direction: column; justify-content: flex-start; align-items: center; gap: 8px; border-top: 0; border-right: 1px solid var(--line); padding: 18px 0; overflow-y: auto; }
  .nav .phoneonly { display: none; }
  .nav .wideonly { display: flex; }
  .nav .brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 6px; }
  .nav .brand span:last-child { display: none; }
  .nav .addic { margin-top: 0; width: 48px; height: 48px; border-radius: 16px; }
  .nav a { min-width: 80px; }
}
@media (min-width: 1024px) {
  .main { padding-left: calc(248px + 32px); max-width: none; padding-right: 32px; }
  .main > * { max-width: 1180px; }
  .nav { width: 248px; align-items: stretch; padding: 20px 14px; gap: 4px; }
  .nav a { flex-direction: row; gap: 12px; min-height: 44px; padding: 0 12px; font-size: 14px; font-weight: 500; color: var(--fg); }
  .nav a[aria-current="page"] { background: var(--soft); color: var(--brand); font-weight: 700; }
  .nav .brand { flex-direction: row; gap: 12px; padding: 0 8px 12px; }
  .nav .brand span:last-child { display: flex; flex-direction: column; }
  .nav .brand small { color: var(--muted); font-size: 12px; }
  .nav .addbtn { order: -1; justify-content: center; background: var(--brand); color: var(--brand-fg) !important; font-weight: 700 !important; margin: 0 0 8px; }
  .nav .addbtn .addic { width: auto; height: auto; background: none; box-shadow: none; color: inherit; }
  .nav .addbtn .addic svg { width: 20px; height: 20px; }
  .nav .brand { order: -2; }
}
.tile { width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.tile svg { width: 24px; height: 24px; }

/* ---------- headers, banners ---------- */
.top { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.top h1 { flex: 1; font-size: 26px; font-weight: 800; letter-spacing: -.02em; display: flex; flex-direction: column; }
.top h1 .sub { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.iconbtn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--fg); display: grid; place-items: center; flex: none; text-decoration: none; }
.iconbtn.bare { border: 0; background: none; }
.iconbtn svg { width: 22px; height: 22px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--none-bg); color: var(--none-fg); font-size: 13px; }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); } .banner.bad { background: var(--bad-bg); color: var(--bad-fg); }
.banner svg { width: 18px; height: 18px; } .banner span { flex: 1; }
.linkbtn { background: none; border: 0; padding: 0; min-height: 32px; color: var(--brand); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }

/* ---------- cards, rows ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.card.list { padding: 2px 16px; }
.card.empty, .empty { color: var(--muted); text-align: center; padding: 22px 16px; }
.section { display: flex; flex-direction: column; gap: 8px; }
.section .head h2 { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.irow { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line2); text-decoration: none; color: inherit; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.card.list > .irow:first-child, .card.list > :first-child .irow { border-top: 0; }
.irow.sel { background: var(--soft); margin: 0 -16px; padding: 11px 16px; width: calc(100% + 32px); }
.irow .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.irow .t1 { font-size: 14px; font-weight: 600; } .irow .t2 { font-size: 12px; color: var(--muted); }
.irow .end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.irow .chev { width: 16px; height: 16px; color: var(--muted); }
.logo { width: 36px; height: 36px; border-radius: 12px; background: var(--line2); color: var(--muted); display: grid; place-items: center; flex: none; }
.logo svg { width: 19px; height: 19px; }
.logo.bad { background: var(--bad-bg); color: var(--bad-fg); } .logo.warn { background: var(--warn-bg); color: var(--warn-fg); } .logo.brand { background: var(--soft); color: var(--brand); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; flex: none; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); } .pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.bad { background: var(--bad-bg); color: var(--bad-fg); } .pill.none { background: var(--none-bg); color: var(--none-fg); }
.pend { font-style: normal; font-size: 11px; font-weight: 600; color: var(--warn-fg); background: var(--warn-bg); padding: 1px 6px; border-radius: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.vchip { padding: 0 14px; min-height: 38px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13px; }
.vchip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.seg { display: inline-flex; gap: 6px; }
.seg button { min-height: 38px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13px; }
.seg button[aria-pressed="true"] { border: 1.5px solid var(--brand); background: var(--soft); color: var(--brand); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--none-bg); color: var(--none-fg); font-size: 13px; }
.note.warn { background: var(--warn-bg); color: var(--warn-fg); }
.note svg { width: 18px; height: 18px; margin-top: 1px; }
.badge { font-size: 12px; font-weight: 600; color: var(--brand); background: var(--soft); padding: 4px 10px; border-radius: 99px; text-decoration: none; white-space: nowrap; }


/* ---------- forms and buttons ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; min-width: 0; }
.field input, .field textarea, .field select { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--input); background: var(--card); font-size: 16px; font-weight: 600; }
.field input:disabled { opacity: .5; }
.field small { font-weight: 400; color: var(--muted); font-size: 12px; min-height: 16px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.toggle span { display: flex; flex-direction: column; font-size: 14px; } .toggle small { color: var(--muted); font-size: 12px; }
.toggle input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--input); position: relative; flex: none; margin: 0; cursor: pointer; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked { background: var(--brand); } .toggle input:checked::after { transform: translateX(20px); }
.paid { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.paid legend { font-size: 13px; font-weight: 600; padding: 0; margin-bottom: 6px; }
.rchip input { position: absolute; opacity: 0; pointer-events: none; }
.rchip span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13px; cursor: pointer; }
.rchip input:checked + span { border: 1.5px solid var(--brand); background: var(--soft); color: var(--brand); }
.rchip input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.err { color: var(--bad-fg); font-size: 13px; min-height: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0; font-weight: 700; font-size: 15px; text-decoration: none; }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--brand); color: var(--brand-fg); } .btn.primary:disabled { opacity: .5; }
.btn.line { background: transparent; border: 1.5px solid var(--brand); color: var(--brand); }
.btn.block { width: 100%; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.kv .lab { font-size: 13px; color: var(--muted); flex: none; max-width: 45%; }
.kv .val { font-size: 14px; font-weight: 600; text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere; }
.wrap { white-space: normal; }

.spin { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
@media (max-width: 380px) { .stats3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .top h1 { font-size: 23px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Email Actions ---------- */
.nav .cnt { position: absolute; transform: translate(14px, -4px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav a { position: relative; }
@media (min-width: 1024px) { .nav .cnt { position: static; transform: none; margin-left: auto; } }
.apphead { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.apphead .tile { width: 40px; height: 40px; border-radius: 12px; }
.apphead .tile svg { width: 22px; height: 22px; }
.apphead h1 { flex: 1; min-width: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; display: flex; flex-direction: column; }
.apphead h1 .sub { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
@media (min-width: 700px) { .apphead .tile { display: none; } }
.fchips { display: flex; gap: 8px; flex-wrap: wrap; }
.fchip { min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.fchip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.ghead { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 4px 2px 0; display: flex; gap: 6px; align-items: center; }
.items { display: flex; flex-direction: column; gap: 10px; }
.icard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.icard.sel { border: 1.5px solid var(--brand); }
.icard.closed, .icard.queued { box-shadow: none; background: transparent; }
.icard .open { display: flex; gap: 10px; align-items: flex-start; text-decoration: none; color: inherit; background: none; border: 0; padding: 0; text-align: left; width: 100%; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--none-fg); }
.dot.p0 { background: #DC2626; } .dot.p1 { background: #EA8A1A; } .dot.p2 { background: #D4A106; } .dot.p4 { background: #94A3B8; } .dot.ok { background: var(--ok-fg); opacity: .7; }
.icard .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.icard .t1 { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.icard .t1 .id { color: var(--muted); font-weight: 600; }
.icard .t2 { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.icard.closed .t1, .icard.queued .t1 { color: var(--muted); font-weight: 600; }
.due { font-size: 12px; font-weight: 700; color: var(--muted); } .due.bad { color: var(--bad-fg); } .due.warn { color: var(--warn-fg); }
.qrow { display: flex; gap: 8px; flex-wrap: wrap; padding-left: 20px; }
.qbtn { min-height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--line2); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.state { font-size: 12px; color: var(--muted); padding-left: 20px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.state b { color: var(--ok-fg); }
.sendbar { position: fixed; z-index: 15; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 52px; padding: 0 16px; border-radius: 16px; border: 0; background: var(--brand); color: var(--brand-fg); font-weight: 700; font-size: 15px; box-shadow: 0 8px 22px rgba(11, 107, 78, .35); }
.sendbar[disabled] { opacity: .7; }
@media (min-width: 700px) { .sendbar { left: auto; right: 24px; bottom: 24px; width: 340px; } }
.dhead { display: flex; flex-direction: column; gap: 4px; }
.dhead .idl { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.dhead .meta { font-size: 13px; color: var(--muted); }
.dtitle { font-size: 19px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.from { font-size: 13px; color: var(--muted); } .from b { color: var(--fg); }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.box h3 { font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.box p { overflow-wrap: anywhere; white-space: pre-line; }
.glink { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; } .glink a { font-weight: 700; text-decoration: none; }
.agrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.abtn { min-height: 50px; border-radius: 14px; border: 0; background: var(--line2); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--fg); }
.abtn.primary { background: var(--brand); color: var(--brand-fg); }
.abtn[aria-pressed="true"] { outline: 2.5px solid var(--brand); outline-offset: -2.5px; }
.lbl { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
textarea.notein { width: 100%; min-height: 96px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--input); background: var(--card); font-size: 16px; resize: vertical; }
.inbox { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-fg); font-size: 13px; font-weight: 600; }
.opts { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 12px; }
.opt { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--line2); font-weight: 700; font-size: 15px; text-align: left; color: var(--fg); }
.opt span:last-child { font-weight: 600; color: var(--muted); }
.opt[aria-pressed="true"] { border: 1.5px solid var(--brand); background: var(--soft); }
.opt input[type=date] { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--fg); min-height: 40px; max-width: 60%; }
.ack { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 20px 0 8px; }
.ack .big { font-size: 56px; line-height: 1; }
.ack h1 { font-size: 22px; font-weight: 800; }
.ack p { font-size: 13px; color: var(--muted); }
.arow { display: flex; flex-direction: column; gap: 2px; padding: 11px 0; border-top: 1px solid var(--line2); font-size: 14px; }
.card.list > .arow:first-child { border-top: 0; }
.arow b { font-weight: 800; } .arow small { font-size: 12px; color: var(--muted); }
.arow.bad { color: var(--bad-fg); }
.rrow { display: flex; gap: 10px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line2); }
.card.list > .rrow:first-child { border-top: 0; }
.rrow .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rrow .t1 { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; } .rrow .t2 { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.rrow .t3 { font-size: 13px; overflow-wrap: anywhere; }
.rrow .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.split { display: block; }
@media (min-width: 1024px) {
  .split { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 24px; align-items: start; }
  .split > .pane { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 90px; }
  .split .listcol { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding-bottom: 90px; }
}
.split > .pane:empty { display: none; }
