/* ============================================================================
   TUT — DESIGN TOKENS  v1.0   (December 2026)
   Source of truth: the 12 reference screens Mahmoud approved ("دي الهوية والشكل")
   Rule: one language for museum (inside) and 2D dashboards (outside).
   Gold/amber is the ONLY accent. Red/green only for status. Turquoise stays
   reserved for buttons and links (owner's standing decision).
   ============================================================================ */

:root {
  /* ---------- 1. SURFACES ---------- */
  --tut-bg-0:        #0A0A0C;   /* page base */
  --tut-bg-1:        #101014;   /* raised panel */
  --tut-bg-2:        #141418;   /* card */
  --tut-bg-3:        #1A1A20;   /* hover / selected row */
  --tut-bg-inset:    #08080A;   /* wells, table headers */
  --tut-gradient-page: radial-gradient(1200px 700px at 50% -10%, #17171C 0%, #0A0A0C 55%, #08080A 100%);

  /* ---------- 2. GOLD / AMBER (single accent family) ---------- */
  --tut-gold:        #C9A227;   /* primary accent: borders, icons, rules */
  --tut-gold-value:  #E0B84C;   /* numbers, key figures */
  --tut-gold-glow:   #F2D98A;   /* glow, hover highlight */
  --tut-gold-deep:   #8A6E18;   /* pressed, inactive accent */
  --tut-gold-a08:    rgba(201,162,39,.08);
  --tut-gold-a14:    rgba(201,162,39,.14);
  --tut-gold-a28:    rgba(201,162,39,.28);
  --tut-gold-a45:    rgba(201,162,39,.45);

  /* ---------- 3. TEXT ---------- */
  --tut-text:        #ECE8DF;   /* primary body */
  --tut-text-2:      #A8A49B;   /* secondary */
  --tut-text-3:      #6E6B64;   /* labels, captions */
  --tut-text-on-gold:#0A0A0C;

  /* ---------- 4. STATUS (small doses only) ---------- */
  --tut-ok:          #35C08A;
  --tut-warn:        #E39A2B;
  --tut-bad:         #D2503F;
  --tut-info:        #2EC4B6;   /* turquoise: links + buttons only */
  --tut-ok-a12:      rgba(53,192,138,.12);
  --tut-warn-a12:    rgba(227,154,43,.12);
  --tut-bad-a12:     rgba(210,80,63,.12);

  /* ---------- 5. LINES & GLOW ---------- */
  --tut-line:        1px solid rgba(201,162,39,.18);
  --tut-line-strong: 1px solid rgba(201,162,39,.38);
  --tut-line-soft:   1px solid rgba(255,255,255,.06);
  --tut-glow-sm:     0 0 12px rgba(201,162,39,.18);
  --tut-glow-md:     0 0 24px rgba(201,162,39,.26);
  --tut-glow-lg:     0 0 48px rgba(201,162,39,.32);
  --tut-shadow-card: 0 10px 30px rgba(0,0,0,.55);

  /* ---------- 6. RADII / SPACING / TYPE ---------- */
  --tut-r-xs: 6px;
  --tut-r-sm: 10px;
  --tut-r-md: 14px;
  --tut-r-lg: 20px;
  --tut-r-pill: 999px;
  --tut-s-1: 4px;  --tut-s-2: 8px;  --tut-s-3: 12px;
  --tut-s-4: 16px; --tut-s-5: 24px; --tut-s-6: 32px; --tut-s-7: 48px;

  --tut-font: "Inter", "Segoe UI", "Tahoma", system-ui, sans-serif;
  --tut-font-ar: "Cairo", "Tajawal", "Segoe UI", "Tahoma", sans-serif;
  --tut-font-num: "IBM Plex Mono", "JetBrains Mono", ui-monospace, monospace;

  --tut-t-label: 11px;   /* uppercase label, letter-spacing .08em */
  --tut-t-small: 12.5px;
  --tut-t-body: 14px;
  --tut-t-h3: 17px;
  --tut-t-h2: 22px;
  --tut-t-h1: 30px;
  --tut-t-kpi: 40px;     /* KPI figures */
  --tut-t-hero: 56px;    /* museum / executive hero numbers */
}

/* ============================ BASE ============================ */
.tut-page { background: var(--tut-gradient-page); color: var(--tut-text); font-family: var(--tut-font-ar); }
.tut-num  { font-family: var(--tut-font-num); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.tut-label{ font-size: var(--tut-t-label); letter-spacing: .08em; text-transform: uppercase; color: var(--tut-text-3); }

/* ============================ SHELL ============================ */
.tut-rail {                     /* narrow icon rail, reference screens 5 & 12 */
  width: 64px; background: var(--tut-bg-1); border-inline-end: var(--tut-line);
  display: flex; flex-direction: column; align-items: center; gap: var(--tut-s-3); padding: var(--tut-s-4) 0;
}
.tut-rail__item {
  width: 38px; height: 38px; border-radius: var(--tut-r-sm); display: grid; place-items: center;
  color: var(--tut-text-3); border: 1px solid transparent;
}
.tut-rail__item:hover { color: var(--tut-gold-glow); border-color: var(--tut-gold-a28); }
.tut-rail__item.is-active {
  color: var(--tut-gold-value); border-color: var(--tut-gold); background: var(--tut-gold-a08); box-shadow: var(--tut-glow-sm);
}

.tut-topbar {
  height: 60px; display: flex; align-items: center; gap: var(--tut-s-3);
  padding-inline: var(--tut-s-5); background: var(--tut-bg-1); border-bottom: var(--tut-line);
}
.tut-search {
  flex: 1; max-width: 420px; height: 36px; border-radius: var(--tut-r-pill);
  background: var(--tut-bg-inset); border: var(--tut-line-soft); color: var(--tut-text);
  padding-inline: var(--tut-s-4);
}

/* ============================ CARD ============================ */
.tut-card {
  background: linear-gradient(180deg, var(--tut-bg-2), var(--tut-bg-1));
  border: var(--tut-line); border-radius: var(--tut-r-md);
  box-shadow: var(--tut-shadow-card); padding: var(--tut-s-5); position: relative;
}
.tut-card--glow { box-shadow: var(--tut-shadow-card), var(--tut-glow-sm); }
.tut-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--tut-s-4); }
.tut-card__title { font-size: var(--tut-t-h3); font-weight: 600; color: var(--tut-text); }
.tut-card__meta { font-size: var(--tut-t-label); color: var(--tut-text-3); }

