/* =========================================================================
   Portal - Saad Dahlab University, Faculty of Technology
   A single, hand-crafted stylesheet with a premium, official feel.
   ========================================================================= */

/* ----------------------- Design tokens ----------------------------------- */
:root {
  --color-bg: #f6f8fc;
  --color-surface: #ffffff;
  --color-surface-2: #f1f4fb;
  --color-surface-elev: #ffffff;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-text: #0f172a;
  --color-text-muted: #475569;
  --color-text-soft: #64748b;

  --color-brand-50:  #eff6ff;
  --color-brand-100: #dbeafe;
  --color-brand-200: #bfdbfe;
  --color-brand-300: #93c5fd;
  --color-brand-400: #60a5fa;
  --color-brand-500: #3b82f6;
  --color-brand-600: #2563eb;
  --color-brand-700: #1d4ed8;
  --color-brand-800: #1e40af;
  --color-brand-900: #1e3a8a;
  --color-brand-950: #0b2447;

  --color-amber-50: #fffbeb;
  --color-amber-100:#fef3c7;
  --color-amber-600:#d97706;
  --color-amber-700:#b45309;

  --color-green-50: #ecfdf5;
  --color-green-100:#d1fae5;
  --color-green-600:#059669;
  --color-green-700:#047857;

  --color-red-50:   #fef2f2;
  --color-red-100:  #fee2e2;
  --color-red-600:  #dc2626;
  --color-red-700:  #b91c1c;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.10), 0 8px 16px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 12px 36px rgba(37, 99, 235, 0.20);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-2xl: 28px;
  --radius-pill: 999px;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --container: 1180px;

  --t-fast: 140ms cubic-bezier(.4,.0,.2,1);
  --t-base: 220ms cubic-bezier(.4,.0,.2,1);
  --t-slow: 360ms cubic-bezier(.4,.0,.2,1);
}

html.theme-dark {
  --color-bg: #0b1220;
  --color-surface: #0f1a30;
  --color-surface-2: #122443;
  --color-surface-elev: #142a52;
  --color-border: #1e2f55;
  --color-border-strong: #2a3e6e;
  --color-text: #e6edf7;
  --color-text-muted: #aab8d3;
  --color-text-soft: #8696b8;

  --shadow-md: 0 6px 18px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.25);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.45), 0 8px 16px rgba(0,0,0,0.30);
  --shadow-glow: 0 12px 36px rgba(59, 130, 246, 0.35);
}

/* ------------------------- Base / reset ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; }
html, body { margin: 0; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); line-height: 1.08; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); line-height: 1.15; }
h3 { font-size: 1.15rem; }
p  { margin: 0; }

a { color: var(--color-brand-700); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--color-brand-900); }
html.theme-dark a { color: var(--color-brand-300); }
html.theme-dark a:hover { color: var(--color-brand-100); }

img, svg { display: block; max-width: 100%; }
button { font-family: inherit; }

[x-cloak] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -100px; left: 8px; padding: 8px 12px; z-index: 100;
  background: var(--color-brand-900); color: #fff; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 8px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }
@media (min-width: 768px) { .container { padding: 0 2rem; } }

/* ----------------------- Page shell / header ----------------------------- */
.page-shell { display: flex; flex-direction: column; min-height: 100vh; }
.site-main { flex: 1; }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--color-surface) 80%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--color-border);
}
.site-header__inner {
  max-width: var(--container); margin: 0 auto; padding: 0.85rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
@media (min-width: 768px) { .site-header__inner { padding: 1rem 2rem; } }

.brand {
  display: inline-flex; align-items: center; gap: 0.75rem;
  color: var(--color-text); text-decoration: none;
}
.brand--center { flex-direction: column; gap: 0.6rem; align-items: center; text-align: center; }
.brand__mark { width: 44px; height: 44px; flex: none; display: grid; place-items: center; }
.brand__mark svg, .brand__mark img { width: 100%; height: 100%; object-fit: contain; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__line1 { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; }
.brand__line2 { font-size: 0.78rem; color: var(--color-text-muted); }

.nav-desktop {
  margin-left: auto;
  display: none; gap: 0.4rem; align-items: center;
}
@media (min-width: 880px) { .nav-desktop { display: flex; } }
.nav-link {
  padding: 0.55rem 0.9rem; border-radius: var(--radius-md);
  color: var(--color-text-muted); font-weight: 500; font-size: 0.93rem;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-link:hover { background: var(--color-surface-2); color: var(--color-text); }
.nav-link.is-active { color: var(--color-brand-700); background: var(--color-brand-50); }
html.theme-dark .nav-link.is-active { background: rgba(59,130,246,0.15); color: var(--color-brand-200); }
.nav-link--cta {
  background: linear-gradient(135deg, var(--color-brand-700), var(--color-brand-900));
  color: #fff !important;
  box-shadow: var(--shadow-glow);
}
.nav-link--cta:hover { transform: translateY(-1px); }
.nav-link--ghost { border: 1px solid var(--color-border); }

.nav-burger {
  margin-left: auto;
  display: inline-flex; flex-direction: column; gap: 4px; width: 40px; height: 40px;
  align-items: center; justify-content: center;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: 10px; cursor: pointer;
}
.nav-burger span { width: 18px; height: 2px; background: var(--color-text); border-radius: 2px; }
@media (min-width: 880px) { .nav-burger { display: none; } }

.nav-mobile {
  border-top: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  padding: 0.5rem 1.25rem 1rem;
  background: var(--color-surface);
}
.nav-mobile__link {
  padding: 0.85rem 0.5rem; border-bottom: 1px solid var(--color-border);
  color: var(--color-text); font-weight: 500;
}
.nav-mobile__link:last-child { border-bottom: 0; }
.nav-mobile__link--cta { color: var(--color-brand-700); }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--color-border); background: var(--color-surface-2);
  color: var(--color-text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t-fast);
}
.theme-toggle:hover { color: var(--color-text); transform: translateY(-1px); }

/* Notification bell (dashboard top bar) */
.notif-bell {
  position: relative;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--color-border); background: var(--color-surface-2);
  color: var(--color-text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.notif-bell:hover { color: var(--color-text); transform: translateY(-1px); }
.notif-bell__badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--color-red-600, #dc2626); color: #fff;
  font-size: 0.7rem; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--color-surface);
}

