/* =============================================================================
   MockCall — shared design system
   A single stylesheet shared by the coach portal, admin portal, score page and
   login screens. Plain CSS (no build step). Design language adapted from the
   gemini_mockcall prototype: indigo + slate, large radii, soft shadows,
   Inter / Space Grotesk / JetBrains Mono.
   Many class names (.grade, .pill, .empty, .badge, .dim*, .idea*, .spark,
   .bar-*, .chart-*, .gauge-*) are kept so existing page JS keeps working.
   ========================================================================== */

/* ---------- Reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Author rule beats the UA `[hidden]{display:none}` for flex containers. */
[hidden] { display: none !important; }

/* ---------- Tokens ---------- */
:root {
    /* Brand indigo */
    --indigo: #4f46e5;
    --indigo-600: #4f46e5;
    --indigo-700: #4338ca;
    --indigo-800: #3730a3;
    --indigo-900: #312e81;   /* header bar */
    --indigo-950: #1e1b4b;   /* score badge / deep panels */
    --indigo-50: #eef2ff;
    --indigo-100: #e0e7ff;
    --indigo-200: #c7d2fe;

    /* Slate neutrals */
    --ink: #0f172a;          /* slate-900, body text */
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;    /* muted */
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;    /* lines */
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;     /* page */
    --line: #e2e8f0;
    --muted: #64748b;
    --page: #f8fafc;

    /* Status */
    --emerald: #059669;
    --emerald-50: #ecfdf5;
    --emerald-100: #d1fae5;
    --amber: #d97706;
    --amber-50: #fffbeb;
    --amber-100: #fef3c7;
    --rose: #e11d48;
    --rose-50: #fff1f2;
    --rose-100: #ffe4e6;
    --blue: #3f6fd1;
    --green: #059669;        /* legacy alias used by some JS */
    --red: #e11d48;          /* legacy alias */

    /* Radii */
    --r-card: 24px;
    --r-lg: 16px;
    --r-md: 12px;
    --r-sm: 8px;
    --r-pill: 999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 6px 20px rgba(15, 23, 42, .08);
    --shadow-lg: 0 18px 50px rgba(15, 23, 42, .18);

    /* Fonts */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: "Space Grotesk", var(--font-sans);
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

body {
    font-family: var(--font-sans);
    background: var(--page);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.01em; }

.mono { font-family: var(--font-mono); }

/* =============================================================================
   App shell + header
   ========================================================================== */
.mc-shell { max-width: 1240px; margin: 0 auto; padding: 24px; }
.mc-shell.narrow { max-width: 1040px; }

.mc-header {
    position: sticky; top: 0; z-index: 40;
    background: var(--indigo-900);
    color: #fff;
    border-bottom: 1px solid var(--indigo-950);
    padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    box-shadow: var(--shadow-sm);
}
.mc-header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mc-logo-chip {
    background: #fff; border-radius: 10px; padding: 5px 9px;
    display: flex; align-items: center; justify-content: center; flex: none;
    box-shadow: var(--shadow-xs);
}
.mc-logo-chip img { height: 28px; width: auto; display: block; }
.mc-brand-title { display: flex; align-items: center; gap: 8px; }
.mc-brand-title h1 { font-size: 17px; font-weight: 800; color: #fff; line-height: 1; }
.mc-brand-tag {
    font-size: 9px; text-transform: uppercase; letter-spacing: .18em;
    font-family: var(--font-mono); font-weight: 700;
    background: var(--indigo-800); color: var(--indigo-200);
    padding: 3px 7px; border-radius: var(--r-pill); line-height: 1;
}
.mc-brand-sub { font-size: 11px; color: rgba(199, 210, 254, .8); margin-top: 3px; }

.mc-header-right { display: flex; align-items: center; gap: 12px; }
.mc-user {
    display: flex; align-items: center; gap: 10px;
    padding-left: 14px; border-left: 1px solid var(--indigo-800);
}
.mc-user-text { text-align: right; line-height: 1.25; }
.mc-user-name { font-size: 13px; font-weight: 700; color: #fff; }
.mc-user-role {
    font-size: 9px; font-family: var(--font-mono); font-weight: 700;
    text-transform: uppercase; letter-spacing: .14em; color: var(--indigo-200);
}

/* =============================================================================
   Buttons
   ========================================================================== */
.btn, .btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    background: var(--indigo-600); color: #fff; border: none;
    border-radius: var(--r-md); padding: 10px 16px;
    font-family: var(--font-sans); font-size: 13px; font-weight: 700;
    cursor: pointer; transition: background .15s, filter .15s, opacity .15s;
    box-shadow: var(--shadow-xs); text-decoration: none; white-space: nowrap;
}
.btn:hover, .btn-primary:hover { background: var(--indigo-700); }
.btn:disabled, .btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    background: rgba(255, 255, 255, .08); color: #fff;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: var(--r-md); padding: 9px 14px;
    font-family: var(--font-sans); font-size: 13px; font-weight: 700;
    cursor: pointer; transition: background .15s; text-decoration: none; white-space: nowrap;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .16); }

