/* Etsy Fulfillment Centre — refined amber theme.
   Distinct from the Amazon board's green; shared SwissHelvetia warmth. */

:root {
  /* ── palette ─────────────────────────────────────────────────────────── */
  --bg: #f7f3ea;
  --bg-glow: #fffdf8;
  --card: #ffffff;
  --line: #ece2d2;
  --line-soft: #f4ecdf;
  --line-strong: #dccbb0;
  --ink: #241c12;
  --ink-soft: #4a3d2c;
  --muted: #7d6b53;
  --faint: #a2917a;
  --accent: #17604a;
  --accent-soft: #2b7f61;
  --accent-dark: #0f3d2e;
  --accent-tint: #e7f2ec;
  /* SwissHelvetia brand green — the same chrome as the hub and HQ. */
  --sidebar: #12352a;
  --sidebar-2: #1a4638;
  --sidebar-deep: #0d281e;
  --sidebar-ink: #e8f2ec;
  --sidebar-muted: #9dbbac;
  --ok: #2f6b4f;
  --ok-tint: #e7f1ec;
  --warn: #8d6320;
  --warn-tint: #fbf1de;
  --red: #a4361f;
  --red-tint: #f9e8e3;

  /* ── form ────────────────────────────────────────────────────────────── */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(45, 33, 18, .05);
  --shadow: 0 1px 2px rgba(45, 33, 18, .05), 0 18px 40px -32px rgba(45, 33, 18, .38);
  --shadow-lg: 0 2px 6px rgba(45, 33, 18, .07), 0 32px 60px -44px rgba(45, 33, 18, .5);
  --ring: 0 0 0 3px rgba(23, 96, 74, .18);
  --ease: cubic-bezier(.22, .61, .36, 1);

  /* ── type ────────────────────────────────────────────────────────────── */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* CRITICAL: the [hidden] attribute must always win. Without this rule, class
   rules with an explicit `display` (`.boot`/`.gate` are `display: grid`, and
   `.shell` too) override the browser's built-in `[hidden]` styling, so the
   sign-in gate stays painted over the app even after a successful sign-in. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 12% -8%, var(--bg-glow) 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #fbf3e6 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: #f0e2c6; color: var(--ink); }

h1, h2, h3 { margin: 0; text-wrap: balance; }
p { line-height: 1.62; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.1px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.spacer { flex: 1; }

a { color: var(--accent-dark); }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

/* ── Boot + gate ───────────────────────────────────────────────────────── */

.boot, .gate {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: 26px; z-index: 40;
}

.boot {
  background: linear-gradient(180deg, #fbf7ef, var(--bg));
}
.boot span {
  display: flex; align-items: center; gap: 11px;
  color: var(--muted); font-size: 13.5px; letter-spacing: .01em;
}
.boot-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px;
  border-radius: 9px; background: linear-gradient(150deg, var(--accent-soft), var(--accent));
  color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: var(--shadow-sm);
}

.gate {
  background:
    radial-gradient(800px 420px at 50% 12%, #fffdf8, transparent 65%),
    linear-gradient(180deg, #fbf6ee, #f5efe3);
}
.gate-inner {
  width: 100%; max-width: 452px; text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 40px 34px 30px;
  box-shadow: var(--shadow-lg);
}
.gate-logo { margin-bottom: 18px; }
.gate-logo svg { filter: drop-shadow(0 8px 18px rgba(18, 53, 42, .3)); }
.gate h1 { font-family: var(--display); font-size: 27px; font-weight: 400; letter-spacing: -.4px; }
.gate .lead { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.fineprint { color: var(--faint); font-size: 12.5px; line-height: 1.6; margin-top: 20px; }

/* ── Shell ─────────────────────────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  display: flex; flex-direction: column; gap: 26px;
  padding: 26px 20px 22px;
  color: var(--sidebar-ink);
  background: linear-gradient(178deg, var(--sidebar-2) 0%, var(--sidebar) 58%, var(--sidebar-deep) 100%);
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar::after {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .14), transparent);
}

.sidebar-brand { display: flex; align-items: center; gap: 12px; }
.sidebar-brand .mark {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  background: linear-gradient(150deg, #f4f8f2, #dcead9);
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .7);
}
.sidebar-brand strong {
  font-size: 13.5px; font-weight: 700; line-height: 1.2; letter-spacing: .01em;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative;
  display: block; width: 100%; text-align: left;
  padding: 11px 14px;
  border: 0; border-radius: 11px;
  background: none; color: #b7d2c3;
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
/* Cream pill: a green indicator would vanish against the green chrome. */
.nav-item.active {
  background: linear-gradient(180deg, #f0f6ee, #dee9da);
  color: #12352a; font-weight: 650;
  box-shadow: 0 8px 20px -14px rgba(0, 0, 0, .75);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 11px; }
.who {
  font-size: 12px; color: var(--sidebar-muted); word-break: break-all;
  padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08);
}
.back {
  color: var(--sidebar-muted); font-size: 12.5px; text-decoration: none;
  transition: color .16s var(--ease);
}
.back:hover { color: #fff; }

.content { padding: 34px clamp(20px, 3.6vw, 46px) 72px; max-width: 1240px; min-width: 0; }
.view { display: none; }
.view.active { display: block; animation: rise .28s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.head { margin-bottom: 24px; }
.head h1 {
  font-family: var(--display); font-size: clamp(25px, 2.6vw, 31px);
  font-weight: 400; letter-spacing: -.6px; line-height: 1.15;
}
.head p { color: var(--muted); margin: 8px 0 0; max-width: 74ch; }

/* ── Cards ─────────────────────────────────────────────────────────────── */

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 15px; min-height: 30px;
}
.card-head h3 {
  font-size: 14.5px; font-weight: 650; letter-spacing: -.1px; color: var(--ink);
}
.card-head .badge { margin-left: 2px; }
.connect-card {
  text-align: center;
  padding: 42px 30px 34px;
  background:
    radial-gradient(720px 260px at 50% -12%, #fff8ec, transparent 72%),
    linear-gradient(180deg, #fffdf9, #fffcf6);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.connect-icon {
  width: 58px; height: 58px; margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 18px;
  color: #12352a;
  background: linear-gradient(160deg, #eff6ee, #dbead8);
  border: 1px solid #d5e6d3;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 14px 26px -20px rgba(18, 53, 42, .75);
}
.connect-card h3 {
  font-family: var(--display); font-size: 24px; font-weight: 400; letter-spacing: -.4px;
}
.connect-lede { max-width: 54ch; margin: 10px auto 20px; }

.steps {
  list-style: none; padding: 0;
  margin: 32px auto 0; max-width: 780px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px; text-align: left;
}
.steps li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 16px 15px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.steps .step-n {
  flex: none; width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: #fff; font-size: 12px; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}
.steps strong { display: block; font-size: 13px; font-weight: 650; margin-bottom: 3px; }
.steps p { margin: 0; font-size: 12.5px; line-height: 1.55; }

/* ── Tables ────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto; border-radius: 12px;
  border: 1px solid var(--line-soft);
}
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data th {
  position: sticky; top: 0;
  text-align: left; font-size: 10.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .1em; color: var(--faint);
  background: #fbf7f0;
  padding: 11px 13px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: 12px 13px; border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft); vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .empty { color: var(--muted); text-align: center; padding: 34px 20px; font-size: 13.5px; }
tr.row-link { cursor: pointer; transition: background .14s var(--ease); }
tr.row-link:hover td { background: #fdfaf4; }
tr.row-link:focus-visible td { background: #fdfaf4; }
tr.row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── Stats ─────────────────────────────────────────────────────────────── */

.stat-grid, .grid-2 { display: grid; gap: 18px; }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 20px; }
.grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }

.stat {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  background: linear-gradient(90deg, var(--accent-soft), transparent 85%);
  opacity: .85;
}
.stat .label {
  font-size: 10.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .1em; color: var(--faint);
}
.stat .value {
  font-family: var(--display); font-size: 27px; font-weight: 400;
  letter-spacing: -.5px; margin: 8px 0 3px; color: var(--ink);
}
.stat .sub { font-size: 12px; color: var(--muted); }

/* ── Controls ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 17px; min-height: 42px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: #fff; font-family: inherit; font-size: 13.5px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 1px 2px rgba(70, 50, 18, .22), inset 0 1px 0 rgba(255, 255, 255, .16);
  transition: filter .16s var(--ease), transform .16s var(--ease), box-shadow .16s var(--ease);
}
.btn:hover { filter: brightness(1.05); box-shadow: 0 2px 10px rgba(70, 50, 18, .2), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; transform: none; }
.btn.ghost {
  background: #fff; color: #12402f;
  border-color: #cfe0d4; box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { background: #f2f8f3; filter: none; }
.btn.danger {
  background: var(--red-tint); color: var(--red);
  border-color: #eccfc6; box-shadow: none;
}
.btn.danger:hover { background: #f6ded7; filter: none; }
.btn.sm { padding: 7px 13px; min-height: 34px; font-size: 12.5px; border-radius: 9px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.field { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 13px; }
.field input, .field select, .field textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 12px; min-height: 42px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font-family: inherit; font-size: 14px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field input::placeholder { color: #b9a88f; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent-soft); box-shadow: var(--ring);
}
.field.inline { display: inline-flex; flex-direction: column; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
  margin-bottom: 18px; padding: 16px 18px;
  background: #fffdf9; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.toolbar .field { margin-bottom: 0; }
.toolbar .btn { margin-bottom: 1px; }

details.extra { margin: 10px 0 18px; }
details.extra summary {
  cursor: pointer; color: var(--accent-dark); font-size: 12.5px; font-weight: 600;
  margin-bottom: 12px; list-style: none;
}
details.extra summary::-webkit-details-marker { display: none; }
details.extra summary::before { content: "▸ "; color: var(--faint); }
details.extra[open] summary::before { content: "▾ "; }

.addr {
  background: #fbf7ef; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 15px; font-size: 13px; white-space: pre-wrap;
  margin: 0; font-family: var(--mono); line-height: 1.7; color: var(--ink-soft);
}
.list { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); }
.list li:last-child { border-bottom: 0; padding-bottom: 0; }
.list li:first-child { padding-top: 0; }

/* ── Pills, badges, banners ────────────────────────────────────────────── */

.pill, .badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 10.5px; font-weight: 650; letter-spacing: .07em;
  text-transform: uppercase; white-space: nowrap;
  background: #f1ece1; color: var(--ink-soft);
}
.pill.ok, .badge.ok { background: var(--ok-tint); color: var(--ok); }
.pill.open, .badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.error { background: var(--red-tint); color: var(--red); }
.badge.neutral { background: #f1ece1; color: var(--ink-soft); }

.banner {
  padding: 14px 16px; border-radius: 12px; font-size: 13.5px;
  margin-bottom: 15px; line-height: 1.6; border: 1px solid transparent;
}
.banner.warn { background: var(--warn-tint); border-color: #f0dfc0; color: #7a5518; }
.banner.ok { background: var(--ok-tint); border-color: #cfe5d8; color: #2c5f47; }
.banner ul { margin: 8px 0 0; padding-left: 18px; }

.kv {
  display: grid; grid-template-columns: minmax(120px, auto) 1fr;
  gap: 9px 20px; font-size: 13.5px; margin: 0 0 16px;
}
.kv dt { color: var(--faint); font-weight: 500; }
.kv dd { margin: 0; color: var(--ink-soft); }

.role-matrix table { font-size: 13px; }

/* Stripe Elements mount point — the iframe lives inside this box. */
.card-element {
  background: #fff; border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 14px; margin: 4px 0 14px; max-width: 470px;
  box-shadow: var(--shadow-sm);
}

.draft-item {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 14px; background: #fffdfa;
  box-shadow: var(--shadow-sm);
}
.draft-item-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; color: var(--faint); font-size: 12px;
}
.draft-item-head .mono { color: var(--faint); }

input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  max-width: min(92vw, 600px);
  padding: 13px 19px; border-radius: 12px;
  background: #12352a; color: #eaf3ed; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 24px 50px -26px rgba(0, 0, 0, .6);
  z-index: 60; animation: toastIn .22s var(--ease) both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.error { background: #7d2a18; color: #fdeeea; }

/* ── Scrollbars ────────────────────────────────────────────────────────── */

* { scrollbar-width: thin; scrollbar-color: #d9cbb4 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: #ddd0ba; border-radius: var(--radius-pill);
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #cdbb9e; background-clip: content-box; }

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 940px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 12px; padding: 16px;
  }
  .sidebar-brand { margin-right: auto; }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; padding-bottom: 2px; }
  .nav-item { white-space: nowrap; }
  .sidebar-foot { margin: 0; flex-direction: row; align-items: center; width: 100%; }
  .who { border: 0; padding: 0; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 22px 16px 60px; }
  .gate-inner { padding: 32px 22px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
