/* Design kit of the template: Arabic first (RTL), calm and readable, light and dark, phone first.
   Change the TOKENS below (colour, radius, font) and the whole site follows; do not scatter colours through the rules.
   Only logical properties (inline-start/end) are used, so the same file works for right-to-left and left-to-right.
   The page's policy allows fonts from this site and from https://api.tapnova.dev (see fonts.css). */

:root {
  /* colour tokens (light) */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5b6270;
  --line: #e2e5ea;
  --brand: #b45309;          /* the one accent colour: buttons, links, focus */
  --brand-strong: #92400e;
  --brand-soft: #fef3c7;
  --on-brand: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #067647;
  --ok-soft: #e7f6ee;
  /* shape, depth, rhythm */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / .06), 0 8px 24px rgb(16 24 40 / .06);
  --gap: 1rem;
  /* type */
  --font: "IBM Plex Sans Arabic", "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-head: "Cairo", "IBM Plex Sans Arabic", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #181c22;
    --text: #eceff4;
    --muted: #a0a8b5;
    --line: #2a303a;
    --brand: #f59e0b;
    --brand-strong: #fbbf24;
    --brand-soft: #3a2a0c;
    --on-brand: #1f1300;
    --danger: #f97066;
    --danger-soft: #3a1a18;
    --ok: #47cd89;
    --ok-soft: #12291d;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.35; margin: 0 0 .5rem; letter-spacing: 0; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 var(--gap); }
a { color: var(--brand); text-underline-offset: .2em; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---- layout ---- */
.shell { width: min(100% - 2rem, 40rem); margin-inline: auto; padding-block: 1.25rem 3rem; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap);
  padding-block: .5rem 1.25rem;
}
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--font-head); font-weight: 800; font-size: 1.25rem; }
.brand .mark {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 12px;
  background: var(--brand); color: var(--on-brand); font-size: 1.1rem;
}
.stack { display: grid; gap: var(--gap); }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.row.bottom { align-items: flex-end; }
.row > .field { flex: 1 1 12rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---- card ---- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem;
}
.card > :last-child { margin-bottom: 0; }

/* ---- form ---- */
.field { display: grid; gap: .35rem; }
.field > label { font-weight: 600; font-size: .95rem; }
.hint { color: var(--muted); font-size: .85rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: .65rem .8rem; min-height: 2.9rem;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft);
}
input[aria-invalid="true"] { border-color: var(--danger); }
/* e-mail and numbers are written left to right even inside an Arabic page */
input[type="email"], input[type="password"], input[type="url"], input[type="tel"], input[type="number"] { direction: ltr; text-align: start; }
input[type="email"]::placeholder, input[type="password"]::placeholder { direction: rtl; text-align: start; }

/* ---- buttons ---- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 700; min-height: 2.9rem; padding: .55rem 1.1rem; cursor: pointer;
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  background: var(--brand); color: var(--on-brand);
  transition: background .15s, transform .05s, border-color .15s, opacity .15s;
}
.btn:hover, button:hover { background: var(--brand-strong); }
.btn:active, button:active { transform: translateY(1px); }
button[disabled], .btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.ghost, button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover, button.ghost:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn.danger, button.danger { background: transparent; color: var(--danger); border-color: var(--line); min-height: 2.4rem; padding-inline: .8rem; }
.btn.danger:hover, button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.block, button.block { width: 100%; }

/* ---- feedback ---- */
.notice { border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .95rem; }
.notice:empty { display: none; }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.badge {
  display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: var(--brand-soft); color: var(--brand-strong);
}

/* ---- list ---- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .9rem;
  overflow-wrap: anywhere;
}
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; border: 2px dashed var(--line); border-radius: var(--radius); }
.loading { color: var(--muted); }

/* ---- dashboard ---- */
.shell.wide { width: min(100% - 2rem, 72rem); }
.narrow { max-width: 28rem; margin-inline: auto; width: 100%; }
h3 { font-size: 1.05rem; font-weight: 700; }
.tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; }
.tabs .tab { background: var(--surface); color: var(--text); border-color: var(--line); white-space: nowrap; min-height: 2.6rem; }
.tabs .tab[aria-current="page"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.stat .num { font-family: var(--font-head); font-size: 1.8rem; font-weight: 800; color: var(--brand-strong); }
.stat .lbl { color: var(--muted); font-size: .9rem; }
.item .main { display: grid; gap: .2rem; flex: 1 1 16rem; }
.item .actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.item .actions select { min-height: 2.4rem; padding-block: .3rem; width: auto; }
.meta { color: var(--muted); font-size: .85rem; }
.badge.warn { background: var(--danger-soft); color: var(--danger); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.muted { background: var(--line); color: var(--muted); }
.field.inline { grid-template-columns: auto auto; align-items: center; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.check input { width: 1.2rem; height: 1.2rem; min-height: 0; }
textarea { min-height: 5rem; resize: vertical; }
.item.dim { opacity: .6; }

@media (max-width: 30rem) {
  .shell { width: calc(100% - 1.5rem); }
  h1 { font-size: 1.4rem; }
  .card { padding: 1rem; }
  .item { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
