/* Operator and admin app shell. Loaded after style.css, reuses its tokens, fonts and buttons. */

.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: var(--bg); }
.app-side { background: var(--ink); color: rgba(250, 245, 239, 0.8); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.app-side .logo { color: var(--bg); font-size: 18px; padding: 4px 10px 18px; }
.app-side .logo b { color: var(--sun); }
.app-side__label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(250, 245, 239, 0.5); padding: 14px 10px 6px; }
.app-nav a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 500; transition: background-color 140ms var(--ease-out); }
.app-nav a[aria-current="page"] { background: rgba(250, 245, 239, 0.12); color: var(--white); }
@media (hover: hover) { .app-nav a:hover { background: rgba(250, 245, 239, 0.07); } }
.app-nav .count { font-size: 12px; background: var(--sun); color: var(--ink); border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.app-side__foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(250, 245, 239, 0.12); font-size: 13px; }
.app-side__foot button { background: none; border: 0; color: inherit; padding: 6px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.app-main { min-width: 0; }
.app-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px clamp(16px, 3vw, 36px); border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.app-top h1 { font-size: clamp(22px, 2.4vw, 28px); }
.app-top .muted { font-size: 14px; }
.app-body { padding: clamp(16px, 3vw, 36px); display: grid; gap: 24px; }
.app-menu { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .app-side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform 220ms var(--ease-out); }
  .app-side.is-open { transform: none; }
  .app-menu { display: inline-flex; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
}

/* Panels, KPI tiles */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: clamp(18px, 2.4vw, 26px); min-width: 0; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel__head h2 { font-size: 19px; letter-spacing: -0.02em; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; }
.kpi span { display: block; font-size: 13px; color: var(--muted); }
.kpi strong { display: block; font-family: var(--serif); font-size: clamp(24px, 2.6vw, 30px); letter-spacing: -0.03em; margin-top: 4px; }
.kpi small { font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* Notice banners */
.notice { border-radius: var(--r-md); padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; border: 1px solid; }
.notice p { margin-top: 2px; font-size: 14px; }
.notice--warn { background: #FBEFD5; border-color: #EBCB8B; color: #6B4600; }
.notice--info { background: #DDEDEE; border-color: #A9CDD0; color: #134248; }
.notice--bad { background: #F8E1DE; border-color: #E4ADA6; color: #8A231B; }
.notice--good { background: #E3F1E8; border-color: #A8D2B6; color: #1A5A3A; }

/* Tables */
.table-wrap { overflow-x: auto; margin-inline: -4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .sub { display: block; font-size: 12px; color: var(--muted); }
table.data tbody tr.is-click { cursor: pointer; }
@media (hover: hover) { table.data tbody tr.is-click:hover td { background: var(--bg); } }
.empty-row { text-align: center; color: var(--muted); padding: 32px 12px !important; }

/* Status chips */
.chip-s { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.chip-s::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-live, .s-approved, .s-confirmed, .s-verified, .s-paid { background: #E3F1E8; color: #1A5A3A; }
.s-review, .s-pending, .s-uploaded, .s-scheduled { background: #FBEFD5; color: #6B4600; }
.s-rejected, .s-cancelled, .s-suspended, .s-missing, .s-noshow { background: #F8E1DE; color: #8A231B; }
.s-draft, .s-completed, .s-paused { background: #ECE6DC; color: #4F4A42; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type="search"], .toolbar select { padding: 9px 12px; border: 1px solid #CFC3B3; border-radius: var(--r-sm); background: var(--white); font-size: 14px; }
.toolbar input[type="search"] { min-width: 220px; flex: 1; max-width: 340px; }
.btn--xs { padding: 7px 14px; font-size: 13px; }
.btn--ghost-ink { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--danger { background: #A12C22; color: var(--white); }
@media (hover: hover) { .btn--ghost-ink:hover { border-color: var(--ink); } .btn--danger:hover { background: #87231B; } }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Bar chart (CSS only) */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 6px; height: 160px; padding-top: 8px; }
.bars div { background: var(--primary); border-radius: 4px 4px 0 0; min-height: 3px; position: relative; }
.bars div:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: 12px; padding: 4px 8px; border-radius: 4px; white-space: nowrap; }
.bars-x { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 6px; text-align: center; }

/* Definition list for detail views */
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
@media (max-width: 600px) { .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; } }

/* Drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(20, 24, 23, 0.4); z-index: 40; opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease-out); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg); z-index: 41; transform: translateX(100%); transition: transform 240ms var(--ease-out); overflow-y: auto; display: flex; flex-direction: column; }
.drawer.is-open { transform: none; }
.drawer-bg.is-open { opacity: 1; pointer-events: auto; }
.drawer__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
.drawer__head h2 { font-size: 20px; }
.drawer__body { padding: 24px; display: grid; gap: 22px; }
.drawer__body h3 { font-size: 15px; margin-bottom: 10px; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 18px; line-height: 1; }

/* Auth and onboarding pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth__aside { position: relative; color: var(--white); overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(24px, 4vw, 48px); }
.auth__aside img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.auth__aside::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18, 22, 21, 0.55), rgba(18, 22, 21, 0.78)); }
.auth__aside > * { position: relative; z-index: 1; }
.auth__aside .logo { color: var(--white); }
.auth__aside .logo b { color: var(--sun); }
.auth__aside h2 { font-size: clamp(28px, 3.4vw, 42px); max-width: 16ch; margin-bottom: 18px; }
.auth__aside ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 15px; color: rgba(255, 255, 255, 0.9); }
.auth__main { padding: clamp(24px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; }
.auth__card { width: 100%; max-width: 520px; margin-inline: auto; }
.auth__card h1 { font-size: clamp(28px, 3vw, 36px); margin-bottom: 8px; }
.auth__alt { margin-top: 20px; font-size: 14px; color: var(--muted); }
.auth__alt a { color: var(--ink); font-weight: 600; }
.demo-box { margin-top: 28px; padding: 16px; border: 1px dashed #CFC3B3; border-radius: var(--r-md); font-size: 14px; }
.demo-box p { color: var(--muted); margin-bottom: 10px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { min-height: 0; padding: 18px 20px 22px; gap: 14px; justify-content: flex-start; background: var(--ink); }
  .auth__aside img, .auth__aside::after { display: none; }
  .auth__aside h2 { font-size: 22px; max-width: none; margin-bottom: 0; }
  .auth__aside ol { display: none; }
}

.session-bar { font-size: 14px; color: var(--muted); padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Stepper (onboarding and product wizard) */
.stepper-nav { list-style: none; padding: 0; margin: 0 0 28px; display: flex; gap: 6px; flex-wrap: wrap; counter-reset: st; }
.stepper-nav li { counter-increment: st; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); }
.stepper-nav li::before { content: counter(st); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface); color: var(--ink); }
.stepper-nav li.is-done::before { content: "\2713"; background: var(--sea); color: var(--white); }
.stepper-nav li.is-current { color: var(--ink); border-color: var(--ink); font-weight: 600; }
.stepper-nav li.is-current::before { background: var(--primary); color: var(--white); }
.stepper-nav button { all: unset; cursor: pointer; }
.step-panel h2 { font-size: 24px; margin-bottom: 6px; }
.step-panel > p.muted { margin-bottom: 8px; }
.step-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.field small { font-size: 12px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: #A12C22; }

/* Choice cards (radio/checkbox) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.choice { position: relative; display: flex; gap: 10px; align-items: center; border: 1px solid #CFC3B3; border-radius: var(--r-md); padding: 12px 14px; background: var(--white); cursor: pointer; font-size: 14px; font-weight: 500; }
.choice input { width: auto; accent-color: var(--primary); margin: 0; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--surface); }

/* Upload */
.upload { border: 1.5px dashed #CFC3B3; border-radius: var(--r-md); padding: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--white); flex-wrap: wrap; }
.upload strong { display: block; font-size: 15px; }
.upload .muted { font-size: 13px; }
.upload input[type="file"] { font-size: 13px; max-width: 230px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.photos figure { margin: 0; position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photos button { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(20, 24, 23, 0.75); color: var(--white); cursor: pointer; }
.photos .cover { position: absolute; left: 6px; bottom: 6px; background: var(--bg); color: var(--ink); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }

/* Lists editable */
.list-edit { display: grid; gap: 8px; }
.list-edit div { display: flex; gap: 8px; }
.list-edit input { flex: 1; }

/* Preview card in product wizard */
.preview { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.preview img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-md); background: var(--surface); }
@media (max-width: 700px) { .preview { grid-template-columns: 1fr; } }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
.checklist li::before { content: "\2713"; color: var(--sea); font-weight: 700; margin-right: 8px; }
.checklist li.is-missing::before { content: "!"; color: #A12C22; }
