/* 1688IMEX panel — values taken from the design mockups */
:root {
  --navy: #0A2A66;
  --navy-2: #0E3A8A;
  --navy-3: #071F4A;
  --orange: #F7891F;
  --orange-ink: #C85E06;
  --orange-text: #A84A06;
  --orange-soft: #FFF1E3;
  --ink: #0B1F44;
  --text-2: #3A4863;
  --muted: #55627A;
  --placeholder: #66748C;
  --page: #F4F7FC;
  --field: #F9FBFE;
  --chip: #EEF2F9;
  --blue-soft: #E7EEFA;
  --line: #E3E9F3;
  --line-2: #D5DEEC;
  --line-3: #C3CFE3;
  --green: #1E9E4F;
  --green-ink: #146C36;
  --green-soft: #E3F5E9;
  --grey-ink: #4A5568;
  --grey-soft: #EEF0F4;
  --red: #9B2C2C;
  --shadow-card: 0 10px 30px rgba(10,42,102,0.07);
  --shadow-soft: 0 4px 16px rgba(10,42,102,0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--page);
}
a { color: var(--orange-text); }
a:hover { color: var(--navy); }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
button:focus-visible, a:focus-visible, label:focus-within { outline: 2px solid var(--orange); outline-offset: 2px; }
button { font: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: none; }