/* Settings form helpers */
.field__hint { display: block; margin-top: 0.35rem; color: var(--color-text-muted); font-size: 0.85rem; }
.field__error { display: block; margin-top: 0.35rem; color: var(--color-red-600, #dc2626); font-size: 0.85rem; }
.setting-check { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; user-select: none; }
.setting-check input { width: 18px; height: 18px; }

/* ----------------------- Footer ------------------------------------------ */
.site-footer { border-top: 1px solid var(--color-border); background: var(--color-surface); margin-top: 4rem; }
.site-footer__inner {
  max-width: var(--container); margin: 0 auto; padding: 2rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.5rem; justify-content: space-between; align-items: flex-start;
}
@media (min-width: 768px) {
  .site-footer__inner { flex-direction: row; align-items: center; padding: 2rem; }
}
.site-footer__brand { display: flex; align-items: flex-start; gap: 0.7rem; font-size: 0.9rem; }
.site-footer__logo { width: 40px; height: 40px; flex: none; object-fit: contain; }
.site-footer__brand-text { display: flex; flex-direction: column; gap: 0.15rem; }
.site-footer__brand strong { font-family: var(--font-display); }
.site-footer__addr { color: var(--color-text-soft); font-size: 0.82rem; }
.site-footer__meta { color: var(--color-text-muted); font-size: 0.85rem; display: inline-flex; gap: 0.4rem; align-items: center; }
.site-footer__dot { opacity: 0.5; }
.site-footer__right { display: flex; flex-direction: column; gap: 0.7rem; align-items: flex-start; }
@media (min-width: 768px) { .site-footer__right { align-items: flex-end; } }
.site-footer__social { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.site-footer__social-label { font-size: 0.82rem; color: var(--color-text-muted); margin-right: 0.15rem; }
.social-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--color-border); background: var(--color-surface-2, transparent);
  color: var(--color-text-soft); font-size: 0.82rem; font-weight: 600;
  text-decoration: none; transition: color .15s, border-color .15s, background .15s, transform .15s;
}
.social-link svg { color: #1877F2; flex: none; }
.social-link:hover { color: var(--color-text); border-color: #1877F2; transform: translateY(-1px); }

/* ----------------------- Hero ------------------------------------------- */
.hero { position: relative; overflow: hidden; padding: 3rem 0 4rem; }
@media (min-width: 768px) { .hero { padding: 5rem 0 6rem; } }

.hero__bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.hero__blob {
  position: absolute; width: 520px; height: 520px; border-radius: 50%;
  filter: blur(80px); opacity: 0.55;
}
.hero__blob--a { background: radial-gradient(circle, #93c5fd 0%, transparent 60%); top: -120px; left: -120px; animation: floatA 18s ease-in-out infinite; }
.hero__blob--b { background: radial-gradient(circle, #1e40af 0%, transparent 60%); bottom: -180px; right: -120px; animation: floatB 22s ease-in-out infinite; }
html.theme-dark .hero__blob--a { opacity: 0.35; }
html.theme-dark .hero__blob--b { opacity: 0.45; }

@keyframes floatA { 50% { transform: translate(40px, 30px) scale(1.08); } }
@keyframes floatB { 50% { transform: translate(-30px, -40px) scale(1.1); } }

.hero__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.6), transparent 70%);
}
html.theme-dark .hero__grid {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

.hero__inner {
  position: relative; z-index: 1;
  display: grid; gap: 3rem;
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) { .hero__inner { grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 4rem; } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.8rem; border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 0.78rem; font-weight: 600; color: var(--color-brand-800);
  letter-spacing: 0.04em; text-transform: uppercase;
}
html.theme-dark .eyebrow { color: var(--color-brand-200); }
.eyebrow__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--color-brand-500);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.35); }
  50%      { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}

.hero__title { margin-top: 1.1rem; }
.hero__title-grad {
  background: linear-gradient(120deg, var(--color-brand-700), var(--color-brand-400) 60%, var(--color-brand-800));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.hero__lede {
  margin-top: 1.2rem; max-width: 56ch;
  font-size: 1.1rem; color: var(--color-text-muted);
}
.hero__cta { margin-top: 1.8rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero__bullets { list-style: none; padding: 0; margin: 1.8rem 0 0; display: grid; gap: 0.5rem; }
.hero__bullets li { color: var(--color-text-muted); }
.check {
  display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 50%; background: var(--color-green-100); color: var(--color-green-700);
  font-weight: 700; margin-right: 0.5rem; font-size: 0.85rem;
}

/* Phone mockup */
.hero__art { display: flex; justify-content: center; }
.device-frame {
  width: min(320px, 80vw);
  background: linear-gradient(180deg, #0b2447, #1e3a8a);
  border-radius: 44px; padding: 18px;
  box-shadow: 0 40px 80px rgba(15, 23, 42, 0.25), inset 0 0 0 1px rgba(255,255,255,0.06);
  position: relative;
}
.device-frame__notch {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 22px; background: #0b1220; border-radius: 16px;
}
.device-frame__screen {
  background: #fff; border-radius: 28px; min-height: 540px;
  padding: 1.6rem 1.2rem 1.2rem; overflow: hidden;
}
.float-anim { animation: floaty 5s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-12px); } }

.mock-app__top { display: flex; justify-content: space-between; align-items: center; }
.mock-app__logo { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display); font-size: 0.85rem; color: var(--color-brand-900); }
.mock-dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #1e3a8a); }
.mock-pill { font-size: 0.7rem; background: var(--color-brand-50); color: var(--color-brand-700); padding: 4px 8px; border-radius: 999px; font-weight: 600; }
.mock-app__title { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; margin-top: 1.2rem; color: #0f172a; }
.mock-app__sub { font-size: 0.85rem; color: #64748b; margin-top: 2px; }

.mock-field { display: flex; flex-direction: column; gap: 4px; margin-top: 0.9rem; }
.mock-label { font-size: 0.72rem; color: #475569; }
.mock-input {
  background: #f1f5f9; border-radius: 10px; padding: 0.6rem 0.7rem; font-size: 0.82rem; color: #0f172a;
  min-height: 38px; display: flex; align-items: center;
}
.mock-input--chip { background: var(--color-brand-50); color: var(--color-brand-800); font-weight: 600; }
.mock-input--multi { min-height: 80px; align-items: flex-start; position: relative; }
.mock-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.mock-typing::after {
  content: 'My grade for the Signals module seems incorrect…';
  display: inline-block; overflow: hidden; white-space: pre-wrap;
  animation: typing 5s steps(40, end) infinite alternate;
  font-size: 0.82rem; color: #0f172a;
}
@keyframes typing { from { max-width: 0; } to { max-width: 100%; } }

.mock-cta {
  margin-top: 1.1rem; background: linear-gradient(135deg, #2563eb, #1e3a8a);
  color: #fff; padding: 0.75rem 1rem; border-radius: 12px; text-align: center;
  font-weight: 600; box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
}

/* ----------------------- Buttons ----------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.7rem 1.15rem; border-radius: var(--radius-md);
  font-weight: 600; font-size: 0.95rem; cursor: pointer;
  border: 1px solid transparent; background: var(--color-surface);
  color: var(--color-text);
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: linear-gradient(135deg, var(--color-brand-700), var(--color-brand-900));
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn--primary:hover { color: #fff; box-shadow: 0 16px 44px rgba(37, 99, 235, 0.30); }
.btn--ghost {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn--ghost:hover { background: var(--color-surface-2); border-color: var(--color-border-strong); color: var(--color-text); }
.btn--white { background: #fff; color: var(--color-brand-900); }
.btn--white:hover { color: var(--color-brand-900); box-shadow: var(--shadow-lg); }

.btn--lg { padding: 0.95rem 1.4rem; font-size: 1.0rem; border-radius: 14px; }
.btn--sm { padding: 0.5rem 0.8rem; font-size: 0.85rem; border-radius: 10px; }
.btn--xs { padding: 0.35rem 0.65rem; font-size: 0.8rem; border-radius: 8px; }
.btn--block { width: 100%; }
.btn--danger { background: var(--color-red-100); color: var(--color-red-700); }
.btn--danger:hover { background: var(--color-red-700); color: #fff; }
.inline-form { display: inline; }

.btn[disabled], .btn.is-loading { opacity: 0.85; cursor: progress; }
.btn-loader { display: inline-flex; align-items: center; gap: 0.5rem; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.4px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
.btn--ghost .spinner, .htmx-indicator.spinner {
  border-color: rgba(15,23,42,0.15); border-top-color: var(--color-brand-700);
}
@keyframes spin { to { transform: rotate(360deg); } }

.htmx-indicator { opacity: 0; transition: opacity var(--t-fast); }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* ----------------------- How / Types / CTA band ------------------------- */
.how { padding: 4rem 0 1rem; }
.how__head { text-align: center; max-width: 640px; margin: 0 auto 2.5rem; }
.how__head p { color: var(--color-text-muted); margin-top: 0.5rem; }
.how__grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .how__grid { grid-template-columns: repeat(3, 1fr); } }

.step {
  position: relative; padding: 1.6rem 1.4rem; border-radius: var(--radius-xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.step:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--color-brand-200); }
.step__num {
  position: absolute; top: 1.4rem; right: 1.4rem;
  font-family: var(--font-display); font-weight: 800; font-size: 1.6rem;
  color: var(--color-brand-100);
  -webkit-text-stroke: 1px var(--color-brand-300);
}
.step__icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--color-brand-50), var(--color-brand-100));
  color: var(--color-brand-800);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
}
.step h3 { font-family: var(--font-display); }
.step p { color: var(--color-text-muted); margin-top: 0.35rem; }

.types { padding: 4rem 0 2rem; }
.types__head { text-align: center; max-width: 640px; margin: 0 auto 2rem; }
.types__head p { color: var(--color-text-muted); margin-top: 0.5rem; }
.types__grid {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) { .types__grid { grid-template-columns: repeat(4, 1fr); } }

.type-card {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  gap: 0.5rem; padding: 1rem; border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  min-height: 110px; font-weight: 600;
  transition: transform var(--t-base), border-color var(--t-base), background var(--t-base);
}
.type-card span:first-child { font-size: 1.5rem; }
.type-card:hover { transform: translateY(-3px); border-color: var(--color-brand-300); background: var(--color-brand-50); }
html.theme-dark .type-card:hover { background: rgba(59,130,246,0.12); }

.cta-band {
  margin: 4rem 0 0;
  background:
    radial-gradient(800px 200px at 20% 0%, rgba(255,255,255,0.18), transparent),
    linear-gradient(135deg, var(--color-brand-800), var(--color-brand-950));
  color: #fff;
  padding: 3rem 0;
}
.cta-band__inner {
  display: flex; flex-direction: column; gap: 1.4rem; align-items: flex-start; justify-content: space-between;
}
@media (min-width: 768px) { .cta-band__inner { flex-direction: row; align-items: center; } }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,0.78); margin-top: 0.4rem; }

