/* Click in Peace — shared styles for the admin app and the trainee simulator.
   Company colours arrive as --brand / --brand-ink set inline on <html> at runtime. */
:root {
  --brand: #1f5f8b;
  --brand-ink: #ffffff;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1b2733;
  --muted: #5a6b7b;
  --line: #dce3ea;
  --good: #1a7f46;
  --good-bg: #e6f4ec;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --warn: #8a6d00;
  --warn-bg: #fdf3d7;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 32, 48, .08), 0 6px 20px rgba(16, 32, 48, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink);
}
a { color: var(--brand); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* buttons */
.btn {
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; line-height: 1;
}
.btn:hover { border-color: #b9c6d3; }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* forms */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
textarea { min-height: 70px; resize: vertical; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.error { color: var(--bad); font-size: 13px; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; }
.notice.good { background: var(--good-bg); color: var(--good); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }

/* panels / cards */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: #eef2f6; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.chip.phish { background: var(--bad-bg); color: var(--bad); }
.chip.legit { background: var(--good-bg); color: var(--good); }
.chip.draft { background: var(--warn-bg); color: var(--warn); }
.chip.approved { background: var(--good-bg); color: var(--good); }
.tag { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tbody tr:hover { background: #f8fafb; }

/* ===== app shell ===== */
.appbar { display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.appbar .logo { font-weight: 800; letter-spacing: -.01em; }
.appbar .logo b { color: var(--brand); }
.appbar .logo-img { height: 26px; width: auto; border-radius: 4px; }
.appbar nav { display: flex; gap: 4px; }
.appbar nav button { background: transparent; border: 0; padding: 8px 12px; border-radius: 7px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.appbar nav button[aria-current=page] { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.appwrap { max-width: 1040px; margin: 0 auto; padding: 22px 20px 60px; }
.lang-switch button { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; cursor: pointer; font: inherit; font-size: 12.5px; }
.lang-switch button[aria-pressed=true] { background: var(--brand); color: var(--brand-ink); border-color: transparent; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 22px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.stat { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-tile { padding: 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.stat-tile .n { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.stat-tile .l { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* scenario cards */
.scn { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.scn .scn-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.scn .subj { font-weight: 700; }
.scn .from { font-size: 13px; color: var(--muted); }
.scn.scn-select { flex-direction: row; gap: 12px; align-items: flex-start; text-align: left; cursor: pointer; }
.scn.scn-select input { margin-top: 4px; flex: none; }

/* bars */
.bar { height: 8px; background: #eef2f6; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.meter-row { display: grid; grid-template-columns: 160px 1fr 44px; gap: 10px; align-items: center; margin: 6px 0; font-size: 13.5px; }

/* ===== centered auth / join card ===== */
.hero { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.hero .card { width: min(440px, 100%); }
.brandmark { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
.brandmark b { color: var(--brand); }

/* ========================================================= */
/*  TRAINEE SIMULATOR                                         */
/* ========================================================= */
.sim { max-width: 1100px; margin: 0 auto; padding: 16px; }
.sim-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sim-head .logo-img { height: 24px; }
.sim-head .progress { margin-left: auto; font-size: 13px; color: var(--muted); }
.sim-head .score { font-weight: 700; }

/* A training banner is always visible so no one mistakes the sim for real mail. */
.sim-banner { background: var(--warn-bg); color: var(--warn); font-size: 12.5px; font-weight: 600; text-align: center; padding: 6px; border-radius: 7px; margin-bottom: 10px; }

.mail { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); }

/* --- shared mail header inside reading view --- */
.msg { padding: 18px 20px; }
.msg .msg-subject { font-size: 19px; font-weight: 700; margin: 0 0 10px; }
.msg .msg-meta { display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.msg .avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
.msg .who { line-height: 1.3; }
.msg .who .name { font-weight: 600; }
.msg .who .addr { font-size: 13px; color: var(--muted); }
.msg .when { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.msg .msg-body p { margin: 0 0 10px; }

/* the fake link / attachment / QR trap */
.lure { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: #f7fafc; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--brand); }
.lure.att { color: var(--ink); }
.lure .ico { font-size: 16px; }
.lure .qr { width: 86px; height: 86px; background:
  conic-gradient(from 0deg, #111 25%, #fff 0 50%, #111 0 75%, #fff 0) 0 0/16px 16px; border: 6px solid #fff; outline: 1px solid var(--line); }
/* hover/press preview of where a link really goes */
.previewing { position: relative; }
.url-preview { position: fixed; z-index: 50; background: #111a22; color: #fff; font-size: 12.5px; padding: 6px 9px; border-radius: 6px; max-width: 320px; word-break: break-all; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.3); }

/* decision bar */
.decide { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfdfe; flex-wrap: wrap; }
.decide .spread { color: var(--muted); font-size: 13px; }

/* feedback panel after a decision */
.fb { padding: 16px 20px; border-top: 3px solid; }
.fb.good { border-color: var(--good); background: var(--good-bg); }
.fb.bad { border-color: var(--bad); background: var(--bad-bg); }
.fb h3 { margin: 0 0 6px; }
.fb .reveal { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.fb ul { margin: 6px 0 0; padding-left: 20px; }
.fb li { margin: 3px 0; }

/* ---------- webmail skin (generic, no third-party branding) ---------- */
.sk-webmail { display: grid; grid-template-columns: 190px 300px 1fr; min-height: 520px; }
.sk-webmail .side { background: #fafbfc; border-right: 1px solid var(--line); padding: 14px 10px; }
.sk-webmail .side .compose { width: 100%; margin-bottom: 12px; }
.sk-webmail .side .folder { padding: 7px 10px; border-radius: 7px; font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; }
.sk-webmail .side .folder.on { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-weight: 700; }
.sk-webmail .list { border-right: 1px solid var(--line); }
.sk-webmail .reading { }

/* ---------- outlook-style skin (three-pane + ribbon) ---------- */
.sk-outlook .ribbon { display: flex; gap: 14px; padding: 8px 14px; background: #f3f6f9; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.sk-outlook .ribbon b { color: var(--ink); }
.sk-outlook .panes { display: grid; grid-template-columns: 300px 1fr; min-height: 500px; }
.sk-outlook .list { border-right: 1px solid var(--line); }

/* message list rows (shared by webmail + outlook) */
.mlist { overflow: auto; max-height: 560px; }
.mrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mrow:hover { background: #f5f8fa; }
.mrow.on { background: color-mix(in srgb, var(--brand) 10%, transparent); box-shadow: inset 3px 0 0 var(--brand); }
.mrow .r-from { font-weight: 600; font-size: 14px; }
.mrow .r-time { font-size: 12px; color: var(--muted); }
.mrow .r-subj { grid-column: 1 / -1; font-size: 13.5px; }
.mrow .r-prev { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- phone skin ---------- */
.sk-phone { max-width: 390px; margin: 0 auto; border: 10px solid #10151a; border-radius: 34px; overflow: hidden; background: #000; }
.sk-phone .screen { background: #fff; min-height: 600px; }
.sk-phone .statusbar { height: 26px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.sk-phone .pmsg .msg-meta { flex-wrap: wrap; }
.sk-phone .decide { position: sticky; bottom: 0; }

/* results + certificate */
.result-hero { text-align: center; padding: 30px 20px; }
.result-ring { --p: 0; width: 140px; height: 140px; border-radius: 50%; margin: 0 auto 16px;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), #e8edf1 0); display: grid; place-items: center; }
.result-ring > div { width: 108px; height: 108px; background: #fff; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.cert { border: 2px solid var(--brand); border-radius: 12px; padding: 26px; text-align: center; background: #fff; }
.cert .seal { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); font-weight: 700; }
.cert .who { font-size: 24px; font-weight: 800; margin: 8px 0; }

@media (max-width: 820px) {
  .grid.two { grid-template-columns: 1fr; }
  .sk-webmail, .sk-outlook .panes { grid-template-columns: 1fr; }
  .sk-webmail .side { display: none; }
  .meter-row { grid-template-columns: 120px 1fr 40px; }
}
