/* =========================================================================
   ASTRO CODE 2026 — Judging System
   Design System v4 · "QUIET SAAS" — warm-stone neutrals + soft sky accent
   Inspiration: refined CRM dashboards (Northline-style) — minimal, precise,
   medium weights, tight tracking, tiny uppercase micro-labels, soft shadows.
   RTL (Arabic). Class contract unchanged. Fonts: Inter + IBM Plex Sans Arabic.
   ========================================================================= */

/* ---------------------------------------------------------------------------
   1. Design tokens
--------------------------------------------------------------------------- */
:root {
    /* warm stone surfaces */
    --bg:         #f5f5f4;   /* stone-100 */
    --bg-2:       #ececeb;
    --panel:      #ffffff;
    --panel2:     #fafaf9;   /* stone-50 — raised / table head */
    --sidebar-bg: #fafaf9;

    --border:     #e7e5e4;   /* stone-200 */
    --border-2:   #d6d3d1;   /* stone-300 */

    --text:       #1c1917;   /* stone-900 */
    --text-2:     #44403c;   /* stone-700 */
    --muted:      #78716c;   /* stone-500 */
    --faint:      #a8a29e;   /* stone-400 */

    /* soft sky accent */
    --primary:    #0284c7;   /* sky-600 */
    --primary2:   #0ea5e9;   /* sky-500 */
    --primary-700:#0369a1;   /* sky-700 */
    --primary-50: #f0f9ff;
    --primary-100:#e0f2fe;
    --primary-200:#bae6fd;
    --accent:     #0ea5e9;

    /* semantic (soft pastels) */
    --success:    #059669;
    --success-bg: #ecfdf5;  --success-fg: #047857;  --success-bd: #a7f3d0;
    --warning:    #d97706;
    --warning-bg: #fffbeb;  --warning-fg: #92400e;  --warning-bd: #fde68a;
    --danger:     #e11d48;
    --danger-bg:  #fff1f2;  --danger-fg: #9f1239;   --danger-bd: #fecdd3;
    --info-bg:    #f0f9ff;  --info-fg:   #075985;    --info-bd:  #bae6fd;
    --signal:     #059669;

    --gold:      #d97706;
    --silver:    #78716c;
    --bronze:    #b45309;
    --creative:  #7c3aed;

    --radius:    12px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --sidebar-w: 244px;
    --shadow-sm: 0 1px 2px rgba(28, 25, 23, .04);
    --shadow:    0 1px 2px rgba(28, 25, 23, .025), 0 8px 20px rgba(28, 25, 23, .045);
    --shadow-md: 0 1px 2px rgba(28, 25, 23, .03), 0 14px 30px rgba(28, 25, 23, .07);
    --shadow-lg: 0 18px 42px rgba(28, 25, 23, .12), 0 2px 10px rgba(28, 25, 23, .04);
    --trans:     .15s cubic-bezier(.4, 0, .2, 1);

    --font:      "Inter", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
    --font-mono: "Inter", ui-monospace, monospace;
    --micro:     .14em;      /* micro-label tracking */
}

/* ---------------------------------------------------------------------------
   2. Reset & base
--------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 15px; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
    line-height: 1.55;
    direction: rtl;
    font-weight: 450;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.006em;
}

a { color: var(--primary); text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--primary-700); }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.022em; color: var(--text); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d6d3d1; border-radius: 20px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c2bdb9; }
::selection { background: var(--primary-100); color: var(--primary-700); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* micro-label — the signature tiny uppercase label */
.kicker, .nav-section, .stat-label {
    font-size: .67rem; font-weight: 600; letter-spacing: var(--micro);
    text-transform: uppercase; color: var(--faint);
}
.mono { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   3. App shell / layout
--------------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    background: var(--sidebar-bg);
    border-inline-start: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
}
.sidebar .brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1.05rem 1.1rem; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--sidebar-bg); z-index: 2;
}
.sidebar .brand .brand-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; flex: 0 0 30px;
    border-radius: 9px; font-size: .92rem; font-weight: 700;
    background: #292524; color: #fff;       /* monochrome refined mark */
}
.sidebar .brand .brand-name { line-height: 1.2; font-weight: 600; font-size: .98rem; letter-spacing: -.02em; color: var(--text); }
.sidebar .brand .brand-sub { display: block; font-size: .68rem; font-weight: 450; color: var(--faint); margin-top: 2px; letter-spacing: 0; }

