/* ============================================================
   Ciqur24 Security Awareness Portal — Design System
   Built on the brand navy/blue from the Ciqur24 wordmark.
   Type: Space Grotesk (display) + Inter (UI) + JetBrains Mono (data)
   ============================================================ */

:root {
  /* Color */
  --ink: #0b1220;
  --navy-900: #0a1730;
  --navy-800: #10233f;
  --navy-700: #16305a;
  --accent-600: #2454e0;
  --accent-500: #3b6bf0;
  --accent-100: #e9eefd;
  --surface: #f4f6fb;
  --surface-card: #ffffff;
  --line: #e3e8f2;
  --line-strong: #cbd5e8;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --amber-ink: #92600a;
  --amber-bg: #fff2da;
  --amber-line: #f3d9a3;
  --red-ink: #b3352f;
  --red-bg: #fdeceb;
  --red-line: #f4c4c0;
  --green-ink: #12724f;
  --green-bg: #e4f7ef;
  --green-line: #b9e8d3;
  --blue-ink: #2454e0;
  --blue-bg: #eaf0fe;
  --blue-line: #c7d7fb;

  /* Type */
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 18px rgba(15, 23, 42, 0.08);
  --shadow-lift: 0 14px 30px rgba(15, 23, 42, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%; /* respect the browser's text-size setting */
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 480px at 12% -8%, rgba(59, 107, 240, 0.07), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(36, 84, 224, 0.05), transparent 55%),
    var(--surface);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.625rem;
  font-weight: 700;
  margin-bottom: 4px;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 600;
}

a {
  color: var(--accent-600);
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--accent-100);
  color: var(--accent-600);
  padding: 1px 6px;
  border-radius: 5px;
}

:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 2px;
}

/* ---------------- App shell: top bar + content ---------------- */

.topbar {
  background: linear-gradient(115deg, var(--navy-900), var(--navy-800) 55%, var(--navy-700));
  color: #fff;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 6px 24px rgba(6, 14, 32, 0.28);
  position: relative;
  z-index: 10;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-wrap {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.brand-logo {
  height: 26px;
  width: auto;
  display: block;
}

.brand-tagline {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.875rem;
  color: #9fb3d1;
}

nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #cfe0ff;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-btn.active {
  background: var(--accent-600);
  border-color: var(--accent-600);
  color: #fff;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #cfe0ff;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nav-dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-dropdown-trigger.active {
  background: var(--accent-600);
  border-color: var(--accent-600);
  color: #fff;
}

.nav-dropdown-caret {
  font-size: 0.75rem;
  transition: transform 0.15s ease;
}

.nav-dropdown-trigger.caret-flipped .nav-dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  z-index: 50;
}

.nav-dropdown-menu.open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown-item {
  background: transparent;
  border: none;
  color: var(--ink);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
}

.nav-dropdown-item:hover {
  background: var(--accent-100);
}

.nav-dropdown-item.active {
  background: var(--accent-100);
  color: var(--accent-600);
  font-weight: 600;
}

.logout-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #cfe0ff;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

main {
  padding: 28px 32px 60px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* ---------------- Sub-tabs (My Training) ---------------- */

.subtabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin: 4px 0 22px;
}

