/* KASKAL admin panel. Same look as the app: charcoal greys, indigo only for what is touched. */
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url("fonts/ibm_plex_sans_arabic_regular.ttf"); }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url("fonts/ibm_plex_sans_arabic_semibold.ttf"); }

:root {
  --ink950: #0e0f12; --ink900: #141518; --ink800: #1d1f23; --ink700: #272a30; --ink600: #343840;
  --gray: #6c727e; --gray-light: #a2a8b4; --text: #edeef2;
  --indigo: #6373ff; --indigo-soft: #98a3ff; --danger: #ff8f8f;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--ink900); color: var(--text); font: 15px/1.7 "Plex Arabic", system-ui, Tahoma, sans-serif; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
a { color: var(--indigo-soft); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--gray-light); }
.error { color: var(--danger); min-height: 1.7em; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.wordmark { font-size: 13px; letter-spacing: .28em; color: var(--indigo-soft); font-weight: 600; direction: ltr; }

/* ---- sign-in */
#login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(380px, 100%); background: var(--ink800); border: 1px solid var(--ink600);
  border-radius: 24px; padding: 32px 28px; text-align: center; animation: rise .35s ease-out both; }
.login-card h1 { margin: 10px 0 4px; }
#google-button { display: flex; justify-content: center; margin: 22px 0 8px; min-height: 44px; }

/* ---- frame */
#app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
#nav { background: var(--ink800); border-inline-end: 1px solid var(--ink600); padding: 22px 12px;
  display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
#nav .wordmark { padding: 0 12px; }
#nav-items { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: var(--gray-light);
  background: none; border: 0; font: inherit; cursor: pointer; text-align: start; transition: background .15s, color .15s; }
.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item:hover { background: var(--ink700); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--ink700); color: var(--indigo-soft); }
.nav-item .count { margin-inline-start: auto; background: var(--indigo); color: #fff; border-radius: 10px;
  font-size: 12px; padding: 0 7px; line-height: 20px; }
.nav-foot { padding: 0 12px; font-size: 13px; }
#view { padding: 28px clamp(16px, 3vw, 36px) 60px; min-width: 0; outline: none; }
#view > * { animation: rise .28s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { margin-inline-end: auto; }

/* ---- pieces */
.card { background: var(--ink800); border: 1px solid var(--ink600); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.stat b { display: block; font-size: 26px; font-weight: 600; line-height: 1.3; }
.stat span { color: var(--gray-light); font-size: 13px; }

button { font: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 12px; border: 1px solid transparent; background: var(--ink700); color: var(--text); cursor: pointer;
  transition: transform .12s, background .15s, opacity .15s; }
.btn:hover { background: var(--ink600); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--indigo); color: #fff; }
.btn.primary:hover { background: #7482ff; }
.btn.quiet { background: none; border-color: var(--ink600); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.link { background: none; border: 0; color: var(--indigo-soft); cursor: pointer; padding: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 5px 14px; border-radius: 999px; border: 1px solid var(--ink600); background: none; color: var(--gray-light); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--ink700); color: var(--indigo-soft); border-color: transparent; }

.chip { display: inline-block; padding: 0 10px; border-radius: 999px; background: var(--ink700); color: var(--gray-light);
  font-size: 12px; line-height: 22px; white-space: nowrap; }
.chip.on { color: var(--indigo-soft); }
.chip.bad { color: var(--danger); }

input, select, textarea { font: inherit; color: var(--text); background: var(--ink950); border: 1px solid var(--ink600);
  border-radius: 12px; padding: 8px 12px; width: 100%; min-height: 40px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .nav-item:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--indigo); outline-offset: 1px; }
textarea { resize: vertical; min-height: 84px; }
label.field { display: block; }
label.field > span { display: block; font-size: 13px; color: var(--gray-light); margin-bottom: 4px; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 42px; min-height: 24px; height: 24px; border-radius: 12px; background: var(--ink600);
  border: 0; padding: 0; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--gray-light); transition: transform .15s, background .15s; }
.switch input:checked { background: var(--indigo); }
.switch input:checked::after { background: #fff; transform: translateX(-18px); }
[dir="ltr"] .switch input:checked::after { transform: translateX(18px); }

.table-wrap { overflow-x: auto; border: 1px solid var(--ink600); border-radius: var(--radius); background: var(--ink800); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: start; vertical-align: middle; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 180px; }
th { font-size: 12px; font-weight: 400; color: var(--gray-light); border-bottom: 1px solid var(--ink600); }
tr + tr td { border-top: 1px solid var(--ink700); }
.empty { padding: 48px 16px; text-align: center; color: var(--gray-light); }

.item h2 { margin-bottom: 2px; }
.item p { color: var(--gray-light); font-size: 14px; }
.item .facts { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.item img { width: 100%; max-height: 150px; object-fit: cover; border-radius: 12px; margin: 10px 0 0; }
.item .row { margin-top: 12px; }

dialog { margin: auto; width: min(420px, calc(100% - 32px)); background: var(--ink800); color: var(--text);
  border: 1px solid var(--ink600); border-radius: 20px; padding: 22px; }
dialog[open] { animation: rise .2s ease-out both; }
dialog::backdrop { background: rgba(8, 9, 11, .66); }
dialog h2 { margin-bottom: 12px; }
dialog .row { justify-content: flex-end; margin-top: 16px; }
dialog form { display: grid; gap: 12px; }

#toasts { position: fixed; bottom: 20px; inset-inline: 0; display: flex; flex-direction: column; align-items: center;
  gap: 8px; pointer-events: none; z-index: 10; }
.toast { background: var(--ink700); border: 1px solid var(--ink600); border-radius: 12px; padding: 9px 16px;
  animation: rise .2s ease-out both; max-width: calc(100% - 32px); }
.toast.bad { color: var(--danger); }

@media (max-width: 820px) {
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  #nav { position: sticky; top: 0; z-index: 5; height: auto; min-width: 0; flex-direction: row; align-items: center;
    padding: 8px 10px; border-inline-end: 0; border-bottom: 1px solid var(--ink600); gap: 6px; }
  #nav .wordmark, .nav-foot #who { display: none; }
  #nav-items { flex-direction: row; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat b { font-size: 21px; }
  .nav-item { white-space: nowrap; padding: 7px 10px; }
  .nav-item span.label { display: none; }
  .nav-item[aria-current="page"] span.label { display: inline; }
  .nav-foot { padding: 0; white-space: nowrap; }
  #view { padding: 18px 14px 60px; }
}
