/* Lumati Protocols admin, in the look of Lumati's membership CRM: light, an indigo accent,
   cool off-white neutrals and navy text. System fonts only, nothing loaded from elsewhere,
   and no script: the phone menu is a checkbox. */
:root {
  /* The CRM's tokens, as its stylesheet has them. */
  --bg: oklch(97.6% 0.004 264);
  --panel: oklch(99.6% 0.0015 264);
  --panel-2: oklch(96.6% 0.004 264);
  --border: oklch(92.6% 0.006 264);
  --border-strong: oklch(88% 0.009 264);
  --text: oklch(25% 0.03 264);
  --muted: oklch(48% 0.025 260);
  --faint: oklch(64% 0.02 262);
  --accent: oklch(58.5% 0.215 277);
  --accent-dark: oklch(51% 0.245 277);
  --accent-soft: oklch(58.5% 0.215 277 / 0.11);
  --accent-tint: oklch(96.4% 0.02 277);
  --on-accent: oklch(99.5% 0.005 277);
  --danger: oklch(57% 0.215 27);
  --danger-tint: oklch(95.8% 0.03 27);
  --ok: oklch(58% 0.15 152);
  --ok-tint: oklch(95.8% 0.04 156);
  --warn: oklch(60% 0.13 70);
  --warn-tint: oklch(96% 0.05 85);
  --info: oklch(56% 0.17 255);
  --info-tint: oklch(96% 0.035 255);
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px oklch(25% 0.03 264 / 0.06);
  --shadow-lg: 0 12px 28px oklch(25% 0.03 264 / 0.14), 0 3px 8px oklch(25% 0.03 264 / 0.08);
  --transition: 160ms cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Text on the CRM's tints, and white on its indigo, a step darker than the CRM draws them,
     so that each pair reaches 4.5:1 (the CRM's own pairs measure 3.3 to 4.4:1). Form fields
     get an edge of 3:1 against the panel. */
  --faint-text: oklch(54% 0.02 262);
  --accent-fill: oklch(56% 0.215 277);
  --danger-text: oklch(52% 0.215 27);
  --ok-text: oklch(48% 0.15 152);
  --warn-text: oklch(50% 0.13 70);
  --info-text: oklch(50% 0.17 255);
  --field-border: var(--faint);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }

h1 { margin: 0 0 6px; font-size: 1.4rem; line-height: 1.25; letter-spacing: -0.01em; }
h1 + p { margin-bottom: 18px; font-size: 14px; color: var(--muted); }
h2 { margin: 32px 0 10px; font-size: 1.05rem; line-height: 1.3; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
p.muted { font-size: 14px; }
.note { margin: 4px 0 0; font-size: 13px; font-weight: 400; color: var(--muted); }
code { font-family: var(--mono); font-size: 0.85em; color: var(--muted); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* ---- the frame: a sidebar, and a main column with the top bar ---- */
.app-shell { display: flex; align-items: flex-start; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex: none;
  flex-direction: column;
  width: 212px;
  height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; }
.sidebar .brand { padding: 15px 18px; border-bottom: 1px solid var(--border); }
.sidebar .brand:focus-visible { outline-offset: -4px; } /* inside: the sidebar clips what overflows it */
.brand-mark { flex: none; width: 26px; height: 26px; }
.brand-word { display: block; width: auto; height: 17px; }
.brand-tag {
  margin-left: auto;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-tint);
  border-radius: 100px;
}

.side-nav { display: flex; flex: 1; flex-direction: column; gap: 1px; padding: 10px 8px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group-label {
  padding: 12px 10px 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint-text);
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.side-nav a:hover { color: var(--text); background: var(--panel-2); }
.side-nav a[aria-current="page"] { font-weight: 600; color: var(--accent-dark); background: var(--accent-tint); }
.nav-badge {
  min-width: 20px;
  margin-left: auto;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  color: var(--danger-text);
  background: var(--danger-tint);
  border-radius: 100px;
}
/* The site preview at the foot of the sidebar, across its whole width. */
.side-foot { margin: auto -8px -10px; padding: 10px 8px; border-top: 1px solid var(--border); }

.app-main { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-height: 57px;
  padding: 11px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.env-pill {
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--warn-text);
  background: var(--warn-tint);
  border-radius: 100px;
}
.env-staging { color: var(--info-text); background: var(--info-tint); }
.env-live { color: var(--ok-text); background: var(--ok-tint); }
.who { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: 14px; }
.who form { margin: 0; }
.who-name { overflow: hidden; max-width: 16rem; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.role-pill {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-tint);
  border-radius: 100px;
}

/* The warnings: bars across the main column, under the top bar. */
.banner {
  margin: 0;
  padding: 9px 24px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--danger-text);
  background: var(--danger-tint);
  border-bottom: 1px solid oklch(57% 0.215 27 / 0.2);
}
.banner-info { color: var(--info-text); background: var(--info-tint); border-bottom-color: oklch(56% 0.17 255 / 0.2); }

main.view { width: 100%; max-width: 1400px; margin: 0 auto; padding: 24px 28px 48px; }

.flashes { display: flex; flex-direction: column; gap: 8px; margin: 0 0 18px; }
.flash {
  margin: 0;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.flash-success { color: var(--ok-text); background: var(--ok-tint); border-color: transparent; }
.flash-error { color: var(--danger-text); background: var(--danger-tint); border-color: transparent; }

/* ---- buttons ---- */
button,
.button,
.pager a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
button:hover,
.pager a:hover { background: var(--panel-2); border-color: var(--border-strong); }
button:active,
.button:active { transform: translateY(1px); }
/* The main action of a form: Release, Save, Add item, Sign off, Sign in. */
.button { font-weight: 600; color: var(--on-accent); background: var(--accent-fill); border-color: var(--accent-dark); }
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button.button-quiet { font-weight: 500; color: var(--text); background: var(--panel); border-color: var(--border); }
.button.button-quiet:hover { background: var(--panel-2); border-color: var(--border-strong); }
/* What cannot be taken back lightly: Cancel order, Disable, Switch off, Go live. */
.button.button-danger { font-weight: 500; color: var(--danger-text); background: var(--panel); border-color: var(--border); }
.button.button-danger:hover { background: var(--danger-tint); border-color: var(--danger); }
.button.button-small { padding: 4px 10px; }
/* Sign out: a button without a frame until it is pointed at. */
.link-button { color: var(--text); background: transparent; border-color: transparent; box-shadow: none; }
.link-button:hover { background: var(--panel-2); border-color: var(--border); }

/* ---- forms ---- */
label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--muted); }
input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  max-width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}
input[type="text"]:hover,
input[type="date"]:hover,
input[type="number"]:hover,
select:hover,
textarea:hover { border-color: var(--muted); }
input:focus-visible,
select:focus-visible,
textarea:focus-visible { border-color: var(--accent-dark); outline-offset: 1px; }
textarea { width: 18rem; line-height: 1.45; }
input[type="number"] { width: 6rem; }
input[type="checkbox"] { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent-dark); cursor: pointer; }