/* ============================ KPI TILE ============================ */
.tut-kpi {
  background: var(--tut-bg-2); border: var(--tut-line); border-radius: var(--tut-r-md);
  padding: var(--tut-s-4) var(--tut-s-5); min-height: 120px; display: flex; flex-direction: column; gap: var(--tut-s-2);
}
.tut-kpi__icon {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: var(--tut-gold-value); border: 1px solid var(--tut-gold-a28); background: var(--tut-gold-a08);
}
.tut-kpi__label { font-size: var(--tut-t-small); color: var(--tut-text-2); }
.tut-kpi__value { font-family: var(--tut-font-num); font-size: var(--tut-t-kpi); line-height: 1.05; color: var(--tut-gold-value); }
.tut-kpi__delta { font-size: var(--tut-t-label); }
.tut-kpi__delta--up { color: var(--tut-ok); }
.tut-kpi__delta--down { color: var(--tut-bad); }
.tut-kpi__spark { height: 28px; }   /* inline SVG polyline, stroke var(--tut-gold) */

/* ============================ BUTTONS ============================ */
.tut-btn {
  height: 36px; padding-inline: var(--tut-s-5); border-radius: var(--tut-r-sm);
  border: 1px solid var(--tut-gold); background: transparent; color: var(--tut-gold-value);
  font-family: var(--tut-font-ar); font-size: var(--tut-t-body); cursor: pointer;
}
.tut-btn:hover { background: var(--tut-gold-a08); box-shadow: var(--tut-glow-sm); }
.tut-btn--primary { background: linear-gradient(180deg, var(--tut-gold-glow), var(--tut-gold)); color: var(--tut-text-on-gold); font-weight: 600; }
.tut-btn--link { border-color: var(--tut-info); color: var(--tut-info); }   /* turquoise = links only */

/* ============================ BADGES ============================ */
.tut-badge { font-size: var(--tut-t-label); padding: 3px 10px; border-radius: var(--tut-r-pill); border: 1px solid transparent; }
.tut-badge--ok   { color: var(--tut-ok);   background: var(--tut-ok-a12);   border-color: rgba(53,192,138,.3); }
.tut-badge--warn { color: var(--tut-warn); background: var(--tut-warn-a12); border-color: rgba(227,154,43,.3); }
.tut-badge--bad  { color: var(--tut-bad);  background: var(--tut-bad-a12);  border-color: rgba(210,80,63,.3); }
.tut-badge--gold { color: var(--tut-gold-value); background: var(--tut-gold-a08); border-color: var(--tut-gold-a28); }

