:root {
  --bg: #fff9f2;
  --card: #fff;
  --text: #172554;
  --muted: #64748b;
  --line: #eae4dc;
  --orange: #ff6b35;
  --teal: #20b8a6;
  --navy: #172554;
  --gold: #f4c95d;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #080f1c;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --line: #263449;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Vazirmatn, Tahoma, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: white; padding: 20px 16px; }
.side a { display: block; padding: 8px 10px; border-radius: 12px; }
.side a:hover, .side a.is-on { background: rgba(255,255,255,.1); }
.side .brand { padding: 0 4px 14px; background: transparent; }
.side .brand:hover, .side .brand.is-on { background: transparent; }
.side .brand img { display: block; height: 58px; width: auto; max-width: 100%; }
.side .role { color: var(--gold); margin: 0 10px 12px; font-size: .85rem; }
.main { padding: 24px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat strong { display: block; font-size: 1.6rem; color: var(--orange); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tree-1 { padding-inline-start: 26px; }
.tree-2 { padding-inline-start: 44px; }
.tree-3 { padding-inline-start: 62px; }
.tree-4 { padding-inline-start: 80px; }
.tree-5 { padding-inline-start: 98px; }
.tree-6 { padding-inline-start: 116px; }
.btn { border: 0; border-radius: 999px; padding: 8px 14px; background: var(--orange); color: white; cursor: pointer; font-weight: 700; }
.btn.teal { background: var(--teal); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 4px 10px; }
.btn.danger { background: #b91c1c; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
td form { display: inline; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #dcfce7; color: #166534; }
.pill.off { background: #fee2e2; color: #991b1b; }
.stack { display: grid; gap: 10px; }
label { display: grid; gap: 4px; }
input, select, textarea { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 10px; }
.flash { padding: 10px 12px; border-radius: 12px; margin-bottom: 12px; }
.ok { background: #dcfce7; color: #166534; }
.bad { background: #fee2e2; color: #991b1b; }
.login { width: min(420px, calc(100% - 32px)); margin: 10vh auto; }
img.thumb { width: 120px; height: 80px; object-fit: cover; border-radius: 12px; }
img.thumb.wide { width: 100%; height: 168px; }
.cover-field { display: grid; gap: 4px; }
.hint { color: var(--muted); font-size: .82rem; }
.icon-option { color: var(--navy); }
.icon-glyph {
  width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px;
  border-radius: 10px; background: #fff7ed;
}
.icon-glyph svg, .icon-option svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.cat-icon { display: inline-flex; align-items: center; gap: 8px; }
.icon-pick { display: grid; gap: 4px; position: relative; }
.icon-pick details { width: 100%; }
.icon-pick summary {
  list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 10px;
}
.icon-pick summary::-webkit-details-marker { display: none; }
.icon-pick summary::after {
  content: ""; margin-inline-start: auto; border: 5px solid transparent; border-top-color: var(--muted);
}
.icon-pick details[open] summary::after { border-top-color: transparent; border-bottom-color: var(--muted); transform: translateY(-4px); }
.icon-menu {
  position: absolute; z-index: 5; inset-inline: 0; top: calc(100% + 6px);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  max-height: 280px; overflow: auto; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 12px 32px rgba(23, 37, 84, .12);
}
.icon-option {
  position: relative; display: grid; justify-items: center; gap: 4px;
  border: 1px solid transparent; border-radius: 12px; padding: 8px 4px; cursor: pointer; font-size: .75rem;
}
.icon-option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.icon-option:hover, .icon-option:has(input:checked) { border-color: var(--orange); background: #fff7ed; }
.tone-music { color: #3b6cff; } .tone-theater { color: #ff7a18; } .tone-education { color: #243e86; }
.tone-travel { color: #12b886; } .tone-health { color: #f43f5e; } .tone-game { color: #22a55b; }
.tone-workshop { color: #7c5cbf; } .tone-special, .tone-star, .tone-crown, .tone-bolt { color: #f5b301; }
.tone-heart, .tone-gift { color: #f43f5e; } .tone-calendar, .tone-headset { color: #3b6cff; }
.tone-ticket, .tone-flame { color: #ff6b35; } .tone-pin, .tone-wallet { color: #12b886; }
.tone-users, .tone-home { color: #243e86; } .tone-camera { color: #7c5cbf; }
.tone-cart, .tone-shield { color: #20b8a6; } .tone-bell { color: #ff7a18; }
.tone-clock { color: #64748b; }
[data-theme="dark"] .icon-glyph, [data-theme="dark"] .icon-option:hover, [data-theme="dark"] .icon-option:has(input:checked) { background: #172033; }
@media (max-width: 800px) { .shell, .stats, .form-grid { grid-template-columns: 1fr; } }
