/* Farahmi: one stylesheet for the whole app. Tokens follow the screen mockups. */
:root {
  --violet: #5b36b0;
  --violet-dark: #4a2c95;
  --violet-deep: #3f2384;
  --tint: #ece7f7;
  --tint-2: #f4f1fb;
  --ink: #1f2430;
  --ink-2: #3e4553;
  --muted: #586070;
  --paper: #f2f4f0;
  --card: #ffffff;
  --line: #d6dbd3;
  --line-2: #e3e7e1;
  --input: #8a9188;
  --manila: #eed9a4;
  --manila-ink: #4d3b0a;
  --pending-bg: #f6e7b8;
  --pending-ink: #6b4e00;
  --green: #1c6b4f;
  --green-bg: #e3f1e9;
  --green-ink: #17573f;
  --red: #b3261e;
  --red-bg: #f8e3e1;
  --red-ink: #8e1f18;
  --per-bg: #fbe3cf;
  --per-ink: #7a3e0c;
  --non-bg: #e2e8f0;
  --non-ink: #2f3b4c;
  --ledger: #e2a6a0;
  --nav: #1f2430;
  --radius: 12px;
  --font: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; }
a { color: var(--violet); }
a:hover { color: var(--violet-deep); }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.tiny { font-size: 12.5px; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }

