/* ============================================================
   DRP-OS Super-Admin
   A warm, operator-focused console. Inspired by the field journal
   aesthetic, not the dashboard-template aesthetic. Bone-paper
   surfaces, ink-black sidebar, terra-cotta accents.
   ============================================================ */

:root {
  --paper:        #f7f3ee;
  --paper-pure:   #fdfaf5;
  --paper-warm:   #f0e9df;
  --ink:          #1a1714;
  --ink-soft:     #2a2520;
  --ink-70:       #4a423b;
  --ink-50:       #8a8278;
  --ink-30:       #b8b0a4;
  --ink-15:       #d9d2c4;
  --ink-08:       #ebe5d8;
  --rule:         #d9d2c4;

  --accent:       #c2410c;        /* terra-cotta */
  --accent-soft:  #fdba74;
  --accent-wash:  #fef3eb;
  --accent-deep:  #9a3412;

  --ok:           #15803d;
  --ok-wash:      #ecfdf5;
  --warn:         #b45309;
  --warn-wash:    #fef3c7;
  --err:          #b91c1c;
  --err-wash:     #fef2f2;

  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(26,23,20,0.04), 0 1px 1px rgba(26,23,20,0.06);
  --shadow-md: 0 4px 12px rgba(26,23,20,0.06), 0 2px 4px rgba(26,23,20,0.04);
  --shadow-lg: 0 20px 50px -20px rgba(26,23,20,0.18), 0 10px 25px -15px rgba(26,23,20,0.10);

  --side-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

button { font-family: inherit; cursor: pointer; }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}

/* ───── LAYOUT ───── */

.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid #0a0907;
}

.sidebar-brand {
  padding: 22px 20px 26px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05), inset 0 1px 0 rgba(255,255,255,0.15);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-30);
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}

.nav-group { margin-bottom: 18px; }

.nav-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-30);
  padding: 4px 10px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.7);
  transition: background 0.12s, color 0.12s;
  margin-bottom: 1px;
}

.nav-item i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item:hover { background: rgba(255,255,255,0.04); color: white; }
.nav-item:hover i { opacity: 1; }

.nav-item.active {
  background: rgba(255,255,255,0.06);
  color: white;
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item.active i { opacity: 1; color: var(--accent-soft); }

.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 14px 14px 16px;
}

.me {
  display: flex;
  align-items: center;
  gap: 10px;
}

.me-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.me-info { flex: 1; min-width: 0; }
.me-name { font-size: 13px; font-weight: 500; color: white; line-height: 1.2; }
.me-role {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-30);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.me-logout {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--ink-30);
  transition: all 0.12s;
}
.me-logout:hover { background: rgba(255,255,255,0.06); color: white; }
.me-logout i { width: 14px; height: 14px; }

/* ───── MAIN ───── */

.main {
  padding: 32px 40px 80px;
  max-width: 1280px;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  line-height: 1;
}

.page-head h1 em { font-style: italic; color: var(--accent); }

.page-head p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-50);
}

.page-head-actions { display: flex; gap: 8px; }

/* ───── BUTTONS ───── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  transition: all 0.12s;
  white-space: nowrap;
  line-height: 1.2;
}
.btn i { width: 15px; height: 15px; }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-soft); }

.btn-accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn-ghost {
  background: var(--paper-pure);
  border-color: var(--rule);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--paper-warm); border-color: var(--ink-30); }

.btn-danger {
  background: transparent;
  border-color: transparent;
  color: var(--err);
}
.btn-danger:hover { background: var(--err-wash); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-sm i { width: 13px; height: 13px; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
}

/* ───── FLASH ───── */

