/* Ritu's back office. Same family as the shop: lavender paper, forest ink,
   Instrument Serif for the words that matter, DM Sans for everything else. */
:root {
  color-scheme: light;
  --paper: #EFEAF7; --card: #FBF9FE; --lav: #E9E2F5; --lav-2: #DDD3EE;
  --ink: #1E1D1B; --mute: #6A6577; --line: #E2DCEC; --line-2: #CFC6DE;
  --forest: #15301F; --forest-2: #1F4630; --pista: #D5E0B1; --pista-ink: #2F3D12;
  --amber: #F4E3B8; --amber-ink: #6B4A00; --rose: #F6D9D9; --rose-ink: #7A2323; --sky: #DCE7F5; --sky-ink: #1F3E66;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', system-ui, -apple-system, Arial, sans-serif;
  --mono: 'DM Mono', ui-monospace, Menlo, monospace;
  --r: 18px; --shadow: 0 1px 0 rgb(30 20 50 / .04), 0 8px 24px -12px rgb(30 20 50 / .18);
  --side: 232px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100svh; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
[hidden] { display: none !important; }

.wm { display: block; aspect-ratio: 1080 / 493; background: #12301C; -webkit-mask: url(/assets/wordmark.webp) center / contain no-repeat; mask: url(/assets/wordmark.webp) center / contain no-repeat; }

/* ---------- Login ---------- */
.login { min-height: 100svh; display: grid; place-items: center; padding: 24px; background: var(--lav); }
.login form { width: min(100%, 360px); display: grid; gap: 18px; justify-items: center; text-align: center; }
.login .wm { width: 150px; margin-bottom: 4px; }
.login h1 { font: 400 2.6rem/1 var(--serif); letter-spacing: -.02em; }
.login p { color: var(--mute); }
.login input { width: 100%; min-height: 56px; border: 1.5px solid var(--line-2); border-radius: 16px; background: #fff; text-align: center; font-size: 1.25rem; letter-spacing: .3em; }
.login input:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 4px rgb(21 48 31 / .1); }
.login .btn { width: 100%; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100svh; }
.side { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; gap: 6px; padding: 26px 16px; border-right: 1px solid var(--line); background: var(--lav); }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; }
.side .brand .wm { width: 78px; }
.side .brand span { font: 500 .66rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); padding-top: 8px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-decoration: none; font-weight: 500; color: #3a3646; }
.nav a:hover { background: rgb(255 255 255 / .5); }
.nav a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.nav svg { width: 20px; height: 20px; flex: none; }
.side .foot { margin-top: auto; display: grid; gap: 6px; padding: 0 10px; font-size: .82rem; color: var(--mute); }
.side .foot a { text-underline-offset: 3px; }

.main { min-width: 0; padding: 34px clamp(18px, 4vw, 48px) 90px; max-width: 1080px; }
.top { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.top h1 { font: 400 clamp(2.2rem, 5vw, 3rem)/1 var(--serif); letter-spacing: -.025em; }
.top p { color: var(--mute); margin-top: 6px; max-width: 60ch; }
.top .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Bottom tab bar on phones */
.tabs { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding: max(20px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
  .mtop { display: flex !important; }
  .tabs {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px max(6px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-right, 0px));
    background: rgb(251 249 254 / .94); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  }
  .tabs a { display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border-radius: 12px; text-decoration: none; font-size: .68rem; font-weight: 500; color: var(--mute); }
  .tabs a[aria-current="page"] { color: var(--forest); background: var(--lav); }
  .tabs svg { width: 22px; height: 22px; }
}
.mtop { display: none; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.mtop .wm { width: 64px; }
.mtop a { font-size: .85rem; color: var(--mute); text-underline-offset: 3px; }

/* ---------- Building blocks ---------- */
.grid { display: grid; gap: 16px; }
.g2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font: 400 1.6rem/1.05 var(--serif); letter-spacing: -.015em; }
.card h3 { font: 600 .95rem/1.3 var(--sans); }
.card .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.label { font: 500 .66rem/1 var(--mono); letter-spacing: .13em; text-transform: uppercase; color: var(--mute); }
.muted { color: var(--mute); }
.small { font-size: .85rem; }
.serif { font-family: var(--serif); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1.5px solid transparent; border-radius: 99px; background: var(--forest); color: #F3EEFA; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--forest-2); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--lav); }
.btn.soft { background: var(--lav); color: var(--ink); }
.btn.soft:hover { background: var(--lav-2); }
.btn.danger { background: transparent; color: var(--rose-ink); border-color: #E8BDBD; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: .85rem; }
.btn svg { width: 16px; height: 16px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font: 600 .74rem/1.4 var(--sans); white-space: nowrap; background: var(--lav); color: #3a3646; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill.paid, .pill.live, .pill.open { background: var(--pista); color: var(--pista-ink); }
.pill.pending, .pill.soon, .pill.draft { background: var(--amber); color: var(--amber-ink); }
.pill.collected, .pill.home { background: var(--sky); color: var(--sky-ink); }
.pill.refunded, .pill.cancelled, .pill.expired, .pill.archived, .pill.sold { background: #ECE8F1; color: #5d586a; }
.pill.warn { background: var(--rose); color: var(--rose-ink); }

/* Status hero */
.status { position: relative; overflow: hidden; background: var(--forest); color: #F3EEFA; border: 0; padding: 24px; }
.status .label { color: rgb(243 238 250 / .7); }
.status h2 { font: 400 clamp(2.6rem, 7vw, 3.8rem)/.95 var(--serif); letter-spacing: -.03em; margin: 10px 0 8px; }
.status p { color: rgb(243 238 250 / .78); max-width: 46ch; }
.status .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.status .btn.ghost { color: #F3EEFA; border-color: rgb(243 238 250 / .35); }
.status .btn.ghost:hover { background: rgb(255 255 255 / .08); }
.status.override { background: #5A3E06; }
.status .tub { position: absolute; right: -18px; bottom: -36px; width: 150px; opacity: .9; transform: rotate(-6deg); pointer-events: none; }
@media (max-width: 560px) { .status .tub { width: 110px; right: -24px; bottom: -30px; opacity: .5; } }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 38px; padding: 0 14px; border: 1.5px solid var(--line-2); border-radius: 99px; background: var(--card); font-size: .86rem; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg.on-dark button { background: transparent; color: #F3EEFA; border-color: rgb(243 238 250 / .3); }
.seg.on-dark button[aria-pressed="true"] { background: #F3EEFA; color: var(--forest); border-color: #F3EEFA; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; border-radius: 14px; background: var(--paper); }
.stat b { display: block; font: 400 2rem/1 var(--serif); letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.bar { height: 10px; border-radius: 99px; background: #E6E0EF; overflow: hidden; display: flex; margin: 14px 0 8px; }
.bar i { display: block; height: 100%; }
.bar .s { background: var(--forest); } .bar .h { background: #C7A54B; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--mute); }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }

.list { display: grid; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line); text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; }
.row-item:last-child { border-bottom: 0; }
button.row-item:hover { background: var(--paper); border-radius: 10px; }
.row-item .who { flex: 1; min-width: 0; }
.row-item .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .who span { font-size: .82rem; color: var(--mute); }
.row-item .amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.empty { padding: 34px 16px; text-align: center; color: var(--mute); }
.empty h3 { font: 400 1.6rem/1.1 var(--serif); color: var(--ink); margin-bottom: 6px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 220px; }
.search { position: relative; }
.search input { width: 100%; min-height: 42px; padding: 0 14px 0 38px; border: 1.5px solid var(--line-2); border-radius: 99px; background: var(--card); }
.search svg { position: absolute; left: 13px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--mute); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips button { flex: none; min-height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 99px; background: var(--card); font-size: .83rem; font-weight: 500; }
.chips button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Drop cards */
.drop { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.swatch { width: 54px; height: 54px; border-radius: 14px; background: var(--c, var(--pista)); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06); }
.swatch .wm { width: 38px; opacity: .8; }
.drop h3 { font: 400 1.5rem/1 var(--serif); letter-spacing: -.01em; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.drop p { font-size: .85rem; color: var(--mute); margin-top: 4px; }
@media (max-width: 560px) { .drop { grid-template-columns: auto minmax(0, 1fr); } .drop > :last-child { grid-column: 1 / -1; } }

/* ---------- Drawer (editor) ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; background: rgb(25 15 40 / .38); animation: fade .2s ease; }
.drawer .panel { width: min(100%, 520px); height: 100%; overflow: auto; background: var(--card); padding: 26px 24px calc(28px + env(safe-area-inset-bottom, 0px)); box-shadow: -20px 0 40px -20px rgb(25 15 40 / .35); animation: slide .28s cubic-bezier(.2, .8, .2, 1); }
.drawer .panel > header { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 18px; }
.drawer h2 { font: 400 2.1rem/1 var(--serif); letter-spacing: -.02em; }
.x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--paper); display: grid; place-items: center; flex: none; }
.x svg { width: 18px; height: 18px; }
@media (max-width: 600px) {
  .drawer { align-items: flex-end; }
  .drawer .panel { height: auto; max-height: 94svh; border-radius: 24px 24px 0 0; animation: rise .3s cubic-bezier(.2, .8, .2, 1); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

/* Forms */
.form { display: grid; gap: 16px; }
.form section { display: grid; gap: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.form section:first-child { border-top: 0; padding-top: 0; }
.form section > h3 { font: 500 .66rem/1 var(--mono); letter-spacing: .13em; text-transform: uppercase; color: var(--mute); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .two { grid-template-columns: 1fr; } }
.f { display: grid; gap: 6px; min-width: 0; }
.f > span { font-size: .84rem; font-weight: 600; }
.f > small { font-size: .78rem; color: var(--mute); line-height: 1.4; }
.f input, .f select, .f textarea { width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; }
.f textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 4px rgb(21 48 31 / .1); }
.f input[type="color"] { padding: 4px; height: 46px; }
.prefix { position: relative; }
.prefix i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--mute); }
.prefix input { padding-left: 40px; }
.choice { display: grid; gap: 8px; }
.choice label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: 14px; background: #fff; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--forest); background: #F4F8EE; }
.choice input { margin-top: 3px; accent-color: var(--forest); }
.choice b { display: block; font-weight: 600; }
.choice small { color: var(--mute); font-size: .8rem; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--forest); }
.sticky-save { position: sticky; bottom: calc(-28px - env(safe-area-inset-bottom, 0px)); margin: 8px -24px calc(-28px - env(safe-area-inset-bottom, 0px)); padding: 14px 24px calc(16px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, var(--card) 30%); display: flex; gap: 10px; }
.sticky-save .btn { flex: 1; }
.err { padding: 12px 14px; border-radius: 12px; background: var(--rose); color: var(--rose-ink); font-size: .88rem; }
.hint { padding: 12px 14px; border-radius: 12px; background: var(--paper); color: #4a4558; font-size: .85rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .92rem; }
.kv dt { color: var(--mute); } .kv dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }

#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; padding: 12px 18px; border-radius: 99px; background: var(--ink); color: #fff; font-weight: 500; box-shadow: var(--shadow); animation: rise .25s ease; }
@media (min-width: 861px) { #toast { bottom: 28px; } }
.spin { display: grid; place-items: center; min-height: 40svh; color: var(--mute); }