/* ---------- decorative diamonds ---------- */
.diamond { position: absolute; transform: rotate(45deg); pointer-events: none; }
.diamond.orange { background: linear-gradient(135deg, #FFA24A, #F07A12); }
.diamond.orange-2 { background: linear-gradient(135deg, #FFB061, #F7891F); opacity: .85; }
.diamond.ghost { background: rgba(255,255,255,0.04); }
.diamond.outline-light { border: 2px solid rgba(255,255,255,0.08); }
.diamond.outline-navy { border: 2px solid rgba(14,58,138,0.12); }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.sidebar {
  flex: 1 1 250px; position: relative; overflow: hidden;
  background: linear-gradient(170deg, var(--navy-2) 0%, var(--navy) 45%, var(--navy-3) 100%);
  color: #fff; padding: 36px 20px 28px; display: flex; flex-direction: column; gap: 40px;
}
/* Side-by-side layout: pin the menu while the page scrolls (below 900px it's a top bar) */
@media (min-width: 900px) {
  .sidebar { position: sticky; top: 0; height: 100vh; align-self: flex-start; }
}
.sidebar-top { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; }
.sidebar-body { position: relative; flex: 1; display: flex; flex-direction: column; gap: 40px; }
.nav-toggle {
  display: none; width: 44px; height: 44px; border: 0; border-radius: 12px; flex: none;
  background: rgba(255,255,255,0.10); color: #fff; align-items: center; justify-content: center; cursor: pointer;
}
.nav-toggle .when-open, .nav-open .nav-toggle .when-closed { display: none; }
.nav-open .nav-toggle .when-open { display: block; }
.m-label { display: none; }
.brand { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; }
.brand-name { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; color: #fff; }
.brand-name span { color: var(--orange); }
.brand-sub { font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.82); }
.nav { position: relative; display: flex; flex-direction: column; gap: 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 18px;
  border-radius: 12px; color: #fff; font-size: 15px; font-weight: 500; text-decoration: none;
}
.nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav a[aria-current="page"] {
  background: var(--orange); color: var(--navy); font-weight: 700;
  box-shadow: 0 8px 20px rgba(247,137,31,0.35);
}
.sidebar-foot {
  position: relative; margin-top: auto; display: flex; flex-direction: column; gap: 18px;
  padding-top: 22px; border-top: 1px solid rgba(255,255,255,0.22);
}
.tagline { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 1.45; color: rgba(255,255,255,0.88); }
.me { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,0.85); }
.me .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; background: rgba(255,255,255,0.12); color: #fff; }
.logout-btn {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; border: 0;
  background: transparent; font-size: 14px; font-weight: 600; color: #fff; cursor: pointer;
}

.main {
  flex: 999 1 560px; min-width: 0; position: relative; overflow: hidden;
  padding: 32px 28px 48px; display: flex; flex-direction: column; gap: 24px;
}
.main > *:not(.diamond) { position: relative; }

/* ---------- page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.title-block { display: flex; gap: 16px; align-items: stretch; }
.title-bar { width: 3px; border-radius: 2px; background: var(--orange); flex: none; }
.title-block > div { display: flex; flex-direction: column; gap: 4px; }
.title-block h1 { margin: 0; font-size: 34px; font-weight: 400; letter-spacing: -0.02em; color: var(--navy); }
.title-block h1 strong { font-weight: 800; }
.title-block p { margin: 0; font-size: 15px; color: var(--text-2); }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; color: var(--navy); font-weight: 600; text-decoration: none; }
.head-stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border: 0; border-radius: 12px;
  font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--orange); color: var(--navy); }
.btn-primary:hover { color: var(--navy); filter: brightness(1.04); }
.btn-primary.lift { box-shadow: 0 8px 20px rgba(247,137,31,0.30); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { color: #fff; background: var(--navy-2); }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid var(--line-2); font-weight: 600; }
.btn-ghost:hover { color: var(--navy); border-color: var(--line-3); }
.btn-head { height: 48px; padding: 0 18px; border-radius: 14px; }
/* Filter row under the page title; popovers open rightwards from the filter
   (phones use the bottom-sheet popover instead) */
@media (min-width: 641px) { .toolbar .popover { right: auto; left: 0; } }
.btn-sm { min-height: 40px; height: 40px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--page);
  color: var(--navy); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none; flex: none;
}
.icon-btn:hover { background: var(--chip); color: var(--navy); }
.icon-btn.danger { color: var(--red); }
.icon-btn.lg { width: 44px; height: 44px; border-radius: 12px; }

/* ---------- search / date pill ---------- */
.pill {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px;
  border-radius: 14px; background: #fff; box-shadow: var(--shadow-soft); color: var(--muted);
}
.pill.search { width: 240px; max-width: 100%; }
.pill.bordered { box-shadow: none; border: 1px solid var(--line); width: 100%; }
.pill input {
  flex: 1; min-width: 0; border: 0; background: transparent; height: 44px;
  font: inherit; font-size: 15px; color: var(--ink);
}
.pill input:focus { outline: 0; }
.pill:focus-within { outline: 2px solid var(--orange); outline-offset: 1px; }

.date-filter-wrap { position: relative; display: inline-flex; align-items: center; }
.date-filter { position: relative; }
.date-filter > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 10px; height: 48px;
  padding: 0 16px; border: 1px solid transparent; border-radius: 14px; background: #fff;
  box-shadow: var(--shadow-soft); font-size: 15px; font-weight: 500; color: var(--navy);
  cursor: pointer; white-space: nowrap; user-select: none;
}
.date-filter > summary::-webkit-details-marker { display: none; }
.date-filter > summary:hover { border-color: var(--line-2); }
.date-filter > summary .chev { transition: transform .15s ease; color: var(--muted); }
.date-filter[open] > summary { border-color: var(--navy); }
.date-filter[open] > summary .chev { transform: rotate(180deg); }
.date-filter.is-active > summary { background: var(--blue-soft); color: var(--navy-2); font-weight: 600; padding-right: 44px; }
.date-filter.is-active > summary .chev { display: none; }
.date-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px;
  border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--navy-2); text-decoration: none;
}
.date-clear:hover { background: rgba(10,42,102,0.08); color: var(--navy); }

.popover {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
  width: 360px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 20px 48px rgba(10,42,102,0.18); overflow: hidden;
  display: flex; flex-direction: column;
}
.popover-head { padding: 16px 20px 0; }
.popover-title { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--navy); }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 20px 0; }
.preset {
  display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--navy);
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.preset:hover { border-color: var(--line-3); background: var(--page); color: var(--navy); }
.preset[aria-current="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.presets.list { grid-template-columns: 1fr; max-height: min(360px, 60vh); overflow-y: auto; padding-bottom: 16px; }
.presets.list .preset { justify-content: flex-start; gap: 8px; text-align: left; }
.range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 8px; padding: 16px 20px 18px; }
.range .field { min-width: 0; }
.range .field > label { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.range .field input[type=date] { min-width: 0; height: 44px; padding: 0 10px; border-radius: 10px; font-size: 14px; }
.range-dash { height: 44px; display: inline-flex; align-items: center; color: var(--muted); }
.popover-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--line); background: var(--field);
}
.popover-foot .btn { min-width: 110px; }