main.view > form { margin: 0 0 14px; }
form.stack { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 0 0 12px; }
form.stack:last-child { margin-bottom: 0; }
form.stack .note { margin: 0 0 4px; }
form.inline { margin: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-weight: 400; }

/* The store's add form and edit forms: fields as wide as the room allows, up to a readable line. */
form.item-form input[type="text"],
form.item-form textarea { width: 100%; max-width: 32rem; }

summary { padding: 6px 0; font-size: 13.5px; font-weight: 600; line-height: 20px; color: var(--accent-dark); cursor: pointer; }
details[open] > summary { margin-bottom: 6px; }
details.add-item {
  margin: 0 0 18px;
  padding: 4px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
details.add-item[open] { padding-bottom: 16px; }

/* ---- tables ---- */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th,
table.data td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
table.data thead th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  background: var(--panel-2);
}
table.data tbody tr { transition: background var(--transition); }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data tbody tr:last-child > td,
table.data tbody tr:last-child > th { border-bottom: 0; }
table.data td.nowrap { white-space: nowrap; }
table.data td.wide { min-width: 16rem; }
table.data td.actions { min-width: 13rem; }

/* A table that must stay inside the page's width (States, SKU flags, Store): its headers and
   cells wrap instead of scrolling sideways, and the forms of a row sit in its first cell. */
table.fit th,
table.fit td { padding: 9px 10px; }
table.fit thead th { white-space: normal; }
table.fit tbody td:first-child { min-width: 12rem; font-weight: 600; }
table.fit td.wide { min-width: 10rem; }
table.fit td.stamp { min-width: 7rem; }
table.fit td.reasons { min-width: 12rem; }
table.fit td.breaks { overflow-wrap: anywhere; }
table.fit td.breaks code { white-space: normal; }
table.fit td.item { min-width: 15rem; }
table.fit td.reasons .sellable { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
table.fit td.name { min-width: 8rem; }
table.fit td.prices { min-width: 9rem; }
table.fit td.prices > span { display: block; }
table.fit td.prices > span + span { margin-top: 4px; }
table.fit td.prices .label { display: block; font-size: 12.5px; color: var(--muted); }
table.fit td.prices .value { white-space: nowrap; }
table.fit .address { font-weight: 600; overflow-wrap: anywhere; }
table.fit textarea,
table.fit input[type="text"],
table.fit input[type="date"] { width: 100%; }
table.fit details { margin-top: 6px; font-weight: 400; }

/* ---- pills, badges and chips ---- */
/* A compliance state. */
.pill {
  display: inline-block;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 100px;
}
.pill-held { color: var(--warn-text); background: var(--warn-tint); }
.pill-hold_refused { color: var(--danger-text); background: var(--danger-tint); }
.pill-alerted { color: var(--info-text); background: var(--info-tint); }
.pill-released { color: var(--ok-text); background: var(--ok-tint); }

.badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 100px;
}
.badge-ok { color: var(--ok-text); background: var(--ok-tint); }
.badge-bad { color: var(--danger-text); background: var(--danger-tint); }