.subtab-btn {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  margin-right: 22px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.subtab-btn:hover {
  color: var(--ink);
}

.subtab-btn.active {
  color: var(--accent-600);
  border-bottom-color: var(--accent-600);
}

/* ---------------- Collapsible panels (My Training) ---------------- */

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header-row h2 {
  margin: 0;
}

.panel-collapse-btn {
  appearance: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

.panel-collapse-btn:hover {
  background: var(--surface);
  color: var(--ink);
}

.panel.is-collapsed > *:not(.panel-header-row) {
  display: none !important;
}

/* ---------------- Gamified phishing reporting ---------------- */

.report-phish-panel button {
  margin-top: 4px;
}

/* Compound selector (.panel.report-stats-panel) rather than relying on this
   rule's position in the file — the base .panel rule below also sets
   `background`/`border`, and with equal single-class specificity, source
   order (not intent) would decide the winner otherwise. */
.panel.report-stats-panel {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  border-color: transparent;
}

.report-stats-panel h2 {
  color: #fff;
}

.report-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 14px 0 10px;
}

.report-stat-tile {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
}

.report-stat-value {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

.report-stat-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#reportStatNext {
  color: rgba(255, 255, 255, 0.75);
}

@keyframes reportCelebrate {
  0% { transform: scale(1); }
  30% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.report-stats-panel.celebrate {
  animation: reportCelebrate 0.4s ease;
}

/* ---------------- Cards / stat tiles ---------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.section-heading {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin: 26px 0 10px;
}

.section-heading:first-of-type {
  margin-top: 0;
}

.section-collapsible {
  margin: 26px 0 10px;
}

.section-heading-toggle {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
}

.section-heading-toggle::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
}

.section-heading-toggle.open::before {
  transform: rotate(90deg);
}

.section-collapsible > div[id] {
  margin-top: 10px;
}

.card {
  position: relative;
  overflow: hidden;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 18px 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:active {
  transform: translateY(0);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-600);
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 1rem;
  background: var(--accent-100);
  color: var(--accent-600);
}

.card-icon svg {
  width: 17px;
  height: 17px;
}

.card h3 {
  font-family: var(--font-mono);
  font-size: 1.6875rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--accent-600);
  letter-spacing: -0.02em;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-blue::before { background: var(--accent-600); }
.card-blue .card-icon { background: var(--blue-bg); color: var(--blue-ink); }

.card-amber::before { background: linear-gradient(90deg, #d99a1f, #f4c150); }
.card-amber .card-icon { background: var(--amber-bg); color: var(--amber-ink); }
.card-amber h3 { color: var(--amber-ink); }

.card-red::before { background: linear-gradient(90deg, #c0392b, #e0685a); }
.card-red .card-icon { background: var(--red-bg); color: var(--red-ink); }
.card-red h3 { color: var(--red-ink); }

.card-green::before { background: linear-gradient(90deg, #157a3a, #4cb877); }
.card-green .card-icon { background: var(--green-bg); color: var(--green-ink); }
.card-green h3 { color: var(--green-ink); }

/* Inline icons used next to h2 section headers and in buttons. */
h2 svg, .small-btn svg {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 4px;
}

/* Empty-state placeholders (script.js renders these into list/table views
   that have no data yet). */
.empty-state-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  color: var(--muted-2);
}
.empty-state-icon svg {
  width: 100%;
  height: 100%;
}

.panel-flash {
  animation: panelFlash 1.2s ease;
}

@keyframes panelFlash {
  0% { box-shadow: 0 0 0 3px rgba(36, 84, 224, 0.45); }
  100% { box-shadow: var(--shadow-sm); }
}

/* ---------------- Training hero (My Training) ---------------- */

.training-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  position: relative;
  overflow: hidden;
}

.training-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(700px 300px at 90% -30%, rgba(59, 107, 240, 0.45), transparent 60%);
  pointer-events: none;
}

.training-hero.hero-done {
  background: linear-gradient(135deg, #0d5c40, #12724f);
}

.training-hero-icon {
  font-size: 2.625rem;
  line-height: 1;
  flex: 0 0 auto;
  z-index: 1;
}

.training-hero-body {
  flex: 1;
  min-width: 0;
  z-index: 1;
}

.training-hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 4px;
}

.training-hero-body h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  color: #fff;
}

.training-hero-sub {
  margin: 0;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.78);
}

.training-hero-action {
  flex: 0 0 auto;
  z-index: 1;
}

.training-hero-action .btn-hero {
  background: #fff;
  color: var(--navy-900);
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
}

.training-hero-action .btn-hero:hover {
  filter: brightness(0.95);
}

@media (max-width: 640px) {
  .training-hero {
    flex-direction: column;
    text-align: center;
  }
}

/* ---------------- Panels ---------------- */

.panel {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel:not(.training-hero)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-500), var(--accent-600) 60%, transparent);
  opacity: 0.9;
}

.panel h2 {
  margin-bottom: 6px;
}

.notice {
  background: var(--blue-bg);
  border-left: 3px solid var(--accent-600);
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--navy-800);
}

.notice a {
  color: var(--accent-600);
  font-weight: 600;
}

.hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 6px 0 14px;
  line-height: 1.5;
}

.hint-tight {
  margin-top: -6px;
}

/* ---------------- Forms: labeled fields ---------------- */

.toolbar,
.admin-toolbar {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.toolbar-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
  align-items: end;
}

.toolbar-grid-3 > .field {
  min-width: 0 !important;
  width: 100%;
}

.toolbar-grid-3 > .field > input,
.toolbar-grid-3 > .field > select {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100%;
  box-sizing: border-box;
}

