@font-face {
  font-family: "IBM Plex Sans";
  src: url(fonts/plex-sans.woff2) format("woff2");
  font-weight: 100 700;
  font-display: swap;
}

:root {
  /* Inarsys palette */
  --ink: #00314F;        /* rail, deep brand */
  --brand: #004A77;      /* primary actions (sector can override) */
  --signal: #3DBDFF;     /* active, focus */
  --canvas: #F3F6F9;
  --surface: #FFFFFF;
  --line: #DCE3EA;
  --line-soft: #EBF0F4;
  --text: #0E2233;
  --muted: #5B6B7A;
  --faint: #8796A5;
  --danger: #C2362F;
  --ok: #1F9D55;

  --r: 6px;
  font: 400 14px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 0;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 13px; }
h3 { font-size: 13px; }

.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i.big { width: 32px; height: 32px; stroke-width: 1.25; color: var(--faint); }

/* ---------- controls ---------- */
input, select, textarea { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color .12s, border-color .12s;
}
.btn:hover { text-decoration: none; border-color: #C3CED8; background: #FAFBFC; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 82%, black); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.small { height: 28px; padding: 0 9px; font-size: 13px; color: var(--muted); }
.btn.small .i { width: 14px; height: 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--r);
  background: none; color: var(--muted); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--line-soft); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.danger:hover { color: var(--danger); background: #FBEDEC; }
kbd { font: 500 11px/1 "IBM Plex Sans", sans-serif; padding: 3px 6px; border-radius: 4px; border: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.55); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 4px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 13%, white); color: color-mix(in srgb, var(--c) 70%, #0E2233);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

.av {
  --h: 200; display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 7px;
  background: hsl(var(--h) 42% 92%); color: hsl(var(--h) 38% 30%); font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.av.round { border-radius: 50%; }
.av.sm { width: 24px; height: 24px; font-size: 10px; border-radius: 5px; }
.av.xs { width: 20px; height: 20px; font-size: 9px; border-radius: 4px; }
.av.lg { width: 48px; height: 48px; font-size: 17px; border-radius: 10px; }
.av.round.sm, .av.round.xs, .av.round.lg { border-radius: 50%; }

/* ---------- login ---------- */
#login-wrap:has(#login:not([hidden])) {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 80% -10%, #0A4D78 0%, transparent 60%), var(--ink);
}
#login {
  width: min(360px, 100%); padding: 32px 28px 24px; background: var(--surface); border-radius: 12px;
  display: grid; gap: 14px; box-shadow: 0 30px 80px rgba(0, 20, 40, .45);
}
.login-mark { width: 40px; height: 40px; background: var(--ink); border-radius: 10px; padding: 6px; }
#login h1 { font-size: 24px; margin-top: 4px; }
.tagline { margin: -10px 0 6px; color: var(--muted); }
#login label span { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
#login input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r); }
#login input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 30%, transparent); }
#login .btn { height: 38px; justify-content: center; margin-top: 4px; }
.error { color: var(--danger); margin: 0; min-height: 1.5em; font-size: 13px; }

/* ---------- shell ---------- */
#app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
#nav {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 16px 12px; background: var(--ink); color: #D5E3EE;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; color: #fff; font-size: 16px; font-weight: 600; }
.brand:hover { text-decoration: none; }
.mark svg { width: 28px; height: 28px; display: block; }
.gsearch { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 10px; border-radius: var(--r);
  background: rgba(255,255,255,.07); color: rgba(255,255,255,.55); }
.gsearch:focus-within { background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(61,189,255,.6); }
.gsearch input { flex: 1; min-width: 0; border: 0; background: none; color: #fff; outline: none; }
.gsearch input::placeholder { color: rgba(255,255,255,.5); }
#nav ul { list-style: none; margin: 0; padding: 0; flex: 1; display: grid; align-content: start; gap: 2px; }
#nav li a {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r);
  color: #C7D7E4; font-weight: 500; position: relative;
}
#nav li a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
#nav li a.on { background: rgba(61,189,255,.14); color: #fff; }
#nav li a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--signal); }
#nav li a.on .i { color: var(--signal); }
#nav .n { margin-left: auto; font-size: 12px; color: rgba(255,255,255,.45); font-variant-numeric: tabular-nums; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid rgba(255,255,255,.08); }
.me .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.me .av { background: rgba(61,189,255,.2); color: #BFE7FF; }
.me .icon-btn { color: rgba(255,255,255,.55); }
.me .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

main { padding: 24px 32px 48px; min-width: 0; max-width: 1480px; }

.bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.bar h1 { flex: 1; display: flex; align-items: baseline; gap: 10px; }
.total { font-size: 14px; font-weight: 400; color: var(--faint); font-variant-numeric: tabular-nums; }
.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; width: min(300px, 100%);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--faint); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 25%, transparent); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; }
.seg { display: inline-flex; padding: 2px; border-radius: var(--r); background: #E6ECF1; }
.seg a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 4px; color: var(--muted); font-weight: 500; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(14,34,51,.12); }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 14px; }
.fchip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-radius: 5px;
  background: color-mix(in srgb, var(--signal) 14%, white); color: var(--ink); font-size: 13px; font-weight: 500; }