/* ---------- monogram ---------- */
.mark {
  width: 32px; height: 32px; flex: none; border-radius: 8px;
  background: var(--violet); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--cond); font-weight: 700; font-size: 20px;
  box-shadow: inset 0 0 0 2.5px var(--violet), inset 0 0 0 3.5px #fff;
  transform: rotate(-4deg);
}
.mark.big { width: 44px; height: 44px; font-size: 26px; border-radius: 11px; box-shadow: inset 0 0 0 3px var(--violet), inset 0 0 0 4.5px #fff; }
.mark.light { background: #fff; color: var(--violet); box-shadow: inset 0 0 0 2.5px #fff, inset 0 0 0 3.5px var(--violet); }

/* ---------- buttons ---------- */
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  background: var(--violet); color: #fff; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; white-space: nowrap; touch-action: manipulation;
}
.btn:hover { background: var(--violet-dark); color: #fff; }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--input); }
.btn.secondary:hover { background: var(--tint-2); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--violet); }
.btn.ghost:hover { background: var(--tint); }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-bg); }
.btn.green { background: var(--green); }
.btn.green:hover { background: #15553e; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.big { min-height: 52px; font-size: 16px; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; position: relative;
}
.icon-btn:hover { background: rgba(91, 54, 176, 0.1); }
.icon { width: 20px; height: 20px; flex: none; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--violet); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.icon-btn .badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; font-size: 11px; background: var(--red); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 700; font-size: 14px; }
.hint { font-size: 13.5px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--input); border-radius: 10px; background: #fff; font-size: 16px;
}
textarea.input { min-height: 88px; resize: vertical; line-height: 1.4; }
.input:disabled { background: #f7f8f6; color: var(--muted); }
.input.search { padding-left: 40px; background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="%23586070" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5"/><path d="M20 20l-4.2-4.2"/></svg>') no-repeat 12px center; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--violet); }
.check span { display: flex; flex-direction: column; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.error-text { color: var(--red); font-size: 14px; }
.switch { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; }
.switch label { cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: #c5cbc2; margin: 0; position: relative; cursor: pointer; flex: none; transition: background 0.15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--violet); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:disabled { opacity: 0.6; cursor: not-allowed; }

/* segmented tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--input); border-radius: 10px;
  background: #fff; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none;
}
.tab[aria-selected='true'], .tab[aria-current='page'], .tab.on { background: var(--violet); border-color: var(--violet); color: #fff; font-weight: 700; }
.tab .badge { background: var(--tint); color: var(--violet-dark); }
.tab[aria-selected='true'] .badge, .tab[aria-current='page'] .badge { background: #fff; color: var(--violet-dark); }

/* ---------- cards, lists, chips ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.tinted { background: var(--tint-2); border-color: #d9cff0; }
.card.warn { background: #fff8e6; border-color: #e7cf8c; }
.card h2 + p { margin-top: 4px; }
.list { display: flex; flex-direction: column; }
.list > .item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-2);
  color: inherit; text-decoration: none; min-height: 56px;
}
.list > .item:first-child { border-top: 0; }
a.item:hover, button.item:hover { background: var(--tint-2); }
button.item { width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer; }
.item .title { font-weight: 700; }
.item a.title { color: var(--ink); text-decoration: none; }
.item a.title:hover { color: var(--violet); text-decoration: underline; }
.thumb {
  width: 48px; height: 48px; flex: none; border-radius: 10px; background: var(--line-2);
  object-fit: cover; display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
}
.thumb.big { width: 72px; height: 72px; }
.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  background: var(--tint); color: var(--violet-dark); font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--line-2); color: var(--ink-2);
}
.chip.perishable { background: var(--per-bg); color: var(--per-ink); }
.chip.non_perishable { background: var(--non-bg); color: var(--non-ink); }
.chip.asset { background: var(--tint); color: var(--violet-dark); }
.chip.pending { background: var(--pending-bg); color: var(--pending-ink); }
.chip.ok { background: var(--green-bg); color: var(--green-ink); }
.chip.bad { background: var(--red-bg); color: var(--red-ink); }
.chip.violet { background: var(--tint); color: var(--violet-dark); }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 4px 10px; border-radius: 999px; background: var(--line-2); font-size: 13.5px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--tint-2); border: 1px solid #d9cff0; font-size: 14px; }
.notice.warn { background: #fff8e6; border-color: #e7cf8c; color: var(--pending-ink); }
.notice.bad { background: var(--red-bg); border-color: #efc4bf; color: var(--red-ink); }
.notice.ok { background: var(--green-bg); border-color: #bfe0cd; color: var(--green-ink); }
.dashed { border: 1.5px dashed var(--input); border-radius: 10px; padding: 10px 14px; }

/* ---------- stamps ---------- */
.stamp {
  display: inline-flex; flex-direction: column; align-items: center; padding: 5px 9px 4px;
  border: 2px solid var(--violet); border-radius: 6px;
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px var(--violet);
  color: var(--violet); font-family: var(--cond); text-transform: uppercase; letter-spacing: 0.05em;
  line-height: 1.1; background: #fff; transform: rotate(-3deg);
}
.stamp b { font-size: 14px; font-weight: 700; }
.stamp span { font-size: 11px; }
.stamp.green { border-color: var(--green); color: var(--green); box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px var(--green); }
.stamp.red { border-color: var(--red); color: var(--red); box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px var(--red); }
.stamp.amber { border-color: #9a7200; color: #7a5a00; box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px #9a7200; }
.stamp.mini { padding: 2px 6px 1px; }
.stamp.mini b { font-size: 11px; }
.stamp.mini span { display: none; }
.stamps { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stamps .stamp:nth-child(2n) { transform: rotate(3deg); }
.stamps .stamp:nth-child(3n) { transform: rotate(-1.5deg); }

/* ---------- requisition file cards ---------- */
.file { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.file .tab-label {
  align-self: flex-start; padding: 3px 12px 1px; border-radius: 8px 8px 0 0; background: var(--manila); color: var(--manila-ink);
  font-family: var(--cond); font-weight: 600; font-size: 15px; letter-spacing: 0.03em;
}
.file .body {
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: 0 14px 14px 14px;
}
a.file:hover .body { border-color: #b9addf; box-shadow: 0 6px 18px rgba(31, 36, 48, 0.06); }

/* timeline of stamps */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.timeline li::before { content: ''; position: absolute; left: 13px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot {
  width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--violet); color: #fff;
  display: flex; align-items: center; justify-content: center; position: relative; z-index: 1;
}
.timeline .dot.todo { background: #fff; border: 2px solid var(--line); color: var(--muted); }
.timeline .dot.now { background: var(--pending-bg); color: var(--pending-ink); border: 2px solid #d7b44a; }
.timeline .dot.bad { background: var(--red); }
.timeline .dot.green { background: var(--green); }
.timeline .dot svg { width: 14px; height: 14px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 14px; font-size: 13px; font-weight: 700; color: var(--muted); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); background: #fff; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.on td { background: var(--tint-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .best { background: var(--green-bg); color: var(--green-ink); font-weight: 700; }
.ledger { border-left: 3px double var(--ledger); }

/* count stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--input); border-radius: 12px; background: #fff; overflow: hidden; }
.stepper button { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--violet); }
.stepper button:hover { background: var(--tint); }
.stepper input { width: 64px; height: 44px; border: 0; border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2); text-align: center; font-size: 16px; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- material tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 46%), 1fr)); gap: 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.tile:hover { border-color: #b9addf; }
.tile .pic { aspect-ratio: 4 / 3; background: var(--line-2); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.tile .pic img { width: 100%; height: 100%; object-fit: cover; }
.tile .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tile .name { font-weight: 700; line-height: 1.25; }
.tile .added { background: var(--tint); }

/* ---------- app shell ---------- */
.app { min-height: 100vh; display: flex; }
.sidebar {
  width: 248px; flex: none; background: var(--nav); color: #fff; display: flex; flex-direction: column; gap: 14px;
  padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.sidebar .brand .org { font-size: 12.5px; color: #c7cbd6; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar .section { font-size: 12px; color: #9aa1b0; padding: 10px 10px 4px; }
.sidebar a.nav {
  min-height: 40px; padding: 0 10px; display: flex; align-items: center; gap: 12px; border-radius: 8px;
  color: #e6e8ee; text-decoration: none;
}
.sidebar a.nav:hover { background: #2c3242; color: #fff; }
.sidebar a.nav[aria-current='page'] { background: #3a3165; color: #fff; font-weight: 700; }
.sidebar a.nav .badge { margin-left: auto; background: #fff; color: var(--ink); }
.sidebar .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid #3e4553; }
.sidebar .me .avatar { background: var(--tint); color: #3e2a7e; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 60px; padding: 8px 16px 8px 8px;
  display: flex; align-items: center; gap: 6px; background: #fff; border-bottom: 1px solid var(--line);
}
.topbar .top-title { font-size: 19px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 8px; }
#view:focus { outline: none; }
.topbar .actions { display: flex; align-items: center; gap: 4px; }
.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 120px; display: flex; flex-direction: column; gap: 16px; }
.content.narrow { max-width: 720px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.tabbar a {
  flex: 1; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; position: relative;
}
.tabbar a[aria-current='page'] { color: var(--violet); font-weight: 700; }
.tabbar a .badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; background: var(--red); }
.tabbar .icon { width: 22px; height: 22px; }

/* sticky bottom bar for the main actions of a page (sits above the phone tab bar) */
.actionbar {
  position: sticky; bottom: calc(58px + var(--safe-bottom)); z-index: 15; margin: 4px -16px 0; padding: 12px 16px;
  background: #fff; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
}
.actionbar .btn { flex: 1 1 auto; }
@media (min-width: 600px) { .actionbar .btn { flex: 0 0 auto; } }
.draftbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(70px + var(--safe-bottom)); z-index: 25;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 10px 10px 16px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px rgba(31, 36, 48, 0.25);
}
.draftbar .btn { background: #fff; color: var(--ink); }

@media (max-width: 959px) {
  .sidebar { display: none; }
  .content { padding-bottom: 140px; }
  /* The top bar already shows the title on phones; keep the heading for screen readers. */
  .page-head h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (min-width: 960px) {
  .tabbar { display: none; }
  .draftbar { left: auto; right: 24px; bottom: 24px; width: 420px; }
  .actionbar { bottom: 12px; margin: 4px 0 0; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(31, 36, 48, 0.08); }
}

/* ---------- sheets, dialogs, toasts ---------- */
dialog.sheet {
  border: 0; padding: 0; border-radius: 16px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  box-shadow: 0 20px 60px rgba(31, 36, 48, 0.3); color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(31, 36, 48, 0.45); }
dialog.sheet .sheet-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: calc(100vh - 140px); }
dialog.sheet .sheet-foot { padding: 12px 20px 16px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line-2); }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 16px 16px 0 0; }
  dialog.sheet .sheet-foot { padding-bottom: calc(16px + var(--safe-bottom)); }
}
.toasts { position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(480px, calc(100vw - 24px)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); pointer-events: auto; }
.toast.bad { background: var(--red-ink); }
@media (min-width: 960px) { .toasts { bottom: 24px; } }

/* ---------- sign-in and sign-up pages ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 48px 20px; }
.auth .box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 22px; }
.auth .brand { display: flex; align-items: center; gap: 12px; }
.code-input { letter-spacing: 0.4em; font-size: 24px; text-align: center; font-weight: 700; }
.public-head {
  min-height: 64px; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.type-tile {
  min-height: 116px; padding: 14px; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--input);
  border-radius: 12px; background: #fff; cursor: pointer; text-align: left;
}
.type-tile:has(input:checked) { border: 2px solid var(--violet); padding: 13px; background: var(--tint); }
.type-tile input { width: 18px; height: 18px; margin: 0; accent-color: var(--violet); }
.type-tile .name { font-weight: 700; font-size: 16px; }

/* skeleton while loading */
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--tint); border-top-color: var(--violet); animation: spin 0.9s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } * { transition: none !important; } }

/* photo capture preview */
.preview-box { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 10px; display: flex; gap: 12px; align-items: center; }
.preview-box img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--line-2); }
.scan-view { background: #2a2f3a; border-radius: 12px; padding: 12px; display: flex; justify-content: center; }
.scan-view img { max-height: 420px; border-radius: 4px; background: #fff; }

/* ======================= screens ======================= */
.ok-text { color: var(--green-ink); font-size: 13.5px; }
.small-head { font-size: 13.5px; color: var(--muted); font-weight: 700; padding: 0 4px; }
.card-head { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.filters .search { flex: 1 1 240px; }
.filters select { flex: 0 1 260px; }

/* home */
.hello { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.hello h1 { font-size: 26px; }
.count-tile { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; min-height: 76px; }
.count-tile:hover { border-color: #b9addf; color: inherit; }
.count-tile .n { font-family: var(--cond); font-weight: 700; font-size: 38px; line-height: 1; color: var(--violet); min-width: 44px; text-align: center; }
.count-tile.pending { background: #fffaf0; border-color: #ead9a8; }
.count-tile.pending .n { color: var(--pending-ink); }
ul.todo { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
ul.todo li { border-top: 1px solid var(--line-2); }
ul.todo li:first-child { border-top: 0; }
ul.todo a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 0; color: var(--ink); text-decoration: none; }
ul.todo a::before { content: ''; width: 16px; height: 16px; flex: none; border: 2px solid var(--input); border-radius: 4px; }
ul.todo a:hover { color: var(--violet); }

/* register */
.register { min-height: 100vh; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps .n { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: #fff; }
.steps .n svg { width: 14px; height: 14px; }
.steps li.now { color: var(--ink); font-weight: 700; }
.steps li.now .n { border-color: var(--violet); color: var(--violet); }
.steps li.done .n { background: var(--violet); border-color: var(--violet); color: #fff; }
.type-tile.own { border-style: dashed; }
.type-tile.own:has(input:checked) { border-style: solid; }

/* catalog */
.chip-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip-row .tab { flex: none; }
.tab[aria-pressed='true'] { background: var(--violet); border-color: var(--violet); color: #fff; font-weight: 700; }
.tile .name { color: var(--ink); text-decoration: none; }
.tile .name:hover { color: var(--violet); }
.tile-action { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: auto; padding-top: 4px; }
.tile-action .stepper { width: 100%; }
.tile-action .stepper button { width: 40px; height: 40px; flex: none; }
.tile-action .stepper input { flex: 1; min-width: 0; width: auto; height: 40px; }
.big-icon { width: 34px; height: 34px; opacity: 0.5; }
.class-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px; }
.class-tile { min-height: 0; }
.photo-frame { width: 96px; height: 96px; flex: none; border-radius: 10px; background: var(--line-2); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.photo-frame img:not([hidden]) + .photo-empty { display: none; }
.photo-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); }
.photo-empty .icon { width: 28px; height: 28px; }
.material-view { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
.material-photo { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; }
.material-photo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.photo-empty.big .icon { width: 48px; height: 48px; }
@media (min-width: 820px) { .material-view { grid-template-columns: minmax(280px, 5fr) 6fr; } }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14.5px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* request and requisition */
.draft-item { align-items: flex-start; }
.note-input { min-height: 40px; font-size: 15px; padding: 8px 12px; }
.file-head h1 { font-size: 22px; }
.file-head .body { padding: 18px 20px; gap: 12px; }
.detail-cols { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 960px) { .detail-cols { grid-template-columns: 3fr 2fr; } }
.quote { padding-left: 10px; border-left: 3px solid var(--line); color: var(--ink-2); white-space: pre-wrap; }
.item.struck { opacity: 0.6; }
.item.struck .title { text-decoration: line-through; }
details.history summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 4px; list-style-position: inside; }
ol.history-list { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; }
ol.history-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; border-top: 1px solid var(--line-2); padding-top: 8px; }
.item.wrap-row { flex-wrap: wrap; }
.item.wrap-row > .grow { flex: 1 1 200px; }

/* notifications */
.item.notif .avatar svg { width: 18px; height: 18px; }
.item.notif.unread { background: var(--tint-2); }
.item.notif.unread .title::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--violet); margin-right: 8px; vertical-align: middle; }
.item.notif:not(.unread) .title { font-weight: 400; }

/* people */
.person-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.avatar.big { width: 56px; height: 56px; font-size: 19px; }
.big-code { font-family: var(--cond); font-weight: 700; font-size: 52px; letter-spacing: 0.18em; text-align: center; color: var(--violet); line-height: 1; padding: 8px 0; }
.message-box { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.pill-x { border: 0; background: transparent; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); margin-right: -6px; }
.pill-x:hover { background: rgba(0, 0, 0, 0.06); color: var(--ink); }
.pill-x svg { width: 14px; height: 14px; }

/* rules */
.sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.money-wrap { display: inline-flex; align-items: center; border: 1px solid var(--input); border-radius: 10px; background: #fff; overflow: hidden; }
.money-wrap .cur { padding: 0 10px; color: var(--muted); font-weight: 700; border-right: 1px solid var(--line-2); align-self: stretch; display: flex; align-items: center; background: #f7f8f6; }
.money-wrap .money-input { border: 0; border-radius: 0; width: 150px; min-height: 44px; }
.field .money-wrap { align-self: flex-start; }
@media (max-width: 599px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .tab { flex: none; }
}

/* ======================= purchase ======================= */
.need { font-size: 13.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.need.enough { background: var(--green-bg); color: var(--green-ink); }
.need.short { background: var(--pending-bg); color: var(--pending-ink); }
.file .body.flush-body { padding: 0; gap: 0; overflow: hidden; }
.pick-row { cursor: pointer; }
.pick-row input[type='checkbox'], .check input[type='checkbox'] { accent-color: var(--violet); }
.pick-row > input[type='checkbox'] { width: 22px; height: 22px; flex: none; margin: 0; }
.quote-card.lowest { border-color: #9fd0b6; box-shadow: inset 4px 0 0 var(--green); }
.tab[aria-checked='true'] { background: var(--violet); border-color: var(--violet); color: #fff; font-weight: 700; }
.radio-tab input { position: absolute; opacity: 0; pointer-events: none; }
.radio-tab { position: relative; cursor: pointer; }
.radio-tab:has(input:checked) { background: var(--violet); border-color: var(--violet); color: #fff; font-weight: 700; }
.radio-tab:has(input:focus-visible) { outline: 3px solid var(--violet); outline-offset: 2px; }
.total-row { padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 16px; }
.card.stack > .total-row { padding: 10px 0 0; }
.big-total { font-size: 20px; font-family: var(--cond); letter-spacing: 0.02em; }
.rate-row { align-items: center; flex-wrap: wrap; }
.rate-row .money-wrap .money-input, .rate-input { width: 130px; min-height: 44px; border: 0; border-radius: 0; }
.scan-frame { background: #2a2f3a; color: #c7cbd6; }
.scan-frame img { object-fit: contain; background: #fff; }

/* comparison */
table.compare { min-width: 100%; }
table.compare th, table.compare td { border-right: 1px solid var(--line-2); }
table.compare th:last-child, table.compare td:last-child { border-right: 0; }
table.compare thead th { vertical-align: bottom; background: #fbfcfa; }
table.compare tbody th, table.compare tfoot th { text-align: left; font-weight: 400; background: #fff; }
table.compare tbody th:first-child, table.compare thead th:first-child, table.compare tfoot th:first-child { position: sticky; left: 0; z-index: 1; min-width: 160px; box-shadow: 1px 0 0 var(--line); }
table.compare thead th:first-child { background: #fbfcfa; }
table.compare tfoot th, table.compare tfoot td { border-top: 3px double var(--ledger); font-size: 15px; }
table.compare .sup { font-weight: 700; color: var(--ink); white-space: normal; text-align: right; max-width: 180px; }
table.compare td.best { background: var(--green-bg); }
table.compare td.chosen, table.compare th.chosen { box-shadow: inset 0 0 0 2px var(--violet); }
.pick { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 700; color: var(--violet); min-height: 32px; }
.pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--violet); }
.cell-pick { color: var(--ink); }
.progress { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--violet); }
tr.link-row { cursor: pointer; }
tr.link-row:hover td { background: var(--tint-2); }

/* purchase order */
.po-doc { display: flex; flex-direction: column; gap: 18px; }
.po-doc header h1 { font-size: 24px; }
.po-to { padding: 12px 14px; border-left: 3px solid var(--manila); background: #fffcf2; border-radius: 0 10px 10px 0; }
.po-doc footer { border-top: 1px dashed var(--line); padding-top: 10px; }

/* receiving */
.receive-list { padding: 4px 0; }
.receive-row { padding: 14px 16px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 10px; }
.receive-row:first-child { border-top: 0; }
.receive-row.struck { opacity: 0.6; }
.grid-receive { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .grid-receive { grid-template-columns: 1fr 1fr 2fr 2fr; } }

/* printing a purchase order */
@media print {
  .sidebar, .topbar, .tabbar, .actionbar, .no-print, .toasts, .draftbar { display: none !important; }
  body, .content { background: #fff; padding: 0; }
  .card, .po-doc { border: 0; box-shadow: none; padding: 0; }
  .po-to { background: #fff; }
  a { color: inherit; text-decoration: none; }
}
.compare-line { cursor: default; }
label.compare-line { cursor: pointer; }
.compare-line input[type='radio'] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--violet); }
.compare-line.best { background: var(--green-bg); }
.compare-line.chosen { box-shadow: inset 4px 0 0 var(--violet); }

/* ======================= stores ======================= */
.store-card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; }
.store-card:hover { border-color: #b9addf; color: inherit; }
.store-name { font-size: 17px; }
.qty-big { font-family: var(--cond); font-size: 22px; line-height: 1; }
.stock-line.is-low { box-shadow: inset 4px 0 0 #d7b44a; }
.stock-line.flash { animation: flash 1.6s ease-out 1; }
@keyframes flash { from { background: var(--pending-bg); } to { background: transparent; } }
.asset-tag {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 6px; border: 1.5px dashed var(--manila-ink);
  background: var(--manila); color: var(--manila-ink); font-family: var(--cond); font-weight: 700; font-size: 15px; letter-spacing: 0.06em; white-space: nowrap;
}
.asset-tag.big { font-size: 22px; padding: 4px 14px; align-self: flex-start; }
.tag-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pick { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; cursor: pointer; }
.tag-pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--violet); }
.issue-line { align-items: flex-start; flex-wrap: wrap; }
.issue-line > .grow { flex: 1 1 200px; }
.qty-input { width: 96px; min-height: 44px; }
.direct-line { padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.asset-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.asset-head h1 { font-size: 22px; }
.linkish { border: 0; background: none; padding: 0; color: var(--violet); font-weight: 700; cursor: pointer; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .stock-line.flash { animation: none; background: var(--pending-bg); } }

/* ======================= platform console ======================= */
.platform-head { background: var(--nav); color: #fff; border-bottom: 0; }
.platform-head .tiny { color: #c7cbd6; }
.narrow-col { max-width: 760px; }

/* ======================= chat (from the Marjan Group chat) ======================= */
:root {
  --wall: #e8eae4;
  --bubble-in: #ffffff;
  --bubble-out: #e9e2f8;
  --quote-bg: rgba(31, 36, 48, 0.06);
  --tick: #7a8290;
  --tick-read: #1e7ad6;
  --online: #1c9e5c;
  --c-shadow: 0 1px 1.5px rgba(31, 36, 48, 0.14);
  --c-shadow-2: 0 6px 24px rgba(31, 36, 48, 0.18);
  /* Names in group chats, the same colours as the round photos. */
  --nc0: #5b36b0;
  --nc1: #1c6b4f;
  --nc2: #9c4a1a;
  --nc3: #1b6f7a;
  --nc4: #7b3f86;
  --nc5: #80600a;
  --nc6: #4c5763;
  --nc7: #a12f2f;
}
.n0 { color: var(--nc0); } .n1 { color: var(--nc1); } .n2 { color: var(--nc2); } .n3 { color: var(--nc3); }
.n4 { color: var(--nc4); } .n5 { color: var(--nc5); } .n6 { color: var(--nc6); } .n7 { color: var(--nc7); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prewrap { white-space: pre-wrap; }
.spin {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: spin 0.8s linear infinite; vertical-align: middle; opacity: 0.7; flex: none;
}
mark { background: rgba(238, 217, 164, 0.85); color: inherit; border-radius: 3px; padding: 0 1px; }

/* The chat pages fill the screen and scroll inside. */
.app.chat-mode { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.app.chat-mode .main { height: 100%; min-height: 0; }
.app.chat-mode .content { flex: 1; min-height: 0; max-width: none; padding: 0; gap: 0; overflow: hidden; }
@media (max-width: 959px) {
  .app.chat-mode:not(.chat-open) .content { padding-bottom: calc(58px + var(--safe-bottom)); }
  .app.chat-open .topbar { display: none; }
  .app.chat-open + .tabbar { display: none; }
}

.chat-split { display: flex; height: 100%; min-height: 0; background: var(--card); }
.chat-listpane, .chat-mainpane { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; position: relative; }
.chat-listpane { width: 100%; background: var(--card); }
.chat-mainpane { flex: 1; background: var(--wall); }
.chat-split[data-view='list'] .chat-mainpane,
.chat-split[data-view='main'] .chat-listpane { display: none; }
@media (min-width: 960px) {
  .chat-listpane { width: 360px; flex: none; border-right: 1px solid var(--line); }
  .chat-split[data-view] .chat-listpane, .chat-split[data-view] .chat-mainpane { display: flex; }
  .chat-head .back-btn { display: none; }
}
.chat-empty {
  margin: auto; text-align: center; color: var(--muted); padding: 32px; max-width: 360px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.chat-empty h2 { color: var(--ink); }
.chat-empty-mark { width: 72px; height: 72px; border-radius: 20px; background: var(--tint); color: var(--violet); display: grid; place-items: center; }
.chat-empty-mark .icon { width: 34px; height: 34px; }

/* round photos */
.cav {
  --size: 48px; width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: calc(var(--size) * 0.36);
  background: var(--av, #4c5763); overflow: hidden; position: relative; user-select: none;
}
.cav img { width: 100%; height: 100%; object-fit: cover; }
.cav .icon { width: 52%; height: 52%; }
.cav.req { background: var(--manila); color: var(--manila-ink); }
.cav.lead { background: var(--violet); color: #fff; }
button.cav.photo-pick { background: var(--line-2); color: var(--ink-2); border: 0; cursor: pointer; }
.cav-wrap { position: relative; flex: none; display: inline-flex; }
.cav-wrap .online { position: absolute; right: 0; bottom: 1px; width: 13px; height: 13px; border-radius: 50%; background: var(--online); box-shadow: 0 0 0 2.5px var(--card); }

/* the chat list */
.chatlist-head { padding: 10px 12px; border-bottom: 1px solid var(--line-2); flex: none; }
.list-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 96px; }
.cbanner {
  display: flex; align-items: center; gap: 12px; margin: 10px 12px 2px; padding: 12px;
  background: var(--tint-2); border: 1px solid #d9cff0; border-radius: 12px; font-size: 14.5px;
}
.cbanner .grow { display: flex; flex-direction: column; }
.chat-row { display: flex; align-items: center; gap: 14px; min-height: 74px; padding: 0 0 0 14px; color: var(--ink); text-decoration: none; }
.chat-row:hover, .chat-row.active { background: var(--tint-2); color: var(--ink); }
.chat-row .meta {
  flex: 1; min-width: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 3px;
  padding-right: 14px; border-bottom: 1px solid var(--line-2);
}
.row-top, .row-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-top .cname { flex: 1; font-weight: 700; font-size: 16px; }
.row-top .when { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.row-top .when.fresh { color: var(--violet); font-weight: 700; }
.row-bottom { color: var(--ink-2); font-size: 14.5px; }
.row-bottom .preview { flex: 1; min-width: 0; }
.row-bottom .preview.typing { color: var(--green); }
.row-bottom > .icon { width: 18px; height: 18px; color: var(--muted); }
.ccount {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--violet); color: #fff;
  font-size: 12.5px; font-weight: 700; display: grid; place-items: center; flex: none; font-variant-numeric: tabular-nums;
}
.ccount.muted { background: var(--line-2); color: var(--ink-2); }
.list-section { padding: 16px 16px 6px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.list-empty { padding: 40px 28px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.fab {
  position: absolute; right: 16px; bottom: 18px; width: 58px; height: 58px; border-radius: 18px;
  background: var(--violet); color: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22); display: grid; place-items: center; z-index: 2;
}
.fab:hover { background: var(--violet-dark); color: #fff; }
.fab .icon { width: 26px; height: 26px; }

/* the ticks: ✓ sent, ✓✓ delivered, blue ✓✓ read */
.icon.tk, .icon.tk-pending { width: 17px; height: 17px; color: var(--tick); stroke-width: 2.2; }
.icon.tk.read { color: var(--tick-read); }
.failed, .failed .icon { color: var(--red); }

/* a conversation */
.thread { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--wall); position: relative; }
.chat-head {
  flex: none; display: flex; align-items: center; gap: 2px; min-height: 60px;
  padding: env(safe-area-inset-top) 4px 0 4px; background: var(--card); border-bottom: 1px solid var(--line);
}
.chat-head .title-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 10px; color: inherit; text-decoration: none; }
.chat-head .title-btn:hover { background: var(--tint-2); color: inherit; }
.title-text { display: flex; flex-direction: column; min-width: 0; }
.chat-head .t1 { font-size: 16.5px; font-weight: 700; line-height: 1.2; }
.chat-head .t2 { font-size: 13px; color: var(--muted); line-height: 1.3; }
.chat-head .t2.typing { color: var(--green); }
.msgs { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 10px 10px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.msgs-inner { max-width: 820px; margin: 0 auto; }
.loader { text-align: center; padding: 10px; color: var(--muted); font-size: 13px; }
.day-sep, .sys { display: flex; justify-content: center; margin: 12px 0 8px; }
.day-sep span, .sys span {
  background: var(--card); color: var(--ink-2); font-size: 12.5px; padding: 4px 11px; border-radius: 8px;
  box-shadow: var(--c-shadow); text-align: center; max-width: 88%;
}
.sys span { background: #f4f1fb; font-size: 13px; }
.unread-sep { margin: 12px -10px; padding: 5px; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-2); background: rgba(238, 217, 164, 0.45); }
.notice-bar { margin: 8px auto; max-width: 560px; font-size: 12.5px; color: var(--ink-2); background: var(--card); border-radius: 10px; padding: 8px 12px; text-align: center; box-shadow: var(--c-shadow); }
.say-hello { text-align: center; color: var(--muted); padding: 24px 0; font-size: 14px; }
.msg { display: flex; margin-top: 2px; position: relative; touch-action: pan-y; }
.msg.out { justify-content: flex-end; }
.msg.first { margin-top: 8px; }
.msg.has-reactions { margin-bottom: 16px; }
.msg.flash .bubble { animation: msgflash 1.6s ease-out; }
@keyframes msgflash { 0%, 40% { box-shadow: 0 0 0 3px var(--violet); } 100% { box-shadow: var(--c-shadow); } }
@media (prefers-reduced-motion: reduce) { .msg.flash .bubble { animation: none; box-shadow: 0 0 0 3px var(--violet); } }
.swipe-reply {
  position: absolute; left: -36px; top: 50%; margin-top: -16px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--card); display: grid; place-items: center; opacity: 0; color: var(--ink-2); box-shadow: var(--c-shadow);
}
.swipe-reply .icon { width: 18px; height: 18px; }
.bubble {
  position: relative; max-width: min(82%, 540px); min-width: 64px; padding: 6px 8px 6px 9px; border-radius: 12px;
  background: var(--bubble-in); box-shadow: var(--c-shadow); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform 0.15s;
}
.bubble:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.msg.out .bubble { background: var(--bubble-out); }
.msg.in.first .bubble { border-top-left-radius: 4px; }
.msg.out.first .bubble { border-top-right-radius: 4px; }
.sender { font-size: 13.5px; font-weight: 700; margin-bottom: 2px; display: flex; gap: 6px; align-items: baseline; }
.sender small { font-weight: 400; color: var(--muted); font-size: 12px; }
.fwd { font-size: 12.5px; font-style: italic; color: var(--muted); display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.fwd .icon { width: 14px; height: 14px; }
.mbody { font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.mbody::after { content: ''; display: block; clear: both; }
.mbody.big-emoji { font-size: 38px; line-height: 1.2; }
.mbody.deleted { font-style: italic; color: var(--muted); }
.mbody code { font-family: ui-monospace, Menlo, monospace; font-size: 0.9em; background: var(--quote-bg); padding: 1px 4px; border-radius: 4px; }
.mstamp {
  float: right; direction: ltr; unicode-bidi: isolate; position: relative; top: 6px; margin: 0 -2px 0 10px;
  display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; line-height: 1.2; color: var(--muted);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tk-wrap { display: inline-flex; }
.media-wrap { position: relative; margin: -2px -4px 0 -5px; }
.media-wrap .mstamp.overlay {
  position: absolute; float: none; top: auto; right: 6px; bottom: 6px; margin: 0; padding: 2px 6px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.45); color: #fff;
}
.media-wrap .mstamp.overlay .icon.tk { color: #fff; }
.media-wrap .mstamp.overlay .icon.tk.read { color: #8fd3ff; }
.photo { display: block; border-radius: 9px; width: 260px; max-width: 100%; height: auto; max-height: 380px; object-fit: cover; background: var(--line-2); cursor: zoom-in; }
.upload-veil { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.35); border-radius: 9px; color: #fff; font-size: 14px; font-weight: 700; }
.file-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 2px 0 4px; border-radius: 10px;
  background: var(--quote-bg); color: var(--ink); text-decoration: none; min-width: 200px;
}
.file-card:hover { color: var(--ink); }
.file-card .grow { display: flex; flex-direction: column; }
.file-card .fi { width: 40px; height: 40px; border-radius: 8px; background: var(--violet); color: #fff; display: grid; place-items: center; flex: none; }
.file-card .fn { font-weight: 700; font-size: 14.5px; }
.file-card .fs { font-size: 12.5px; color: var(--muted); }
.file-card .icon-btn { margin-left: auto; flex: none; }
video.vid { display: block; width: 280px; max-width: 100%; border-radius: 9px; background: #000; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 2px 0; }
.voice .play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--violet); color: #fff; display: grid; place-items: center; flex: none; cursor: pointer; }
.voice .track { flex: 1; min-width: 0; }
.voice input[type='range'] { width: 100%; accent-color: var(--violet); margin: 6px 0 2px; }
.voice .vrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.voice .vrow .mstamp { float: none; top: 0; margin: 0; }
.voice .vt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mquote {
  display: flex; flex-direction: column; width: 100%; border: 0; border-left: 4px solid var(--qc, var(--muted)); background: var(--quote-bg);
  border-radius: 7px; padding: 5px 8px; margin: 0 0 4px; text-align: left; color: var(--ink); cursor: pointer;
}
.mquote .qn { font-size: 13px; font-weight: 700; color: var(--qc, var(--ink-2)); }
.mquote .qt { font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reactions {
  position: absolute; bottom: -14px; right: 10px; display: flex; gap: 2px; align-items: center; padding: 1px 6px; border-radius: 12px;
  background: var(--card); box-shadow: var(--c-shadow); border: 0; font-size: 14px; line-height: 22px; color: var(--ink-2); cursor: pointer;
}
.msg.in .reactions { right: auto; left: 10px; }
.reactions .rc { font-size: 12px; margin-left: 2px; }
.jump {
  position: absolute; right: 14px; bottom: calc(76px + var(--safe-bottom)); width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--card); color: var(--ink-2); box-shadow: var(--c-shadow-2); display: grid; place-items: center; z-index: 3; cursor: pointer;
}
.jump .ccount { position: absolute; top: -8px; right: -4px; }

/* the composer */
.composer { flex: none; display: flex; align-items: flex-end; gap: 6px; padding: 6px 8px calc(8px + var(--safe-bottom)); }
.composer.readonly { justify-content: center; align-items: center; padding: 12px 16px calc(14px + var(--safe-bottom)); font-size: 14px; color: var(--ink-2); text-align: center; background: var(--card); }
.cpill { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--card); border-radius: 24px; box-shadow: var(--c-shadow); overflow: hidden; }
.cpill-row { display: flex; align-items: flex-end; min-height: 48px; padding: 0 2px; }
.cpill-gap { width: 12px; flex: none; }
.cpill textarea {
  flex: 1; min-width: 0; border: 0; background: transparent; resize: none; font-size: 16.5px; line-height: 1.4;
  padding: 12px 6px 12px 2px; max-height: 150px; outline: none; color: var(--ink);
}
.cpill .icon-btn { color: var(--muted); }
.cpill .attach-btn { width: 44px; height: 48px; }
.cpill:focus-within { box-shadow: 0 0 0 2px var(--violet); }
.ctx-bar { display: flex; align-items: center; gap: 8px; margin: 6px 6px 0; padding: 6px 4px 6px 10px; border-left: 4px solid var(--violet); background: var(--quote-bg); border-radius: 10px; }
.ctx-bar .grow { min-width: 0; }
.ctx-bar .t1 { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.ctx-bar .t2 { font-size: 14px; color: var(--ink-2); }
.ctx-bar .icon-btn { width: 36px; height: 36px; }
.send { width: 48px; height: 48px; flex: none; border: 0; border-radius: 50%; background: var(--violet); color: #fff; display: grid; place-items: center; box-shadow: var(--c-shadow); cursor: pointer; }
.send:hover { background: var(--violet-dark); }
.recording {
  flex: 1; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 6px 0 16px;
  background: var(--card); border-radius: 24px; box-shadow: var(--c-shadow); font-variant-numeric: tabular-nums;
}
.recording .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--red); animation: pulse 1.2s infinite; }
.recording .grow { color: var(--ink-2); font-size: 14px; }
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .recording .dot { animation: none; } }

/* sheets for the chat: actions, reactions, pickers */
dialog.csheet { padding: 0; }
dialog.csheet .csheet-body { max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 4px 0 calc(12px + var(--safe-bottom)); }
.csheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 8px 4px 20px; }
.csheet-head h2 { font-size: 18px; }
.csheet-sub { margin: 0 20px 10px; color: var(--muted); font-size: 14.5px; }
.csheet-body > :not(.csheet-head):not(.csheet-actions):not(.list):not(.csheet-sub):not(.list-section) { margin: 0 16px; }
.csheet-body .stack > .list { margin: 0 -16px; }
.csheet-actions { display: flex; flex-direction: column; padding-top: 6px; }
.sheet-item { display: flex; align-items: center; gap: 18px; width: 100%; min-height: 54px; padding: 0 22px; border: 0; background: none; text-align: left; font-size: 16px; color: var(--ink); cursor: pointer; }
.sheet-item:hover, .sheet-item:focus-visible { background: var(--tint-2); }
.sheet-item .icon { color: var(--ink-2); width: 22px; height: 22px; }
.sheet-item.danger, .sheet-item.danger .icon { color: var(--red); }
.react-row { display: flex; justify-content: space-around; padding: 4px 12px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.react-row button { font-size: 28px; width: 48px; height: 48px; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.react-row button.on, .react-row button:hover { background: var(--tint); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 0 6px; flex-wrap: wrap; }
.dialog-actions.sticky { position: sticky; bottom: -12px; background: var(--card); border-top: 1px solid var(--line-2); padding-bottom: 12px; }
.big-emoji-inline { font-size: 24px; }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; }
.photo-strip img { height: 150px; border-radius: 10px; flex: none; max-width: 80%; object-fit: cover; }
.pick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--input); display: grid; place-items: center; flex: none; }
.pick.on { background: var(--violet); border-color: var(--violet); color: #fff; }
.pick .icon { width: 16px; height: 16px; }
.cswitch { position: relative; display: inline-flex; flex: none; }
.cswitch input { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: #c5cbc2; margin: 0; cursor: pointer; transition: background 0.15s; }
.cswitch input:checked { background: var(--violet); }
.cswitch input:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.cswitch i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; pointer-events: none; }
.cswitch input:checked + i { transform: translateX(18px); }

/* the photo viewer */
dialog.viewer { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; background: #000; color: #fff; }
dialog.viewer::backdrop { background: #000; }
.viewer-inner { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; }
.viewer-bar { position: absolute; inset: 0 0 auto; z-index: 2; display: flex; align-items: center; gap: 8px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; background: rgba(0, 0, 0, 0.5); }
.viewer-bar .icon-btn { color: #fff; }
.viewer-bar .icon-btn:hover { background: rgba(255, 255, 255, 0.15); }
.viewer .stage { flex: 1; overflow: auto; display: grid; place-items: center; }
.viewer .stage img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; }
.viewer .stage.zoomed { display: block; }
.viewer .stage.zoomed img { max-width: none; max-height: none; width: 200vw; }
.viewer .caption { position: absolute; inset: auto 0 0; padding: 14px 16px calc(14px + var(--safe-bottom)); background: rgba(0, 0, 0, 0.55); font-size: 15px; }

/* a message in another chat, while the app is open */
.peek {
  position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 70;
  width: min(94vw, 460px); display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 14px;
  background: #fff; color: var(--ink); box-shadow: var(--c-shadow-2); text-align: left; cursor: pointer;
}
.peek .grow { display: flex; flex-direction: column; min-width: 0; }
.peek b { font-size: 14.5px; }
.peek .grow > span { font-size: 14px; color: var(--ink-2); }

/* profiles and group info */
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 8px 0; }
.profile-head h1 { font-size: 22px; }
.plain-btn { border: 0; background: none; padding: 0; border-radius: 50%; cursor: pointer; }
.plain-btn:disabled { cursor: default; }
.danger-text, .danger-text .icon { color: var(--red); }
.sidebar .me .me-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: #fff; text-decoration: none; border-radius: 8px; padding: 4px; }
.sidebar .me .me-link:hover { background: #2c3242; color: #fff; }
.avatar.photo { overflow: hidden; padding: 0; }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; }
.person-head .avatar.big.photo img { border-radius: 50%; }
a.plain-link { color: inherit; text-decoration: none; }
a.plain-link:hover { color: inherit; background: var(--tint-2); }