.toolbar-grid-3 > button {
  justify-self: start;
  align-self: end;
}

@media (max-width: 760px) {
  .toolbar-grid-3 {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 170px;
}

.field.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding-bottom: 8px;
}

.field label,
.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field-check label {
  text-transform: none;
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0;
  color: var(--ink);
}

input:not([type]),
input[type="text"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  font-family: var(--font-body);
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--surface-card);
  color: var(--ink);
  width: 100%;
}

input:not([type]),
input[type="text"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select {
  /* Browsers render type="date" inputs with slightly different intrinsic
     height than text inputs (the native day/month/year segments + calendar
     icon lay out differently), even with identical padding/border/font-size.
     In a flex toolbar with align-items: flex-end, that tiny height
     difference is enough to visibly knock the date field's label out of
     line with its siblings. An explicit height removes the ambiguity. */
  height: 38px;
  /* Flex items default to min-width: auto, which for a <select> means the
     browser won't shrink it below the width its longest <option> text
     needs — even with width: 100% set. That fights the equal flex:1
     distribution in a toolbar row and forces neighboring fields (like a
     plain text input) to visibly shrink to compensate. min-width: 0
     removes that content-driven floor so every field in a row actually
     ends up the same width. */
  min-width: 0;
  /* The browser's own native dropdown-arrow icon has its own reserved
     spacing baked in that isn't controllable via padding — even at an
     identical computed box width to a plain <input>, a <select> can look
     visually narrower/different because of it. Drawing the arrow ourselves
     removes that inconsistency entirely. */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  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 d='M1 1L6 6L11 1' stroke='%2364748b' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px 7px;
  padding-right: 34px;
}

/* Text-style inputs share the block above for sizing only; the dropdown
   chevron belongs to <select> alone. */
input:not([type]),
input[type="text"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"] {
  background-image: none;
  padding-right: 12px;
}

select::-ms-expand {
  display: none;
}

select[multiple] {
  height: auto;
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  background-image: none;
  padding-right: 12px;
}

textarea {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px var(--accent-100);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

/* ---------------- Buttons ---------------- */

button {
  font-family: var(--font-body);
}

.toolbar button,
.admin-toolbar button,
#genReportBtn,
#addEmpBtn,
#addCampBtn,
#bundleAssignBtn,
#addGroupBtn,
#addConsentBtn,
#adminAddUserBtn,
#adminAddGroupBtn,
#phishLaunchBtn,
#m365SaveConfigBtn,
#m365SaveDefaultSenderBtn,
#smtpSaveConfigBtn,
#resendSaveConfigBtn,
#sesSaveConfigBtn,
#ssoSaveConfigBtn {
  background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(36, 84, 224, 0.28);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.toolbar button:active,
.admin-toolbar button:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(36, 84, 224, 0.28);
}

.toolbar button:hover,
.admin-toolbar button:hover,
#genReportBtn:hover {
  background: linear-gradient(135deg, #4c7bff, #1c46c4);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(36, 84, 224, 0.35);
}

/* .toolbar/.admin-toolbar button (class+element) outranks the single-class
   .small-btn below it, so a secondary action placed in a toolbar was
   silently getting the primary gradient fill. Re-assert .small-btn's own
   look with matching specificity wherever it's nested in one. */
.toolbar .small-btn,
.admin-toolbar .small-btn {
  background: var(--surface-card);
  color: var(--accent-600);
  border: 1px solid var(--line-strong);
  box-shadow: none;
  font-weight: 600;
}

.toolbar .small-btn:hover,
.admin-toolbar .small-btn:hover {
  background: var(--accent-100);
  border-color: var(--accent-500);
  transform: none;
  box-shadow: none;
}

.small-btn {
  background: var(--surface-card);
  color: var(--accent-600);
  border: 1px solid var(--line-strong);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
}

.small-btn:hover {
  background: var(--accent-100);
  border-color: var(--accent-500);
}

.btn-danger,
button.admin-del-user-btn,
button.admin-del-group-btn {
  background: var(--surface-card);
  color: var(--red-ink);
  border: 1px solid var(--red-line);
}

.btn-danger:hover {
  background: var(--red-bg);
}

#downloadReportBtn {
  margin-left: 10px;
}

/* ---------------- Tables ---------------- */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  font-size: 0.875rem;
}

th,
td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: #fafbfe;
}

th {
  background: #f7f9fd;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  color: var(--ink);
}

/* ---------------- Status pills ---------------- */