/* ----------------------- Form page --------------------------------------- */
.form-page { padding: 3rem 0 4rem; }
.form-page__inner { max-width: 800px; }
.form-page__head h1 { margin-top: 1rem; }
.form-page__head p { color: var(--color-text-muted); margin-top: 0.8rem; max-width: 60ch; }

.card-form {
  margin-top: 2rem; padding: 1.6rem;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl); box-shadow: var(--shadow-md);
  display: grid; gap: 1.6rem;
}
@media (min-width: 768px) { .card-form { padding: 2.2rem; } }

.card-form__group {
  border: 0; padding: 0; margin: 0;
  display: grid; gap: 0.85rem;
}
.card-form__group legend {
  font-family: var(--font-display); font-weight: 700; font-size: 1.0rem;
  margin-bottom: 0.4rem; padding: 0;
}

.grid { display: grid; gap: 0.85rem; }
.grid--two { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid--two { grid-template-columns: 1fr 1fr; } }

.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-size: 0.86rem; font-weight: 600; color: var(--color-text-muted); }
.field .req { color: var(--color-red-600); }
.field .opt { color: var(--color-text-soft); font-weight: 500; font-size: 0.78rem; }

.input, .select, .textarea,
.field input[type="text"],
.field input[type="search"],
.field input[type="email"],
.field input[type="password"],
.field textarea {
  width: 100%; appearance: none;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.96rem; font-family: inherit; line-height: 1.4;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input:focus, .select:focus, .textarea:focus,
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--color-brand-500);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}
.input--lg { padding: 1rem 1.1rem; font-size: 1rem; }
.input--mono { font-family: var(--font-mono); letter-spacing: 0.05em; }
.textarea { resize: vertical; min-height: 130px; }

.err { color: var(--color-red-600); font-size: 0.82rem; margin-top: 0.15rem; }

/* Chips (academic year) */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  position: relative; cursor: pointer; user-select: none;
}
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip span {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.55rem 1.05rem; border-radius: var(--radius-pill);
  border: 1px solid var(--color-border); background: var(--color-surface);
  font-weight: 600; transition: all var(--t-fast);
  min-width: 60px;
}
.chip:hover span { border-color: var(--color-brand-300); color: var(--color-brand-800); }
.chip input:checked + span {
  background: linear-gradient(135deg, var(--color-brand-700), var(--color-brand-900));
  color: #fff; border-color: transparent; box-shadow: var(--shadow-glow);
}

