/* ============================================================
   MEM Onboarding — design system
   ============================================================ */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Noto Sans Armenian", "Noto Sans", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --bg:        #f6f7fb;
  --surface:   #ffffff;
  --surface-2: #f2f3f8;
  --surface-3: #e9ebf3;
  --border:    #e3e6ef;
  --border-strong: #cdd2e2;

  --text:      #171a26;
  --text-2:    #5b6178;
  --text-3:    #8b91a7;

  --primary:      #5b52e0;
  --primary-hover:#4a41d4;
  --primary-soft: #ecebfd;
  --primary-text: #ffffff;

  --green:  #14875a;  --green-soft:  #e2f5ec;
  --amber:  #b06f00;  --amber-soft:  #fdf1dd;
  --red:    #c9384a;  --red-soft:    #fdeaec;
  --blue:   #1a6fc4;  --blue-soft:   #e6f1fb;
  --slate:  #6b7280;  --slate-soft:  #eef0f4;

  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16,20,40,.06), 0 1px 3px rgba(16,20,40,.04);
  --shadow:    0 4px 14px rgba(16,20,40,.08);
  --shadow-lg: 0 18px 48px rgba(16,20,40,.18);

  --sidebar-w: 252px;
  --header-h:  60px;
}

:root[data-theme="dark"] {
  --bg:        #0e1017;
  --surface:   #171a24;
  --surface-2: #1d2130;
  --surface-3: #262b3d;
  --border:    #262b3a;
  --border-strong: #38405a;

  --text:      #eceef5;
  --text-2:    #a2a9bf;
  --text-3:    #737b94;

  --primary:      #7b73f0;
  --primary-hover:#8d86f5;
  --primary-soft: #232145;

  --green:  #3fce97;  --green-soft:  #122c23;
  --amber:  #e5a53b;  --amber-soft:  #2e2413;
  --red:    #f4788b;  --red-soft:    #331a20;
  --blue:   #61aaf0;  --blue-soft:   #12233a;
  --slate:  #98a0b4;  --slate-soft:  #232735;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 4px 16px rgba(0,0,0,.45);
  --shadow-lg: 0 18px 48px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }

/* every inline icon gets a sane default size; context rules override it */
svg.ico { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: -3px; }
.badge svg.ico, .crumbs svg.ico, .chip svg.ico, .small svg.ico { width: 13px; height: 13px; vertical-align: -2px; }
.card-head > svg.ico, .modal-head > svg.ico { color: var(--text-2); }
.toast svg.ico { width: 16px; height: 16px; }
td svg.ico { vertical-align: -4px; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p  { margin: 0 0 10px; }
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
::selection { background: var(--primary-soft); }

/* ---------- layout ---------- */
#app { min-height: 100vh; }

.auth-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1fr;
  place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 600px at 12% -10%, var(--primary-soft), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, var(--blue-soft), transparent 55%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 32px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-head { margin-bottom: 20px; }
.auth-head p { color: var(--text-2); margin: 4px 0 0; }
.auth-foot { margin-top: 18px; text-align: center; color: var(--text-2); font-size: 13px; }
.auth-demo {
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border);
}
.auth-demo-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); font-weight: 650; margin-bottom: 8px; }
.demo-row { display: flex; gap: 8px; flex-wrap: wrap; }

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; height: var(--header-h);
  padding: 0 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.nav-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-3); font-weight: 700; padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 550; cursor: pointer; margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item .ico { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .count {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px;
  font-weight: 700; padding: 1px 7px; border-radius: 999px;
}
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.content { padding: 24px 26px 60px; max-width: 1320px; width: 100%; }

.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- brand ---------- */
.logo {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #8b7ef8);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  letter-spacing: -.02em; box-shadow: var(--shadow-sm);
}
.logo-lg { width: 38px; height: 38px; border-radius: 11px; font-size: 15px; }
.brand-name { font-weight: 700; letter-spacing: -.02em; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: -3px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--red); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }
.btn .ico { width: 16px; height: 16px; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field > label, .label {
  display: block; font-size: 12.5px; font-weight: 620; color: var(--text-2); margin-bottom: 5px;
}
.hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 8px 11px; height: 36px;
  transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 90px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b91a7' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
/* grid/flex children default to min-width:auto, which lets one wide child
   stretch the whole layout — never let that reach the page */
.grid-2 > *, .grid-3 > *, .stack > *, .main, .tile > *, .tiles > *, .podium > * { min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-error {
  background: var(--red-soft); color: var(--red); border: 1px solid currentColor;
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.search {
  position: relative; display: flex; align-items: center;
}
.search .ico { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--text-3); }
.search .input { padding-left: 31px; }

/* ---------- rich text editor ---------- */
.rich { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.rich:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.rich-bar {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 5px 6px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.rich-btn {
  min-width: 30px; height: 28px; padding: 0 7px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); font: inherit; font-size: 13px;
  cursor: pointer; line-height: 1;
}
.rich-btn:hover { background: var(--surface-3); color: var(--text); }
.rich-area {
  min-height: 170px; max-height: 46vh; overflow-y: auto; padding: 12px 14px;
  outline: none; font-size: 13.5px;
}
.rich-area:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.rich-area > *:first-child { margin-top: 0; }

/* ---------- cards / panels ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.card-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow-sm);
}
.stat .k { font-size: 12px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .v { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.stat .d { font-size: 12px; color: var(--text-3); }
.stat .ico { width: 15px; height: 15px; color: var(--primary); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: box-shadow .15s, border-color .15s, transform .15s;
  display: flex; flex-direction: column; gap: 10px;
}
.tile:hover { box-shadow: var(--shadow); border-color: var(--border-strong); transform: translateY(-1px); }
.tile-top { display: flex; align-items: flex-start; gap: 10px; }
.tile-title { font-weight: 650; font-size: 14.5px; }
.tile-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-2); font-size: 12.5px; }
.tile-meta span { display: inline-flex; align-items: center; gap: 5px; }
.tile-meta .ico { width: 13px; height: 13px; color: var(--text-3); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); font-weight: 700; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.actions { text-align: right; white-space: nowrap; }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
/* keep the leading (name/title) column from collapsing into a narrow wrap */
table.tbl:not(.matrix) th:first-child:not(.tight-col),
table.tbl:not(.matrix) td:first-child:not(.num):not(.tight-col) { min-width: 180px; }
table.tbl td.tight-col, table.tbl th.tight-col { width: 1%; white-space: nowrap; }
/* long headers (Armenian labels) may wrap instead of forcing a scrollbar */
table.tbl.wrap-head th { white-space: normal; }
.row-click { cursor: pointer; }

/* ---------- misc atoms ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
  background: var(--slate-soft); color: var(--slate);
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red   { background: var(--red-soft);   color: var(--red); }
.badge.blue  { background: var(--blue-soft);  color: var(--blue); }
.badge.violet{ background: var(--primary-soft); color: var(--primary); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
  background: var(--primary); letter-spacing: -.02em;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .em { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; min-width: 70px; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.progress.green > i { background: var(--green); }
.progress.amber > i { background: var(--amber); }

.empty { text-align: center; padding: 46px 20px; color: var(--text-2); }
.empty .ico { width: 34px; height: 34px; color: var(--text-3); margin-bottom: 10px; }
svg.big-ico { width: 46px; height: 46px; color: var(--amber); }
.empty h3 { margin-bottom: 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 9px 14px; font-weight: 600; font-size: 13.5px; color: var(--text-2);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px;
}
.chip button {
  border: 0; background: transparent; color: var(--text-3); cursor: pointer;
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; padding: 0;
}
.chip button:hover { background: var(--red-soft); color: var(--red); }

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }
.crumbs a { color: var(--text-2); font-weight: 550; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
/* long URLs and tokens break instead of widening their container */
.mono, .md a, .person .em, td a { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.right { margin-left: auto; }

/* ---------- markdown guide ---------- */
.md { line-height: 1.7; }
.md h1, .md h2, .md h3 { margin: 22px 0 10px; }
.md h1 { font-size: 19px; } .md h2 { font-size: 16.5px; } .md h3 { font-size: 14.5px; }
.md h1:first-child, .md h2:first-child { margin-top: 0; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin-bottom: 5px; }
.md blockquote {
  margin: 0 0 12px; padding: 8px 14px; border-left: 3px solid var(--primary);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2);
}
.md code { font-family: var(--font-mono); background: var(--surface-3); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.md strong { font-weight: 680; }
.md hr { margin: 18px 0; }

/* ---------- assessment ---------- */
.assess-row { border-bottom: 1px solid var(--border); padding: 14px 16px; }
.assess-row:last-child { border-bottom: 0; }
.assess-q { font-weight: 570; margin-bottom: 10px; display: flex; gap: 10px; }
.assess-q .n {
  width: 22px; height: 22px; border-radius: 6px; background: var(--surface-3); color: var(--text-2);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex-shrink: 0;
}
.opts { display: flex; flex-wrap: wrap; gap: 7px; }
.opt {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 999px; font-size: 12.5px; font-weight: 570;
  color: var(--text-2); background: var(--surface); transition: all .12s; user-select: none;
}
.opt input { display: none; }
.opt .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.opt:hover { border-color: var(--text-3); }
.opt.on { color: #fff; }
.opt.on .dot { background: rgba(255,255,255,.85); }
.opt.on.v-fully_done     { background: var(--green); border-color: var(--green); }
.opt.on.v-needs_revision { background: var(--amber); border-color: var(--amber); }
.opt.on.v-not_done       { background: var(--red);   border-color: var(--red); }
.opt.on.v-cannot_do      { background: var(--blue);  border-color: var(--blue); }
.opt.on.v-not_assessed   { background: var(--slate); border-color: var(--slate); }

.note-input { margin-top: 9px; }
.section-head {
  padding: 9px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2);
}
.sticky-bar {
  position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border);
  padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.cmp-cell { display: flex; flex-direction: column; gap: 2px; }
.cmp-note { font-size: 11.5px; color: var(--text-3); font-style: italic; }

/* matrix */
.matrix { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.matrix th, .matrix td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 7px; text-align: center; }
.matrix th.corner, .matrix td.rowhead { text-align: left; background: var(--surface-2); position: sticky; left: 0; z-index: 2; white-space: nowrap; font-weight: 600; }
.matrix th { background: var(--surface-2); font-size: 11px; font-weight: 650; color: var(--text-2); }
.matrix th.vert { height: 118px; vertical-align: bottom; padding-bottom: 8px; }
.matrix th.vert > div { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; margin: 0 auto; }
.matrix td.self { background: var(--surface-3); }
.matrix td.mentor { background: var(--green-soft); }
.matrix td.mentor input[type=checkbox] { accent-color: var(--green); }
.matrix input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* ---------- leaderboard ---------- */
.podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.podium-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 16px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative;
}
.podium-card .avatar { margin-top: 4px; }
.podium-card .nm { font-weight: 650; }
.podium-card.gold   { border-color: #d9a441; box-shadow: 0 0 0 1px #d9a44133, var(--shadow); }
.podium-card.silver { border-color: #9aa4b2; }
.podium-card.bronze { border-color: #b98357; }
.podium-score { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; }

.rank-badge {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  font-size: 12.5px; font-weight: 750; background: var(--surface-3); color: var(--text-2);
}
.podium-card .rank-badge { position: absolute; top: 12px; left: 12px; }
.rank-badge.gold   { background: #f4dfae; color: #7a5510; }
.rank-badge.silver { background: #e2e6ec; color: #4d5765; }
.rank-badge.bronze { background: #eed6c3; color: #7d4a26; }
:root[data-theme="dark"] .rank-badge.gold   { background: #4a3a15; color: #f2cf82; }
:root[data-theme="dark"] .rank-badge.silver { background: #2e343f; color: #cdd4de; }
:root[data-theme="dark"] .rank-badge.bronze { background: #422f22; color: #e3b48f; }

table.tbl tr.me-row td { background: var(--primary-soft); }
table.tbl tr.me-row:hover td { background: var(--primary-soft); }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(12,15,28,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column;
  border: 1px solid var(--border); animation: pop .16s;
}
.modal.wide { max-width: 800px; }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985) } }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: var(--bg); padding: 11px 15px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 550; max-width: 340px;
  display: flex; align-items: center; gap: 9px; animation: slide .18s;
}
.toast.err { background: var(--red); color: #fff; }
.toast.ok  { background: var(--green); color: #fff; }
@keyframes slide { from { opacity: 0; transform: translateX(16px) } }

/* ---------- responsive ---------- */
.menu-btn { display: none; }
.hide-sm { display: revert; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 60;
    transform: translateX(-100%); transition: transform .2s;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; }

  .content { padding: 16px 14px 72px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* the leading-column minimum is a desktop nicety — it must not widen the page */
  table.tbl:not(.matrix) th:first-child,
  table.tbl:not(.matrix) td:first-child:not(.num):not(.tight-col) { min-width: 0; }
  /* any table narrow enough to fit does; anything else scrolls by itself
     instead of stretching the layout viewport */
  table.tbl { display: block; overflow-x: auto; min-width: 100%; }
  table.tbl th, table.tbl td { padding: 10px; }

  .card-head { flex-wrap: wrap; }
  .card-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .select { flex: 1 1 160px; width: auto !important; }
  .page-head h1 { font-size: 20px; }

  /* comfortable tap targets */
  .btn { height: 40px; padding: 0 15px; }
  .btn-sm { height: 34px; }
  .btn-icon { width: 40px; }
  .nav-item { padding: 11px 10px; }
  .tab { padding: 11px 14px; }

  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .person .nm, .topbar .person .em { display: none; }

  .stat .v { font-size: 23px; }
  .tiles { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; gap: 10px; }
  .podium-card { flex-direction: row; align-items: center; text-align: left; gap: 12px; padding: 14px; min-width: 0; }
  .podium-card > * { min-width: 0; }
  .podium-card .nm, .podium-card .small { overflow-wrap: anywhere; }
  .podium-card .rank-badge { position: static; }
  .podium-score { margin-left: auto; font-size: 22px; }

  .modal-back { padding: 0; align-items: flex-end; }
  .modal { max-width: none; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-foot { position: sticky; bottom: 0; background: var(--surface); }
  .modal-foot .btn { flex: 1; }
  .grid-2 > .field, .grid-3 > .field { min-width: 0; }

  .opts { gap: 6px; }
  .opt { padding: 8px 11px; font-size: 12px; }
  .sticky-bar { flex-wrap: wrap; }
  .sticky-bar .right { width: 100%; }
  .sticky-bar .right .btn { flex: 1; }

  .rich-area { min-height: 200px; max-height: 40vh; }
  .auth-card { padding: 24px 20px; }
}

@media (max-width: 520px) {
  .hide-sm { display: none !important; }
  h1 { font-size: 19px; }
  .content { padding: 14px 12px 72px; }
  .card-body { padding: 14px; }
  .demo-row .btn { flex: 1 1 100%; }
  .matrix th.vert { height: 96px; }
}

/* ---------- recognition ---------- */
/* every card takes its accent from the value it carries */
.rec-card, .value-chip, .rec-emoji { --v: var(--slate); --v-soft: var(--slate-soft); }
.rec-card.violet, .value-chip.violet, .rec-emoji.violet { --v: var(--primary); --v-soft: var(--primary-soft); }
.rec-card.blue,   .value-chip.blue,   .rec-emoji.blue   { --v: var(--blue);    --v-soft: var(--blue-soft); }
.rec-card.green,  .value-chip.green,  .rec-emoji.green  { --v: var(--green);   --v-soft: var(--green-soft); }
.rec-card.amber,  .value-chip.amber,  .rec-emoji.amber  { --v: var(--amber);   --v-soft: var(--amber-soft); }
.rec-card.red,    .value-chip.red,    .rec-emoji.red    { --v: var(--red);     --v-soft: var(--red-soft); }

 /* one recognition per row — never two cards side by side */
.rec-grid { display: flex; flex-direction: column; gap: 14px; }
/* feed + sidebar; collapses to one column on small screens (a class, not an
   inline style, so the media query below can actually win) */
.rec-layout { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
.rec-layout > * { min-width: 0; }
@media (max-width: 900px) { .rec-layout { grid-template-columns: 1fr; } }

.rec-card {
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--v);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
  display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s;
}
.rec-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* the value is the headline of the card */
.rec-value {
  display: flex; align-items: center; gap: 12px; padding: 15px 16px;
  background: var(--v-soft); border-bottom: 1px solid var(--border);
}
.rec-value .em {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 14px; display: grid; place-items: center;
  font-size: 25px; line-height: 1; background: var(--surface); box-shadow: var(--shadow-sm);
}
.rec-value .nm {
  font-size: 15.5px; font-weight: 750; color: var(--v); letter-spacing: -.01em; line-height: 1.25;
}
.rec-value .ds { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

.rec-people { display: flex; align-items: center; gap: 8px; padding: 14px 16px 0; flex-wrap: wrap; }
.rec-people .who { display: flex; align-items: center; gap: 7px; min-width: 0; }
.rec-people .who span { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-people .from span { color: var(--text-2); }
.rec-people .to span { font-weight: 680; color: var(--text); }
.rec-people .arrow { color: var(--v); flex-shrink: 0; }

.rec-quote {
  margin: 12px 16px 0; padding: 10px 0 10px 13px; border-left: 3px solid var(--v);
  color: var(--text-2); line-height: 1.6; font-size: 13.5px; overflow-wrap: anywhere;
}
.rec-foot {
  margin-top: auto; padding: 12px 16px; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-3);
}
.rec-foot .btn { margin-left: auto; }

/* compact emoji tile reused in sidebars and admin tables */
.rec-emoji {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 14px; display: grid; place-items: center;
  font-size: 24px; line-height: 1; background: var(--v-soft);
}

.value-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 8px;
  border-radius: 999px; font-size: 12.5px; font-weight: 650;
  background: var(--v-soft); color: var(--v);
}
.value-chip .em { font-size: 15px; line-height: 1; }

.quota-dots { display: flex; gap: 5px; }
.quota-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--surface-3); }
.quota-dots i.on { background: var(--primary); }

.value-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.value-pick {
  display: flex; align-items: center; gap: 10px; padding: 11px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  transition: all .12s; text-align: left;
}
.value-pick:hover { border-color: var(--primary); }
.value-pick.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.value-pick .em { font-size: 22px; line-height: 1; }
.value-pick .nm { font-weight: 620; font-size: 13px; }
.value-pick .ds { font-size: 11.5px; color: var(--text-3); }

/* ---------- recognition graph ---------- */
.graph-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
.graph-wrap > * { min-width: 0; }
.graph-stage {
  position: relative; height: calc(100vh - var(--header-h) - 150px); min-height: 460px;
  background:
    radial-gradient(circle at 30% 20%, var(--surface-2), transparent 60%),
    radial-gradient(circle at 75% 80%, var(--primary-soft), transparent 55%),
    var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.graph-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.graph-tools {
  position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px;
}
.graph-tools .btn { background: var(--surface); box-shadow: var(--shadow-sm); }
.graph-legend {
  position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap;
  max-width: calc(100% - 24px);
}
.graph-side { display: flex; flex-direction: column; gap: 12px; }
.graph-side .card-head { padding: 12px 14px; }
.graph-side .card-head h3 { font-size: 13.5px; }
.graph-side .card-body { padding: 12px 14px; }

@media (max-width: 900px) {
  .graph-wrap { grid-template-columns: 1fr; }
  .graph-stage { height: 62vh; min-height: 380px; }
}
@media (max-width: 520px) { .graph-legend { display: none; } }

/* the 0–3 wording from the task guide, folded away until asked for */
.assess-guide {
  margin: 6px 0 10px; padding: 10px 12px;
  border-left: 3px solid var(--border); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2); font-size: 13px; color: var(--text-2);
}
.assess-guide > div { padding: 2px 0; }
.guide-toggle { margin-left: 6px; vertical-align: middle; opacity: .6; }
.guide-toggle:hover { opacity: 1; }

/* the admin's real-vs-demo split, quieter than the role tabs above it */
.tabs.subtle { margin-top: -4px; }
.tabs.subtle .tab { font-size: 12px; padding: 4px 10px; }

.copy-box {
  padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-mono); font-size: 13px;
}

/* ---- choosing a first password ------------------------------------------
   The first screen a new person sees, so it is a welcome rather than a form. */
.pw-card { max-width: 440px; }
.pw-hero { text-align: center; padding-bottom: 4px; }
.pw-hero h1 { margin-top: 14px; font-size: 22px; }
.pw-hero p { margin-top: 8px; font-size: 14px; line-height: 1.5; }
.pw-hero-ring {
  display: inline-grid; place-items: center; padding: 5px;
  border-radius: 50%; background: var(--surface);
  box-shadow: 0 0 0 2px var(--primary-soft), 0 0 0 8px var(--surface-2);
}
.pw-who {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2);
}
.pw-who svg.ico { width: 14px; height: 14px; }
#pw-form { margin-top: 22px; }

/* the field, with a reveal button living inside it */
.pw-input { position: relative; display: block; }
.pw-input input { width: 100%; padding-right: 42px; }
.pw-eye {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  color: var(--text-3); opacity: .75;
}
.pw-eye:hover { opacity: 1; background: var(--surface-2); }
.pw-eye.on { color: var(--primary); opacity: 1; }

/* strength, shown as one quiet bar rather than a verdict */
.pw-meter {
  /* clear of the field above, or it reads as that input's underline */
  height: 4px; margin: 22px 0 14px; border-radius: 999px;
  background: var(--surface-3); overflow: hidden;
}
.pw-meter i { display: block; height: 100%; width: 0; border-radius: 999px;
  transition: width .25s ease, background-color .25s ease; }
.pw-meter i.s1 { width: 25%; background: var(--red); }
.pw-meter i.s2 { width: 50%; background: var(--amber); }
.pw-meter i.s3 { width: 75%; background: var(--blue); }
.pw-meter i.s4 { width: 100%; background: var(--green); }

.pw-rules { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 7px; }
.pw-rules li {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-3);
}
.pw-rules li svg.ico {
  width: 16px; height: 16px; padding: 2px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-3);
  transition: background-color .2s ease, color .2s ease;
}
.pw-rules li.ok { color: var(--text); }
.pw-rules li.ok svg.ico { background: var(--green); color: #fff; }

/* ---- questionnaires ------------------------------------------------------ */
.q-list { display: grid; }
.q-row {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: start;
}
.q-row:last-child { border-bottom: 0; }
.q-num {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--primary-soft); color: var(--primary-text);
  font-size: 12px; font-weight: 700;
}
.q-main { min-width: 0; }
.q-text { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.q-side { display: grid; gap: 6px; justify-items: end; }
.q-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.q-opt {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.q-opt svg.ico { width: 13px; height: 13px; }
.q-scale-preview { display: flex; align-items: center; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.q-scale-preview i {
  display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border);
  font-style: normal; font-size: 12px; color: var(--text-2);
}

/* filling one in */
.q-fill { display: grid; gap: 26px; }
.q-field { display: grid; gap: 9px; }
.q-label { display: flex; gap: 9px; align-items: baseline; font-weight: 600; }
.q-help { margin-left: 31px; margin-top: -4px; }
.q-choices { display: grid; gap: 8px; margin-left: 31px; }
.q-choice {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s ease, background-color .15s ease;
}
.q-choice:hover { border-color: var(--primary); }
.q-choice.on { border-color: var(--primary); background: var(--primary-soft); }
.q-choice input { accent-color: var(--primary); }
.q-scale { display: flex; gap: 8px; flex-wrap: wrap; margin-left: 31px; }
.q-step { cursor: pointer; }
.q-step input { position: absolute; opacity: 0; pointer-events: none; }
.q-step span {
  display: grid; place-items: center; min-width: 42px; height: 42px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-weight: 600;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.q-step:hover span { border-color: var(--primary); }
.q-step.on span { background: var(--primary); border-color: var(--primary); color: #fff; }
.q-scale-ends { display: flex; justify-content: space-between; margin-left: 31px; max-width: 420px; }
.q-fill textarea.input, .q-fill input.input { margin-left: 31px; max-width: 520px; }

/* results */
.res-row { display: grid; grid-template-columns: minmax(90px, 190px) 1fr auto; gap: 12px;
  align-items: center; padding: 6px 0; }
.res-label { font-size: 14px; }
.res-track { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.res-track i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.res-n { font-size: 13px; font-weight: 600; white-space: nowrap; }
.res-avg { display: flex; align-items: baseline; gap: 10px; }
.res-avg-n { font-size: 30px; font-weight: 700; color: var(--primary); }
.res-text {
  display: flex; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); font-size: 14px;
}
.res-text svg.ico { width: 15px; height: 15px; flex: 0 0 auto; color: var(--text-3); margin-top: 2px; }
.stat-row { display: flex; gap: 26px; }
.stat-n { font-size: 26px; font-weight: 700; }

@media (max-width: 720px) {
  .q-row { grid-template-columns: 26px 1fr; }
  .q-side { justify-items: start; grid-column: 1 / -1; }
  .q-choices, .q-scale, .q-scale-ends, .q-help { margin-left: 0; }
  .q-fill textarea.input, .q-fill input.input { margin-left: 0; }
  .res-row { grid-template-columns: 1fr auto; }
  .res-track { grid-column: 1 / -1; }
}

/* previews — the real form, shown but not usable */
.preview-note {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--primary-soft); color: var(--primary-text); font-size: 13px;
}
.preview-note svg.ico { width: 15px; height: 15px; flex: 0 0 auto; }
.preview-frame {
  padding: 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.q-fill.is-preview { pointer-events: none; }
.q-fill.is-preview .q-choice, .q-fill.is-preview .q-step span { opacity: .92; }