.status-pill {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-block;
}

.status-pending { background: var(--amber-bg); color: var(--amber-ink); }
.status-complete { background: var(--green-bg); color: var(--green-ink); }
.status-active { background: var(--blue-bg); color: var(--blue-ink); }
.status-signed { background: var(--green-bg); color: var(--green-ink); }
.status-unsigned { background: var(--red-bg); color: var(--red-ink); }
.status-good { background: var(--green-bg); color: var(--green-ink); }
.status-warn { background: var(--amber-bg); color: var(--amber-ink); }
.status-bad { background: var(--red-bg); color: var(--red-ink); }
.status-neutral { background: var(--surface); color: var(--muted); }

/* ---------------- Recipient picker (Phishing Simulation) ---------------- */

.recipient-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.875rem;
  color: var(--muted);
}

.recipient-summary strong {
  color: var(--ink);
}

.recipient-scroll {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 4px;
}

.recipient-scroll table {
  border: none;
  border-radius: 0;
  margin-bottom: 0;
}

.recipient-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--surface-card);
  z-index: 1;
}

.mini-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}
.mini-progress-track {
  flex: 1;
  background: #eef1f8;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.mini-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-600), var(--accent-500));
}
.mini-progress-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  flex: 0 0 auto;
}
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.sending-badge {
  font-size: 0.75rem;
  color: var(--amber-ink);
  font-weight: 700;
  background: var(--amber-bg);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.fail-reason {
  color: var(--red-ink);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.fail-detail {
  color: var(--red-ink);
  font-size: 0.75rem;
  margin-top: 2px;
  max-width: 260px;
  white-space: normal;
  line-height: 1.4;
  opacity: 0.85;
}

/* ---------------- Activity feed ---------------- */

#activityLog {
  list-style: none;
  padding: 0;
  margin: 0;
}

#activityLog li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
}

#activityLog li:last-child {
  border-bottom: none;
}

.activity-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 10px;
  flex: 0 0 auto;
}

.dot-blue { background: var(--accent-600); }
.dot-red { background: var(--red-ink); }
.dot-green { background: var(--green-ink); }
.dot-gray { background: var(--muted-2); }

/* ---------------- Report output / pre ---------------- */

#reportOutput {
  background: var(--navy-800);
  color: #cfe0ff;
  padding: 18px;
  border-radius: var(--radius-md);
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  min-height: 60px;
  margin-top: 16px;
}

/* ---------------- Funnel / trend charts ---------------- */

.funnel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 110px 1fr 60px;
  align-items: center;
  gap: 12px;
}

.funnel-label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 600;
}

.funnel-bar-track {
  background: #eef1f8;
  border-radius: 6px;
  height: 16px;
  overflow: hidden;
}

.funnel-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.funnel-sent { background: linear-gradient(90deg, var(--accent-600), var(--accent-500)); }
.funnel-opened { background: linear-gradient(90deg, #d99a1f, #f4c150); }
.funnel-clicked { background: linear-gradient(90deg, #c0392b, #e0685a); }
.funnel-acked { background: linear-gradient(90deg, #157a3a, #4cb877); }

.funnel-count {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: right;
  color: var(--ink);
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 170px;
  padding-top: 10px;
  overflow-x: auto;
}

.trend-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  height: 100%;
  justify-content: flex-end;
}

.trend-bar-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--red-ink);
  margin-bottom: 4px;
}

.trend-bar {
  width: 26px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #e0685a, #c0392b);
  transition: height 0.3s ease;
}

.trend-bar-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
  text-align: center;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dept-chip {
  margin: 0 6px 6px 0;
}

/* ---------------- Login screen ---------------- */

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--navy-900);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(1100px 500px at 15% -10%, rgba(36, 84, 224, 0.35), transparent 60%),
    linear-gradient(135deg, rgba(10, 23, 48, 0.82), rgba(16, 35, 63, 0.82));
}

.login-box {
  position: relative;
  z-index: 2;
  background: var(--surface-card);
  padding: 38px 40px 34px;
  border-radius: var(--radius-lg);
  width: 340px;
  box-shadow: 0 24px 60px rgba(3, 9, 26, 0.45);
  text-align: center;
}

.login-logo {
  display: block;
  margin: 0 auto 16px;
  height: 42px;
  width: auto;
}

.login-box h2 {
  margin: 0 0 6px;
  font-size: 1.125rem;
}

.login-box p {
  margin: 0 0 20px;
  font-size: 0.875rem;
  color: var(--muted);
}

.login-box input {
  width: 100%;
  padding: 10px 13px;
  margin-bottom: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.login-box button {
  width: 100%;
  padding: 11px 12px;
  background: var(--accent-600);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.login-box button:hover {
  background: #1c46c4;
}

.login-error {
  color: var(--red-ink);
  font-size: 0.8125rem;
  min-height: 18px;
  margin-top: 10px;
}

.sso-btn {
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 8px;
  background: #fff;
  color: var(--navy-800);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.sso-btn:hover {
  background: var(--surface);
}

.app-hidden {
  display: none;
}

/* ---------------- Employee "My Training" dashboard ---------------- */

.kb-summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 760px) {
  .kb-summary-row {
    grid-template-columns: 1fr;
  }
}

.kb-summary-panel {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 0;
}

.kb-summary-main {
  flex: 0 0 auto;
  text-align: center;
  padding-right: 20px;
  border-right: 1px solid var(--line);
}

.kb-big-stat {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-600);
  line-height: 1;
}

.kb-big-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-top: 8px;
  max-width: 120px;
}

.kb-summary-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-side-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--ink);
}