/* Type radio grid */
.type-radio-grid {
  display: grid; gap: 0.6rem;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) { .type-radio-grid { grid-template-columns: repeat(4, 1fr); } }

.type-radio { position: relative; cursor: pointer; }
.type-radio input { position: absolute; opacity: 0; inset: 0; }
.type-radio__inner {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.45rem;
  padding: 0.85rem 0.9rem; border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.88rem; font-weight: 600; min-height: 92px;
  transition: all var(--t-fast);
}
.type-radio:hover .type-radio__inner { border-color: var(--color-brand-300); transform: translateY(-2px); }
.type-radio input:checked + .type-radio__inner {
  border-color: var(--color-brand-500);
  background: var(--color-brand-50);
  color: var(--color-brand-900);
  box-shadow: var(--shadow-glow);
}
html.theme-dark .type-radio input:checked + .type-radio__inner {
  background: rgba(59,130,246,0.15); color: var(--color-brand-100);
}
.type-radio__icon { font-size: 1.5rem; }

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 2rem 1rem;
  border: 2px dashed var(--color-border-strong); border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  cursor: pointer; text-align: center;
  transition: all var(--t-fast);
}
.dropzone:hover, .dropzone.is-drag {
  border-color: var(--color-brand-500); background: var(--color-brand-50);
  color: var(--color-brand-800);
}
html.theme-dark .dropzone:hover, html.theme-dark .dropzone.is-drag {
  background: rgba(59,130,246,0.10);
}
.dropzone__hint { font-size: 0.82rem; }
.dropzone__input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.file-list { list-style: none; padding: 0; margin: 0.8rem 0 0; display: grid; gap: 0.4rem; }
.file-item {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 0.5rem 0.7rem;
  animation: fadeUp 240ms ease both;
}
.file-item__name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item__size { color: var(--color-text-soft); font-size: 0.8rem; }
.file-item__rm {
  border: 0; background: transparent; color: var(--color-text-soft);
  font-size: 1.2rem; cursor: pointer; padding: 0 0.3rem; line-height: 1;
}
.file-item__rm:hover { color: var(--color-red-600); }

.char-meter { text-align: right; font-size: 0.78rem; color: var(--color-text-soft); margin-top: 0.2rem; }

.card-form__submit { margin-top: 0.5rem; }
.card-form__legal {
  margin-top: 0.8rem; font-size: 0.82rem; color: var(--color-text-soft); text-align: center;
}

/* Alerts / flashes */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius-md); border: 1px solid; }
.alert--error { background: var(--color-red-50); border-color: var(--color-red-100); color: var(--color-red-700); }

.flash-stack {
  position: fixed; top: 84px; right: 1.25rem; z-index: 70;
  display: flex; flex-direction: column; gap: 0.5rem; max-width: 360px;
}
.flash-stack--dash { top: 70px; right: 1rem; }
.flash {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 0.8rem 1rem; box-shadow: var(--shadow-lg);
  font-size: 0.92rem; display: flex; align-items: center; gap: 0.8rem;
  animation: slideIn 280ms cubic-bezier(.2,.8,.2,1) both;
}
.flash--success { border-left: 4px solid var(--color-green-600); }
.flash--error   { border-left: 4px solid var(--color-red-600); }
.flash--info    { border-left: 4px solid var(--color-brand-600); }
.flash__close {
  margin-left: auto; background: transparent; border: 0; color: var(--color-text-soft);
  font-size: 1.2rem; cursor: pointer;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } }

/* ----------------------- Success page ----------------------------------- */
.success { position: relative; padding: 4rem 0 6rem; text-align: center; overflow: hidden; }
.success__inner { max-width: 700px; margin: 0 auto; position: relative; z-index: 1; }
.success__check {
  width: 110px; height: 110px; margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-green-50), transparent 70%);
}
.success__check svg { width: 100%; height: 100%; }
.success__ring {
  fill: none; stroke: var(--color-green-600); stroke-width: 3;
  stroke-dasharray: 184; stroke-dashoffset: 184;
  animation: drawRing 0.9s ease-out 0.1s forwards;
}
.success__tick {
  fill: none; stroke: var(--color-green-600); stroke-width: 4;
  stroke-dasharray: 60; stroke-dashoffset: 60;
  animation: drawTick 0.45s ease-out 0.7s forwards;
}
@keyframes drawRing { to { stroke-dashoffset: 0; } }
@keyframes drawTick { to { stroke-dashoffset: 0; } }

.success__title { margin-bottom: 0.5rem; }
.success__lede { color: var(--color-text-muted); max-width: 60ch; margin: 0.5rem auto 2rem; }

.track-card {
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 1.4rem 2rem; border-radius: var(--radius-xl);
  background: var(--color-surface);
  border: 1px dashed var(--color-brand-300);
  box-shadow: var(--shadow-md);
  margin: 0 auto;
}
.track-card__label { color: var(--color-text-soft); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; }
.track-card__num-row { display: flex; gap: 0.7rem; align-items: center; }
.track-card__num {
  font-family: var(--font-mono); font-weight: 700; font-size: 1.6rem;
  letter-spacing: 0.08em; color: var(--color-brand-900);
}
html.theme-dark .track-card__num { color: var(--color-brand-200); }
.track-card__hint { font-size: 0.78rem; color: var(--color-text-soft); }

.success-summary {
  margin: 2.5rem auto 0; max-width: 520px; text-align: left;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: 1.4rem 1.6rem;
}
.success-summary h3 { margin-bottom: 0.8rem; }
.success-summary dl { display: grid; gap: 0.5rem; margin: 0; }
.success-summary dl div { display: flex; justify-content: space-between; gap: 1rem; }
.success-summary dt { color: var(--color-text-soft); }
.success-summary dd { margin: 0; font-weight: 600; text-align: right; }