.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  margin-bottom: 18px;
  border: 1px solid;
}
.flash i { width: 16px; height: 16px; flex-shrink: 0; }
.flash-ok  { background: var(--ok-wash);  border-color: #bbf7d0; color: var(--ok); }
.flash-err { background: var(--err-wash); border-color: #fecaca; color: var(--err); }

/* ───── CARDS / SURFACES ───── */

.card {
  background: var(--paper-pure);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.card-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.card-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-50);
}

.card-body { padding: 22px; }
.card-body.tight { padding: 0; }

/* ───── TABLES ───── */

.table-wrap { overflow-x: auto; }

table.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

table.tbl thead th {
  text-align: left;
  padding: 11px 18px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-50);
  font-weight: 500;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

table.tbl tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--ink-08);
  vertical-align: middle;
}

table.tbl tbody tr:hover td { background: var(--paper-warm); }
table.tbl tbody tr:last-child td { border-bottom: none; }

table.tbl .cell-actions {
  text-align: right;
  white-space: nowrap;
}

.cell-strong { font-weight: 500; color: var(--ink); }
.cell-muted  { color: var(--ink-50); font-size: 13px; }
.cell-mono   { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-70); }

/* ───── PILLS / STATUS ───── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.pill-live   { background: var(--ok-wash);   color: var(--ok); }
.pill-beta   { background: var(--warn-wash); color: var(--warn); }
.pill-coming { background: #ede9fe;          color: #5b21b6; }
.pill-archived { background: var(--paper-warm); color: var(--ink-50); }
.pill-active { background: var(--ok-wash);   color: var(--ok); }
.pill-inactive { background: var(--paper-warm); color: var(--ink-50); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-popular { background: var(--accent); color: white; }
.badge-best    { background: var(--ink); color: white; }
.badge-new     { background: var(--ok); color: white; }
.badge-core    { background: var(--ink-08); color: var(--ink-70); }

/* ───── FORMS ───── */

.form-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--ink-08);
}
.form-row:last-child { border-bottom: none; }
.form-row.full { grid-template-columns: 1fr; }

.form-row .label {
  font-weight: 500;
  font-size: 13.5px;
  padding-top: 8px;
}
.form-row .label .hint {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-50);
  margin-top: 4px;
}

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--paper-pure);
  font-size: 14px;
  color: var(--ink);
  transition: border 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.12);
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.input-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13.5px;
  user-select: none;
}
.checkbox input { width: 16px; height: 16px; cursor: pointer; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 20px 0 0;
  margin-top: 8px;
  border-top: 1px solid var(--rule);
}

@media (max-width: 760px) {
  .form-row { grid-template-columns: 1fr; gap: 8px; }
  .form-row .label { padding-top: 0; }
}

/* ───── EMPTY ───── */

.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--ink-50);
}
.empty .empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--paper-warm);
  color: var(--ink-30);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}
.empty .empty-icon i { width: 24px; height: 24px; }
.empty h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 4px;
}
.empty p { margin: 0 0 16px; font-size: 14px; }

/* ───── STAT TILES ───── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat {
  background: var(--paper-pure);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-50);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--ink);
}
.stat-value em { font-style: italic; color: var(--accent); }

.stat-sub {
  font-size: 12px;
  color: var(--ink-50);
  margin-top: 6px;
}

/* ───── COLOR DOT (product color preview) ───── */

.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid rgba(0,0,0,0.1);
}

/* ───── LOGIN ───── */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(194,65,12,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(26,23,20,0.05) 0%, transparent 50%),
    var(--paper);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--paper-pure);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 44px 40px 36px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-brand .mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  font-weight: 400;
}
.login-brand h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
}
.login-brand h1 em { font-style: italic; color: var(--accent); }
.login-brand p {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--ink-50);
}

.login-field { margin-bottom: 14px; }
.login-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-70);
  margin-bottom: 5px;
}

.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; padding: 11px 16px; }
.login-card .flash { margin-bottom: 14px; }

.login-foot {
  margin-top: 22px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-30);
  letter-spacing: 0.04em;
}

/* ───── RESPONSIVE ───── */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s;
    width: var(--side-w);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 20px 18px 60px; }
}