.kb-side-row strong {
  font-family: var(--font-mono);
}

.report-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 10px 0 18px;
}

.report-detail-grid .kb-side-row strong {
  text-align: right;
  max-width: 65%;
}

.risk-gauge {
  max-width: 520px;
}

.risk-gauge-track {
  position: relative;
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: visible;
  margin-top: 30px;
}

.risk-zone {
  flex: 1;
  height: 100%;
}

.risk-zone:first-child { border-radius: 6px 0 0 6px; }
.risk-zone:last-child { border-radius: 0 6px 6px 0; }

.risk-low { background: #4cb877; }
.risk-medium { background: #f4c150; }
.risk-high { background: #e0685a; }
.risk-critical { background: #c0392b; }

.risk-marker {
  position: absolute;
  top: -22px;
  transform: translateX(-50%);
  color: var(--ink);
  font-size: 1.125rem;
  transition: left 0.4s ease;
}

.risk-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
}

.risk-score-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-top: 12px;
  color: var(--ink);
}

.category-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-bar-row {
  display: grid;
  grid-template-columns: 220px 1fr 70px;
  align-items: center;
  gap: 12px;
}

.category-bar-label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 600;
}

.category-bar-track {
  background: #eef1f8;
  border-radius: 6px;
  height: 14px;
  overflow: hidden;
}

.category-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent-600), var(--accent-500));
}

.category-bar-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: right;
  color: var(--ink);
}

.compare-metric {
  margin-bottom: 24px;
}

.compare-metric:last-child {
  margin-bottom: 0;
}

.compare-metric-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}

.compare-bar-line {
  display: grid;
  grid-template-columns: 64px 1fr 50px;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.compare-bar-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  text-align: center;
}

.compare-tag-you {
  background: var(--blue-bg);
  color: var(--blue-ink);
}

.compare-tag-org {
  background: #eef1f8;
  color: var(--muted);
}

.compare-bar-track {
  background: #eef1f8;
  border-radius: 6px;
  height: 16px;
  overflow: hidden;
}

.compare-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.compare-fill-you {
  background: linear-gradient(90deg, var(--accent-600), var(--accent-500));
}

.compare-fill-org {
  background: linear-gradient(90deg, #94a3b8, #cbd5e1);
}

.compare-bar-val {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: right;
  color: var(--ink);
}

/* ---------------- Industry benchmark (Dashboard) ---------------- */

.benchmark-bars {
  margin-top: 14px;
}

.benchmark-row {
  display: grid;
  grid-template-columns: 140px 1fr 60px;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.benchmark-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}

.benchmark-track {
  background: #eef1f8;
  border-radius: 7px;
  height: 18px;
  overflow: hidden;
}

.benchmark-fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.5s ease;
}

.benchmark-fill-you {
  background: linear-gradient(90deg, var(--accent-600), var(--accent-500));
}