.success__actions { margin-top: 2rem; display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

.success__bg { position: absolute; inset: 0; pointer-events: none; }
.success__confetti { position: absolute; inset: 0; overflow: hidden; }
.success__confetti span {
  position: absolute; top: -20px; width: 8px; height: 14px; border-radius: 2px;
  background: var(--color-brand-500);
  opacity: 0; animation: confetti 4s ease-out infinite;
  left: calc(8% + var(--i) * 8%);
  animation-delay: calc(var(--i) * 0.12s);
}
.success__confetti span:nth-child(3n) { background: var(--color-green-600); }
.success__confetti span:nth-child(4n) { background: var(--color-amber-600); }
.success__confetti span:nth-child(5n) { background: var(--color-brand-900); }
@keyframes confetti {
  0% { transform: translateY(-20px) rotate(0); opacity: 0; }
  10% { opacity: 0.85; }
  100% { transform: translateY(620px) rotate(540deg); opacity: 0; }
}

/* ----------------------- Track page ------------------------------------- */
.track-page { padding: 4rem 0 6rem; }
.track-page__inner { max-width: 760px; margin: 0 auto; }
.track-page__head h1 { margin-top: 1rem; }
.track-page__head p { color: var(--color-text-muted); margin-top: 0.6rem; max-width: 60ch; }

.track-form { margin-top: 2rem; }
.track-form__row {
  display: flex; gap: 0.5rem; align-items: stretch;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: 0.6rem;
  box-shadow: var(--shadow-md);
}
.track-form__row .input { border: 0; box-shadow: none; padding: 0.7rem 0.9rem; }
.track-form__row .input:focus { box-shadow: none; }
.track-form__row .btn { white-space: nowrap; }

.track-result { margin-top: 1.5rem; }
.track-empty {
  padding: 2rem; text-align: center;
  background: var(--color-surface); border: 1px dashed var(--color-border); border-radius: var(--radius-xl);
}
.track-empty__ico { font-size: 2rem; margin-bottom: 0.5rem; }

.track-card-result {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: 1.6rem 1.8rem;
  box-shadow: var(--shadow-md);
}
.track-card-result__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.track-card-result__num { font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.08em; }
.track-card-result__line { color: var(--color-text-muted); margin-top: 0.2rem; }
.track-card-result__line strong { color: var(--color-text); }

.track-timeline { display: grid; gap: 0.6rem; margin-top: 1.6rem; }
.track-timeline__item {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 0.9rem; border-radius: var(--radius-md);
  background: var(--color-surface-2); color: var(--color-text-soft);
  opacity: 0.65;
}
.track-timeline__item .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-border-strong); }
.track-timeline__item.is-done { opacity: 1; color: var(--color-text); }
.track-timeline__item.is-done .dot { background: var(--color-green-600); box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.18); }
.track-timeline__item small { margin-left: auto; color: var(--color-text-soft); }

/* ----------------------- Status pills ------------------------------------ */
.status-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem; font-size: 0.78rem; font-weight: 700;
  border-radius: var(--radius-pill); white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.06em;
  transition: all var(--t-base);
}
.status-pill--lg { padding: 0.45rem 1rem; font-size: 0.85rem; }
.status-pill--new       { background: var(--color-brand-100); color: var(--color-brand-800); }
.status-pill--in_review { background: var(--color-amber-100); color: var(--color-amber-700); }
.status-pill--solved    { background: var(--color-green-100); color: var(--color-green-700); }
.status-pill--rejected  { background: var(--color-red-100);   color: var(--color-red-700); }
html.theme-dark .status-pill--new       { background: rgba(96,165,250,0.20); color: #bfdbfe; }
html.theme-dark .status-pill--in_review { background: rgba(217,119,6,0.20); color: #fcd34d; }
html.theme-dark .status-pill--solved    { background: rgba(5,150,105,0.22); color: #6ee7b7; }
html.theme-dark .status-pill--rejected  { background: rgba(220,38,38,0.20); color: #fca5a5; }

/* ----------------------- Auth (login) ----------------------------------- */
.login-body { background: linear-gradient(160deg, var(--color-bg), var(--color-surface-2)); }
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; padding: 2rem 1.25rem; }
.auth__bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.auth__panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl); box-shadow: var(--shadow-lg);
  padding: 2rem;
}
@media (min-width: 768px) { .auth__panel { padding: 2.6rem; } }
.auth__title { margin-top: 1.5rem; text-align: center; }
.auth__sub { color: var(--color-text-muted); text-align: center; margin-top: 0.5rem; margin-bottom: 1.6rem; }
.auth__form { display: grid; gap: 1rem; }
.auth__foot { margin-top: 1.2rem; text-align: center; font-size: 0.88rem; }

/* ----------------------- Dashboard shell --------------------------------- */
.dashboard-body { background: var(--color-bg); }
.dash-shell {
  display: grid; grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
@media (max-width: 980px) {
  .dash-shell { grid-template-columns: 1fr; }
  .dash-side { position: fixed; top: 0; left: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform var(--t-base); z-index: 60; box-shadow: var(--shadow-lg); }
  .dash-side.is-open { transform: translateX(0); }
}

.dash-side {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  padding: 1.2rem 0.9rem;
}
.dash-side__brand {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem; margin-bottom: 1rem;
}
.dash-side__brand small { color: var(--color-text-soft); font-size: 0.78rem; display: block; }

.dash-nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.dash-nav__link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 0.85rem; border-radius: var(--radius-md);
  color: var(--color-text-muted); font-weight: 500; font-size: 0.92rem;
  transition: all var(--t-fast);
}
.dash-nav__link:hover { background: var(--color-surface-2); color: var(--color-text); transform: translateX(2px); }
.dash-nav__link.is-active {
  background: linear-gradient(135deg, var(--color-brand-50), transparent);
  color: var(--color-brand-800);
  box-shadow: inset 3px 0 0 var(--color-brand-600);
}
html.theme-dark .dash-nav__link.is-active {
  background: rgba(59,130,246,0.12);
  color: var(--color-brand-200);
}

.dash-side__foot { display: grid; gap: 0.7rem; padding: 0.6rem; border-top: 1px solid var(--color-border); margin-top: 0.6rem; }
.dash-user { display: flex; align-items: center; gap: 0.7rem; }
.dash-user__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-brand-500), var(--color-brand-800));
  color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.dash-user__meta strong { display: block; font-size: 0.88rem; }
.dash-user__meta small { color: var(--color-text-soft); font-size: 0.78rem; }

.dash-main { display: flex; flex-direction: column; min-width: 0; }
.dash-top {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 80%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 40;
}
.dash-top__burger {
  display: inline-flex; flex-direction: column; gap: 4px;
  width: 38px; height: 38px; align-items: center; justify-content: center;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: 10px; cursor: pointer;
}
.dash-top__burger span { width: 18px; height: 2px; background: var(--color-text); border-radius: 2px; }
@media (min-width: 981px) { .dash-top__burger { display: none; } }