.refresh-region { display: flex; flex-direction: column; gap: 24px; }
.refreshed { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; font-size: 13px; color: var(--muted); }

/* ---------- filter tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--navy);
  font-size: 14px; font-weight: 500; text-decoration: none;
}
.tab:hover { color: var(--navy); border-color: var(--line-3); }
.tab .count { min-width: 22px; padding: 2px 6px; border-radius: 6px; background: var(--chip); font-size: 12px; font-weight: 700; color: var(--text-2); text-align: center; }
.tab[aria-current="true"] { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.tab[aria-current="true"] .count { background: rgba(255,255,255,0.18); color: #fff; }

/* ---------- data table ---------- */
.card {
  background: #fff; border-radius: 18px; border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  /* Rows switch to cards when the table itself gets too narrow (see "responsive") */
  container-type: inline-size;
}
.table-scroll { overflow-x: auto; border-radius: 17px 17px 0 0; }
.grid-row { display: grid; align-items: center; }
.grid-head { background: var(--navy); color: #fff; font-size: 14px; font-weight: 700; }
.grid-head > div { padding: 16px 12px; display: flex; align-items: center; gap: 8px; }
.grid-head > div + div { border-left: 1px solid rgba(255,255,255,0.12); }
.grid-body { list-style: none; margin: 0; padding: 0; }
.grid-body > li { border-top: 1px solid var(--line); font-size: 14px; color: var(--navy); }
.grid-body > li.clickable { cursor: pointer; }
.grid-body > li.clickable:hover { background: #FAFBFE; }
.grid-body > li > div { padding: 18px 12px; min-width: 0; }
.cols-orders { grid-template-columns: 60px 98px minmax(110px, 1fr) 112px 112px minmax(150px, 1.4fr) minmax(120px, 1fr) 156px 48px; min-width: 940px; }
.cols-orders > div { padding-left: 10px !important; padding-right: 10px !important; }
.cols-users { grid-template-columns: minmax(220px, 1.5fr) 150px 150px 130px 64px; min-width: 720px; }
.cols-users > div:first-child, .cols-cats > div:first-child { padding-left: 20px !important; }
.cols-users.grid-body-row > div, .cols-cats.grid-body-row > div { padding-top: 14px; padding-bottom: 14px; }
.cols-cats { grid-template-columns: minmax(240px, 1fr) 100px 130px 110px; min-width: 600px; }
.table-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2);
}
.empty { margin: 0; padding: 40px 24px; border-top: 1px solid var(--line); text-align: center; font-size: 15px; color: var(--muted); }
.pager { display: flex; gap: 6px; }
.pager a, .pager span {
  width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.pager .current { border: 0; background: var(--navy); color: #fff; }
.pager .disabled { opacity: .45; }

.no-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 38px; padding: 0 8px;
  border-radius: 10px; background: var(--orange-soft); color: var(--orange-ink); font-size: 18px; font-weight: 800;
}
.no-badge.sm { min-width: 34px; height: 28px; border-radius: 8px; font-size: 15px; }
.no-badge.lg { min-width: 52px; height: 46px; padding: 0 10px; border-radius: 12px; font-size: 22px; }
.no-badge.md { min-width: 48px; height: 42px; padding: 0 10px; font-size: 20px; }
.file-chip {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px;
  border-radius: 6px; background: var(--chip); font-size: 12px; font-weight: 600; color: var(--text-2);
}
.cell-stack { display: flex; flex-direction: column; gap: 6px; line-height: 1.45; }
.cell-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.write-link { font-size: 13px; font-weight: 700; color: var(--orange-text); }

/* status badges */
.status { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; }
.st-new { background: var(--blue-soft); color: var(--navy-2); }
.st-new .dot { background: #2F64D6; }
.st-answered { background: var(--orange-soft); color: var(--orange-text); }
.st-ordered { background: var(--green-soft); color: var(--green-ink); }
.st-paid { background: #F1EBFD; color: #5B2DB0; }
.st-shipped { background: #DFF4F6; color: #0B6670; }
.st-arrived { background: #FFF6D6; color: #855F00; }
.st-delivered { background: var(--navy); color: #fff; }
.st-delivered .ic { color: var(--orange); }
.st-rejected { background: var(--grey-soft); color: var(--grey-ink); }
.st-text { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.st-text .dot { width: 8px; height: 8px; border-radius: 50%; }
.st-text.new { color: var(--navy-2); } .st-text.new .dot { background: #2F64D6; }
.st-text.answered { color: var(--orange-text); } .st-text.answered .dot { background: #E07B12; }
.st-text.ordered { color: var(--green-ink); } .st-text.ordered .dot { background: var(--green); }
.st-text.paid { color: #5B2DB0; } .st-text.paid .dot { background: #7C4DDB; }
.st-text.shipped { color: #0B6670; } .st-text.shipped .dot { background: #0E9AA7; }
.st-text.arrived { color: #855F00; } .st-text.arrived .dot { background: #D4A106; }
.st-text.delivered { color: var(--navy); } .st-text.delivered .dot { background: var(--orange); box-shadow: 0 0 0 2px var(--navy); }
.st-text.rejected { color: var(--grey-ink); } .st-text.rejected .dot { background: #8A94A6; }

/* row menu */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 190px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(10,42,102,0.16);
  display: flex; flex-direction: column;
}
.menu-list a, .menu-list button {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--navy); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; text-align: left; width: 100%;
}
.menu-list a:hover, .menu-list button:hover { background: var(--page); color: var(--navy); }
.menu-list .danger { color: var(--red); }
.menu-list form { margin: 0; }

/* avatar / role / switch */
.avatar {
  width: 42px; height: 42px; border-radius: 12px; background: var(--blue-soft); color: var(--navy-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; flex: none;
}
.role { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.role-admin { background: var(--navy); color: #fff; }
.role-manager { background: var(--orange-soft); color: var(--orange-text); }
.role-operator { background: var(--blue-soft); color: var(--navy-2); }
.role-sourcing { background: var(--chip); color: var(--navy); }
.switch {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; border: 0;
  background: transparent; font-size: 13px; font-weight: 600; color: var(--grey-ink); cursor: pointer;
}
.switch .track {
  width: 42px; height: 24px; border-radius: 999px; background: var(--line-3); display: inline-flex;
  align-items: center; justify-content: flex-start; padding: 3px;
}
.switch .knob { width: 18px; height: 18px; border-radius: 50%; background: #fff; }
.switch[aria-checked="true"] { color: var(--green-ink); }
.switch[aria-checked="true"] .track { background: var(--green); justify-content: flex-end; }
.switch:disabled { cursor: not-allowed; opacity: .6; }
.inline-form { margin: 0; display: inline; }
.count-link {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 32px; padding: 0 10px;
  border-radius: 8px; background: var(--orange-soft); color: var(--orange-ink); font-size: 15px; font-weight: 800; text-decoration: none;
}
.cat-icon {
  width: 42px; height: 42px; border-radius: 12px; background: var(--blue-soft); color: var(--navy-2);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}

/* ---------- forms ---------- */
.form-card {
  width: 100%; display: flex; flex-direction: column; background: #fff; border-radius: 20px;
  border: 1px solid var(--line); box-shadow: var(--shadow-card); overflow: hidden;
}
.form-card.w-960 { max-width: 960px; }
.form-card.w-860 { max-width: 860px; }
.form-meta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 28px; background: var(--field); border-bottom: 1px solid var(--line);
}
.form-meta .num { display: flex; align-items: center; gap: 12px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.form-section { display: flex; flex-direction: column; gap: 16px; padding: 24px 28px; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.section-title { margin: 0; display: inline-flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 800; color: var(--navy); }
.section-title .hint { font-size: 13px; font-weight: 500; color: var(--muted); }
.section-icon {
  width: 30px; height: 30px; border-radius: 9px; background: var(--blue-soft); color: var(--navy-2);
  display: inline-flex; align-items: center; justify-content: center;
}
.split-section { display: flex; flex-wrap: wrap; gap: 20px 32px; padding: 28px; }
.split-section + .split-section { border-top: 1px solid var(--line); }
.split-section > .intro { flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px; }
.split-section > .intro h2 { margin: 0; font-size: 16px; font-weight: 800; color: var(--navy); }
.split-section > .intro p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.split-section > .fields { flex: 2 1 400px; min-width: 0; }
.fields-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 16px; }
.span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 14px; font-weight: 600; color: var(--navy); }
.label .opt, .field > label .opt { font-weight: 500; color: var(--muted); }
.input, .field input[type=text], .field input[type=email], .field input[type=url], .field input[type=password],
.field input[type=date], .field input[type=tel], .field select, .field textarea {
  width: 100%; height: 48px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 14px;
  background: var(--field); font: inherit; font-size: 15px; color: var(--ink);
}
.field textarea { height: auto; padding: 12px 14px; line-height: 1.5; resize: vertical; min-height: 110px; }
.field select { appearance: none; -webkit-appearance: none; padding-right: 40px; }
.select-wrap { position: relative; }
.select-wrap .ic { position: absolute; right: 14px; top: 15px; pointer-events: none; color: var(--muted); }
.input-group {
  display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 12px; background: var(--field); overflow: hidden;
}
.input-group:focus-within { outline: 2px solid var(--orange); outline-offset: 1px; }
.input-group .prefix { display: inline-flex; align-items: center; padding: 0 12px; border-right: 1px solid var(--line-2); background: var(--chip); font-size: 14px; font-weight: 600; color: var(--navy); }
.input-group .prefix.at { border: 0; background: transparent; padding: 0 4px 0 14px; font-size: 15px; color: var(--muted); }
.input-group input { flex: 1; min-width: 0; height: 48px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; outline: 0 !important; }
.field-error { margin: 0; font-size: 13px; font-weight: 600; color: var(--red); }
.has-error input, .has-error select, .has-error textarea, .has-error.input-group { border-color: var(--red) !important; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); margin: 0; flex: none; }
.form-actions {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 20px 28px;
  border-top: 1px solid var(--line); background: var(--field);
}
.errorlist-box { margin: 0; padding: 12px 16px; border-radius: 12px; background: #FDECEC; color: var(--red); font-size: 14px; font-weight: 600; }

/* result (status) picker — radios styled as buttons */
.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.choice > span { text-align: center; }
@media (max-width: 640px) { .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice > span {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 12px; background: #fff; color: var(--text-2);
  font-size: 14px; font-weight: 500;
}
.choice > span .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-3); }
.choice input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }
.choice input:checked + span { border-width: 2px; font-weight: 700; }
.choice.new input:checked + span { border-color: #2F64D6; background: var(--blue-soft); color: var(--navy-2); }
.choice.new input:checked + span .dot { background: #2F64D6; }
.choice.answered input:checked + span { border-color: #E07B12; background: var(--orange-soft); color: var(--orange-text); }
.choice.answered input:checked + span .dot { background: #E07B12; }
.choice.ordered input:checked + span { border-color: var(--green); background: var(--green-soft); color: var(--green-ink); }
.choice.ordered input:checked + span .dot { background: var(--green); }
.choice.paid input:checked + span { border-color: #7C4DDB; background: #F1EBFD; color: #5B2DB0; }
.choice.paid input:checked + span .dot { background: #7C4DDB; }
.choice.shipped input:checked + span { border-color: #0E9AA7; background: #DFF4F6; color: #0B6670; }
.choice.shipped input:checked + span .dot { background: #0E9AA7; }
.choice.arrived input:checked + span { border-color: #D4A106; background: #FFF6D6; color: #855F00; }
.choice.arrived input:checked + span .dot { background: #D4A106; }
.choice.delivered input:checked + span { border-color: var(--navy); background: var(--navy); color: #fff; }
.choice.delivered input:checked + span .dot { background: var(--orange); }
.choice.rejected input:checked + span { border-color: #8A94A6; background: var(--grey-soft); color: var(--grey-ink); }
.choice.rejected input:checked + span .dot { background: #8A94A6; }
fieldset.plain { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
fieldset.plain legend { padding: 0; margin-bottom: 8px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--navy); }

/* role cards */
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 10px; }
.role-card { position: relative; }
.role-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.role-card .body {
  height: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px;
  border: 1px solid var(--line-2); border-radius: 14px; background: #fff;
}
.role-card .top { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.role-card strong { font-size: 15px; color: var(--navy); }
.role-card .desc { font-size: 13px; line-height: 1.45; color: var(--text-2); }
.role-card .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-3); display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.role-card .radio .ic { display: none; }
.role-card input:checked + .body { border: 2px solid var(--navy); background: var(--page); padding: 15px; }
.role-card input:checked + .body .radio { border: 0; background: var(--navy); }
.role-card input:checked + .body .radio .ic { display: block; }
.role-card input:focus-visible + .body { outline: 2px solid var(--orange); outline-offset: 2px; }

/* icon picker */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.icon-opt { position: relative; }
.icon-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.icon-opt span {
  height: 52px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line-2);
  border-radius: 12px; background: #fff; color: var(--navy-2);
}
.icon-opt input:checked + span { border: 2px solid var(--navy); background: var(--blue-soft); }
.icon-opt input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---------- uploads ---------- */
.dropzone {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px;
  min-height: 104px; padding: 20px; border: 1.5px dashed var(--line-3); border-radius: 14px; background: var(--field);
  cursor: pointer; text-align: left;
}
.dropzone.small { min-height: 72px; padding: 16px; border-radius: 12px; font-size: 14px; color: var(--text-2); text-align: center; }
.dropzone.dragover { border-color: var(--orange); background: var(--orange-soft); }
.dropzone .bubble {
  width: 48px; height: 48px; border-radius: 14px; background: var(--navy); color: var(--orange);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.dropzone .copy { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--text-2); }
.dropzone .copy strong { font-size: 15px; color: var(--navy); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.files-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.files-title { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--navy); }
.files-title .n { font-weight: 500; color: var(--muted); }
.file-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 10px; }
.file-card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.file-card .thumb { position: relative; height: 84px; background: var(--chip); display: flex; align-items: center; justify-content: center; color: var(--muted); text-decoration: none; }
.file-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.file-card .ext { padding: 6px 10px; border-radius: 8px; background: var(--navy); color: #fff; font-size: 13px; font-weight: 800; letter-spacing: 0.04em; }
.file-card .meta { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; min-width: 0; }
.file-card .name { font-size: 13px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card .size { font-size: 12px; color: var(--muted); }
.file-card .remove {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border: 0; border-radius: 9px;
  background: rgba(255,255,255,0.94); color: var(--navy); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 1px 4px rgba(10,42,102,0.18);
}
.file-card.pending .thumb { background: var(--orange-soft); }

/* ---------- request detail ---------- */
.detail {
  width: 100%; max-width: 960px; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 22px;
  padding: 28px; border-radius: 20px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-card);
}
.detail > *:not(.diamond) { position: relative; }
.detail .diamond { right: -80px; top: -80px; width: 170px; height: 170px; border-radius: 34px; background: rgba(247,137,31,0.10); }
.detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.detail-head .who { display: flex; align-items: center; gap: 14px; }
.detail-head h2 { margin: 0; font-size: 22px; font-weight: 800; color: var(--navy); }
.detail-head .date { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px; }
.facts > div { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 14px; background: var(--page); }
.facts dt { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-size: 15px; font-weight: 700; color: var(--navy); overflow-wrap: anywhere; }
.facts dd a { color: var(--navy); }
.block { display: flex; flex-direction: column; gap: 8px; }
.block h3, .block > label { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--navy); }
.clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }
.answer-input { height: 50px !important; font-size: 16px !important; font-weight: 600; }
.read-only { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--page); font-size: 15px; line-height: 1.5; color: var(--navy); white-space: pre-line; overflow-wrap: anywhere; }
.read-only.empty { color: var(--muted); }
.detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.detail-actions .btn-navy { padding: 0 22px; }

/* ---------- toasts ---------- */
.toasts { display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: var(--green-soft); color: var(--green-ink); border: 1px solid #BFE6CC;
}
.toast.error { background: #FDECEC; color: var(--red); border-color: #F5C2C2; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-brand {
  flex: 1 1 520px; position: relative; overflow: hidden; color: #fff; padding: 56px 64px;
  background: linear-gradient(160deg, var(--navy-2) 0%, var(--navy) 55%, var(--navy-3) 100%);
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px; min-height: 560px;
}
.auth-brand > *:not(.diamond) { position: relative; }
.auth-brand .brand { align-items: flex-start; gap: 4px; }
.auth-brand .brand-name { font-size: 34px; }
.auth-brand .brand-sub { color: rgba(255,255,255,0.8); }
.auth-pitch { display: flex; flex-direction: column; gap: 28px; max-width: 460px; }
.auth-pitch h1 { margin: 0; font-size: 44px; line-height: 1.12; font-weight: 800; letter-spacing: -0.025em; text-wrap: balance; }
.auth-pitch h1 span { color: var(--orange); }
.auth-pitch p { margin: 0; font-size: 17px; line-height: 1.6; color: rgba(255,255,255,0.82); }
.auth-pitch ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-pitch li { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 500; }
.auth-pitch li .tick { width: 28px; height: 28px; border-radius: 8px; background: rgba(247,137,31,0.18); color: var(--orange); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.auth-foot { display: flex; align-items: center; gap: 12px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.18); font-size: 14px; line-height: 1.45; color: rgba(255,255,255,0.85); max-width: 460px; }
.auth-side { flex: 1 1 480px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 56px 24px; }
.auth-box { position: relative; width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 32px; }
.auth-box h2 { margin: 0; font-size: 32px; font-weight: 400; letter-spacing: -0.02em; color: var(--navy); }
.auth-box h2 strong { font-weight: 800; }
.auth-form { display: flex; flex-direction: column; gap: 20px; background: #fff; border-radius: 20px; padding: 32px; box-shadow: 0 12px 40px rgba(10,42,102,0.08); border: 1px solid var(--line); }
.icon-input { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 14px; background: var(--field); color: var(--muted); }
.icon-input.with-btn { padding-right: 6px; }
.icon-input:focus-within { outline: 2px solid var(--orange); outline-offset: 1px; }
.icon-input input, .field .icon-input input { flex: 1; padding: 0; border-radius: 0; outline: 0; min-width: 0; border: 0; background: transparent; height: 48px; font: inherit; font-size: 15px; color: var(--ink); }
.icon-input input:focus { outline: 0; }
.icon-input button { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-login { height: 52px; font-size: 16px; }
.auth-note { margin: 0; display: flex; align-items: flex-start; justify-content: center; gap: 10px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.auth-note .ic { margin-top: 1px; }
.totp-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.totp-qr { align-self: center; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: #fff; line-height: 0; }
.totp-key { font-size: 13px; color: var(--text-2); }
.totp-key summary { cursor: pointer; color: var(--navy); font-weight: 600; }
.totp-key code { display: block; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--page); font-size: 15px; letter-spacing: 0.08em; color: var(--navy); overflow-wrap: anywhere; user-select: all; }
.icon-input input.totp-input { font-size: 20px; font-weight: 700; letter-spacing: 0.2em; }

/* ---------- responsive ---------- */

/* Phones & tablets: the sidebar becomes a sticky top bar with a menu button */
@media (max-width: 899px) {
  .shell { flex-direction: column; flex-wrap: nowrap; }
  .sidebar { flex: none; position: sticky; top: 0; z-index: 60; padding: 10px 16px; gap: 0; box-shadow: 0 6px 20px rgba(7,31,74,0.18); }
  .sidebar .diamond { display: none; }
  .sidebar-top { justify-content: space-between; min-height: 48px; }
  .sidebar .brand { flex-direction: row; align-items: baseline; gap: 10px; }
  .sidebar .brand-name { font-size: 24px; }
  .sidebar .brand-sub { font-size: 12px; }
  .nav-toggle { display: inline-flex; }
  .sidebar-body { display: none; gap: 16px; padding: 14px 0 6px; max-height: calc(100vh - 70px); overflow-y: auto; }
  .sidebar.nav-open .sidebar-body { display: flex; }
  .sidebar-foot { margin-top: 0; gap: 10px; padding-top: 14px; }
  .sidebar-foot .tagline { display: none; }
  .main { flex: 1 0 auto; padding: 28px 24px 48px; }

  /* Login & code pages: a slim brand header instead of the big panel */
  .auth { flex-direction: column; flex-wrap: nowrap; }
  .auth-brand { flex: none; min-height: 0; padding: 18px 24px; gap: 0; }
  .auth-brand .diamond, .auth-pitch, .auth-foot { display: none; }
  .auth-brand .brand-name { font-size: 28px; }
  .auth-side { flex: 1 0 auto; align-items: flex-start; padding: 40px 20px 48px; }
}

/* Tables become one card per row once the table no longer fits */
@container (max-width: 939px) {
  .table-scroll { overflow: visible; }
  .grid-head { display: none; }
  .grid-body > li.grid-row { min-width: 0; gap: 6px 12px; padding: 16px; }
  .grid-body > li.grid-row > div { padding: 0 !important; }
  .grid-body > li:first-child { border-top: 0; }
  .m-label { display: inline; color: var(--muted); font-weight: 500; }

  .grid-body > li.cols-orders {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "num name menu" "num phone menu" "cat cat cat" "req req req" "ans ans ans" "status status date";
  }
  .c-num { grid-area: num; align-self: start; }
  .c-name { grid-area: name; font-size: 15px; }
  .c-phone { grid-area: phone; font-size: 13px; color: var(--text-2); }
  .c-menu { grid-area: menu; align-self: start; }
  .c-req { grid-area: req; }
  .c-ans { grid-area: ans; border-radius: 10px; background: var(--page); }
  .grid-body > li.grid-row > div.c-ans { padding: 8px 12px !important; }
  .c-status { grid-area: status; margin-top: 4px; }
  .c-cat { grid-area: cat; margin-top: 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
  .c-date { grid-area: date; margin-top: 4px; font-size: 13px; color: var(--muted); align-self: center; }

  .grid-body > li.cols-users {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "who actions" "role toggle" "login login";
  }
  .grid-body > li.cols-cats {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "who actions" "count toggle";
  }
  .c-who { grid-area: who; } .c-actions { grid-area: actions; } .c-role { grid-area: role; }
  .c-toggle { grid-area: toggle; } .c-login { grid-area: login; font-size: 13px; } .c-count { grid-area: count; font-size: 14px; }
  .c-role, .c-toggle, .c-count { display: flex; align-items: center; gap: 6px; }
}
/* Tablets: two order cards side by side */
@container (min-width: 600px) and (max-width: 939px) {
  .cols-orders-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-orders-body > li:nth-child(2) { border-top: 0; }
  .cols-orders-body > li:nth-child(even) { border-left: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .main { padding: 20px 16px 40px; gap: 20px; }
  .title-block h1 { font-size: 26px; }
  .auth-side { padding: 28px 16px 40px; }
  .auth-box { gap: 24px; }
  .auth-box h2 { font-size: 28px; }
  .auth-form { padding: 24px 20px; }
  .pill.search { width: 100%; }

  /* Status tabs: one swipeable row instead of five wrapped ones */
  .tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }

  /* Filters: search on its own row, category + date side by side */
  .toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar .pill.search { grid-column: 1 / -1; }
  .toolbar .date-filter-wrap, .toolbar .date-filter, .toolbar .date-filter > summary { width: 100%; min-width: 0; }
  .toolbar .date-filter > summary { padding: 0 12px; gap: 8px; }
  .toolbar .date-filter > summary > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .toolbar .date-filter.is-active > summary { padding-right: 40px; }

  .head-actions { width: 100%; }
  .form-section, .split-section { padding: 20px; }
  .form-meta, .form-actions { padding: 16px 20px; }
  .detail { padding: 20px; }
}
@media (max-width: 640px) {
  .popover {
    position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px;
    width: auto; max-width: none; z-index: 50;
  }
  .date-filter[open] > summary::before {
    content: ''; position: fixed; inset: 0; z-index: 40; background: rgba(7,31,74,0.35);
  }
}