.benchmark-fill-baseline {
  background: linear-gradient(90deg, #c0392b, #e0685a);
}

.benchmark-fill-trained {
  background: linear-gradient(90deg, #157a3a, #4cb877);
}

.benchmark-val {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  text-align: right;
  color: var(--ink);
}

/* ---------------- Dashboard 2-column grid ---------------- */

.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.dash-grid-2 > .panel {
  margin-bottom: 0;
}

@media (max-width: 880px) {
  .dash-grid-2 {
    grid-template-columns: 1fr;
  }
}

.trend-chart-compact {
  height: 140px;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 880px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  nav {
    width: 100%;
  }
  main {
    padding: 20px 16px 40px;
  }
  .toolbar, .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------------- Individual people picker (training campaigns) ---------------- */
.people-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 14px;
}
.people-row .hint { margin: 0; }
.people-picker h3 { margin: 0 0 12px; }
.people-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.people-actions .hint { margin: 0 0 0 auto; font-weight: 600; }
.people-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  margin-bottom: 12px;
}
.people-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1.4fr) minmax(0, 1.6fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.875rem;
}
.people-item:last-child { border-bottom: none; }
.people-item:hover { background: var(--accent-100); }
.people-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent-600); cursor: pointer; }
.people-item .pn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-item .pe { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-item .pd { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-item.is-locked { opacity: 0.55; cursor: not-allowed; background: var(--surface); }
.people-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 0.875rem; }
@media (max-width: 760px) {
  .people-item { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .people-item .pe, .people-item .pd { display: none; }
}

/* ---------------- Learning paths (assign multiple trainings) ---------------- */
.bundle-trainings {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  padding: 4px 0;
}
.bundle-group {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px 4px;
}
.bundle-training {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  font-size: 0.875rem;
  cursor: pointer;
}
.bundle-training:hover { background: var(--accent-100); }
.bundle-training input { width: 16px; height: 16px; accent-color: var(--accent-600); cursor: pointer; }
.bundle-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.bundle-quick .qc {
  display: inline-block;
  min-width: 18px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-100);
  color: var(--accent-600);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}
.bundle-quick button:disabled { opacity: 0.5; cursor: not-allowed; }
.camp-bundle-tag { display: block; margin-top: 3px; font-size: 0.75rem; color: var(--muted); }

/* Training names in the learning-path list are plain text, not form labels. */
.field .bundle-training {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--ink);
}

/* ---------------- Personal portal: My Training ---------------- */
.portal-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  margin-bottom: 18px;
  border-radius: 16px;
  color: #fff;
  background:
    radial-gradient(520px 220px at 90% 0%, rgba(251, 191, 36, 0.20), transparent 60%),
    linear-gradient(135deg, #0a1730 0%, #16305a 55%, #2454e0 100%);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.portal-hero h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 10px 0 6px;
  color: #fff;
}
.portal-hero-main { flex: 1; min-width: 0; }
.portal-hero p { margin: 0; color: #cfe0ff; font-size: 1rem; line-height: 1.55; max-width: 560px; }
.portal-level-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  padding: 4px 12px;
}
.portal-xp { display: flex; align-items: center; gap: 12px; margin-top: 16px; max-width: 460px; }
.portal-xp-bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.portal-xp-bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #fbbf24, #f59e0b); transition: width 0.6s ease; }
#portalXpLabel { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; color: #fde68a; white-space: nowrap; }
.portal-tip { margin-top: 16px !important; font-size: 1.0625rem !important; line-height: 1.5 !important; color: #e3edff !important; max-width: 620px !important; }
.portal-ring { flex: 0 0 auto; width: 150px; height: 150px; position: relative; }
.portal-ring svg { width: 100%; height: 100%; display: block; transform: rotate(-90deg); }
.portal-ring .ring-bg { stroke: rgba(255, 255, 255, 0.16); }
.portal-ring .ring-fg { stroke: #fbbf24; transition: stroke-dashoffset 0.8s ease; }
.portal-ring.is-done .ring-fg { stroke: #34d399; }
.portal-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.portal-ring-label strong { font-family: var(--font-display); font-size: 2rem; line-height: 1; }
.portal-ring-label span { font-size: 0.75rem; color: #cfe0ff; margin-top: 4px; }

.portal-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 18px; margin-bottom: 18px; }
.portal-grid .panel { margin-bottom: 0; }

.portal-upnext h2 { margin-top: 0; }
.upnext-body { display: flex; gap: 16px; align-items: flex-start; }
.upnext-icon {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--navy-800), var(--accent-600));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.upnext-icon svg { width: 28px; height: 28px; }
.upnext-title { font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; margin: 0 0 4px; }
.upnext-meta { color: var(--muted); font-size: 0.875rem; margin: 0 0 14px; }
.portal-start {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
  color: #fff !important;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 10px rgba(36, 84, 224, 0.28);
}
.portal-start:hover { filter: brightness(1.06); }
.upnext-clear { text-align: center; padding: 8px 0; }
.upnext-clear .upnext-icon { margin: 0 auto 12px; background: linear-gradient(135deg, #12724f, #34d399); }

.badge-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px; }
.badge-tile { text-align: center; }
.badge-medal {
  width: 62px; height: 62px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 0 4px #fff2da, 0 6px 16px rgba(245, 158, 11, 0.35);
}
.badge-medal svg { width: 30px; height: 30px; }
.badge-tile.locked .badge-medal {
  background: var(--line);
  color: var(--muted-2);
  box-shadow: 0 0 0 4px var(--surface);
}
.badge-name { font-size: 0.8125rem; font-weight: 700; line-height: 1.25; }
.badge-tile.locked .badge-name { color: var(--muted); }
.badge-blurb { font-size: 0.75rem; color: var(--muted); line-height: 1.35; margin-top: 2px; }

.assigned-list { display: flex; flex-direction: column; gap: 10px; }
.assigned-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}
.assigned-item.is-done { background: var(--surface); }
.assigned-icon {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--blue-bg);
  color: var(--accent-600);
  display: flex; align-items: center; justify-content: center;
}
.assigned-icon svg { width: 22px; height: 22px; }
.assigned-item.is-done .assigned-icon { background: var(--green-bg); color: var(--green-ink); }
.assigned-main { flex: 1; min-width: 0; }
.assigned-title { font-weight: 700; font-size: 0.9375rem; }
.assigned-sub { color: var(--muted); font-size: 0.8125rem; margin-top: 2px; }
.assigned-empty { color: var(--muted); padding: 14px 4px; }

.portal-toast {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--navy-900);
  color: #fff;
  box-shadow: var(--shadow-lift);
  animation: toast-in 0.35s ease;
}
.portal-toast .badge-medal { margin: 0; width: 44px; height: 44px; }
.portal-toast .badge-medal svg { width: 22px; height: 22px; }
.portal-toast small { display: block; color: #fde68a; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; }
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 900px) {
  .portal-grid { grid-template-columns: 1fr; }
  .portal-hero { flex-direction: column-reverse; align-items: flex-start; padding: 22px; }
  .portal-ring { width: 120px; height: 120px; }
}

