/* ---------------------------------------------------------------------------
   Assessment Panel.

   Its own look, on purpose. Somebody sitting a certification test should be in
   no doubt about which application they are in — a panel that looked like the
   live CRM would have candidates reaching for booking screens that are not
   there, and worse, agents mistaking the real queue for a drill.
   --------------------------------------------------------------------------- */

:root {
    --ap-bg:        #0f1117;
    --ap-surface:   #171a23;
    --ap-surface-2: #1e222d;
    --ap-border:    #2a2f3d;
    --ap-text:      #e6e8ee;
    --ap-muted:     #939aad;
    --ap-muted-2:   #6c7386;
    --ap-accent:    #5b8def;   /* assessment blue — nothing like the CRM's amber */
    --ap-green:     #3ecf8e;
    --ap-amber:     #f5a524;
    --ap-red:       #f2545b;
    --ap-radius:    12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--ap-bg);
    color: var(--ap-text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ap-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- shell ---- */

.ap-shell { display: flex; min-height: 100vh; }

.ap-side {
    width: 244px; flex: 0 0 auto; background: var(--ap-surface);
    border-right: 1px solid var(--ap-border); padding: 18px 0; position: sticky; top: 0;
    height: 100vh; overflow-y: auto;
}

.ap-brand { display: flex; align-items: center; gap: 10px; padding: 0 18px 18px; }
.ap-brand-mark {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    background: linear-gradient(140deg, var(--ap-accent), #7c5cff); color: #fff;
    font-weight: 700; font-size: 1rem; flex: 0 0 auto;
}
.ap-brand b { display: block; font-size: .95rem; line-height: 1.2; }
.ap-brand small { color: var(--ap-muted); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }

.ap-nav { padding: 0 10px; }
.ap-nav-label {
    font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ap-muted-2);
    padding: 14px 10px 6px;
}
.ap-nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
    color: var(--ap-muted); font-size: .87rem; font-weight: 500; text-decoration: none; margin-bottom: 2px;
}
.ap-nav a:hover { background: var(--ap-surface-2); color: var(--ap-text); }
.ap-nav a.active { background: rgba(91,141,239,.14); color: #b9cdfb; }
.ap-nav a i { font-size: 1rem; width: 18px; text-align: center; }

.ap-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.ap-top {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 14px 26px; border-bottom: 1px solid var(--ap-border); background: var(--ap-surface);
    position: sticky; top: 0; z-index: 20;
}
.ap-top h1 { font-size: 1.05rem; font-weight: 600; margin: 0; }
.ap-top .sub { color: var(--ap-muted); font-size: .78rem; }

.ap-who { display: flex; align-items: center; gap: 10px; }
.ap-avatar {
    width: 34px; height: 34px; border-radius: 9px; background: var(--ap-surface-2);
    display: grid; place-items: center; font-weight: 700; font-size: .78rem; color: var(--ap-accent);
    border: 1px solid var(--ap-border);
}

.ap-content { padding: 22px 26px 60px; flex: 1 1 auto; }

/* ---- cards ---- */

.ap-card {
    background: var(--ap-surface); border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius); margin-bottom: 16px; overflow: hidden;
}
.ap-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 13px 17px; border-bottom: 1px solid var(--ap-border); font-weight: 600; font-size: .9rem;
}
.ap-card-body { padding: 17px; }

