/* Youmi admin design tokens: 4/8pt spacing, one type scale, light and dark. */
:root {
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px;
  --text-xs: 0.8125rem; --text-sm: 0.875rem; --text-md: 1rem; --text-lg: 1.25rem; --text-xl: 1.75rem;
  --touch: 44px;

  /* Light (all text pairs >= 4.5:1, UI borders >= 3:1) */
  --bg: #f7f6f3; --surface: #ffffff; --surface-2: #f0eee9;
  --text: #1c1b19; --text-muted: #5b5852; --border: #8a867e;
  --primary: #2f5d50; --on-primary: #ffffff; --primary-soft: #e3efe9;
  --danger: #a3262c; --on-danger: #ffffff; --danger-soft: #fbe9ea;
  --success: #1f6b3a; --success-soft: #e5f3ea;
  --focus: #1a56db;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 2px 8px rgb(0 0 0 / 0.04);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", Tahoma, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413; --surface: #1d1d1b; --surface-2: #262624;
    --text: #f1efe9; --text-muted: #b5b1a8; --border: #8d897f;
    --primary: #8fcdb8; --on-primary: #0f2a22; --primary-soft: #203a32;
    --danger: #f2a1a5; --on-danger: #3a0b0e; --danger-soft: #3d1d20;
    --success: #9bd8ae; --success-soft: #1d3626;
    --focus: #8ab4ff;
    --shadow: none;
  }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: var(--text-md); line-height: 1.5; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: var(--space-2); top: -60px; background: var(--surface); padding: var(--space-2) var(--space-4); z-index: 10; }
.skip-link:focus { top: var(--space-2); }
.muted { color: var(--text-muted); }
.small { font-size: var(--text-sm); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-6); background: var(--surface); border-bottom: 1px solid var(--surface-2); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: var(--text-lg); }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--primary); color: var(--on-primary); }
.topbar-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

.tabs { display: flex; gap: var(--space-1); padding: var(--space-2) var(--space-6); background: var(--surface); border-bottom: 1px solid var(--surface-2); overflow-x: auto; }
.tab { min-height: var(--touch); padding: 0 var(--space-4); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); font: inherit; cursor: pointer; white-space: nowrap; }
.tab[aria-current="page"] { background: var(--primary-soft); color: var(--text); font-weight: 600; box-shadow: inset 0 -3px 0 var(--primary); }

main { max-width: 1080px; margin: 0 auto; padding: var(--space-6); }
h1 { font-size: var(--text-xl); margin: 0 0 var(--space-2); }
h2 { font-size: var(--text-lg); margin: 0 0 var(--space-3); }
.lead { color: var(--text-muted); margin: 0 0 var(--space-6); }

.grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: var(--space-6); }
.card { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-4) var(--space-6); box-shadow: var(--shadow); border: 1px solid var(--surface-2); }
.stat-value { font-size: var(--text-xl); font-weight: 700; }
.stat-label { color: var(--text-muted); font-size: var(--text-sm); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--touch); min-width: var(--touch); padding: 0 var(--space-4); border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: end; }
.row-nowrap { flex-wrap: nowrap; white-space: nowrap; }

form { display: grid; gap: var(--space-4); max-width: 560px; }
label { display: grid; gap: var(--space-1); font-weight: 600; }
.hint { font-weight: 400; color: var(--text-muted); font-size: var(--text-sm); }
input, select, textarea { min-height: var(--touch); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
textarea { min-height: 96px; resize: vertical; }
.check { display: flex; align-items: center; gap: var(--space-3); font-weight: 600; min-height: var(--touch); }
.check input { width: 22px; height: 22px; min-height: 0; }
.field-error { color: var(--danger); font-weight: 400; font-size: var(--text-sm); }

table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-md); overflow: hidden; }
th, td { text-align: start; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--surface-2); vertical-align: top; }
th { font-size: var(--text-sm); color: var(--text-muted); font-weight: 600; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); box-shadow: var(--shadow); }

.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: 999px; font-size: var(--text-xs); font-weight: 600; }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-off { background: var(--danger-soft); color: var(--danger); }

.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); margin-bottom: var(--space-4); border-inline-start: 4px solid; }
.notice-error { background: var(--danger-soft); border-color: var(--danger); }
.notice-success { background: var(--success-soft); border-color: var(--success); }
.empty { text-align: center; padding: var(--space-8); color: var(--text-muted); }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--radius-sm); height: 1em; }
.skeleton-block { height: 88px; border-radius: var(--radius-md); }
@keyframes shimmer { to { background-position: -200% 0; } }

dialog { border: 0; border-radius: var(--radius-lg); padding: var(--space-6); background: var(--surface); color: var(--text); max-width: min(480px, 92vw); }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }

@media (max-width: 600px) {
  main { padding: var(--space-4); }
  .topbar, .tabs { padding-inline: var(--space-4); }
}