/* Admin <-> end-user portal switch (top bar) */
.view-switch-btn {
  border-color: rgba(251, 191, 36, 0.55);
  color: #fde68a;
}
.view-switch-btn:hover { background: rgba(251, 191, 36, 0.14); color: #fff; }
.view-switch-btn.in-portal {
  background: rgba(251, 191, 36, 0.18);
  color: #fff;
}

/* ---------------- Account security dialog ---------------- */
.sec-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 23, 48, 0.62);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; overflow-y: auto;
}
.sec-card {
  width: 100%; max-width: 480px;
  background: var(--surface-card);
  border-radius: 16px;
  padding: 26px 28px;
  box-shadow: var(--shadow-lift);
}
.sec-card h2 { font-family: var(--font-display); font-size: 1.25rem; margin: 0 0 6px; }
.sec-card h3 { font-family: var(--font-display); font-size: 1rem; margin: 20px 0 8px; }
.sec-sub { color: var(--muted); font-size: 0.9375rem; margin: 0 0 14px; }
.sec-note { color: var(--muted); font-size: 0.875rem; margin: 8px 0; }
.sec-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.sec-field label { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.sec-msg { min-height: 1.25rem; margin: 6px 0; font-size: 0.875rem; color: var(--red-ink); }
.sec-msg.sec-good { color: var(--green-ink); }
.sec-actions, .sec-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.sec-row { margin-top: 8px; }
.sec-card button { font-family: var(--font-body); font-size: 0.875rem; font-weight: 600; border-radius: var(--radius-sm); cursor: pointer; padding: 9px 18px; }
.sec-primary { background: linear-gradient(135deg, var(--accent-500), var(--accent-600)); color: #fff; border: none; box-shadow: 0 2px 10px rgba(36, 84, 224, 0.28); }
.sec-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.sec-secondary { background: var(--surface-card); color: var(--accent-600); border: 1px solid var(--line-strong); }
.sec-danger { background: var(--red-bg); color: var(--red-ink); border: 1px solid var(--red-line); }
.sec-pill { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; margin-right: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.sec-on { background: var(--green-bg); color: var(--green-ink); }
.sec-off { background: var(--amber-bg); color: var(--amber-ink); }
.sec-steps { padding-left: 20px; margin: 0 0 12px; color: #2b3548; font-size: 0.9375rem; line-height: 1.55; }
.sec-qr { text-align: center; margin: 8px 0; }
.sec-qr img { border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; }
.sec-key { text-align: center; font-family: var(--font-mono); font-size: 0.9375rem; letter-spacing: 0.08em; word-break: break-all; margin: 6px 0 14px; color: var(--ink); }
.sec-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.sec-codes code { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; text-align: center; font-size: 0.9375rem; letter-spacing: 0.04em; }
.sec-check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 0.9375rem; }
#mfaStep a { color: var(--accent-600); cursor: pointer; }

/* small neutral detail line under a table value */
.sub-detail { font-size: 0.75rem; color: var(--muted); margin-top: 3px; line-height: 1.4; }

.camp-filters { margin: 8px 0 12px; }
.status-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
  font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border, #d6deee);
  background: #fff; color: var(--navy-800, #10233f);
}
.chip:hover { background: #f1f5fd; }
.chip.active { background: var(--accent-600, #2454e0); border-color: var(--accent-600, #2454e0); color: #fff; }
.chip-count { display: inline-block; min-width: 1.4em; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: rgba(16, 35, 63, 0.08); font-size: 0.75rem; text-align: center; }
.chip.active .chip-count { background: rgba(255, 255, 255, 0.25); }
.chip-warn:not(.active) .chip-count { background: #fdeceb; color: #b3352f; }
.camp-filter-row { margin-bottom: 0; }
.camp-source-tag { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; background: #eef2fb; color: var(--navy-800, #10233f); font-size: 0.72rem; font-weight: 600; }
.camp-source-tag.auto { background: #fff4de; color: #8a5a00; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.page-head h1, .detail-head h1 { margin-bottom: 2px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 6px 0 4px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-block; margin-bottom: 8px; font-size: 0.875rem; font-weight: 600; color: var(--accent-600, #2454e0); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.flash { margin: 0 0 12px; padding: 10px 14px; border-radius: 8px; background: #e4f7ef; color: #12724f; font-size: 0.875rem; }
.list-table .row-title { font-weight: 600; }
.list-table .row-sub { margin-top: 2px; font-size: 0.78rem; color: var(--muted); }
.list-table tr.clickable-row { cursor: pointer; }
.list-table tr.clickable-row:hover { background: #f4f7fd; }
.list-table tr.clickable-row:focus-visible { outline: 2px solid var(--accent-600, #2454e0); outline-offset: -2px; }
.list-table .row-go { width: 24px; text-align: right; color: var(--muted); font-size: 1.4rem; }
.hide-training .col-training { display: none; }
.metric-strip { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 14px; }
.metric { flex: 1 1 110px; padding: 10px 14px; border-radius: 10px; background: #f4f7fd; }
.metric b { display: block; font-size: 1.35rem; font-weight: 700; color: var(--navy-800, #10233f); }
.metric span { font-size: 0.78rem; color: var(--muted); }
.metric-bad { background: #fdeceb; }
.metric-bad b { color: #b3352f; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border, #d6deee); margin: 4px 0 12px; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 2px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab:hover { color: var(--navy-800, #10233f); background: none; }
.tab.active { color: var(--navy-800, #10233f); border-bottom-color: var(--accent-600, #2454e0); }
.detail-filters { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.detail-filters input[type="search"] { max-width: 240px; }
.info-table td { padding: 8px 10px; }
.info-table .info-k { width: 180px; color: var(--muted); font-weight: 600; }

label.checkline { display: block; margin: 8px 0; font-weight: 500; font-size: 0.9rem; text-transform: none; letter-spacing: normal; color: var(--navy-800, #10233f); }
label.checkline .hint { text-transform: none; letter-spacing: normal; font-weight: 400; }
.checkline input { margin-right: 8px; }
.ai-brief h3.ai-brief-headline { margin: 4px 0 6px; }
.ai-brief h4, .ai-result h4 { margin: 14px 0 4px; font-size: 0.9rem; }
.ai-brief ul, .ai-result ul { margin: 4px 0 8px 20px; padding: 0; line-height: 1.6; }
.ai-result { margin-top: 16px; padding: 14px 16px; border-radius: 10px; background: #f4f7fd; }
.ai-result .ai-check-headline { margin: 8px 0 0; }
