/* Pashew back office — shared design tokens + components.
   White, black, gold. Calm, generous spacing, one soft shadow. */

:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --subtle: #F7F7F5;
  --text: #0A0A0A;
  --muted: #5F5F5F;
  --faint: #8C8C8C;
  --hairline: rgba(0, 0, 0, .08);
  --gold: #FFD700;
  --gold-text: #8A6E00;
  --gold-tint: rgba(255, 215, 0, .18);
  --green: #1E8E4E;
  --green-tint: rgba(30, 142, 78, .12);
  --red: #C0392B;
  --red-tint: rgba(192, 57, 43, .10);
  --grey-tint: rgba(0, 0, 0, .06);
  --shadow: 0 6px 24px rgba(0, 0, 0, .08);
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --focus: 0 0 0 3px rgba(255, 215, 0, .65);
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 19px; line-height: 1.3; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--text); text-underline-offset: 3px; }
a:hover { color: var(--gold-text); }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; }
.gold-text { color: var(--gold-text); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content:
  space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 0; border-radius: var(--r-sm);
  font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, opacity .15s, transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--text); color: #FFF; }
.btn-primary:hover:not(:disabled) { background: #262626; color: #FFF; }
.btn-gold { background: var(--gold); color: var(--text); }
.btn-gold:hover:not(:disabled) { background: #F2CC00; color: var(--text); }
.btn-ghost { background: var(--subtle); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: #EFEFEC; color: var(--text); }
.btn-danger { background: var(--red); color: #FFF; }
.btn-danger:hover:not(:disabled) { background: #A93226; color: #FFF; }
.btn-link { background: none; color: var(--text); padding: 0 4px;
  min-height: 32px; text-decoration: underline; text-underline-offset: 3px; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13.5px;
  border-radius: 10px; }
.btn-block { width: 100%; }

/* ----------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.field > label, .label { font-weight: 600; font-size: 14px; }
.field .req { color: var(--gold-text); }
.hint { color: var(--muted); font-size: 13px; }

input[type=text], input[type=email], input[type=number], input[type=search],
input[type=tel], select, textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  background: var(--subtle); color: var(--text);
  font: inherit; font-size: 16px; /* ≥16px stops iOS zooming */
  transition: background .15s, border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  outline: none; background: #FFF; border-color: rgba(0, 0, 0, .25);
  box-shadow: var(--focus);
}
input[aria-invalid=true], textarea[aria-invalid=true], select[aria-invalid=true] {
  border-color: var(--red); background: #FFF;
}
.field-error { color: var(--red); font-size: 13px; font-weight: 500; }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  font-size: 14px; margin-top: 16px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: #000;
  flex: none; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 24px;
}
.card-flat { background: var(--subtle); border-radius: var(--r-md);
  padding: 18px 20px; }
.card-title { font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 14px; }
.hairline { height: 1px; background: var(--hairline); border: 0;
  margin: 18px 0; }

/* ----------------------------------------------------------------- pills */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.5;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; }
.pill-gold { background: var(--gold-tint); color: var(--gold-text); }
.pill-green { background: var(--green-tint); color: var(--green); }
.pill-red { background: var(--red-tint); color: var(--red); }
.pill-grey { background: var(--grey-tint); color: var(--muted); }
.pill-black { background: var(--text); color: #FFF; }
.pill-black::before { background: var(--gold); }

/* ----------------------------------------------------------------- banners */

.banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500;
}
.banner-error { background: var(--red-tint); color: var(--red); }
.banner-gold { background: var(--gold-tint); color: var(--gold-text); }
.banner-info { background: var(--subtle); color: var(--text); }
.banner-green { background: var(--green-tint); color: var(--green); }

/* ----------------------------------------------------------------- tables */

.table-wrap {
  overflow: auto; border-radius: var(--r-md); box-shadow: var(--shadow);
  background: #FFF; max-height: calc(100vh - 220px);
}
table.table { width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 1; background: #FFF;
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 12px 14px; border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--hairline);
  vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #FCFBF5; }
.table tr.clickable:focus-visible { box-shadow: inset var(--focus); }
.table td.num, .table th.num { text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.table .sub { color: var(--muted); font-size: 12.5px; }

/* --------------------------------------------------------------- skeleton */

.skeleton-line {
  height: 12px; border-radius: 6px; margin: 6px 0;
  background: linear-gradient(90deg, #F0F0EE 25%, #F8F8F6 50%, #F0F0EE 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}
.skeleton-row td { padding: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .skeleton-line, .spinner { animation: none; }
}

/* ----------------------------------------------------------------- empty */

.empty { text-align: center; padding: 48px 16px; }
.empty-dot { width: 44px; height: 44px; border-radius: 50%;
  background: var(--gold-tint); margin: 0 auto 14px; position: relative; }
.empty-dot::after { content: ""; position: absolute; inset: 15px;
  border-radius: 50%; background: var(--gold); }
.empty-title { font-weight: 600; margin-bottom: 4px; }

/* ----------------------------------------------------------------- toasts */

.toasts {
  position: fixed; z-index: 1000; left: 50%; bottom: 24px;
  transform: translateX(-50%); display: flex; flex-direction: column;
  gap: 8px; align-items: center; pointer-events: none;
  width: min(92vw, 440px);
}
.toast {
  background: var(--text); color: #FFF; padding: 12px 18px;
  border-radius: var(--r-sm); box-shadow: var(--shadow);
  font-size: 14px; font-weight: 500; pointer-events: auto;
  animation: toast-in .2s ease-out;
}
.toast-success { border-left: 4px solid var(--gold); }
.toast-error { background: var(--red); }
.toast-out { opacity: 0; transition: opacity .35s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ----------------------------------------------------------------- dialog */

.dialog {
  border: 0; padding: 0; border-radius: var(--r-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .18);
  width: min(94vw, 520px); max-height: 92vh; color: var(--text);
}
.dialog::backdrop { background: rgba(10, 10, 10, .38); }
.dialog-body { padding: 26px; display: flex; flex-direction: column;
  gap: 14px; }
.dialog-body .field + .field { margin-top: 0; }
.dialog-title { font-size: 19px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 6px; }
.dialog-wide { width: min(96vw, 1040px); height: 90vh; display: flex;
  flex-direction: column; }
.dialog-wide[open] { display: flex; }
.viewer-head { display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--hairline); }
.viewer-head .dialog-title { flex: 1 1 auto; font-size: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-actions { display: flex; gap: 8px; }
.viewer-body { flex: 1 1 auto; overflow: auto; background: var(--subtle);
  display: flex; align-items: center; justify-content: center; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #FFF; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dialog-panel { width: min(96vw, 640px); }
.dialog-panel .viewer-head .dialog-title { white-space: normal; }
.panel-body { padding: 20px 24px; overflow: auto; max-height: calc(92vh - 150px); }
.panel-footer { padding: 14px 24px 20px; margin: 0;
  border-top: 1px solid var(--hairline); }
.panel-footer:empty { display: none; }

/* Key/value list */
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr;
  gap: 8px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
