/* ========================================================================
   YYShop Admin — minimal, dense, keyboard-friendly.
   Uses the same Fraunces/Inter type hierarchy as the storefront.
   ======================================================================== */

:root {
  --bg:         #fafaf7;
  --bg-alt:     #ffffff;
  --surface:    #f2ede5;
  --fg:         #0f0f0f;
  --fg-muted:   #6b6158;
  --fg-subtle:  #9a918a;
  --border:     #e6e0d5;
  --border-strong:#0f0f0f;
  --accent:     #0f0f0f;
  --accent-fg:  #ffffff;
  --accent-2:   #b8976a;
  --danger:     #c8502b;
  --success:    #4a7c59;
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.06);

  --font-display: "Fraunces", "Noto Serif SC", Georgia, serif;
  --font-body:    "Inter", "Noto Sans SC", -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: var(--font-body); background: var(--bg); color: var(--fg); font-size: 14px; line-height: 1.5; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas:
    "brand  topbar"
    "side   main";
  min-height: 100vh;
}

.brand {
  grid-area: brand;
  display: flex; align-items: center; gap: 10px;
  padding: 0 24px;
  background: #0a0a0a;
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px; letter-spacing: -0.02em;
  border-right: 1px solid #1e1e1e;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 4px;
  background: #fff; color: #0a0a0a;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
}
.brand small { color: #888; font-family: var(--font-body); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; margin-left: 8px; }

.topbar {
  grid-area: topbar;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.topbar .crumbs { font-size: 12px; color: var(--fg-muted); letter-spacing: 0.04em; }
.topbar .crumbs strong { color: var(--fg); font-weight: 600; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.topbar-actions .who { font-size: 12px; color: var(--fg-muted); }
.topbar-actions a.ext {
  font-size: 12px; padding: 6px 12px;
  border: 1px solid var(--border-strong); border-radius: 4px;
  color: var(--fg);
}

.side {
  grid-area: side;
  background: #0f0f0f; color: #e8e3dc;
  padding: 24px 0;
  border-right: 1px solid #1a1a1a;
  overflow-y: auto;
}
.side .section { padding: 0 20px; margin: 0 0 8px; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: #666; }
.side nav { display: flex; flex-direction: column; gap: 1px; margin-bottom: 24px; }
.side nav a {
  padding: 10px 20px;
  font-size: 13px; color: #ccc;
  border-left: 2px solid transparent;
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
}
.side nav a:hover { background: #1a1a1a; color: #fff; }
.side nav a.on { background: #1a1a1a; color: #fff; border-left-color: #fff; font-weight: 600; }

.main {
  grid-area: main;
  padding: 28px 32px 80px;
  overflow-y: auto;
}

.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; }
.page-head h1 { font-family: var(--font-display); font-size: 32px; letter-spacing: -0.02em; margin: 0 0 4px; }
.page-head .sub { font-size: 13px; color: var(--fg-muted); }
.page-head .actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: transparent; color: var(--fg);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.primary:hover { opacity: 0.9; background: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 6px; padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.kpi .l { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 10px; }
.kpi .v { font-family: var(--font-display); font-size: 32px; letter-spacing: -0.02em; }
.kpi .s { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }

.panel {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden;
  margin-bottom: 24px;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.panel-head h2 { font-family: var(--font-display); font-size: 20px; margin: 0; }
.panel-body { padding: 0; }
.panel-body.pad { padding: 20px; }

table.t {
  width: 100%;
  border-collapse: collapse;
}
table.t th, table.t td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t th {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-muted); font-weight: 600; background: var(--surface);
}
table.t tbody tr:hover { background: rgba(0,0,0,0.015); }
table.t .pill {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  background: var(--surface); color: var(--fg-muted); border: 1px solid var(--border);
}
table.t .pill.ok   { background: #eaf4ed; color: #2d6b47; border-color: #cae4d0; }
table.t .pill.off  { background: #fcecea; color: #a3412e; border-color: #f3cdc7; }
table.t .pill.warn { background: #fff5e0; color: #8b5a0f; border-color: #f4dbae; }
table.t .mono { font-family: var(--font-mono); font-size: 12px; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions button {
  padding: 4px 10px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 3px;
  background: var(--bg-alt); cursor: pointer;
}
.row-actions button:hover { background: var(--surface); }
.row-actions button.danger { color: var(--danger); border-color: var(--danger); }

/* FORMS */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: flex; flex-direction: column; gap: 6px; }
label.field > span.l {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-muted); font-weight: 600;
}
label.field input, label.field select, label.field textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-alt);
  font-size: 14px;
  font-family: inherit;
}
label.field input:focus, label.field select:focus, label.field textarea:focus {
  outline: none; border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }

.i18n-grid { display: grid; grid-template-columns: 80px 1fr; gap: 8px 14px; }
.i18n-grid .lang { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-muted); font-weight: 600; align-self: center; }
.i18n-grid input, .i18n-grid textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-alt); font-size: 13px;
}

.swatch-row { display: flex; gap: 6px; align-items: center; }
.swatch-row .sw { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--border); }
.swatch-dot { display:inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; border: 1px solid rgba(0,0,0,0.08); }

/* MODAL */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10,10,10,0.44);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--bg-alt);
  border-radius: 8px;
  width: 720px; max-width: 92vw; max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.modal-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h3 { font-family: var(--font-display); font-size: 22px; margin: 0; }
.modal-head .x { cursor: pointer; font-size: 20px; color: var(--fg-muted); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--bg);
}

/* TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #0f0f0f; color: #fff;
  padding: 12px 18px; border-radius: 4px;
  font-size: 13px;
  z-index: 200; opacity: 0; transform: translateY(10px);
  transition: all 220ms ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err  { background: #8b1e1e; }

.loading { padding: 40px; text-align: center; color: var(--fg-muted); font-size: 13px; }

/* channel card for the channels list */
.channel-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-alt);
}
.channel-card .flag {
  width: 40px; height: 40px; border-radius: 4px;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 16px;
}

/* theme card */
.theme-card {
  padding: 16px 18px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-alt);
  display: flex; flex-direction: column; gap: 10px;
}
.theme-card .name { font-family: var(--font-display); font-size: 18px; }
.theme-card .label-line { font-size: 12px; color: var(--fg-muted); }
.theme-card .palette { display: flex; gap: 6px; }
.theme-card .palette .sw { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--border); }

/* product color pill */
.color-pill { display: inline-flex; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 12px; }

/* empty state */
.empty { padding: 48px; text-align: center; color: var(--fg-muted); font-size: 13px; }

.link { color: var(--accent-2); cursor: pointer; text-decoration: underline; }