.dash-top__crumbs { font-size: 0.88rem; color: var(--color-text-muted); display: inline-flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.dash-top__crumbs a { color: var(--color-text-muted); }
.dash-top__crumbs a:hover { color: var(--color-text); }
.dash-top__right { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; }

.dash-content { padding: 1.5rem 1.25rem 4rem; }
@media (min-width: 768px) { .dash-content { padding: 2rem 2rem 4rem; } }

/* Dash hero */
.dash-hero {
  display: flex; flex-direction: column; gap: 1rem;
  margin-bottom: 1.6rem;
}
@media (min-width: 768px) { .dash-hero { flex-direction: row; align-items: center; justify-content: space-between; } }
.dash-hero h1 { font-size: clamp(1.6rem, 2.8vw, 2rem); }
.dash-hero p { color: var(--color-text-muted); margin-top: 0.3rem; }
.dash-hero__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Stat cards */
.stat-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 1.6rem;
}
@media (min-width: 980px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base), box-shadow var(--t-base);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 160px; height: 160px; border-radius: 50%; filter: blur(60px); opacity: 0.55;
  pointer-events: none;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card header { display: flex; align-items: center; justify-content: space-between; color: var(--color-text-soft); font-size: 0.85rem; }
.stat-card__num { display: block; font-family: var(--font-display); font-weight: 800; font-size: 2rem; margin-top: 0.4rem; }
.stat-card small { color: var(--color-text-soft); }
.stat-card--blue::before   { background: var(--color-brand-300); }
.stat-card--amber::before  { background: #fcd34d; }
.stat-card--green::before  { background: #6ee7b7; }
.stat-card--purple::before { background: #c4b5fd; }

/* Panels */
.dash-split {
  display: grid; gap: 1rem; grid-template-columns: 1fr;
}
@media (min-width: 1024px) { .dash-split { grid-template-columns: 1.4fr 1fr; } }

.panel {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--color-border);
}
.panel__head h2 { font-size: 1.05rem; font-family: var(--font-display); }
.panel__link { font-size: 0.86rem; }
.panel__body { padding: 1rem 1.3rem 1.3rem; }
.panel--span { grid-column: 1 / -1; }

/* Activity list */
.activity-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.3rem; }
.activity-item__link {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 0.6rem; border-radius: var(--radius-md);
  color: var(--color-text);
  transition: background var(--t-fast);
}
.activity-item__link:hover { background: var(--color-surface-2); }
.activity-item__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-brand-500), var(--color-brand-800));
  color: #fff; font-weight: 700; font-size: 0.78rem;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.activity-item__body { flex: 1; min-width: 0; }
.activity-item__body strong { display: block; font-size: 0.95rem; }
.activity-item__meta { color: var(--color-text-soft); font-size: 0.82rem; }
.activity-item__tail { text-align: right; display: flex; flex-direction: column; gap: 0.2rem; align-items: flex-end; }
.activity-item__tail small { color: var(--color-text-soft); }

/* Distribution bars */
.dist-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.85rem; }
.dist-list__row { display: flex; justify-content: space-between; font-size: 0.88rem; }
.dist-list__count { color: var(--color-text-soft); }
.dist-bar { height: 8px; background: var(--color-surface-2); border-radius: 999px; overflow: hidden; }
.dist-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--color-brand-500), var(--color-brand-900));
  border-radius: 999px;
  animation: barIn 0.6s ease-out both;
}
@keyframes barIn { from { width: 0 !important; } }

/* Filters */
.filters-panel { padding: 1rem 1.3rem; }
.filters { display: grid; gap: 0.8rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 1024px) { .filters { grid-template-columns: 1fr auto; } }
.filters__search {
  position: relative; display: flex; align-items: center; gap: 0.5rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); padding: 0.2rem 0.5rem 0.2rem 0.8rem;
}
.filters__search input { border: 0; flex: 1; padding: 0.65rem 0; background: transparent; }
.filters__search input:focus { box-shadow: none; }
.filters__group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.select {
  padding: 0.6rem 2.2rem 0.6rem 0.85rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 0.7rem center;
}

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 720px; }
.data-table thead th {
  text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-text-soft); font-weight: 600;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
  position: sticky; top: 0;
}
.data-table tbody td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.92rem;
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover { background: var(--color-surface-2); }
.data-table tbody tr.row-anim { animation: rowIn 380ms ease both; animation-delay: calc(var(--i) * 22ms); }
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } }

.mono { font-family: var(--font-mono); font-size: 0.85rem; }
.cell-user { display: flex; align-items: center; gap: 0.6rem; }
.cell-user__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-brand-500), var(--color-brand-800));
  color: #fff; font-size: 0.72rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.cell-user small { color: var(--color-text-soft); font-size: 0.78rem; display: block; }
.chip-mini { display: inline-block; padding: 0.2rem 0.5rem; background: var(--color-surface-2); border-radius: 999px; font-weight: 600; font-size: 0.75rem; }
.files-count { color: var(--color-text); font-size: 0.85rem; }
.files-count--muted { color: var(--color-text-soft); }

.empty { text-align: center; padding: 2rem 1rem; color: var(--color-text-muted); }
.empty--big { padding: 3.5rem 1rem; }
.empty--inline { padding: 1rem 0; }
.empty__ico { font-size: 2rem; margin-bottom: 0.4rem; }

/* Detail page */
.detail-head {
  display: flex; flex-direction: column; gap: 1rem;
  margin-bottom: 1.6rem;
}
@media (min-width: 768px) { .detail-head { flex-direction: row; align-items: center; justify-content: space-between; } }
.detail-head h1 { margin-top: 0.4rem; font-size: clamp(1.4rem, 2.4vw, 1.8rem); }
.detail-head__sub { color: var(--color-text-muted); margin-top: 0.3rem; }

.detail-grid {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
  .detail-grid { grid-template-columns: 1.6fr 1fr; }
  .detail-grid > .panel--span { grid-column: 1 / -1; }
}
.detail-msg { white-space: pre-wrap; line-height: 1.6; }

.attachment-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.attachment-item {
  display: flex; align-items: center; gap: 0.7rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem; background: var(--color-surface);
}
.attachment-item__icon { font-size: 1.4rem; }
.attachment-item__meta { flex: 1; min-width: 0; }
.attachment-item__meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-item__meta small { color: var(--color-text-soft); font-size: 0.78rem; }