/* ============================ CHARTS (inline SVG) ============================ */
.tut-area   { stroke: var(--tut-gold); stroke-width: 2; fill: url(#tutGoldFade); filter: drop-shadow(0 0 6px rgba(201,162,39,.35)); }
.tut-bar    { fill: url(#tutGoldBar); }            /* gradient: --tut-gold-deep -> --tut-gold-value */
.tut-bar:hover { fill: var(--tut-gold-glow); }
.tut-donut__track { stroke: rgba(255,255,255,.08); }
.tut-donut__value { stroke: var(--tut-gold); filter: drop-shadow(0 0 6px rgba(201,162,39,.4)); }
.tut-donut__text  { fill: var(--tut-gold-value); font-family: var(--tut-font-num); }
.tut-grid-line { stroke: rgba(255,255,255,.06); stroke-width: 1; }
.tut-heat-ok  { fill: var(--tut-ok); }   .tut-heat-warn { fill: var(--tut-warn); }   .tut-heat-bad { fill: var(--tut-bad); }

/* ============================ TABLE ============================ */
.tut-table { width: 100%; border-collapse: collapse; font-size: var(--tut-t-body); }
.tut-table thead th {
  position: sticky; top: 0; background: var(--tut-bg-inset); color: var(--tut-text-3);
  font-size: var(--tut-t-label); letter-spacing: .06em; text-transform: uppercase;
  text-align: start; padding: var(--tut-s-3) var(--tut-s-4); border-bottom: var(--tut-line);
}
.tut-table tbody td { padding: var(--tut-s-3) var(--tut-s-4); border-bottom: var(--tut-line-soft); color: var(--tut-text); }
.tut-table tbody tr:nth-child(even) td { background: rgba(255,255,255,.018); }
.tut-table tbody tr:hover td { background: var(--tut-bg-3); }
.tut-table .is-number { font-family: var(--tut-font-num); color: var(--tut-gold-value); text-align: end; }

/* ============================ PROGRESS ============================ */
.tut-bar-track { height: 6px; border-radius: var(--tut-r-pill); background: rgba(255,255,255,.07); overflow: hidden; }
.tut-bar-fill  { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--tut-gold-deep), var(--tut-gold-value)); box-shadow: var(--tut-glow-sm); }

/* ============================ STATUS BAR ============================ */
.tut-statusbar {
  height: 30px; display: flex; align-items: center; gap: var(--tut-s-4);
  padding-inline: var(--tut-s-5); background: var(--tut-bg-inset); border-top: var(--tut-line);
  font-family: var(--tut-font-num); font-size: 11px; color: var(--tut-text-3);
}

/* ============================ MUSEUM (3D) ============================ */
.tut-hex-frame {              /* hexagonal frame used for wings and alcoves */
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0% 50%);
  border: 1px solid var(--tut-gold); background: rgba(10,10,12,.55);
}
.tut-flow-line { stroke: var(--tut-gold-glow); stroke-width: 2; filter: drop-shadow(0 0 8px rgba(242,217,138,.7)); }
.tut-flow-pulse { animation: tutPulse 2.4s linear infinite; }
@keyframes tutPulse { from { stroke-dashoffset: 240; } to { stroke-dashoffset: 0; } }

/* ============================ RULES ============================ */
/* 1. Body text is --tut-text, never gold. Gold is for figures, borders, icons,
      and headings only: that is what keeps gold-on-black readable.
      Minimum contrast 4.5:1 for body, 3:1 for large text and figures.
   2. Turquoise (--tut-info) is reserved for buttons and links. Never for charts.
   3. Red/amber/green appear only as status badges, heat cells and thin bars.
   4. One motion per screen: the flow pulse, or a single entrance fade. Respect
      prefers-reduced-motion by removing all of it.
   5. Every chart carries: period, source, last refresh, definition, and a path
      to the records behind it.
   6. RTL: logical properties only (margin-inline, inset-inline, border-inline).
      Numbers stay LTR inside .tut-num. */

/* ===================== LIGHT THEME (public identity: cream + gold) =====================
   Used for: the gate, the welcome/sign-in screen, the hero and the public site.
   Same components, same names; only the values change. */
:root[data-theme="light"], .tut-theme-light {
  --tut-bg-0: #F7F3EA;  --tut-bg-1: #FFFFFF;  --tut-bg-2: #FFFFFF;  --tut-bg-3: #FBF6EA;
  --tut-bg-inset: #F2EBDD;
  --tut-gradient-page: radial-gradient(1200px 700px at 50% -10%, #FFFDF7 0%, #F7F3EA 55%, #EFE6D2 100%);
  --tut-gold: #C9A227;  --tut-gold-value: #B8860B;  --tut-gold-glow: #E8C766;  --tut-gold-deep: #8A6E18;
  --tut-text: #1F1B16;  --tut-text-2: #5A5245;  --tut-text-3: #8B8271;  --tut-text-on-gold: #FFFFFF;
  --tut-line: 1px solid rgba(184,134,11,.28);  --tut-line-strong: 1px solid rgba(184,134,11,.5);
  --tut-line-soft: 1px solid rgba(31,27,22,.10);
  --tut-glow-sm: 0 2px 10px rgba(184,134,11,.14);  --tut-glow-md: 0 6px 22px rgba(184,134,11,.18);
  --tut-shadow-card: 0 10px 28px rgba(31,27,22,.10);
  --tut-ok: #2E9E6B;  --tut-warn: #C98A1B;  --tut-bad: #B8402F;  --tut-info: #0F8C82;
}