/* A violation code. The comma between two is read out but not drawn. */
code.chip {
  display: inline-block;
  margin: 0 3px 3px 0;
  padding: 1px 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 100px;
}
.sep { position: absolute; width: 1px; height: 1px; overflow: hidden; white-space: nowrap; clip-path: inset(50%); }

/* ---- notices and facts ---- */
.notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--info-text);
  background: var(--info-tint);
  border: 1px solid oklch(56% 0.17 255 / 0.3);
  border-radius: var(--radius);
}
.notice-error { color: var(--danger-text); background: var(--danger-tint); border-color: oklch(57% 0.215 27 / 0.3); }
.code { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.notice .code { color: inherit; }

dl.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  max-width: 56rem;
  margin: 0 0 18px;
  padding: 2px 16px;
  font-size: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
dl.facts dt,
dl.facts dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--border); }
dl.facts dt { padding-right: 24px; color: var(--muted); }
dl.facts dt:last-of-type,
dl.facts dd:last-of-type { border-bottom: 0; }

.pager { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; font-size: 14px; color: var(--muted); }

/* ---- signed-out pages: one card in the middle ---- */
body.card-page { display: flex; flex-direction: column; min-height: 100vh; }
.card-main { display: grid; flex: 1; place-items: center; padding: 40px 16px; }
.card {
  width: 100%;
  max-width: 380px;
  padding: 36px 32px 30px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.card .brand { justify-content: center; margin: 0 0 26px; }
.card .brand-mark { width: 34px; height: 34px; }
.card .brand-word { height: 22px; }
.card .brand-tag { margin-left: 2px; }
.card h1 { margin-bottom: 10px; font-size: 1.3rem; }
.card p:not(.notice) { font-size: 14px; color: var(--muted); }
.card > :last-child { margin-bottom: 0; }
.card .notice { text-align: left; }
.card .button { min-height: 38px; padding: 8px 18px; font-size: 14px; }
.card-foot { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.card-foot .who { flex-wrap: wrap; justify-content: center; margin: 0; }

/* ---- a phone: the sidebar folds into a menu that the checkbox opens ---- */
.nav-open,
.nav-toggle { display: none; }

@media (max-width: 768px) {
  .app-shell { display: block; }
  .sidebar {
    position: relative;
    width: auto;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar .brand { min-height: 56px; padding: 12px 72px 12px 16px; border-bottom: 0; }
  .sidebar .brand-tag { margin-left: 4px; }
  .nav-open {
    position: absolute;
    top: 6px;
    right: 12px;
    z-index: 2;
    display: block;
    width: 44px;
    height: 44px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }
  .nav-toggle {
    position: absolute;
    top: 6px;
    right: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 44px;
    height: 44px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
  }
  .nav-toggle span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 1px; transition: transform var(--transition), opacity var(--transition); }
  .nav-open:hover + .nav-toggle { background: var(--panel-2); }
  .nav-open:focus-visible + .nav-toggle { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
  .nav-open:checked + .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-open:checked + .nav-toggle span:nth-child(2) { opacity: 0; }
  .nav-open:checked + .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .side-nav { display: none; padding: 4px 8px 10px; border-top: 1px solid var(--border); }
  .nav-open:checked ~ .side-nav { display: flex; }
  .side-foot { margin: 8px -8px -10px; }

  .topbar { position: static; min-height: 0; padding: 10px 16px; }
  .who { gap: 8px; }
  .who-name { max-width: 10rem; }
  .banner { padding: 9px 16px; }
  main.view { padding: 18px 16px 40px; }
  table.data th,
  table.data td { padding: 8px 10px; }
  textarea { width: 100%; }
  dl.facts { grid-template-columns: 1fr; }
  dl.facts dt { padding: 9px 0 0; border-bottom: 0; }
  dl.facts dd { padding: 2px 0 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