.fchip button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; }
.fchip button:hover { background: color-mix(in srgb, var(--signal) 25%, white); color: var(--text); }
.fchip .i, .fadd .icon-btn .i { width: 12px; height: 12px; }
.fadd { display: inline-flex; align-items: center; gap: 6px; padding: 3px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }
.fadd select, .fadd input { height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.fadd input { width: 220px; }
.fadd select:focus, .fadd input:focus { outline: none; border-color: var(--brand); }
.fval { display: contents; }
.switch-slot { display: contents; }

/* ---------- table ---------- */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.scroll { overflow: auto; max-height: calc(100vh - 160px); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0 14px; height: 42px; border-bottom: 1px solid var(--line-soft); white-space: nowrap;
  max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
thead th { position: sticky; top: 0; z-index: 1; height: 36px; background: #F8FAFB; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 500; color: var(--muted); }
th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; }
th button:hover { color: var(--text); }
th button:focus-visible { outline: 2px solid var(--signal); }
.dir { color: var(--brand); }
th.num, td.num { text-align: right; }
th.num button { flex-direction: row-reverse; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: #F6F9FB; }
tbody tr:last-child td { border-bottom: 0; }
td.lead a { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }
td.lead a:hover span { text-decoration: underline; text-underline-offset: 2px; }
td.when, th.when { color: var(--faint); font-size: 13px; text-align: right; }
td .ref { color: var(--text); }
td .ref:hover { color: var(--brand); }
.refs { display: inline-flex; gap: 8px; }
.who-chip { display: inline-flex; align-items: center; gap: 6px; }
.ext { color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 6px 10px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.pager span { margin-right: 8px; }

.empty-state { display: grid; justify-items: center; gap: 12px; padding: 64px 24px; text-align: center; color: var(--muted); }
.empty-state p { margin: 0; max-width: 46ch; }

/* ---------- board ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; align-items: flex-start; padding-bottom: 16px; }
.col { flex: 0 0 272px; display: grid; gap: 10px; padding: 10px; border-radius: 8px; background: #E9EEF3; outline: 2px dashed transparent; outline-offset: -2px; }
.col.over { outline-color: var(--signal); background: #E3F2FB; }
.col > header { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.col .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.col h2 { font-size: 13px; }
.col .n { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.col .sum { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cards { display: grid; gap: 8px; min-height: 48px; }
.card {
  display: grid; gap: 4px; padding: 10px 12px; background: var(--surface); border-radius: 6px; color: var(--text);
  border: 1px solid var(--line); border-left: 3px solid var(--c, var(--line)); cursor: grab;
}
.col .card { border-left-color: var(--c); }
.card:hover { text-decoration: none; border-color: #C3CED8; border-left-color: var(--c); }
.card.lift { opacity: .5; }
.card-title { font-weight: 500; line-height: 1.35; }
.card-meta { font-size: 12px; color: var(--muted); display: flex; }
.card-meta .badge { height: 20px; }
.card-amount { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.more { font-size: 12px; color: var(--muted); padding: 0 4px; }

/* ---------- record ---------- */
.crumbs { margin-bottom: 14px; }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.rec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.rec-title { flex: 1; min-width: 0; }
.rec-title h1 { overflow-wrap: anywhere; }
.sub { margin: 2px 0 0; display: flex; gap: 12px; color: var(--muted); font-size: 13px; }
.saved { color: var(--faint); }

.path { list-style: none; display: flex; margin: 0 0 20px; padding: 0; overflow-x: auto; }
.path li { flex: 1 1 0; min-width: 110px; }
.path button {
  width: 100%; height: 36px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer;
  font: 500 13px/1 "IBM Plex Sans", sans-serif; color: var(--muted); background: #E6ECF1;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
  margin-right: -8px; transition: background-color .15s, color .15s;
}
.path li:first-child button { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 6px 0 0 6px; }
.path li:last-child button { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 6px 6px 0; margin-right: 0; }
.path button:hover { background: #D9E2EA; color: var(--text); }
.path .done button { background: color-mix(in srgb, var(--c) 18%, white); color: color-mix(in srgb, var(--c) 65%, #0E2233); }
.path .now button { background: var(--c); color: #fff; font-weight: 600; cursor: default; }
.path .i { width: 14px; height: 14px; }
.path li.lost { flex: 0 1 auto; min-width: 120px; margin-left: 14px; }
.path li.lost button { clip-path: none; border-radius: 6px; margin: 0; }
.path li.lost:not(.now) button { background: none; box-shadow: inset 0 0 0 1px var(--line); }
.path li.lost:not(.now) button:hover { color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 40%, white); }
.path li:nth-last-child(2):has(+ .lost) button { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 6px 6px 0; margin-right: 0; }

.rec-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.rec-body.single { grid-template-columns: minmax(0, 760px); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; padding: 10px 20px 16px; }
.field { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 44px;
  border-bottom: 1px solid var(--line-soft); }
.field.wide { grid-column: 1 / -1; grid-template-columns: 1fr; align-items: start; padding: 12px 0; gap: 6px; }
.lbl { font-size: 13px; color: var(--muted); }
.req { color: var(--danger); }
.ctl { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ctl > input, .ctl > select, .ctl > textarea, .picker > input {
  width: 100%; min-width: 0; height: 32px; padding: 0 8px; margin-left: -8px;
  border: 1px solid transparent; border-radius: var(--r); background: transparent; outline: none;
}
.ctl > input.num { text-align: left; font-variant-numeric: tabular-nums; }
.ctl > input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.ctl > textarea { height: auto; min-height: 96px; padding: 8px; resize: vertical; line-height: 1.55; margin-left: 0; border-color: var(--line-soft); }
.ctl > input:hover, .ctl > select:hover, .picker > input:hover { background: #F6F9FB; }
.ctl > input:focus, .ctl > select:focus, .ctl > textarea:focus, .picker > input:focus {
  background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 22%, transparent);
}
.ctl > input::placeholder, .picker > input::placeholder, textarea::placeholder { color: #B6C2CE; }
.ctl > select { appearance: none; cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238796A5' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 6px center / 14px; }
.actions { grid-column: 1 / -1; display: flex; gap: 8px; padding-top: 16px; }

.picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
.picker > input { flex: 1 1 120px; margin-left: 0; }
.chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 2px 0 4px; border-radius: 5px;
  background: var(--line-soft); }
.chip a { color: var(--text); font-weight: 500; }
.chip button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 4px; background: none; color: var(--faint); cursor: pointer; }
.chip button:hover { background: #DCE3EA; color: var(--text); }
.chip button .i { width: 12px; height: 12px; }

.activity { display: grid; gap: 18px; position: sticky; top: 24px; }
.adds { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.adds .lbl { margin-right: 4px; }
.activity h3, .results h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--text); }
.activity h3 .i, .results h3 .i { color: var(--faint); }
.activity h3 .n, .results h3 .n { color: var(--faint); font-weight: 400; }
.items { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.items li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.items li:last-child { border-bottom: 0; }
.items li > a { flex: 1; min-width: 0; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.items li > a:hover { color: var(--brand); }
.items .note { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.items .note p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.items .when { color: var(--faint); font-size: 12px; grid-row: 1; grid-column: 2; }
.items .task input { width: 16px; height: 16px; margin: 0; accent-color: var(--ok); cursor: pointer; }
.items .task.done > a { color: var(--faint); text-decoration: line-through; }
.due { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.due.late { color: var(--danger); font-weight: 500; }
.quiet { margin: 0; color: var(--muted); font-size: 13px; }
.results { padding: 16px; margin-bottom: 14px; border: 0; background: none; padding: 0; }

/* ---------- users & account ---------- */
#nav ul.admin { flex: none; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.me .who { display: grid; color: #D5E3EE; line-height: 1.25; }
.me .who:hover { text-decoration: none; color: #fff; }
.me .who small { font-size: 11px; color: rgba(255,255,255,.5); }
.add-panel { padding: 14px 16px; margin-bottom: 14px; }
.add-user { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.add-user input, .add-user select, .users select, .users td.lead input {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.add-user input[type=email] { flex: 1 1 240px; }
.add-user input:not([type]) { flex: 1 1 200px; }
.users td.lead input { border-color: transparent; background: none; width: 220px; }
.users td.lead input:hover { background: #F6F9FB; }
.users td.lead input:focus, .add-user :is(input, select):focus, .users select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 22%, transparent); }
.users tbody tr { cursor: default; }
.users tr.inactive td { color: var(--faint); }
.users td.acts { text-align: right; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.btn.small.danger { color: var(--danger); }
.reveal { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 14px; border-radius: 8px;
  background: color-mix(in srgb, var(--signal) 12%, white); border: 1px solid color-mix(in srgb, var(--signal) 40%, white); }
.reveal p { margin: 0; flex-basis: 100%; }
.reveal code { font: 600 16px/1 ui-monospace, Consolas, monospace; padding: 6px 10px; background: var(--surface); border-radius: 5px; letter-spacing: .04em; }
.roles-help { margin-top: 20px; max-width: 820px; }
.roles-help li { display: grid; grid-template-columns: 140px 1fr; }
.account { padding: 18px 20px; max-width: 560px; }
.account h3 { margin-top: 0; }
.account p + h3 { margin-top: 18px; }
.pw { display: grid; gap: 12px; max-width: 360px; }
.pw label span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.pw input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r); }
.pw .btn { justify-self: start; }
.readonly-note { display: flex; align-items: center; gap: 8px; margin: -6px 0 16px; padding: 8px 12px; border-radius: 6px;
  background: #EEF2F6; color: var(--muted); font-size: 13px; }
.ctl > :disabled, .ctl :disabled { cursor: default; }
.path button:disabled { cursor: default; }

.tokens { margin-top: 14px; }
.tokens .items { margin: 10px 0; }
.tokens .tname { flex: 1; font-weight: 500; }
.tokens .add-user input { flex: 1 1 260px; }
.reveal code.cmd { font-size: 12px; letter-spacing: 0; white-space: pre-wrap; word-break: break-all; flex-basis: 100%; }

/* ---------- mail ---------- */
.mailbox { margin-top: 14px; }
.mailbox .vis { display: grid; gap: 4px; max-width: 420px; margin: 10px 0; }
.mailbox .vis span { font-size: 13px; color: var(--muted); }
.mailbox .vis select { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.mail-error { padding: 8px 12px; border-radius: 6px; background: #FBEDEC; color: var(--danger); font-size: 13px; }
.mail .mitem { align-items: flex-start; }
.mail .mitem > div { flex: 1; min-width: 0; }
.mail .mitem p { margin: 0; }
.mail .kind { color: var(--faint); padding-top: 2px; }
.mail .msubj { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail .mpart { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail .mprev { font-size: 13px; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mail .mmeta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--faint); margin-top: 2px; }

/* ---------- attachments ---------- */
.files .file > div { flex: 1; min-width: 0; display: grid; }
.files .file > a.icon-btn { flex: none; }
.files .file > div a { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .fmeta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); }
.files .thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); flex: none; }
.files .ficon { width: 36px; height: 36px; display: grid; place-items: center; flex: none; border-radius: 5px;
  background: var(--line-soft); color: var(--muted); font-size: 10px; font-weight: 600; }
.drop { display: grid; justify-items: center; gap: 2px; margin-top: 8px; padding: 14px; border: 1.5px dashed #C3CED8; border-radius: 8px;
  color: var(--muted); font-size: 13px; text-align: center; cursor: pointer; background: var(--surface); }
.drop:hover, .drop.over { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--signal) 8%, white); }
.drop .quiet { font-size: 12px; }

/* ---------- history ---------- */
.hist .entry { align-items: flex-start; }
.hist .entry > div { flex: 1; min-width: 0; }
.hist .entry p { margin: 0; font-size: 13px; }
.hist .entry .when { margin-left: 4px; color: var(--faint); font-size: 12px; }
.diff { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.diff li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.diff .hf { color: var(--muted); min-width: 80px; }
.diff .arrow { color: var(--faint); }
.empty-val { color: var(--faint); font-style: italic; }
.history .btn.small { margin-top: 8px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 8px); display: flex; align-items: center; gap: 8px;
  max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff;
  box-shadow: 0 12px 32px rgba(0, 30, 50, .28); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 10;
}
#toast .i { color: var(--signal); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--danger); }
#toast.bad .i { color: #fff; }

@media (max-width: 1100px) {
  .rec-body { grid-template-columns: 1fr; }
  .activity { position: static; }
  .fields { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; }
  #nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
  #nav ul { order: 3; flex-basis: 100%; display: flex; overflow-x: auto; }
  #nav li a.on::before { display: none; }
  .gsearch { flex: 1; }
  .me { border: 0; padding: 0; }
  .me .who { display: none; }
  main { padding: 16px; }
  .field { grid-template-columns: 1fr; gap: 0; padding: 6px 0; }
  .ctl > input, .ctl > select { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