/* Status switching */
.status-form { display: grid; gap: 0.9rem; }
.status-form__comment { width: 100%; resize: vertical; }
.status-picker { border: 0; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.status-picker__legend {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--color-text-muted); padding: 0;
}
.status-picker__grid {
  display: grid; gap: 0.5rem; grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 480px) { .status-picker__grid { grid-template-columns: repeat(4, 1fr); } }

/* Each status option is a label wrapping a hidden radio. */
.status-picker .status-pill {
  position: relative; cursor: pointer; user-select: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.15rem; padding: 0.7rem 0.6rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text-muted);
  font-weight: 600; font-size: 0.86rem;
  transition: all var(--t-fast);
}
.status-picker .status-pill input {
  position: absolute; opacity: 0; inset: 0; cursor: pointer;
}
.status-picker .status-pill:hover:not(.is-current) {
  transform: translateY(-2px);
  border-color: var(--color-border-strong); color: var(--color-text);
}
.status-picker .status-pill__label { font-weight: 700; }
.status-picker .status-pill__tag {
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; opacity: 0.75;
}
.status-picker .status-pill.is-current {
  cursor: not-allowed; opacity: 0.85;
}
.status-picker .status-pill.is-current input { cursor: not-allowed; }

/* Selected (checked) state — same brand-tinted look the old is-current had. */
.status-picker .status-pill:has(input:checked) {
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}
.status-picker .status-pill--new:has(input:checked)       { background: var(--color-brand-100);  color: var(--color-brand-800);  box-shadow: var(--shadow-glow); }
.status-picker .status-pill--in_review:has(input:checked) { background: var(--color-amber-100);  color: var(--color-amber-700);  box-shadow: 0 12px 28px rgba(217,119,6,0.18); }
.status-picker .status-pill--solved:has(input:checked)    { background: var(--color-green-100);  color: var(--color-green-700);  box-shadow: 0 12px 28px rgba(5,150,105,0.18); }
.status-picker .status-pill--rejected:has(input:checked)  { background: var(--color-red-100);    color: var(--color-red-700);    box-shadow: 0 12px 28px rgba(220,38,38,0.18); }

/* The current status pill keeps the tinted background even unselected, so
   staff can see what's active at a glance. */
.status-picker .status-pill--new.is-current       { background: var(--color-brand-100);  color: var(--color-brand-800); }
.status-picker .status-pill--in_review.is-current { background: var(--color-amber-100);  color: var(--color-amber-700); }
.status-picker .status-pill--solved.is-current    { background: var(--color-green-100);  color: var(--color-green-700); }
.status-picker .status-pill--rejected.is-current  { background: var(--color-red-100);    color: var(--color-red-700);   }

.status-form__footer {
  display: flex; justify-content: flex-end; padding-top: 0.2rem;
  border-top: 1px dashed var(--color-border);
}
.status-form__footer .btn { min-width: 12rem; justify-content: center; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; position: relative; }
.timeline__item {
  display: flex; align-items: flex-start; gap: 0.7rem;
  padding: 0.7rem 0.8rem; background: var(--color-surface-2);
  border-radius: var(--radius-md);
}
.timeline__dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--color-brand-500);
  box-shadow: 0 0 0 4px rgba(59,130,246,0.18); margin-top: 0.25rem; flex: none;
}
.timeline__item.is-done .timeline__dot { background: var(--color-green-600); box-shadow: 0 0 0 4px rgba(5,150,105,0.18); }
.timeline strong { font-size: 0.9rem; }
.timeline small { display: block; color: var(--color-text-soft); font-size: 0.78rem; }

/* Notes */
.note-form { display: grid; gap: 0.6rem; margin-bottom: 1rem; }
.note-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.note-item {
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface-2); padding: 0.8rem 1rem;
}
.note-item__head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.note-item__avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-brand-600), var(--color-brand-900));
  color: #fff; font-weight: 700; font-size: 0.78rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.note-item small { color: var(--color-text-soft); font-size: 0.78rem; }
.note-item p { white-space: pre-wrap; margin: 0; color: var(--color-text); }
.note-item--public {
  border-color: var(--color-brand-300);
  background: color-mix(in srgb, var(--color-brand-50) 60%, var(--color-surface-2));
}
.note-item__head .chip {
  margin-left: auto;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem; font-weight: 600;
  border: 1px solid var(--color-border);
  background: var(--color-surface-1);
  color: var(--color-text-muted);
  position: static; opacity: 1; inset: auto;
}
.note-item__head .chip--public {
  background: var(--color-brand-50);
  color: var(--color-brand-800);
  border-color: var(--color-brand-300);
}
.note-item__head .chip--private {
  background: var(--color-surface-2);
  color: var(--color-text-soft);
}

/* Public-facing replies on the tracking page */
.track-replies {
  margin-top: 1rem; display: grid; gap: 0.6rem;
  padding-top: 1rem; border-top: 1px solid var(--color-border);
}
.track-replies__title {
  margin: 0 0 0.2rem; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--color-text-muted);
}
.track-reply {
  border: 1px solid var(--color-brand-300);
  border-left: 3px solid var(--color-brand-600);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-brand-50) 60%, var(--color-surface-1));
  padding: 0.7rem 0.9rem;
}
.track-reply__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.6rem; margin-bottom: 0.3rem;
}
.track-reply__from { font-weight: 700; color: var(--color-brand-800); font-size: 0.85rem; }
.track-reply__head small { color: var(--color-text-soft); font-size: 0.78rem; }
.track-reply__body { margin: 0; white-space: pre-wrap; color: var(--color-text); }

/* QR poster */
.qr-page { display: flex; justify-content: center; }
.qr-poster {
  width: 100%; max-width: 460px;
  background: #fff; color: #0f172a;
  border-radius: var(--radius-2xl); padding: 2rem;
  box-shadow: var(--shadow-lg); border: 1px solid var(--color-border);
  text-align: center; display: grid; gap: 1rem;
}
.qr-poster__logo { display: flex; align-items: center; gap: 0.7rem; justify-content: center; }
.qr-poster__logo strong { display: block; font-family: var(--font-display); }
.qr-poster__logo small { display: block; color: var(--color-text-soft); font-size: 0.78rem; }
.qr-poster__title { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1.2; margin-top: 0.4rem; }
.qr-poster__title span { color: var(--color-brand-700); display: block; font-size: 1.1rem; font-weight: 600; }
.qr-poster__qr { padding: 1.4rem; background: var(--color-surface-2); border-radius: var(--radius-xl); display: flex; justify-content: center; }
.qr-poster__qr img { width: 220px; height: 220px; image-rendering: pixelated; }
.qr-poster__steps { list-style: none; padding: 0; margin: 0; text-align: left; display: grid; gap: 0.3rem; font-size: 0.9rem; }
.qr-poster__steps strong { color: var(--color-brand-700); margin-right: 0.4rem; }
.qr-poster__url { font-family: var(--font-mono); font-size: 0.78rem; color: var(--color-text-soft); overflow-wrap: break-word; }