.ap-grid { display: grid; gap: 16px; }
.ap-grid.two { grid-template-columns: 1fr 1fr; }
.ap-grid.three { grid-template-columns: repeat(3, 1fr); }
.ap-grid.four { grid-template-columns: repeat(4, 1fr); }
.ap-grid.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1100px) { .ap-grid.side, .ap-grid.three, .ap-grid.four { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px)  { .ap-grid.two, .ap-grid.side, .ap-grid.three, .ap-grid.four { grid-template-columns: 1fr; } }

/* ---- stats ---- */

.ap-stat { background: var(--ap-surface); border: 1px solid var(--ap-border); border-radius: var(--ap-radius); padding: 15px 17px; }
.ap-stat .k { color: var(--ap-muted); font-size: .74rem; letter-spacing: .04em; text-transform: uppercase; }
.ap-stat .v { font-size: 1.65rem; font-weight: 700; letter-spacing: -.5px; line-height: 1.25; }
.ap-stat .n { color: var(--ap-muted-2); font-size: .74rem; }

/* ---- pills & bars ---- */

.ap-pill {
    display: inline-flex; align-items: center; gap: 5px; font-size: .71rem; font-weight: 600;
    padding: .24rem .62rem; border-radius: 999px; white-space: nowrap;
    background: rgba(148,158,180,.14); color: var(--ap-muted);
}
.ap-pill.ok    { background: rgba(62,207,142,.15); color: #6ee7b7; }
.ap-pill.warn  { background: rgba(245,165,36,.16); color: #fbc65f; }
.ap-pill.bad   { background: rgba(242,84,91,.15);  color: #ff9aa0; }
.ap-pill.info  { background: rgba(91,141,239,.16); color: #a8c3fb; }

.ap-bar { height: 7px; border-radius: 999px; background: var(--ap-surface-2); overflow: hidden; }
.ap-bar span { display: block; height: 100%; border-radius: 999px; background: var(--ap-accent); }
.ap-bar.ok span   { background: var(--ap-green); }
.ap-bar.warn span { background: var(--ap-amber); }
.ap-bar.bad span  { background: var(--ap-red); }

/* ---- tables ---- */

.ap-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.ap-table th {
    text-align: left; font-weight: 600; font-size: .68rem; letter-spacing: .09em; text-transform: uppercase;
    color: var(--ap-muted-2); padding: 10px 14px; border-bottom: 1px solid var(--ap-border);
}
.ap-table td { padding: 11px 14px; border-bottom: 1px solid var(--ap-border); vertical-align: middle; }
.ap-table tr:last-child td { border-bottom: 0; }
.ap-table tbody tr:hover { background: var(--ap-surface-2); }
.ap-scroll { overflow-x: auto; }

/* ---- forms ---- */

.ap-label { display: block; font-size: .76rem; font-weight: 600; color: var(--ap-muted); margin-bottom: 5px; }
.ap-hint  { color: var(--ap-muted-2); font-size: .75rem; margin-top: 5px; }

.ap-input, .ap-select, .ap-textarea {
    width: 100%; background: var(--ap-bg); color: var(--ap-text);
    border: 1px solid var(--ap-border); border-radius: 9px; padding: .55rem .75rem;
    font-family: inherit; font-size: .88rem; outline: none;
}
.ap-input:focus, .ap-select:focus, .ap-textarea:focus { border-color: var(--ap-accent); }
.ap-textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.ap-textarea.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .82rem; }
.ap-field { margin-bottom: 14px; }

.ap-check { display: flex; align-items: flex-start; gap: 9px; font-size: .85rem; }
.ap-check input { margin-top: 4px; accent-color: var(--ap-accent); width: 16px; height: 16px; }

.ap-btn {
    display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--ap-border);
    background: var(--ap-surface-2); color: var(--ap-text); border-radius: 9px;
    padding: .5rem .95rem; font-size: .85rem; font-weight: 600; cursor: pointer;
    text-decoration: none; font-family: inherit;
}
.ap-btn:hover { border-color: var(--ap-muted-2); text-decoration: none; }
.ap-btn.primary { background: var(--ap-accent); border-color: var(--ap-accent); color: #fff; }
.ap-btn.primary:hover { filter: brightness(1.08); }
.ap-btn.danger  { background: rgba(242,84,91,.14); border-color: rgba(242,84,91,.4); color: #ff9aa0; }
.ap-btn.ghost   { background: transparent; }
.ap-btn.sm { padding: .32rem .65rem; font-size: .76rem; }
.ap-btn:disabled { opacity: .45; cursor: not-allowed; }

.ap-note {
    border-radius: 10px; padding: 11px 14px; font-size: .84rem; margin-bottom: 16px;
    background: rgba(62,207,142,.1); border: 1px solid rgba(62,207,142,.3); color: #8ce8bd;
}
.ap-note.bad { background: rgba(242,84,91,.1); border-color: rgba(242,84,91,.3); color: #ffb0b4; }
.ap-note.info { background: rgba(91,141,239,.1); border-color: rgba(91,141,239,.3); color: #b9cdfb; }

.ap-empty { text-align: center; color: var(--ap-muted-2); padding: 30px 16px; font-size: .86rem; }

/* ---- the exam runner ---- */

.ap-exam { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .ap-exam { grid-template-columns: 1fr; } }

.ap-chat { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 460px; }
.ap-thread { flex: 1 1 auto; overflow-y: auto; padding: 20px; background: #10131b; }

.ap-msg { max-width: 74%; margin-bottom: 14px; }
.ap-msg .b { padding: .6rem .9rem; border-radius: 14px; font-size: .87rem; white-space: pre-wrap; word-break: break-word; }
.ap-msg.in .b  { background: var(--ap-surface-2); border-bottom-left-radius: 4px; }
.ap-msg.out    { margin-left: auto; }
.ap-msg.out .b { background: var(--ap-accent); color: #fff; border-bottom-right-radius: 4px; }
.ap-msg .t { font-size: .67rem; color: var(--ap-muted-2); margin-top: 4px; }
.ap-msg.out .t { text-align: right; }

.ap-divider { text-align: center; color: var(--ap-muted-2); font-size: .72rem; margin: 6px 0 16px; }
.ap-divider span { background: var(--ap-surface-2); padding: 3px 12px; border-radius: 999px; }

.ap-composer { border-top: 1px solid var(--ap-border); padding: 12px; background: var(--ap-surface); }
.ap-composer textarea {
    width: 100%; min-height: 78px; resize: none; background: var(--ap-bg); color: var(--ap-text);
    border: 1px solid var(--ap-border); border-radius: 10px; padding: .6rem .8rem;
    font-family: inherit; font-size: .89rem; outline: none;
}
.ap-composer textarea:focus { border-color: var(--ap-accent); }

.ap-clock { font-variant-numeric: tabular-nums; font-weight: 700; }
.ap-clock.warn { color: var(--ap-amber); }
.ap-clock.bad  { color: var(--ap-red); }

.ap-sla {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 13px; border-radius: 10px; background: var(--ap-surface-2);
    border: 1px solid var(--ap-border); font-size: .78rem; margin-bottom: 10px;
}
.ap-sla.over { background: rgba(242,84,91,.12); border-color: rgba(242,84,91,.4); color: #ffb0b4; }

.ap-doc { max-height: 52vh; overflow-y: auto; font-size: .82rem; white-space: pre-wrap; color: var(--ap-muted); }

/* ---- written questions, typing, voice ---- */

.ap-question { font-size: 1.02rem; font-weight: 600; line-height: 1.5; margin: 0 0 6px; }
.ap-qtimer { margin-bottom: 14px; }

.ap-tokens { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 12px; }
.ap-token {
    background: var(--ap-surface-2); border: 1px solid var(--ap-border); border-radius: 8px;
    padding: .3rem .7rem; font-size: .84rem; font-weight: 600;
}

.ap-passage {
    background: var(--ap-bg); border: 1px solid var(--ap-border); border-radius: 10px;
    padding: 14px 16px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: .85rem; line-height: 1.75; max-height: 30vh; overflow-y: auto; user-select: none;
}

.ap-record { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

/* ---- report ---- */

.ap-verdict { border-radius: 12px; padding: 16px 18px; border: 1px solid var(--ap-border); background: var(--ap-surface-2); }
.ap-verdict h2 { margin: 0 0 4px; font-size: 1.1rem; }
.ap-verdict.ok   { background: rgba(62,207,142,.10); border-color: rgba(62,207,142,.35); }
.ap-verdict.warn { background: rgba(245,165,36,.10); border-color: rgba(245,165,36,.35); }
.ap-verdict.bad  { background: rgba(242,84,91,.10);  border-color: rgba(242,84,91,.35); }

.ap-finding { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ap-border); font-size: .86rem; }
.ap-finding:last-child { border-bottom: 0; }
.ap-finding i { flex: 0 0 auto; margin-top: 3px; }

/* ---- scorecard ---- */

.ap-score-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.ap-score-ring {
    width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center;
    font-size: 1.9rem; font-weight: 700; flex: 0 0 auto;
}
.ap-issue {
    display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ap-border); font-size: .83rem;
}
.ap-issue:last-child { border-bottom: 0; }
.ap-issue code {
    background: var(--ap-surface-2); padding: 1px 6px; border-radius: 5px;
    font-size: .78rem; color: #ffb0b4;
}
.ap-issue .fix { color: #6ee7b7; }

/* ---- certificate ---- */

.ap-cert {
    max-width: 860px; margin: 0 auto; background: #fbfaf7; color: #1b1c22;
    border-radius: 6px; padding: 54px 60px; border: 12px double #b99a4a;
}
.ap-cert h1 { font-size: 2rem; margin: 0 0 4px; letter-spacing: -.5px; }
.ap-cert .name { font-size: 2.35rem; font-weight: 700; margin: 22px 0 6px; }
.ap-cert .rule { height: 1px; background: #d8d2c2; margin: 26px 0; }
.ap-cert .muted { color: #6a6a72; }
.ap-cert .serial { font-family: ui-monospace, Consolas, monospace; letter-spacing: .04em; }

@media print {
    .ap-side, .ap-top, .ap-noprint { display: none !important; }
    body, .ap-content { background: #fff; padding: 0; }
    .ap-cert { border-color: #8a7434; }
}

/* ---- small helpers ---- */

.muted { color: var(--ap-muted); }
.muted-2 { color: var(--ap-muted-2); }
.small { font-size: .8rem; }
.tiny { font-size: .72rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack > * + * { margin-top: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.fw { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.hidden { display: none !important; }