/* Ghost button on a light surface (tables, cards). */
.btn-ghost.on-light {
    background: #fff; color: var(--slate-700);
    border-color: var(--slate-200);
}
.btn-ghost.on-light:hover { background: var(--slate-50); }

.btn-danger { background: var(--rose); }
.btn-danger:hover { background: #be123c; }

.btn-success { background: var(--emerald); }
.btn-success:hover { background: #047857; }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--r-sm); }

.btn-link {
    background: none; border: none; color: var(--indigo-600);
    font-family: var(--font-sans); font-weight: 700; font-size: 13px;
    cursor: pointer; text-decoration: none; padding: 0;
}
.btn-link:hover { color: var(--indigo-700); text-decoration: underline; }

/* =============================================================================
   Cards
   ========================================================================== */
.card {
    background: #fff; border: 1px solid var(--slate-200);
    border-radius: var(--r-card); padding: 24px;
    box-shadow: var(--shadow-xs);
}
.card.tight { padding: 18px 20px; }
.card h2 {
    font-size: 16px; font-weight: 800; color: var(--ink);
    margin-bottom: 14px;
}
.card-title {
    font-family: var(--font-display); font-weight: 800; color: var(--ink);
    font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
    display: flex; align-items: center; gap: 8px;
}
.card-sub { font-size: 11px; color: var(--slate-400); font-weight: 600; margin-top: 2px; }

.section-head { margin-bottom: 14px; }
.eyebrow {
    font-size: 10px; font-family: var(--font-mono); font-weight: 700;
    text-transform: uppercase; letter-spacing: .14em; color: var(--slate-400);
}

/* =============================================================================
   Pills, badges, grades
   ========================================================================== */
.pill {
    display: inline-block; font-size: 11px; font-weight: 700;
    padding: 3px 10px; border-radius: var(--r-pill);
    text-transform: capitalize; line-height: 1.4;
    border: 1px solid transparent;
}
.pill.easy     { background: var(--emerald-100); color: #065f46; border-color: #a7f3d0; }
.pill.moderate { background: var(--emerald-100); color: #065f46; border-color: #a7f3d0; }
.pill.medium   { background: var(--indigo-100);  color: var(--indigo-800); border-color: var(--indigo-200); }
.pill.hard     { background: var(--amber-100);   color: #92400e; border-color: #fde68a; }
.pill.expert   { background: var(--rose-100);    color: #9f1239; border-color: #fecdd3; }
.pill.role     { background: var(--indigo-50);   color: var(--indigo-700); border-color: var(--indigo-100); }

.badge {
    display: inline-block; padding: 2px 9px; border-radius: var(--r-sm);
    font-size: 11px; font-weight: 700; font-family: var(--font-mono);
}
.badge.ok      { background: var(--emerald-100); color: #065f46; }
.badge.off     { background: var(--rose-100); color: #9f1239; }
.badge.pending { background: var(--amber-100); color: #92400e; }
.badge.failed  { background: var(--rose-100); color: #9f1239; }

.grade { font-weight: 800; }
.grade.A { color: var(--emerald); }
.grade.B { color: #16a34a; }
.grade.C { color: var(--amber); }
.grade.D { color: #ea580c; }
.grade.F { color: var(--rose); }

/* Channel pill (web / phone) used in admin score rows. */
.ch-pill {
    font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill);
    background: var(--indigo-50); color: var(--indigo-700);
    text-transform: uppercase; letter-spacing: .04em; font-family: var(--font-mono);
}

/* =============================================================================
   Avatars (initials circles — no external images)
   ========================================================================== */
.avatar {
    flex: none; border-radius: 50%; display: inline-flex;
    align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700; color: #fff;
    background: var(--indigo-600); width: 44px; height: 44px; font-size: 15px;
    user-select: none; box-shadow: var(--shadow-xs);
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
/* Deterministic palette variants — JS picks .v0..v5 from a name hash. */
.avatar.v0 { background: #4f46e5; }
.avatar.v1 { background: #0891b2; }
.avatar.v2 { background: #7c3aed; }
.avatar.v3 { background: #db2777; }
.avatar.v4 { background: #ea580c; }
.avatar.v5 { background: #059669; }

/* =============================================================================
   Forms / inputs
   ========================================================================== */
label { font-size: 12px; font-weight: 600; color: var(--slate-600); }
input, select, textarea { font-family: var(--font-sans); }

.field input, .field select, input.mc-input, select.mc-select {
    width: 100%; padding: 11px 13px;
    border: 1.5px solid var(--slate-200); border-radius: var(--r-md);
    font-size: 14px; color: var(--ink); background: #fff; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus,
input.mc-input:focus, select.mc-select:focus {
    border-color: var(--indigo-600);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; }

/* =============================================================================
   Tabs (underline style)
   ========================================================================== */
.mc-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--slate-200); }
.mc-tab {
    background: none; border: none; cursor: pointer;
    padding: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--slate-500);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    font-family: var(--font-sans); transition: color .15s, border-color .15s;
}
.mc-tab:hover { color: var(--slate-700); }
.mc-tab.active { color: var(--indigo-700); font-weight: 800; border-bottom-color: var(--indigo-600); }

/* =============================================================================
   Tables
   ========================================================================== */
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--slate-400); font-weight: 700; font-family: var(--font-mono);
    padding: 10px 12px; border-bottom: 1px solid var(--slate-200);
}
.grid td { padding: 12px; border-bottom: 1px solid var(--slate-100); color: var(--slate-700); }
.grid tr:last-child td { border-bottom: none; }
.grid .num, .grid td.num { text-align: right; }
.grid .actions, .grid td.actions { text-align: right; white-space: nowrap; }
.grid td.actions button { margin-left: 6px; }
.grid tbody tr:hover td { background: var(--slate-50); }
.empty { text-align: center; color: var(--slate-400); padding: 26px 0 !important; font-weight: 500; }

/* =============================================================================
   Stat tiles
   ========================================================================== */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat {
    background: #fff; border: 1px solid var(--slate-200);
    border-radius: var(--r-lg); padding: 18px 20px;
}
.stat .k {
    font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
    color: var(--slate-400); font-family: var(--font-mono); font-weight: 700;
}
.stat .v { font-size: 28px; font-weight: 800; font-family: var(--font-display); color: var(--indigo-950); margin-top: 6px; }
@media (max-width: 720px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

/* =============================================================================
   Modal
   ========================================================================== */
.modal {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
    background: #fff; border-radius: var(--r-card); padding: 26px;
    width: 100%; max-width: 420px; position: relative;
    box-shadow: var(--shadow-lg); border: 1px solid var(--slate-200);
}
.modal-card.wide { max-width: 760px; max-height: 88vh; overflow-y: auto; }
.modal-card h2 { color: var(--ink); font-size: 18px; margin-bottom: 4px; }
.modal-sub { font-size: 13px; color: var(--slate-400); margin-bottom: 16px; font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-x {
    position: absolute; top: 14px; right: 16px; border: none; background: none;
    font-size: 26px; line-height: 1; color: var(--slate-400); cursor: pointer;
}
.modal-x:hover { color: var(--slate-700); }

/* =============================================================================
   Login
   ========================================================================== */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(79, 70, 229, .10), transparent 60%),
        var(--slate-50);
}
.login-card {
    width: 100%; max-width: 400px; background: #fff;
    border-radius: var(--r-card); border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-md); padding: 34px 30px;
    display: flex; flex-direction: column;
}
.login-logo { width: 150px; max-width: 60%; height: auto; margin-bottom: 22px; }
.login-card h1 { font-size: 22px; color: var(--ink); font-weight: 800; }
.login-sub { font-size: 13px; color: var(--slate-500); margin: 4px 0 24px; }
.login-card label { margin: 14px 0 6px; }
.login-card input {
    padding: 12px 14px; border: 1.5px solid var(--slate-200);
    border-radius: var(--r-md); font-size: 15px; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--indigo-600); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.login-card button {
    margin-top: 24px; padding: 13px; border: none; border-radius: var(--r-md);
    background: var(--indigo-600); color: #fff; font-size: 15px; font-weight: 700;
    cursor: pointer; font-family: var(--font-sans); transition: background .15s;
}
.login-card button:hover { background: var(--indigo-700); }
.login-err { margin-top: 16px; color: var(--rose); font-size: 13px; text-align: center; font-weight: 600; }

/* =============================================================================
   Bars / charts (kept from admin.css so analytics + progress SVG keep working)
   ========================================================================== */
.bar-row { display: grid; grid-template-columns: 150px 1fr 56px; align-items: center; gap: 10px; margin: 8px 0; }
.bar-label { font-size: 13px; color: var(--slate-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 10px; background: var(--slate-100); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; min-width: 2px; background: var(--indigo-600); transition: width .25s ease; }
.bar-val { font-size: 13px; font-weight: 700; color: var(--indigo-950); text-align: right; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 110px 1fr 46px; } }

.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--slate-100); stroke-width: 1; }
.chart-axis { fill: var(--slate-400); font-size: 10px; }
.chart-bar { fill: var(--indigo-600); opacity: .14; }
.chart-line { fill: none; stroke: var(--indigo-600); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--indigo-600); }
.chart-legend { display: flex; gap: 18px; font-size: 12px; color: var(--slate-400); margin-top: 8px; }
.chart-legend i { display: inline-block; width: 14px; height: 0; vertical-align: middle; margin-right: 5px; }
.chart-legend .lg-line { border-top: 2px solid var(--indigo-600); }
.chart-legend .lg-bar { width: 12px; height: 10px; background: var(--indigo-600); opacity: .25; border-radius: 2px; }

.spark { display: block; }
.spark polyline { fill: none; stroke: var(--indigo-600); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.spark-na { color: var(--slate-400); }

.delta { font-weight: 800; }
.delta-pos, .delta.up { color: var(--emerald); }
.delta-neg, .delta.down { color: var(--rose); }

/* IDEA vertical gauges (admin analytics) */
.gauge-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.gauge { display: flex; flex-direction: column; align-items: center; }
.gauge-bar { width: 30px; height: 90px; background: var(--slate-100); border-radius: 6px; overflow: hidden; display: flex; align-items: flex-end; }
.gauge-fill { width: 100%; border-radius: 6px 6px 0 0; background: var(--indigo-600); transition: height .25s ease; }
.gauge-pct { font-size: 14px; font-weight: 800; color: var(--indigo-950); margin-top: 8px; }
.gauge-lbl { font-size: 11px; color: var(--slate-400); margin-top: 2px; }
@media (max-width: 560px) { .gauge-bar { width: 24px; } }

/* =============================================================================
   Toast
   ========================================================================== */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--indigo-950); color: #fff; padding: 12px 20px;
    border-radius: var(--r-md); font-size: 14px; z-index: 80; box-shadow: var(--shadow-lg);
}
.toast.err { background: var(--rose); }

/* =============================================================================
   Animations
   ========================================================================== */
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fade-in .35s ease both; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

@keyframes pulse-ring {
    0%   { transform: scale(.95); opacity: .5; }
    50%  { transform: scale(1.1); opacity: .85; }
    100% { transform: scale(.95); opacity: .5; }
}