/* ------------------------- Animations / utilities ----------------------- */
.fade-up { opacity: 0; animation: fadeUp 480ms cubic-bezier(.2,.8,.2,1) both; animation-delay: var(--delay, 0ms); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .float-anim { animation: none !important; }
  /* These start invisible and are revealed BY an animation. With animations
     disabled (iOS "Reduce Motion", etc.) they'd stay hidden -> blank page.
     Force them to their final, visible state. */
  .fade-up { opacity: 1 !important; transform: none !important; }
  .success__ring, .success__tick { stroke-dashoffset: 0 !important; }
}

/* ------------------------- Language switcher --------------------------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 .5rem;
  padding: 3px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
}
.theme-dark .lang-switch { background: rgba(255, 255, 255, 0.08); }
.lang-switch--mobile { margin: .75rem 0 0; align-self: flex-start; }
.lang-switch--dash { margin: 0 0 .75rem; width: 100%; justify-content: center; }
.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--color-text-soft, #475569);
  font: 600 0.72rem/1 'Inter', sans-serif;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.lang-btn:hover { color: var(--color-text, #0b1730); }
.lang-btn.is-active {
  background: #fff;
  color: var(--color-primary, #1e3a8a);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.theme-dark .lang-btn.is-active { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* ------------------------- RTL (Arabic) overrides ---------------------- */
[dir="rtl"] body { text-align: right; }
[dir="rtl"] .nav-desktop,
[dir="rtl"] .nav-mobile,
[dir="rtl"] .dash-nav,
[dir="rtl"] .dash-top { direction: rtl; }
[dir="rtl"] .brand,
[dir="rtl"] .brand--center,
[dir="rtl"] .dash-side__brand { flex-direction: row-reverse; }
[dir="rtl"] .hero__cta,
[dir="rtl"] .dash-hero__actions,
[dir="rtl"] .success__actions { flex-wrap: wrap; }
[dir="rtl"] .field label,
[dir="rtl"] .auth__title,
[dir="rtl"] .auth__sub { text-align: right; }
[dir="rtl"] .skip-link { left: auto; right: 1rem; }
[dir="rtl"] .lang-switch { direction: ltr; }
[dir="rtl"] .timeline__item { padding-right: 2rem; padding-left: 0; }
[dir="rtl"] .timeline__dot { right: 0; left: auto; }
[dir="rtl"] .dash-top__crumbs { direction: rtl; }
[dir="rtl"] .filters__search svg,
[dir="rtl"] .filters__search .htmx-indicator { left: 12px; right: auto; }
[dir="rtl"] .filters__search input { padding-right: 2.5rem; padding-left: 1rem; }
[dir="rtl"] .nav-mobile { align-items: flex-end; }
[dir="rtl"] code, [dir="rtl"] .mono { direction: ltr; unicode-bidi: embed; display: inline-block; }

/* ----------------------- News ------------------------------------------- */
.news-page { padding: 2.5rem 0 4rem; }
.news-page__head { max-width: 720px; margin-bottom: 2rem; }
.news-page__head h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0.5rem 0 0.4rem; }
.news-page__head p { color: var(--color-text-muted); }

.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.4rem; }

.news-card { background: var(--color-surface-elev); border: 1px solid var(--color-border); border-radius: var(--radius-lg, 16px); overflow: hidden; box-shadow: var(--shadow-md); transition: transform var(--t-fast, 160ms), box-shadow var(--t-fast, 160ms); }
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.news-card__link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: var(--color-text); }
.news-card__media { aspect-ratio: 16 / 9; background: var(--color-surface-2); overflow: hidden; }
.news-card__media img { width: 100%; height: 100%; object-fit: cover; }
.news-card__body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.4rem; }
.news-card__date { font-size: 0.78rem; color: var(--color-text-muted); }
.news-card__title { font-family: var(--font-display); font-size: 1.1rem; margin: 0; line-height: 1.25; }
.news-card__excerpt { color: var(--color-text-muted); font-size: 0.9rem; margin: 0; }
.news-card__more { margin-top: auto; padding-top: 0.5rem; color: var(--color-brand-600); font-weight: 600; font-size: 0.88rem; }

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2.5rem; }
.pager__info { color: var(--color-text-muted); font-size: 0.9rem; }

.news-article { max-width: 760px; padding: 2rem 0 4rem; }
.news-article__crumbs { font-size: 0.85rem; color: var(--color-text-muted); display: flex; gap: 0.5rem; }
.news-article__crumbs a { color: var(--color-text-muted); text-decoration: none; }
.news-article__crumbs a:hover { color: var(--color-brand-600); }
.news-article__head { margin: 1rem 0 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.news-article__date { font-size: 0.85rem; color: var(--color-text-muted); }
.news-article__head h1 { font-family: var(--font-display); font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0; line-height: 1.2; }
.news-article__media { margin: 0 0 1.6rem; border-radius: var(--radius-lg, 16px); overflow: hidden; box-shadow: var(--shadow-md); }
.news-article__media img { width: 100%; max-height: 520px; object-fit: cover; display: block; }
.news-article__body { font-size: 1.05rem; line-height: 1.75; color: var(--color-text); }
.news-article__body p { margin: 0 0 1rem; }
.news-article__more { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--color-border); }
.news-article__more h2 { font-size: 1.1rem; font-family: var(--font-display); margin: 0 0 0.8rem; }
.news-article__more-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.news-article__more-list li { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.news-article__more-list a { text-decoration: none; color: var(--color-text); font-weight: 600; }
.news-article__more-list a:hover { color: var(--color-brand-600); }
.news-article__more-list span { color: var(--color-text-muted); font-size: 0.8rem; white-space: nowrap; }
.news-article__foot { margin-top: 2.5rem; }

/* Landing news strip */
.news-strip { padding: 1rem 0 1rem; }
.news-strip__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.news-strip__head h2 { font-family: var(--font-display); font-size: clamp(1.5rem, 3vw, 2rem); margin: 0; }
.news-strip__head a { color: var(--color-brand-600); font-weight: 600; text-decoration: none; white-space: nowrap; }