.sidebar nav { padding: .7rem .6rem 1rem; display: flex; flex-direction: column; gap: .12rem; flex: 1; }
.nav-section { padding: .95rem .75rem .4rem; }
.nav-link {
    display: flex; align-items: center; gap: .6rem;
    padding: .52rem .7rem; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500; font-size: .9rem;
    border: 1px solid transparent; transition: background var(--trans), color var(--trans);
}
.nav-link .nav-icon { font-size: 1rem; width: 1.3rem; text-align: center; opacity: .85; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active {           /* white raised, not colored */
    background: var(--panel); color: var(--text); font-weight: 600;
    border-color: var(--border); box-shadow: var(--shadow-sm);
}
.nav-link.active .nav-icon { opacity: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .65rem 1.4rem; min-height: 54px;
    background: rgba(250, 250, 249, .85); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30; flex-wrap: wrap;
}
.topbar-title { font-weight: 500; font-size: .92rem; color: var(--muted); display: flex; align-items: center; gap: .5rem; }
.topbar-title .brand-logo { display: none; }
.topbar-right { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.topbar-user { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.topbar-user .u-name { font-weight: 600; font-size: .87rem; color: var(--text); }
.topbar-user .u-title { font-size: .72rem; color: var(--muted); }
.sidebar-toggle {
    display: none; background: var(--panel); border: 1px solid var(--border-2); color: var(--text-2);
    width: 38px; height: 38px; border-radius: var(--radius-sm); font-size: 1.15rem; cursor: pointer;
    align-items: center; justify-content: center;
}

.container { padding: 1.5rem 1.5rem 3.5rem; max-width: 1320px; width: 100%; margin: 0 auto; }
.page-title { font-size: 1.3rem; font-weight: 600; margin: 0 0 1.3rem; display: flex; align-items: center; gap: .5rem; letter-spacing: -.025em; }
.page-title .pt-icon { font-size: 1.1rem; }

/* ---------------------------------------------------------------------------
   4. Cards
--------------------------------------------------------------------------- */
.card {
    position: relative; background: var(--panel);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 1.3rem; overflow: hidden;
    transition: box-shadow var(--trans);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: .95rem 1.25rem; border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: .98rem; color: var(--text); letter-spacing: -.015em;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.card-body { padding: 1.25rem; }

/* ---------------------------------------------------------------------------
   5. Buttons
--------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .42rem;
    padding: .5rem 1rem; height: 36px;
    font-family: inherit; font-size: .87rem; font-weight: 500; line-height: 1;
    color: var(--text-2); background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none; box-shadow: var(--shadow-sm);
    transition: background var(--trans), border-color var(--trans), box-shadow var(--trans), transform var(--trans);
}
.btn:hover { background: var(--panel2); color: var(--text); }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; font-weight: 600; }
.btn-success:hover { background: var(--success-fg); border-color: var(--success-fg); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-danger:hover { background: var(--danger-fg); border-color: var(--danger-fg); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border-2); color: var(--text-2); box-shadow: none; }
.btn-ghost:hover { background: var(--panel2); color: var(--text); }
.btn-sm { padding: .34rem .7rem; height: 30px; font-size: .8rem; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------------------
   6. Tables
--------------------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; font-size: .87rem; text-align: right; font-variant-numeric: tabular-nums; }
.table thead th {
    text-align: right; padding: .65rem 1rem; font-weight: 600; font-size: .64rem;
    letter-spacing: var(--micro); color: var(--faint); text-transform: uppercase;
    background: var(--panel2); border-bottom: 1px solid var(--border); white-space: nowrap;
    position: sticky; top: 0; z-index: 1;
}
.table tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.table tbody tr { transition: background var(--trans); }
.table tbody tr:hover { background: var(--panel2); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody strong, .table tbody b { color: var(--text); font-weight: 600; }
.table.table-center th, .table.table-center td { text-align: center; }

/* ---------------------------------------------------------------------------
   7. Badges (soft bordered pills)
--------------------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .22rem .6rem; border-radius: 999px;
    font-size: .72rem; font-weight: 500; line-height: 1.4;
    border: 1px solid var(--border-2); white-space: nowrap;
    background: var(--panel2); color: var(--text-2);
}
.badge-success { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }
.badge-muted   { background: var(--panel2);     color: var(--muted);      border-color: var(--border); }
.badge-info    { background: var(--info-bg);    color: var(--info-fg);    border-color: var(--info-bd); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-fg);  border-color: var(--danger-bd); }
.badge-gold     { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge-silver   { background: #f5f5f4; color: #57534e; border-color: #e7e5e4; }
.badge-bronze   { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.badge-creative { background: #faf5ff; color: #7c3aed; border-color: #e9d5ff; }

/* ---------------------------------------------------------------------------
   8. Forms
--------------------------------------------------------------------------- */
.form-group { margin-bottom: 1.05rem; }
.form-label { display: block; margin-bottom: .42rem; font-weight: 500; font-size: .83rem; color: var(--text-2); }
.form-label .req { color: var(--danger); margin-inline-start: 3px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: .58rem .8rem; font-family: inherit; font-size: .9rem; color: var(--text);
    background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    transition: border-color var(--trans), box-shadow var(--trans); appearance: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--faint); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100);
}
.form-textarea { resize: vertical; min-height: 104px; line-height: 1.6; }
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2378716c' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left .9rem center; padding-inline-start: 2.2rem; cursor: pointer;
}
.form-select option { background: var(--panel); color: var(--text); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.form-hint { font-size: .77rem; color: var(--muted); margin-top: .33rem; }
.form-input[type="checkbox"], .form-input[type="radio"] { width: auto; }
.checkbox-row { display: flex; align-items: center; gap: .5rem; font-weight: 500; font-size: .88rem; cursor: pointer; color: var(--text-2); }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------------------------------------------------------------------------
   9. Alerts
--------------------------------------------------------------------------- */
.alert {
    display: flex; align-items: center; gap: .6rem; padding: .8rem 1.05rem;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font-weight: 500; font-size: .88rem; margin-bottom: 1.15rem; animation: alert-in .3s ease;
}
.alert::before { font-size: 1rem; line-height: 1; }
.alert-success { background: var(--success-bg); border-color: var(--success-bd); color: var(--success-fg); }
.alert-success::before { content: "\2714"; }
.alert-error   { background: var(--danger-bg);  border-color: var(--danger-bd);  color: var(--danger-fg); }
.alert-error::before { content: "\26A0"; }
.alert-info    { background: var(--info-bg);    border-color: var(--info-bd);    color: var(--info-fg); }
.alert-info::before { content: "\2139"; }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning-fg); }
.alert-warning::before { content: "\26A0"; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.alert.fade-out { opacity: 0; transform: translateY(-6px); transition: opacity .4s ease, transform .4s ease; }

/* ---------------------------------------------------------------------------
   10. Grid
--------------------------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.grid.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.grid-tight { gap: .8rem; }

/* ---------------------------------------------------------------------------
   11. Stat cards
--------------------------------------------------------------------------- */
.stat-card {
    position: relative; overflow: hidden; background: var(--panel);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.15rem 1.25rem; box-shadow: var(--shadow);
    transition: box-shadow var(--trans), transform var(--trans);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-num { font-size: 1.65rem; font-weight: 600; line-height: 1.1; color: var(--text); letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: .55rem; }
.stat-label { margin: 0; }
.stat-card .stat-icon {
    position: absolute; inset-inline-end: .9rem; top: .9rem; font-size: .9rem;
    width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; background: var(--primary-50); color: var(--primary);
}

/* ---------------------------------------------------------------------------
   12. Score pills & medals
--------------------------------------------------------------------------- */
.score-pill {
    display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
    min-width: 52px; padding: .26rem .6rem; border-radius: 999px;
    font-weight: 600; font-size: .82rem; color: var(--primary-700); font-variant-numeric: tabular-nums;
    background: var(--primary-50); border: 1px solid var(--primary-200);
}
.score-pill.is-creative { background: #faf5ff; border-color: #e9d5ff; color: #7c3aed; }
.score-pill.is-muted { background: var(--panel2); border-color: var(--border); color: var(--muted); }

.medal {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%; font-weight: 700; font-size: .85rem; box-shadow: var(--shadow-sm);
}
.medal-gold   { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.medal-silver { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.medal-bronze { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.medal-creative { background: #f3e8ff; color: #7c3aed; border: 1px solid #e9d5ff; }

/* ---------------------------------------------------------------------------
   13. Empty state
--------------------------------------------------------------------------- */
.empty { text-align: center; padding: 2.8rem 1.5rem; color: var(--muted); }
.empty .empty-icon { font-size: 2.5rem; opacity: .5; margin-bottom: .6rem; display: block; }
.empty .empty-title { font-size: 1.02rem; font-weight: 600; color: var(--text); margin-bottom: .3rem; }
.empty .empty-text { font-size: .88rem; }

/* ---------------------------------------------------------------------------
   14. Utilities
--------------------------------------------------------------------------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.flex-end { display: flex; justify-content: flex-end; gap: .55rem; flex-wrap: wrap; }
.gap-sm { gap: .5rem; } .gap { gap: 1rem; }
.items-center { align-items: center; } .wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-muted   { color: var(--muted); }
.muted        { color: var(--muted); }
.text-success { color: var(--success-fg); }
.text-danger  { color: var(--danger-fg); }
.text-warning { color: var(--warning-fg); }
.text-creative{ color: var(--creative); }
.text-center  { text-align: center; }
.text-end     { text-align: end; }
.fw-bold      { font-weight: 600; }
.small        { font-size: .8rem; }
.nowrap       { white-space: nowrap; }
.w-full       { width: 100%; }
.divider { height: 1px; background: var(--border); border: none; margin: 1.2rem 0; }

.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: .5rem; }
.check-item {
    display: flex; align-items: center; gap: .5rem; padding: .48rem .68rem;
    border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--panel);
    font-size: .85rem; font-weight: 500; color: var(--text-2); cursor: pointer;
    transition: border-color var(--trans), background var(--trans);
}
.check-item:hover { border-color: var(--primary); background: var(--primary-50); }
.check-item input { width: 15px; height: 15px; accent-color: var(--primary); }
.row-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.inline-form { display: inline-block; margin: 0; }

.progress { width: 100%; height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.progress > span {
    display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--primary2), var(--primary));
    transition: width .5s cubic-bezier(.4, 0, .2, 1);
}

/* ---------------------------------------------------------------------------
   15. Standalone auth page
--------------------------------------------------------------------------- */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
    background: var(--bg);
}
.auth-card {
    width: 100%; max-width: 400px; position: relative;
    background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: var(--shadow-lg); padding: 2.2rem 2rem; animation: alert-in .4s ease;
}
.auth-brand { text-align: center; margin-bottom: 1.6rem; }
.auth-brand .auth-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; margin-bottom: .85rem; font-size: 1.25rem; font-weight: 700;
    border-radius: 13px; background: #292524; color: #fff;
}
.auth-brand .auth-title { font-size: 1.35rem; font-weight: 600; letter-spacing: -.025em; margin-bottom: .3rem; color: var(--text); }
.auth-brand .auth-sub { font-size: .88rem; color: var(--muted); font-weight: 450; }
.auth-hint {
    margin-top: 1.3rem; padding: .68rem .9rem; border-radius: var(--radius-sm);
    background: var(--panel2); border: 1px solid var(--border);
    font-size: .77rem; color: var(--muted); text-align: center;
}
.auth-hint code { color: var(--primary-700); font-weight: 600; background: var(--primary-50); padding: 1px 6px; border-radius: 5px; }

/* ---------------------------------------------------------------------------
   16. Animations
--------------------------------------------------------------------------- */
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------------------------------------------------------------------------
   17. Responsive
--------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .sidebar {
        /* درج منزلق من اليمين — نستخدم right الفيزيائي لتفادي انقلاب inset-inline في RTL */
        position: fixed; right: 0; left: auto; top: 0; height: 100vh; width: var(--sidebar-w);
        transform: translateX(100%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
        z-index: 60;
    }
    .app-shell.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-toggle { display: inline-flex; }
    .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(28, 25, 23, .42); z-index: 55; }
    .app-shell.sidebar-open .sidebar-backdrop { display: block; }
    .container { padding: 1.1rem 1rem 2.5rem; }
    .page-title { font-size: 1.15rem; }
    .topbar { padding: .6rem 1rem; }
}
@media (max-width: 520px) {
    .topbar-user .u-title { display: none; }
    .auth-card { padding: 1.8rem 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* =========================================================================
   18. v4.1 — SVG icon system, action buttons, shared components, cleanups
   (replaces emoji-as-icon and inline-style patterns app-wide)
   ========================================================================= */

/* ---- icon primitives ---- */
.icn { display: inline-block; vertical-align: -2px; flex: none; stroke-width: 2; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; opacity: 1; color: var(--muted); }
.nav-link:hover .nav-icon { color: var(--text); }
.nav-link.active .nav-icon { color: var(--primary); }
.btn .icn { margin: 0; }
.page-title .pt-icon { display: inline-flex; align-items: center; color: var(--muted); }
.stat-card .stat-icon svg { width: 16px; height: 16px; }
.empty .empty-icon { opacity: 1; color: var(--border-2); display: flex; justify-content: center; }
.empty .empty-icon svg { width: 46px; height: 46px; }

/* ---- icon-only action buttons (table action columns) ---- */
.row-actions { display: inline-flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.table-actions { white-space: nowrap; width: 1%; }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0; flex: none;
    color: var(--muted); background: transparent; border: 1px solid transparent;
    border-radius: var(--radius-xs); cursor: pointer; box-shadow: none;
    transition: background var(--trans), color var(--trans), border-color var(--trans);
}
.btn-icon:hover { background: var(--panel2); color: var(--text); border-color: var(--border); }
.btn-icon:active { transform: translateY(.5px); }
.btn-icon.btn-icon-danger:hover { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--danger-bd); }
.btn-icon.btn-icon-primary:hover { background: var(--primary-50); color: var(--primary); border-color: var(--primary-200); }
.action-sep { width: 1px; align-self: stretch; margin: 0 .15rem; background: var(--border); }

/* ---- shared winner / award card ---- */
.award-card {
    position: relative; text-align: center; padding: 1.35rem 1.15rem;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
}
.award-card.is-gold    { border-color: #fde68a; }
.award-card.is-silver  { border-color: #e2e8f0; }
.award-card.is-bronze  { border-color: #fed7aa; }
.award-card.is-creative{ border-color: #e9d5ff; }
.award-medal {
    width: 42px; height: 42px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.02rem; margin-bottom: .7rem;
}
.award-label { font-size: .67rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.award-name { font-weight: 600; font-size: 1rem; color: var(--text); margin-top: .5rem; letter-spacing: -.01em; }
.award-meta { display: flex; align-items: center; justify-content: center; gap: .35rem; font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.award-meta svg { color: var(--faint); }
.award-score { margin-top: .8rem; }
.award-scorelabel { font-size: .73rem; color: var(--faint); margin-top: .35rem; }
.award-empty { font-size: .85rem; color: var(--muted); margin-top: .6rem; }

/* ---- score selector (0..N) — moved from evaluate.php inline <style>, de-glowed ---- */
.score-opts { display: flex; flex-wrap: wrap; gap: .45rem; }
.score-opt { position: relative; }
.score-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.score-opt span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; height: 42px; padding: 0 .65rem;
    border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    background: var(--panel); color: var(--text-2); font-weight: 600;
    font-variant-numeric: tabular-nums; transition: border-color var(--trans), background var(--trans), color var(--trans);
}
.score-opt:hover span { border-color: var(--primary); }
.score-opt input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.score-opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-100); }
.score-opt input:disabled + span { opacity: .5; cursor: not-allowed; }
.score-opt input:disabled { cursor: not-allowed; }

/* ---- progress label row ---- */
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; font-size: .85rem; color: var(--muted); }

/* ---- live status dot in badges (header) ---- */
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.badge-dot.is-live { animation: pulse-dot 2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .badge-dot.is-live { animation: none; } }

/* ---- read-only info grid (evaluation_view) ---- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem 1.4rem; }
.info-item .info-label { font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: .2rem; }
.info-item .info-value { font-size: .92rem; color: var(--text); font-weight: 500; }

/* ---- layout helpers used across pages ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head .page-title { margin: 0; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .65rem; align-items: end; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.crud-layout { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.criterion-group { border-bottom: 1px solid var(--border); padding-bottom: 1.1rem; margin-bottom: 1.1rem; }
.criterion-group:last-of-type { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
@media (max-width: 900px) { .crud-layout { grid-template-columns: 1fr; } .form-grid-2 { grid-template-columns: 1fr; } }

/* ---- additional utilities ---- */
.flex-col { display: flex; flex-direction: column; }
.gap-xs { gap: .4rem; } .gap-md { gap: 1rem; } .gap-lg { gap: 1.5rem; }
.mt-3 { margin-top: 1.5rem; } .mb-3 { margin-bottom: 1.5rem; }
.text-sm { font-size: .85em; }
.items-end { align-items: flex-end; }

/* ---- state clarity (replaces faint opacity tricks) ---- */
tr.is-unrated td { color: var(--faint); background: var(--panel2); }
tr.is-unrated strong { color: var(--muted); font-weight: 500; }

/* ---- official brand logo (white art on black → shown on a dark plate) ---- */
.sidebar .brand { flex-direction: column; align-items: stretch; gap: .55rem; padding: .85rem .8rem; }
.brand-logo-img { display: block; border-radius: 11px; overflow: hidden; background: #060606; line-height: 0; box-shadow: var(--shadow-sm); border: 1px solid #1c1c1c; }
.brand-logo-img img { display: block; width: 100%; height: auto; }
.sidebar .brand .brand-sub { text-align: center; margin-top: 0; }

.auth-logo-img {
    display: block; width: 100%; max-width: 290px; margin: 0 auto 1.1rem;
    border-radius: 14px; overflow: hidden; background: #060606; line-height: 0;
    box-shadow: var(--shadow-md); border: 1px solid #1c1c1c;
}
.auth-logo-img img { display: block; width: 100%; height: auto; }

/* =========================================================================
   19. Modal / dialog system (form modals + styled confirmations)
   ========================================================================= */
.modal {
    position: fixed; inset: 0; z-index: 100; display: none;
    align-items: flex-start; justify-content: center;
    padding: 5vh 1rem; overflow-y: auto;
}
.modal.is-open { display: flex; }
.modal-overlay { position: fixed; inset: 0; background: rgba(28, 25, 23, .5); backdrop-filter: blur(2px); }
.modal-dialog {
    position: relative; z-index: 1; width: 100%; max-width: 580px; margin: auto 0;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); animation: modal-in .2s cubic-bezier(.4, 0, .2, 1);
}
.modal-dialog.modal-sm { max-width: 440px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(-14px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.05rem 1.3rem; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.05rem; font-weight: 600; letter-spacing: -.015em; display: flex; align-items: center; gap: .5rem; }
.modal-title svg { color: var(--muted); }
.modal-close {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; flex: none;
}
.modal-close:hover { background: var(--panel2); color: var(--text); }
.modal-body { padding: 1.3rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.3rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal-form-foot { padding-top: 1.2rem; margin-top: .2rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }
body.modal-open { overflow: hidden; }
/* confirm modal */
.confirm-body { display: flex; gap: 1rem; align-items: flex-start; }
.confirm-icon { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--danger-bg); color: var(--danger-fg); }
.confirm-text { font-size: .94rem; color: var(--text-2); line-height: 1.55; }
@media (prefers-reduced-motion: reduce) { .modal-dialog { animation: none; } }
@media (max-width: 520px) { .modal { padding: 0; align-items: stretch; } .modal-dialog { max-width: none; border-radius: 0; min-height: 100vh; } }

/* =========================================================================
   20. Competition bar (countdown + announcements), schedule timeline, demo creds
   ========================================================================= */
.comp-bar {
    display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
    padding: .55rem .9rem; margin-bottom: .9rem;
    background: linear-gradient(90deg, var(--primary-50), var(--panel));
    border: 1px solid var(--primary-200); border-radius: var(--radius-sm); font-size: .9rem;
}
.comp-bar-clock { display: inline-flex; color: var(--primary); }
.comp-countdown { font-weight: 700; color: var(--primary-700); font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.comp-countdown.is-ended { color: var(--muted); }
.comp-bar-link { margin-inline-start: auto; display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; font-size: .82rem; color: var(--primary-700); }
.comp-bar-link:hover { color: var(--primary); }

.announcement { position: relative; padding-inline-end: 2.4rem; }
.ann-dismiss {
    position: absolute; inset-inline-end: .55rem; top: 50%; transform: translateY(-50%);
    width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    border: none; background: transparent; color: inherit; cursor: pointer; opacity: .6; border-radius: 6px;
}
.ann-dismiss:hover { opacity: 1; background: rgba(0, 0, 0, .07); }

/* schedule timeline */
.timeline { position: relative; padding-inline-start: 1.6rem; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 5px; top: .4rem; bottom: .4rem; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: ""; position: absolute; inset-inline-start: -1.6rem; top: .2rem;
    width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--primary);
}
.timeline-item.is-past::before { background: var(--primary); }
.timeline-item.is-now::before { background: var(--success); border-color: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.timeline-time { font-size: .75rem; font-weight: 600; color: var(--primary-700); font-variant-numeric: tabular-nums; }
.timeline-title { font-weight: 600; color: var(--text); margin-top: .1rem; }
.timeline-desc { font-size: .85rem; color: var(--muted); margin-top: .15rem; }

/* big countdown card (schedule / dashboards) */
.countdown-hero { text-align: center; padding: 1.2rem; }
.countdown-hero .ch-label { font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.countdown-hero .ch-time { font-size: 2.2rem; font-weight: 800; color: var(--primary-700); font-variant-numeric: tabular-nums; letter-spacing: .5px; margin-top: .3rem; }

/* login demo credentials panel */
.demo-creds { margin-top: 1.2rem; border: 1px dashed var(--border-2); border-radius: var(--radius-sm); padding: .75rem .85rem; background: var(--panel2); text-align: right; }
.demo-creds-title { font-size: .7rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; display: flex; align-items: center; gap: .35rem; }
.demo-cred { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .38rem .5rem; border-radius: 7px; cursor: pointer; transition: background var(--trans); }
.demo-cred:hover { background: var(--primary-50); }
.demo-cred .dc-role { font-size: .8rem; font-weight: 600; color: var(--text-2); }
.demo-cred .dc-val { font-size: .76rem; color: var(--primary-700); font-variant-numeric: tabular-nums; }

/* =========================================================================
   21. Notifications bell + list, inquiry chat thread
   ========================================================================= */
.notif-bell {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 9px; color: var(--muted);
    border: 1px solid var(--border-2); background: var(--panel); transition: background var(--trans), color var(--trans);
}
.notif-bell:hover { background: var(--panel2); color: var(--text); }
.notif-count {
    position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 9px; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--panel); line-height: 1;
}

.notif-item { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-item.is-unread { background: var(--primary-50); }
.notif-item .notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: .45rem; flex: none; }
.notif-item.is-read .notif-dot { background: var(--border-2); }
.notif-item .notif-body { flex: 1; min-width: 0; }
.notif-item .notif-msg { font-size: .9rem; color: var(--text); }
.notif-item .notif-msg a { font-weight: 600; }
.notif-item .notif-time { font-size: .73rem; color: var(--faint); margin-top: .15rem; }

/* inquiry chat thread */
.thread { display: flex; flex-direction: column; gap: .7rem; }
.msg { max-width: 82%; padding: .65rem .9rem; border-radius: 12px; }
.msg .msg-meta { font-size: .7rem; color: var(--muted); margin-bottom: .2rem; font-weight: 600; }
.msg .msg-body { font-size: .9rem; line-height: 1.65; white-space: pre-line; }
.msg.from-team  { align-self: flex-start; background: var(--panel2); border: 1px solid var(--border); }
.msg.from-team .msg-body { color: var(--text-2); }
.msg.from-staff { align-self: flex-end; background: var(--primary-50); border: 1px solid var(--primary-200); }
.msg.from-staff .msg-body { color: var(--primary-700); }
.msg.from-staff .msg-meta { color: var(--primary-700); }

/* inquiry status badges already covered by .badge-* */
.inq-reply-bar { display: flex; gap: .5rem; align-items: flex-end; margin-top: 1rem; }
.inq-reply-bar .form-textarea { min-height: 70px; }

/* =========================================================================
   22. Mobile app shell — bottom navigation bar + drawer footer
   (يجعل التجربة على الجوال كأنها تطبيق: شريط تنقّل سفلي + درج جانبي)
   ========================================================================= */
.bottom-nav { display: none; }
.sidebar-foot { display: none; }

@media (max-width: 860px) {
    /* مساحة أسفل المحتوى حتى لا يغطّيه الشريط السفلي */
    .container { padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px)); }

    /* الشريط السفلي الثابت */
    .bottom-nav {
        display: flex; align-items: stretch;
        position: fixed; inset-inline: 0; bottom: 0; z-index: 45;
        background: rgba(250, 250, 249, .94);
        -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        padding: .28rem .2rem calc(.28rem + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -2px 14px rgba(28, 25, 23, .07);
    }
    .bn-item {
        flex: 1 1 0; min-width: 0;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        padding: .34rem .15rem; border: 0; background: none; cursor: pointer;
        color: var(--muted); font-family: inherit; font-size: .65rem; font-weight: 500;
        text-decoration: none; border-radius: var(--radius-xs);
        -webkit-tap-highlight-color: transparent;
        transition: color var(--trans), background var(--trans);
    }
    .bn-item .bn-icon { display: inline-flex; align-items: center; justify-content: center; height: 22px; opacity: .85; }
    .bn-item .bn-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .bn-item:active { background: var(--bg); }
    .bn-item.active { color: var(--primary-700); font-weight: 600; }
    .bn-item.active .bn-icon { opacity: 1; }

    /* درج القائمة الجانبي: تذييل فيه «حسابي» و«الخروج» */
    .sidebar-foot {
        display: flex; flex-direction: column; gap: .12rem;
        padding: .55rem .6rem calc(.8rem + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--border); margin-top: auto;
    }

    /* الشريط العلوي يصبح أبسط — حسابي/الخروج ينتقلان إلى الدرج */
    .topbar-acct { display: none; }
    .topbar { padding: .55rem .9rem; gap: .5rem; }
    .topbar-title { font-size: .88rem; }
}

@media (max-width: 480px) {
    .bn-item { font-size: .6rem; }
    .topbar-user .u-name { max-width: 38vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
