:root {
  --bg: #071019;
  --bg-deep: #040a11;
  --surface: #0d1823;
  --surface-2: #122231;
  --surface-3: #182d3f;
  --surface-soft: rgba(18, 34, 49, 0.72);
  --border: rgba(151, 188, 214, 0.18);
  --border-strong: rgba(151, 188, 214, 0.34);
  --text: #f4f8fb;
  --muted: #96aabd;
  --subtle: #6e8295;
  --azure: #42c8ee;
  --blue: #4a8dff;
  --yellow: #f5c94f;
  --green: #55d996;
  --red: #ff7180;
  --orange: #ffb45d;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 10px 35px rgba(0, 0, 0, 0.18);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 10px;
  --nav-width: 94px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-deep); }
body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 9% 0%, rgba(66, 200, 238, 0.12), transparent 28rem),
    radial-gradient(circle at 94% 10%, rgba(245, 201, 79, 0.08), transparent 28rem),
    linear-gradient(180deg, #08131d 0%, var(--bg) 45%, var(--bg-deep) 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}
button, input, select, textarea { font: inherit; }
button { border: 0; }
a { color: var(--azure); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(66, 200, 238, .28); color: #fff; }

/* v9: polished scrolling */
html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(106, 145, 171, .62) transparent;
}
*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  min-height: 52px;
  border: 3px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(91, 137, 168, .72), rgba(59, 104, 136, .72));
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(66, 200, 238, .82), rgba(74, 141, 255, .74));
  background-clip: padding-box;
}
*::-webkit-scrollbar-corner { background: transparent; }


.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .04em;
}

.layout {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--nav-width);
  height: 100vh;
  padding: 18px 11px;
  border-right: 1px solid var(--border);
  background: rgba(5, 12, 19, .86);
  backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 12px 0 40px rgba(0,0,0,.13);
}

.brand {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 22px;
  border: 1px solid rgba(245, 201, 79, .62);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(245, 201, 79, .2), rgba(66, 200, 238, .12));
  color: var(--yellow);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 28px rgba(0,0,0,.24);
  font-weight: 900;
  letter-spacing: -.04em;
}
.brand span { transform: translateY(-1px); }
.nav-group { display: flex; flex-direction: column; gap: 9px; width: 100%; }
.nav-spacer { flex: 1; }
.nav-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 58px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  transition: transform .18s ease, color .18s ease, border-color .18s ease, background .18s ease;
}
.nav-btn svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-btn:hover, .nav-btn:focus-visible {
  color: var(--text);
  border-color: rgba(66,200,238,.25);
  background: rgba(66,200,238,.08);
  outline: none;
  transform: translateY(-1px);
}
.nav-btn.active {
  color: var(--azure);
  border-color: rgba(66,200,238,.34);
  background: linear-gradient(145deg, rgba(66,200,238,.16), rgba(74,141,255,.07));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}
.nav-btn.active::before {
  content: "";
  position: absolute;
  left: -12px;
  width: 3px;
  height: 28px;
  border-radius: 4px;
  background: var(--azure);
  box-shadow: 0 0 16px rgba(66,200,238,.5);
}
.nav-label { display: none; }

.main {
  min-width: 0;
  max-width: 1760px;
  width: 100%;
  margin: 0 auto;
  padding: 30px clamp(20px, 3vw, 48px) 52px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}
.title { margin: 0; font-size: clamp(28px, 3vw, 40px); line-height: 1.06; letter-spacing: -.035em; }
.subtitle { max-width: 880px; margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.user-card {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 250px;
  max-width: 330px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(13, 24, 35, .82);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(66,200,238,.24);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(66,200,238,.18), rgba(74,141,255,.1));
  color: var(--azure);
  font-weight: 900;
}
.user-name { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.user-role { margin-top: 3px; color: var(--muted); font-size: 12px; }

.login {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  overflow: hidden;
}
.login::before, .login::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  pointer-events: none;
}
.login::before { width: 420px; height: 420px; left: -150px; top: -150px; background: rgba(66,200,238,.07); }
.login::after { width: 400px; height: 400px; right: -140px; bottom: -160px; background: rgba(245,201,79,.055); }
.login-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(370px, .75fr);
  width: min(1160px, 100%);
  overflow: hidden;
  border: 1px solid rgba(164,201,226,.2);
  border-radius: 30px;
  background: rgba(9, 18, 27, .94);
  box-shadow: 0 36px 120px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.04);
}
.login-info {
  position: relative;
  min-height: 650px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 6vw, 72px);
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(66,200,238,.18), transparent 40%),
    radial-gradient(circle at 100% 90%, rgba(245,201,79,.09), transparent 38%),
    linear-gradient(145deg, rgba(18,34,49,.97), rgba(8,17,26,.98));
}
.login-info::after {
  content: "";
  position: absolute;
  right: -140px;
  top: 60px;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(66,200,238,.15);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(66,200,238,.025), 0 0 0 78px rgba(245,201,79,.018);
}
.eyebrow, .form-kicker {
  position: relative;
  z-index: 1;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .18em;
}
.login-title {
  position: relative;
  z-index: 1;
  max-width: 740px;
  margin: 14px 0 18px;
  font-size: clamp(42px, 6vw, 70px);
  line-height: .98;
  letter-spacing: -.055em;
}
.login-copy { position: relative; z-index: 1; max-width: 660px; margin: 0; color: #b4c4d2; font-size: 16px; line-height: 1.7; }
.login-form {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: clamp(28px, 4vw, 46px);
  border-left: 1px solid var(--border);
  background: rgba(5, 12, 19, .62);
}
.form-title { margin: 2px 0 0; font-size: 28px; letter-spacing: -.03em; }
.security-grid { position: relative; z-index: 1; display: grid; gap: 10px; max-width: 680px; margin-top: 36px; }
.security-card { display: flex !important; align-items: flex-start; gap: 12px; background: rgba(8,18,27,.56) !important; }
.security-card strong, .security-card span { display: block; }
.setup-panel { width: min(1280px, 100%); grid-template-columns: minmax(0, .95fr) minmax(520px, 1.05fr); }
.setup-form { max-height: min(88vh, 900px); overflow-y: auto; align-content: start; }
.setup-form .form-kicker { margin-top: 4px; }
.setup-notes { position: relative; z-index: 1; max-width: 620px; margin-top: 32px; }
.compact-grid { gap: 12px; }

.security-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(255,180,93,.1);
}
.security-dot.ok { background: var(--green); box-shadow: 0 0 0 4px rgba(85,217,150,.1), 0 0 15px rgba(85,217,150,.2); }
.security-dot.warn { background: var(--orange); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 19px 21px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(18,34,49,.92), rgba(10,20,30,.86));
  box-shadow: var(--shadow-soft);
}
.stat::after { content: ""; position: absolute; width: 86px; height: 86px; right: -32px; top: -35px; border-radius: 50%; background: rgba(66,200,238,.08); }
.stat-value { font-size: 32px; font-weight: 900; letter-spacing: -.045em; }
.stat-label { margin-top: 5px; color: var(--muted); font-size: 13px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: rgba(13,24,35,.65);
  backdrop-filter: blur(14px);
}
.toolbar > .input { flex: 1 1 300px; }
.toolbar > .select { flex: 0 1 230px; }

.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(14,27,39,.94), rgba(8,17,26,.94));
  box-shadow: var(--shadow-soft);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 66px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.012);
}
.panel-title { margin: 0; font-size: 17px; font-weight: 850; letter-spacing: -.015em; }
.panel-body { padding: 20px; }

.card {
  display: grid;
  gap: 6px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(20,39,54,.56);
}
.card-title { margin: 0; font-size: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: grid; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; align-content: start; gap: 7px; grid-column: span 2; min-width: 0; }
.field.third { grid-column: span 1; }
.field.full { grid-column: 1 / -1; }
.label { color: #c6d3dd; font-size: 12px; font-weight: 750; letter-spacing: .015em; }

.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  background: rgba(3, 10, 16, .62);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input, .select { padding: 0 13px; }
.textarea { min-height: 126px; resize: vertical; padding: 12px 13px; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: #657a8d; }
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(66,200,238,.62);
  background: rgba(4, 13, 20, .8);
  box-shadow: 0 0 0 3px rgba(66,200,238,.1);
}
.input:disabled, .select:disabled, .textarea:disabled { opacity: .62; cursor: not-allowed; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(26,47,64,.72);
  color: var(--text);
  font-weight: 760;
  font-size: 13px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.button:hover:not(:disabled), .button:focus-visible:not(:disabled) { transform: translateY(-1px); border-color: rgba(66,200,238,.48); background: rgba(35,62,82,.9); outline: none; }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { border-color: rgba(66,200,238,.6); background: linear-gradient(135deg, #32b9df, #397de7); color: #031019; box-shadow: 0 10px 26px rgba(48,155,225,.2); }
.button.primary:hover:not(:disabled) { background: linear-gradient(135deg, #55d4f3, #5597ff); border-color: rgba(115,222,249,.85); }
.button.accent { border-color: rgba(245,201,79,.6); background: rgba(245,201,79,.14); color: #ffe18a; }
.button.danger { border-color: rgba(255,113,128,.35); background: rgba(255,113,128,.1); color: #ff9ca6; }
.button.icon { width: 38px; min-height: 38px; padding: 0; border-radius: 11px; }
.button.compact { min-height: 36px; padding: 0 11px; }
.button.wide { width: 100%; min-height: 48px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }

.badge, .role-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 27px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.035);
  color: #c7d5df;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.badge.active, .badge.approved, .badge.submitted { border-color: rgba(85,217,150,.28); background: rgba(85,217,150,.09); color: #87ebb6; }
.badge.pending, .badge.prepared { border-color: rgba(255,180,93,.28); background: rgba(255,180,93,.09); color: #ffc77f; }
.badge.ready, .badge.sent { border-color: rgba(66,200,238,.28); background: rgba(66,200,238,.09); color: #75dcf7; }
.badge.rejected { border-color: rgba(255,113,128,.28); background: rgba(255,113,128,.09); color: #ff9da7; }
.role-badge.developer { border-color: rgba(245,201,79,.38); background: rgba(245,201,79,.1); color: #ffe08a; }
.role-badge.admin { border-color: rgba(74,141,255,.38); background: rgba(74,141,255,.1); color: #8bb3ff; }
.role-badge.user { color: #b9c7d1; }
.permission-chips { display: flex; flex-wrap: wrap; gap: 5px; max-width: 420px; }
.permission-chips > span:not(.muted) { padding: 4px 7px; border-radius: 8px; background: rgba(66,200,238,.07); color: #a9dce9; font-size: 10px; }
.permission-box { display: grid; gap: 8px; padding: 13px; border: 1px solid var(--border); border-radius: 14px; background: rgba(0,0,0,.12); }

.table-wrap { width: 100%; overflow-x: auto; border-radius: 13px; }
table { width: 100%; border-collapse: collapse; min-width: 650px; }
th, td { padding: 13px 12px; border-bottom: 1px solid rgba(151,188,214,.12); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; z-index: 2; background: rgba(12,24,34,.95); color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .045em; text-transform: uppercase; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: rgba(66,200,238,.035); }
tbody tr:last-child td { border-bottom: 0; }

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(151,188,214,.12);
  border-radius: 11px;
  background: rgba(3,10,16,.24);
  line-height: 1.45;
}
.choice input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--azure); }

.section { display: grid; gap: 13px; padding: 17px; border: 1px solid var(--border); border-radius: 17px; background: rgba(10,21,31,.62); }
.question { display: grid; gap: 11px; padding: 15px; border-left: 3px solid rgba(66,200,238,.28); border-radius: 0 14px 14px 0; background: rgba(66,200,238,.035); }
.question-title { margin: 0; font-size: 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; }

.reference-list { display: grid; gap: 8px; }
.mini-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(151,188,214,.1); }
.mini-row:last-child { border-bottom: 0; }
.mini-row span { color: var(--muted); font-size: 12px; }
.mini-row strong { max-width: 58%; text-align: right; font-size: 12px; overflow-wrap: anywhere; }
.credential-card { border-color: rgba(245,201,79,.32); background: rgba(245,201,79,.055); }
.credential-code { display: block; padding: 13px; border-radius: 11px; background: rgba(0,0,0,.24); white-space: pre-wrap; overflow-wrap: anywhere; color: #fff0b8; }

.histogram { display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) 48px; align-items: center; gap: 10px; }
.bar-label { overflow: hidden; color: #d5dfe7; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.055); }
.bar-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--azure), var(--yellow)); transition: width .35s ease; }
.bar strong { text-align: right; }

.security-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(66,200,238,.09), rgba(245,201,79,.04) 70%, rgba(13,24,35,.9));
  box-shadow: var(--shadow-soft);
}
.security-hero h2 { margin: 7px 0 7px; font-size: clamp(21px, 3vw, 30px); letter-spacing: -.035em; }
.security-score {
  display: grid;
  place-items: center;
  min-width: 146px;
  min-height: 108px;
  padding: 14px;
  border: 1px solid rgba(66,200,238,.28);
  border-radius: 20px;
  background: rgba(3,10,16,.36);
  color: var(--azure);
  font-size: 27px;
  font-weight: 950;
}
.security-score span { margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 700; }
.security-list { display: grid; gap: 7px; }
.security-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid rgba(151,188,214,.1); border-radius: 13px; background: rgba(0,0,0,.08); }
.security-row strong, .security-row span { display: block; }
.security-row .muted { margin-top: 3px; }
.mail-card .badge { font-size: 9px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 5, 10, .72);
  backdrop-filter: blur(14px);
}
.modal {
  width: min(1100px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: #0b1721;
  box-shadow: 0 34px 100px rgba(0,0,0,.56);
}
.modal.compact { width: min(520px, 96vw); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 150;
  max-width: min(430px, calc(100vw - 30px));
  padding: 13px 16px;
  border: 1px solid rgba(85,217,150,.34);
  border-radius: 13px;
  background: rgba(8,30,22,.96);
  color: #a9f2ca;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
}
.toast.error { border-color: rgba(255,113,128,.35); background: rgba(41,13,18,.97); color: #ffb0b7; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.muted { color: var(--muted); }
.small { font-size: 11px; line-height: 1.5; }
.success-text { margin: 0; color: var(--green); }
.danger-text { margin: 0; color: var(--red); }
.empty { min-height: 96px; display: grid; place-items: center; padding: 20px; border: 1px dashed rgba(151,188,214,.18); border-radius: 14px; color: var(--muted); text-align: center; }

@media (max-width: 1120px) {
  .columns { grid-template-columns: 1fr; }
  .login-panel { grid-template-columns: 1fr 420px; }
  .setup-panel { grid-template-columns: 1fr; }
  .setup-panel .login-info { min-height: auto; padding-bottom: 36px; }
  .setup-form { max-height: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  :root { --nav-width: 0px; }
  .layout { display: block; }
  .main { padding: 22px 15px 100px; }
  .rail {
    position: fixed;
    inset: auto 10px 10px 10px;
    z-index: 80;
    width: auto;
    height: 72px;
    flex-direction: row;
    justify-content: center;
    padding: 7px;
    border: 1px solid var(--border-strong);
    border-radius: 22px;
    background: rgba(5,12,19,.93);
    box-shadow: 0 20px 55px rgba(0,0,0,.45);
  }
  .brand { display: none; }
  .nav-group { flex: 1; flex-direction: row; height: 100%; gap: 4px; }
  .nav-spacer { display: none; }
  .nav-btn { flex: 1; min-height: 56px; width: auto; border-radius: 15px; }
  .nav-btn.active::before { left: 50%; top: -8px; width: 28px; height: 3px; transform: translateX(-50%); }
  .nav-label { display: block; margin-top: 2px; font-size: 9px; font-weight: 750; }
  .nav-btn svg { width: 20px; height: 20px; }
  .topbar { align-items: center; }
  .user-card { min-width: 0; max-width: 230px; }
  .user-role { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field.third { grid-column: span 1; }
  .field { grid-column: span 1; }
  .field.full { grid-column: 1 / -1; }
  .login { padding: 14px; }
  .login-panel { grid-template-columns: 1fr; border-radius: 24px; }
  .login-info { min-height: auto; padding: 36px 28px; }
  .login-title { font-size: clamp(36px, 10vw, 56px); }
  .login-form { border-left: 0; border-top: 1px solid var(--border); padding: 28px; }
  .security-grid { grid-template-columns: 1fr; margin-top: 26px; }
  .security-hero { grid-template-columns: 1fr; }
  .security-score { min-width: 0; width: 100%; min-height: 84px; }
}

@media (max-width: 580px) {
  .main { padding-inline: 12px; }
  .topbar { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
  .subtitle { grid-column: 1 / -1; font-size: 13px; }
  .title { font-size: 27px; }
  .user-card { padding: 7px; background: transparent; border-color: transparent; box-shadow: none; }
  .user-card > div:last-child { display: none; }
  .avatar { width: 40px; height: 40px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat { min-height: 92px; padding: 14px; border-radius: 15px; }
  .stat-value { font-size: 27px; }
  .toolbar { align-items: stretch; }
  .toolbar > * { flex: 1 1 100% !important; width: 100%; }
  .panel { border-radius: 18px; }
  .panel-head { min-height: 58px; padding: 14px 15px; }
  .panel-body { padding: 14px; }
  .grid { grid-template-columns: 1fr; }
  .field, .field.third, .field.full { grid-column: 1; }
  .actions > .field { flex: 1 1 100%; }
  .login-info { padding: 30px 22px; }
  .login-form { padding: 24px 20px 28px; }
  .login-copy { font-size: 14px; }
  .security-grid { display: none; }
  .bar { grid-template-columns: 1fr 42px; }
  .bar-label { grid-column: 1 / -1; }
  .mini-row { display: grid; }
  .mini-row strong { max-width: 100%; text-align: left; }
  .modal-backdrop { padding: 8px; align-items: end; }
  .modal, .modal.compact { width: 100%; max-height: 94vh; border-radius: 22px 22px 0 0; }
  .toast { left: 12px; right: 12px; bottom: 92px; max-width: none; }
}

@media (orientation: landscape) and (max-height: 600px) and (max-width: 1000px) {
  .rail { height: 62px; }
  .nav-btn { min-height: 48px; }
  .main { padding-bottom: 82px; }
  .login { align-items: start; }
  .login-panel { margin-block: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* v7: stable application shell and participant onboarding */
.app-root {
  width: 100%;
  min-width: 0;
  min-height: 100vh;
}
.app-root > .layout { width: 100%; }

.login-note {
  margin-top: 16px;
  padding: 12px 13px;
  border: 1px solid rgba(151,188,214,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.profile-hero,
.participant-toolbar,
.onboarding-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(66,200,238,.07), rgba(13,24,35,.9) 55%, rgba(245,201,79,.035));
  box-shadow: var(--shadow-soft);
}
.profile-hero h2,
.participant-toolbar h2,
.onboarding-card h2 { margin: 5px 0 6px; font-size: clamp(20px, 2.3vw, 29px); letter-spacing: -.03em; }
.profile-hero p,
.participant-toolbar p,
.onboarding-card p { max-width: 920px; margin: 0; line-height: 1.55; }
.profile-hero-status { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.subnav {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(5,12,19,.52);
}
.subnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.subnav-btn:hover { color: var(--text); background: rgba(255,255,255,.035); }
.subnav-btn.active {
  color: #dff8ff;
  border-color: rgba(66,200,238,.26);
  background: linear-gradient(135deg, rgba(66,200,238,.14), rgba(74,141,255,.08));
}
.subnav-count {
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255,180,93,.16);
  color: #ffd09a;
  font-size: 10px;
}

.onboarding-card { align-items: stretch; }
.onboarding-steps { display: grid; gap: 8px; min-width: min(480px, 44vw); }
.onboarding-step {
  display: grid;
  grid-template-columns: 28px minmax(0,1fr);
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(151,188,214,.12);
  border-radius: 12px;
  background: rgba(3,10,16,.26);
}
.onboarding-step .step-dot {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255,180,93,.28);
  border-radius: 50%;
  color: var(--orange);
  font-weight: 900;
}
.onboarding-step.done .step-dot { border-color: rgba(85,217,150,.3); background: rgba(85,217,150,.12); color: var(--green); }
.onboarding-step strong, .onboarding-step span { display: block; }
.onboarding-step > div > span { margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.45; }

.participant-toolbar { align-items: center; }
.create-account-btn { min-width: 220px; }
.notice-card {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid rgba(66,200,238,.2);
  border-radius: 13px;
  background: rgba(66,200,238,.055);
}
.notice-card strong { color: #d9f7ff; }
.notice-card span { color: var(--muted); font-size: 12px; line-height: 1.55; }
.leader-choice {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,.1);
}
.leader-choice legend { padding: 0 6px; }
.leader-choice .choice + .choice { margin-top: 8px; }

@media (max-width: 1120px) {
  .profile-hero, .participant-toolbar, .onboarding-card { align-items: flex-start; flex-direction: column; }
  .profile-hero-status { justify-content: flex-start; }
  .onboarding-steps { width: 100%; min-width: 0; }
}
@media (max-width: 580px) {
  .profile-hero, .participant-toolbar, .onboarding-card { padding: 16px; border-radius: 18px; }
  .subnav { width: 100%; }
  .subnav-btn { flex: 1; justify-content: center; padding-inline: 9px; }
  .create-account-btn { width: 100%; min-width: 0; }
}


/* v8: professional language selector + persistent light/dark themes */
.topbar-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
.preference-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.language-picker,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(13,24,35,.78);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}
.language-picker {
  position: relative;
  gap: 3px;
  padding-left: 11px;
  cursor: pointer;
}
.preference-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--muted);
}
.preference-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.preference-select {
  min-height: 40px;
  max-width: 158px;
  padding: 0 30px 0 5px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
.preference-select option { color: var(--text); background: var(--surface); }
.theme-toggle {
  gap: 8px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.theme-toggle:hover,
.language-picker:hover {
  border-color: rgba(66,200,238,.42);
  background: rgba(24,43,58,.92);
}
.theme-toggle:hover { transform: translateY(-1px); }
.theme-label { white-space: nowrap; }
.login-preferences {
  position: absolute;
  z-index: 5;
  top: clamp(16px, 3vw, 30px);
  right: clamp(16px, 3vw, 30px);
}
.login-preferences .language-picker,
.login-preferences .theme-toggle { background: rgba(7,16,25,.82); }

/* v9: sign-in / registration */
.auth-card { align-content: center; }
.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,.14);
}
.auth-switch-btn {
  min-height: 38px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  cursor: pointer;
  transition: color .16s ease, background .16s ease, box-shadow .16s ease;
}
.auth-switch-btn:hover { color: var(--text); }
.auth-switch-btn.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(66,200,238,.15), rgba(74,141,255,.12));
  box-shadow: inset 0 0 0 1px rgba(66,200,238,.18);
}
.login-panel.register-mode {
  grid-template-columns: minmax(0, .9fr) minmax(520px, 1.1fr);
}
.login-panel.register-mode .login-info { min-height: 720px; }
.login-panel.register-mode .login-form {
  align-content: start;
  max-height: min(92vh, 900px);
  overflow-y: auto;
}
.register-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.register-form .field.half { grid-column: span 1; }
.register-form .field.full { grid-column: 1 / -1; }
.register-policy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(85,217,150,.18);
  border-radius: 13px;
  background: rgba(85,217,150,.055);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* v9: Google-like account popover */
.account-menu-wrap {
  position: relative;
  min-width: 0;
}
.user-card-button {
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.user-card-button:hover,
.user-card-button:focus-visible {
  outline: none;
  border-color: rgba(66,200,238,.4);
  background: rgba(19,36,51,.94);
  transform: translateY(-1px);
}
.user-card-copy { min-width: 0; flex: 1; }
.account-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transform: translateY(-2px);
}
.account-popover {
  position: absolute;
  z-index: 120;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: rgba(9, 18, 27, .98);
  box-shadow: 0 30px 90px rgba(0,0,0,.46), inset 0 1px 0 rgba(255,255,255,.035);
  backdrop-filter: blur(24px) saturate(140%);
  animation: account-pop .16s ease-out;
}
@keyframes account-pop {
  from { opacity: 0; transform: translateY(-6px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.account-popover-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 22px 18px;
  text-align: center;
  background:
    radial-gradient(circle at 50% -20%, rgba(66,200,238,.16), transparent 58%),
    linear-gradient(180deg, rgba(18,34,49,.76), rgba(9,18,27,.1));
}
.avatar-large {
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
  border-radius: 50%;
  font-size: 22px;
  box-shadow: 0 12px 34px rgba(0,0,0,.24);
}
.account-popover-name {
  max-width: 100%;
  overflow: hidden;
  font-size: 19px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-popover-email {
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-popover-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
}
.account-popover-actions {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.account-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.account-action:hover { background: rgba(255,255,255,.045); }
.account-action.primary { background: rgba(66,200,238,.065); }
.account-action.danger-link { color: #ffc0c7; }
.account-action-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
}
.account-action-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.account-action strong,
.account-action small { display: block; }
.account-action small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.account-pref-row {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.022);
}
.account-pref-label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.account-pref-row .preference-controls { width: 100%; display: grid; grid-template-columns: 1fr auto; }
.account-pref-row .language-picker { min-width: 0; }
.account-pref-row .preference-select { width: 100%; max-width: none; }

/* v9: account-style profile header */
.profile-account-card {
  align-items: center;
}
.profile-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.profile-avatar {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  font-size: 24px;
  box-shadow: 0 16px 40px rgba(0,0,0,.2);
}
.profile-identity-copy { min-width: 0; }
.profile-identity-copy h2 {
  margin: 5px 0 5px;
  font-size: clamp(26px, 3vw, 36px);
}
.profile-contact-line {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-login-line {
  margin-top: 5px;
  color: var(--subtle);
  font-size: 12px;
}
.profile-login-line strong { color: var(--muted); }
.profile-account-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.profile-intro {
  margin: -4px 0 16px;
  padding: 0 4px;
  font-size: 13px;
}

/* v9: moderation */
.management-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.button.success-outline {
  color: var(--green);
  border-color: rgba(85,217,150,.25);
  background: rgba(85,217,150,.07);
}
.ban-reason { max-width: 280px; margin-top: 7px; line-height: 1.4; }
.account-mini {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.badge.banned {
  color: #ffc0c7;
  border-color: rgba(255,113,128,.28);
  background: rgba(255,113,128,.10);
}


:root[data-theme="light"] {
  --bg: #eef4f8;
  --bg-deep: #e6edf3;
  --surface: #ffffff;
  --surface-2: #f5f9fc;
  --surface-3: #e9f1f7;
  --surface-soft: rgba(255,255,255,.82);
  --border: rgba(39, 69, 91, .14);
  --border-strong: rgba(39, 69, 91, .24);
  --text: #10212f;
  --muted: #5c7182;
  --subtle: #7890a2;
  --shadow: 0 22px 70px rgba(38, 65, 84, .14);
  --shadow-soft: 0 10px 32px rgba(38, 65, 84, .10);
  color-scheme: light;
}
:root[data-theme="light"] html,
:root[data-theme="light"] body { background: var(--bg-deep); }
:root[data-theme="light"] body {
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(66,200,238,.16), transparent 30rem),
    radial-gradient(circle at 95% 8%, rgba(245,201,79,.13), transparent 28rem),
    linear-gradient(180deg, #f8fbfd 0%, var(--bg) 48%, var(--bg-deep) 100%);
}
:root[data-theme="light"] body::before {
  opacity: .32;
  background-image: linear-gradient(rgba(36,75,102,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(36,75,102,.045) 1px, transparent 1px);
}
:root[data-theme="light"] ::selection { color: #09202c; background: rgba(66,200,238,.28); }
:root[data-theme="light"] .rail {
  background: rgba(248,251,253,.88);
  box-shadow: 12px 0 36px rgba(37,65,84,.08);
}
:root[data-theme="light"] .brand {
  background: linear-gradient(145deg, rgba(245,201,79,.28), rgba(66,200,238,.18));
  color: #9b7200;
}
:root[data-theme="light"] .nav-btn:hover,
:root[data-theme="light"] .nav-btn:focus-visible { color: var(--text); background: rgba(66,200,238,.10); }
:root[data-theme="light"] .nav-btn.active { color: #087b9c; background: linear-gradient(145deg, rgba(66,200,238,.18), rgba(74,141,255,.09)); }
:root[data-theme="light"] .user-card,
:root[data-theme="light"] .language-picker,
:root[data-theme="light"] .theme-toggle { background: rgba(255,255,255,.86); }
:root[data-theme="light"] .login-preferences .language-picker,
:root[data-theme="light"] .login-preferences .theme-toggle { background: rgba(255,255,255,.9); }
:root[data-theme="light"] .login-panel {
  background: rgba(255,255,255,.94);
  box-shadow: 0 36px 100px rgba(42,69,88,.18), inset 0 1px 0 rgba(255,255,255,.8);
}
:root[data-theme="light"] .login-info {
  background:
    radial-gradient(circle at 20% 10%, rgba(66,200,238,.18), transparent 40%),
    radial-gradient(circle at 100% 90%, rgba(245,201,79,.14), transparent 38%),
    linear-gradient(145deg, rgba(238,247,252,.98), rgba(248,251,253,.98));
}
:root[data-theme="light"] .login-copy { color: #536c7e; }
:root[data-theme="light"] .login-form { background: rgba(248,251,253,.72); }
:root[data-theme="light"] .security-card,
:root[data-theme="light"] .card,
:root[data-theme="light"] .choice,
:root[data-theme="light"] .section,
:root[data-theme="light"] .onboarding-step,
:root[data-theme="light"] .notice-card,
:root[data-theme="light"] .permission-box,
:root[data-theme="light"] .leader-choice,
:root[data-theme="light"] .security-row,
:root[data-theme="light"] .login-note { background: rgba(255,255,255,.62) !important; }
:root[data-theme="light"] .stat {
  background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(242,248,252,.92));
}
:root[data-theme="light"] .toolbar,
:root[data-theme="light"] .subnav { background: rgba(255,255,255,.72); }
:root[data-theme="light"] .panel {
  background: linear-gradient(160deg, rgba(255,255,255,.98), rgba(247,250,252,.96));
}
:root[data-theme="light"] .panel-head { background: rgba(30,75,105,.018); }
:root[data-theme="light"] .label { color: #415a6c; }
:root[data-theme="light"] .input,
:root[data-theme="light"] .select,
:root[data-theme="light"] .textarea {
  background: rgba(255,255,255,.88);
  color: var(--text);
}
:root[data-theme="light"] .input:focus,
:root[data-theme="light"] .select:focus,
:root[data-theme="light"] .textarea:focus { background: #fff; }
:root[data-theme="light"] .input::placeholder,
:root[data-theme="light"] .textarea::placeholder { color: #8397a5; }
:root[data-theme="light"] .button { background: rgba(235,243,248,.9); color: var(--text); }
:root[data-theme="light"] .button:hover:not(:disabled),
:root[data-theme="light"] .button:focus-visible:not(:disabled) { background: #e5f1f7; }
:root[data-theme="light"] .button.primary { color: #061923; }
:root[data-theme="light"] .button.accent { color: #7d5d00; background: rgba(245,201,79,.18); }
:root[data-theme="light"] .button.danger { color: #a82e3d; background: rgba(255,113,128,.10); }
:root[data-theme="light"] .badge,
:root[data-theme="light"] .role-badge { background: rgba(23,60,85,.035); color: #425b6c; }
:root[data-theme="light"] .role-badge.user { color: #506879; }
:root[data-theme="light"] .permission-chips > span:not(.muted) { color: #176985; background: rgba(66,200,238,.11); }
:root[data-theme="light"] th { background: rgba(241,247,251,.98); }
:root[data-theme="light"] tbody tr:hover { background: rgba(66,200,238,.055); }
:root[data-theme="light"] .credential-code { background: #f6f0d8; color: #5a4500; }
:root[data-theme="light"] .bar-label { color: #334f61; }
:root[data-theme="light"] .bar-track { background: rgba(39,69,91,.10); }
:root[data-theme="light"] .profile-hero,
:root[data-theme="light"] .participant-toolbar,
:root[data-theme="light"] .onboarding-card,
:root[data-theme="light"] .security-hero {
  background: linear-gradient(135deg, rgba(66,200,238,.10), rgba(255,255,255,.92) 55%, rgba(245,201,79,.08));
}
:root[data-theme="light"] .security-score { background: rgba(255,255,255,.68); }
:root[data-theme="light"] .modal-backdrop { background: rgba(46,63,75,.38); }
:root[data-theme="light"] .modal { background: #fbfdfe; box-shadow: 0 34px 100px rgba(37,62,80,.24); }
:root[data-theme="light"] .toast { background: rgba(232,250,241,.98); color: #176b45; }
:root[data-theme="light"] .toast.error { background: rgba(255,238,240,.98); color: #a2303f; }
:root[data-theme="light"] .success-text { color: #13865a; }
:root[data-theme="light"] .danger-text { color: #bd3445; }

:root[data-theme="light"] .auth-switch { background: rgba(32,67,91,.055); }
:root[data-theme="light"] .auth-switch-btn.active { background: linear-gradient(135deg, rgba(66,200,238,.16), rgba(74,141,255,.08)); }
:root[data-theme="light"] .register-policy { background: rgba(38,166,109,.06); }
:root[data-theme="light"] .user-card-button:hover,
:root[data-theme="light"] .user-card-button:focus-visible { background: rgba(255,255,255,.98); }
:root[data-theme="light"] .account-popover {
  background: rgba(251,253,254,.98);
  box-shadow: 0 30px 80px rgba(38,65,84,.2), inset 0 1px 0 rgba(255,255,255,.9);
}
:root[data-theme="light"] .account-popover-head {
  background:
    radial-gradient(circle at 50% -20%, rgba(66,200,238,.16), transparent 58%),
    linear-gradient(180deg, rgba(238,247,252,.94), rgba(251,253,254,.2));
}
:root[data-theme="light"] .account-action:hover { background: rgba(30,75,105,.055); }
:root[data-theme="light"] .account-action.primary { background: rgba(66,200,238,.08); }
:root[data-theme="light"] .account-action.danger-link { color: #a82e3d; }
:root[data-theme="light"] .account-pref-row,
:root[data-theme="light"] .account-mini { background: rgba(30,75,105,.035); }



@media (max-width: 1120px) {
  .login-panel.register-mode { grid-template-columns: minmax(0, .82fr) minmax(460px, 1.18fr); }
  .profile-account-card { align-items: flex-start; }
  .profile-account-actions { align-items: flex-start; }
}
@media (max-width: 980px) {
  .topbar { align-items: flex-start; }
  .topbar-tools { flex-wrap: wrap; }
  .topbar-tools > .preference-controls { order: 2; width: 100%; justify-content: flex-end; }
}
@media (max-width: 820px) {
  :root[data-theme="light"] .rail { background: rgba(248,251,253,.96); box-shadow: 0 20px 55px rgba(45,68,83,.18); }
  .theme-label { display: none; }
  .theme-toggle { width: 42px; padding: 0; justify-content: center; }
  .preference-select { max-width: 132px; }
}
@media (max-width: 580px) {
  .login-preferences { top: 10px; right: 10px; }
  .login-preferences .preference-select { max-width: 124px; width: 124px; font-size: 11px; }
  .login-preferences .preference-select option { font-size: 12px; }
  .topbar-tools { gap: 6px; }
  .topbar-tools > .preference-controls { width: auto; order: 0; }
  .topbar-tools .language-picker { padding-left: 8px; }
  .topbar-tools .preference-select { width: 82px; max-width: 82px; padding-right: 18px; font-size: 10px; }
  .topbar-tools .preference-select option { font-size: 12px; }
  .user-card { order: 2; }
}


@media (max-width: 760px) {
  .login-panel,
  .login-panel.register-mode {
    grid-template-columns: 1fr;
  }
  .login-panel.register-mode .login-info { min-height: auto; }
  .login-info { min-height: auto; padding-top: 88px; padding-bottom: 36px; }
  .login-form { border-left: 0; border-top: 1px solid var(--border); }
  .profile-identity { align-items: flex-start; }
  .profile-avatar { width: 62px; height: 62px; font-size: 18px; }
  .account-popover { position: fixed; top: 76px; right: 14px; }
}
@media (max-width: 520px) {
  .register-form .field.half { grid-column: 1 / -1; }
  .profile-identity { gap: 12px; }
  .profile-account-card { gap: 16px; }
  .profile-account-actions { width: 100%; }
  .profile-account-actions .button { width: 100%; }
}

/* v10: account/profile access lives in the top-right account menu. */
.account-popover-kicker {
  margin-bottom: 10px;
  color: var(--accent-yellow);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.profile-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(66,200,238,.055), rgba(13,24,35,.78) 58%, rgba(245,201,79,.025));
  box-shadow: var(--shadow-soft);
}
.profile-page-head h2 { margin: 5px 0 4px; font-size: clamp(20px, 2.1vw, 28px); letter-spacing: -.03em; }
.profile-page-head p { margin: 0; line-height: 1.5; }
:root[data-theme="light"] .profile-page-head {
  background: linear-gradient(135deg, rgba(66,200,238,.09), rgba(255,255,255,.96) 58%, rgba(245,201,79,.07));
}
@media (max-width: 760px) {
  .profile-page-head { flex-direction: column; padding: 16px; border-radius: 18px; }
}
.boot-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(126,161,185,.22);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: boot-spin .75s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* v11: full-width survey journal, reader, rich attachments and percentage reports */
.survey-journal-panel { margin-top: 18px; }
.survey-journal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.survey-journal-card {
  display: grid;
  gap: 13px;
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(20,48,65,.64), rgba(5,14,22,.54));
  box-shadow: inset 0 1px rgba(255,255,255,.025);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.survey-journal-card:hover { transform: translateY(-2px); border-color: rgba(66,200,238,.36); background: linear-gradient(145deg, rgba(24,58,78,.72), rgba(5,14,22,.62)); }
.survey-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topic-chip, .assignment-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; border: 1px solid rgba(66,200,238,.18); border-radius: 999px; background: rgba(66,200,238,.07); color: var(--azure); font-size: 10px; font-weight: 850; }
.assignment-chip { color: var(--muted); background: rgba(255,255,255,.035); border-color: rgba(151,188,214,.13); }
.assignment-chip.assigned { color: var(--green); border-color: rgba(85,217,150,.2); background: rgba(85,217,150,.06); }
.survey-journal-title { margin: 0; font-size: 19px; line-height: 1.25; }
.survey-meta { flex-wrap: wrap; }
.survey-card-actions { margin-top: auto; }
.survey-reader-modal { width: min(1180px, 97vw); }
.survey-reader { display: grid; gap: 18px; }
.survey-reader-head { display: flex; justify-content: space-between; gap: 18px; padding-bottom: 2px; }
.survey-reader-title { margin: 12px 0 6px; font-size: clamp(25px, 3vw, 38px); line-height: 1.1; letter-spacing: -.03em; }
.compact-actions { gap: 8px; }
.survey-notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid rgba(151,188,214,.15); border-radius: 15px; background: rgba(255,255,255,.025); }
.survey-notice > div:first-child { display: grid; gap: 4px; }
.survey-notice strong, .survey-notice span { display: block; }
.survey-notice span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.survey-notice.success { border-color: rgba(85,217,150,.22); background: rgba(85,217,150,.055); }
.survey-notice.warning { border-color: rgba(255,205,51,.22); background: rgba(255,205,51,.045); }
.survey-answer-form { gap: 20px; }
.survey-section { padding: 22px; border-radius: 18px; }
.survey-section-content { margin: 11px 0 0; color: var(--text); line-height: 1.72; white-space: pre-wrap; }
.survey-question-stack { display: grid; gap: 14px; margin-top: 18px; }
.survey-question { min-width: 0; margin: 0; padding: 17px; border: 1px solid rgba(151,188,214,.13); border-radius: 15px; background: rgba(0,0,0,.09); }
.survey-question[disabled] { opacity: .74; }
.survey-question .question-title { width: 100%; margin: 0 0 4px; padding: 0; color: var(--text); font-size: 14px; font-weight: 850; line-height: 1.45; }
.question-hint { margin: 0 0 10px; color: var(--muted); font-size: 10px; }
.choice-list { display: grid; gap: 8px; }
.survey-choice { position: relative; min-height: 46px; padding: 11px 13px; border-color: rgba(151,188,214,.13); cursor: pointer; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.survey-choice:hover:not(:has(input:disabled)) { transform: translateY(-1px); border-color: rgba(66,200,238,.32); background: rgba(66,200,238,.055); }
.survey-choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-control { flex: 0 0 18px; width: 18px; height: 18px; border: 2px solid rgba(151,188,214,.5); border-radius: 50%; box-shadow: inset 0 0 0 3px transparent; transition: .16s ease; }
.survey-choice:has(input[type="checkbox"]) .choice-control { border-radius: 5px; }
.survey-choice:has(input:checked) { border-color: rgba(66,200,238,.42); background: rgba(66,200,238,.07); }
.survey-choice:has(input:checked) .choice-control { border-color: var(--azure); background: var(--azure); box-shadow: inset 0 0 0 4px var(--panel); }
.survey-choice:has(input[type="checkbox"]:checked) .choice-control { box-shadow: inset 0 0 0 3px var(--panel); }
.survey-submit-row { position: sticky; bottom: -1px; z-index: 2; display: flex; justify-content: flex-end; padding: 14px 0 2px; background: linear-gradient(180deg, transparent, var(--panel) 38%); }
.survey-submit { min-width: 220px; }
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
.attachment-card { min-width: 0; overflow: hidden; border: 1px solid rgba(151,188,214,.13); border-radius: 15px; background: rgba(0,0,0,.11); }
.attachment-thumb-link { display: grid; place-items: center; width: 100%; min-height: 220px; max-height: 440px; padding: 0; overflow: hidden; border: 0; border-bottom: 1px solid rgba(151,188,214,.10); background: rgba(0,0,0,.24); cursor: zoom-in; }
.attachment-thumb { display: block; width: 100%; height: auto; max-height: 440px; object-fit: contain; object-position: center; transition: transform .22s ease; }
.attachment-thumb-link:hover .attachment-thumb { transform: scale(1.012); }
.attachment-card.image { grid-column: span 2; }
.attachment-file-icon { display: grid; place-items: center; height: 105px; background: linear-gradient(135deg, rgba(66,200,238,.13), rgba(255,205,51,.07)); color: var(--azure); font-size: 18px; font-weight: 950; letter-spacing: .08em; }
.attachment-media, .attachment-video { display: block; width: 100%; }
.attachment-video { max-height: 270px; background: #000; }
.attachment-meta { display: grid; gap: 5px; padding: 12px; }
.attachment-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-meta > span { color: var(--muted); font-size: 10px; }
.attachment-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 5px; }
.small-button { min-height: 31px; padding: 6px 10px; font-size: 10px; }
.builder-attachments .attachment-thumb-link { min-height: 150px; max-height: 260px; }
.builder-attachments .attachment-thumb { max-height: 260px; }
.builder-attachments .attachment-card.image { grid-column: span 1; }
.upload-field .muted { margin-top: 3px; }
.report-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.02); }
.report-summary .stat { min-width: 105px; padding: 10px 13px; }
.report-summary-copy { display: grid; gap: 4px; min-width: 0; }
.report-summary-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-question-groups { display: grid; gap: 15px; }
.report-question-card { display: grid; gap: 12px; padding: 14px; border: 1px solid rgba(151,188,214,.11); border-radius: 14px; background: rgba(0,0,0,.08); }
.report-question-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.report-question-head strong { line-height: 1.45; }
.report-bar { grid-template-columns: minmax(110px,1fr) minmax(130px,2fr) 48px; }
.bar-count { grid-column: 2 / -1; color: var(--muted); font-size: 10px; margin-top: -7px; }
.mini-progress { width: 90px; max-width: 100%; height: 5px; margin-top: 5px; overflow: hidden; border-radius: 999px; background: rgba(151,188,214,.12); }
.mini-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--azure), var(--yellow)); }
:root[data-theme="light"] .survey-journal-card,
:root[data-theme="light"] .survey-question,
:root[data-theme="light"] .attachment-card,
:root[data-theme="light"] .report-question-card { background: rgba(255,255,255,.65); }
:root[data-theme="light"] .survey-submit-row { background: linear-gradient(180deg, transparent, #fbfdfe 38%); }
@media (max-width: 700px) {
  .survey-journal-grid { grid-template-columns: 1fr; }
  .survey-notice { align-items: flex-start; flex-direction: column; }
  .attachment-grid { grid-template-columns: 1fr; }
  .report-summary { align-items: stretch; flex-direction: column; }
  .report-bar { grid-template-columns: 1fr 46px; }
  .report-bar .bar-label { grid-column: 1 / -1; }
  .report-bar .bar-track { grid-column: 1; }
  .bar-count { grid-column: 1 / -1; }
  .survey-submit { width: 100%; }
}


/* v12: uncropped image gallery + fullscreen lightbox */
.image-preview-button { font: inherit; color: inherit; }
.image-viewer-backdrop {
  position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 18px;
  background: rgba(1,7,12,.92); backdrop-filter: blur(12px);
}
.image-viewer-shell {
  width: min(1500px, 98vw); height: min(940px, 96vh); min-height: 360px; overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0,1fr); border: 1px solid rgba(151,188,214,.20);
  border-radius: 20px; background: #050d14; box-shadow: 0 28px 90px rgba(0,0,0,.55);
}
.image-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 62px; padding: 10px 12px 10px 16px; border-bottom: 1px solid rgba(151,188,214,.14); background: rgba(12,28,39,.94); }
.image-viewer-title { min-width: 0; display: grid; gap: 3px; }
.image-viewer-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-viewer-title span { color: var(--muted); font-size: 10px; }
.image-viewer-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.image-viewer-stage { min-width: 0; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 14px; background: #02070b; scrollbar-gutter: stable both-edges; }
.image-viewer-stage img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(96vh - 105px); object-fit: contain; object-position: center; box-shadow: 0 12px 38px rgba(0,0,0,.35); }
.image-viewer-stage:fullscreen { padding: 18px; background: #000; }
.image-viewer-stage:fullscreen img { max-width: 100vw; max-height: 100vh; }
:root[data-theme="light"] .image-viewer-backdrop { background: rgba(12,20,28,.88); }
@media (max-width: 700px) {
  .attachment-card.image { grid-column: span 1; }
  .attachment-thumb-link { min-height: 190px; max-height: 360px; }
  .attachment-thumb { max-height: 360px; }
  .image-viewer-backdrop { padding: 0; }
  .image-viewer-shell { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .image-viewer-head { align-items: flex-start; flex-direction: column; }
  .image-viewer-actions { width: 100%; justify-content: flex-start; }
  .image-viewer-stage img { max-height: calc(100dvh - 132px); }
}

/* v13: switch-style theme control, editable attachments, richer image inspection */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 5px 10px 5px 7px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(13,24,35,.78);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.theme-switch:hover { border-color: rgba(66,200,238,.42); background: rgba(24,43,58,.92); transform: translateY(-1px); }
.theme-switch-track {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(151,188,214,.18);
  box-shadow: inset 0 0 0 1px rgba(151,188,214,.18);
  transition: background .18s ease, box-shadow .18s ease;
}
.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0c1822;
  color: #c8d8e5;
  box-shadow: 0 2px 8px rgba(0,0,0,.32);
  transition: transform .2s ease, background .18s ease, color .18s ease;
}
.theme-switch-thumb svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch[aria-checked="true"] .theme-switch-track { background: linear-gradient(90deg, var(--azure), var(--blue)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.theme-switch[aria-checked="true"] .theme-switch-thumb { transform: translateX(18px); background: #fff; color: #24556d; }
.theme-switch-copy { display: grid; text-align: left; line-height: 1.05; white-space: nowrap; }
.theme-switch-copy small { color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: .03em; }
.theme-switch-copy strong { margin-top: 3px; font-size: 11px; font-weight: 900; }
.login-preferences .theme-switch { background: rgba(7,16,25,.82); }
:root[data-theme="light"] .theme-switch { background: rgba(255,255,255,.88); }
:root[data-theme="light"] .login-preferences .theme-switch { background: rgba(255,255,255,.92); }

.hidden-file-input { display: none !important; }
.builder-attachments .attachment-actions { align-items: center; }

/* Full-image gallery: never crop user content; use the available viewport cleanly. */
.survey-section > .attachment-grid { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); }
.survey-section > .attachment-grid .attachment-card.image { grid-column: auto; }
.survey-section > .attachment-grid .attachment-thumb-link {
  min-height: clamp(260px, 42vw, 560px);
  max-height: min(68vh, 720px);
  padding: 10px;
  background:
    radial-gradient(circle at 50% 50%, rgba(66,200,238,.05), transparent 55%),
    #03090e;
}
.survey-section > .attachment-grid .attachment-thumb {
  width: 100%;
  height: 100%;
  max-height: min(68vh, 700px);
  object-fit: contain;
}

.image-zoom-controls { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid rgba(151,188,214,.14); border-radius: 11px; background: rgba(0,0,0,.16); }
.zoom-button { min-width: 32px; padding-inline: 8px; font-size: 16px; line-height: 1; }
.zoom-value { min-width: 58px; }
.image-viewer-stage { align-content: center; justify-content: center; }
.image-viewer-stage img { transform-origin: center center; transition: transform .14s ease; }
.image-viewer-stage:has(img[style*="scale(1.25"]),
.image-viewer-stage:has(img[style*="scale(1.5"]),
.image-viewer-stage:has(img[style*="scale(1.75"]),
.image-viewer-stage:has(img[style*="scale(2"]),
.image-viewer-stage:has(img[style*="scale(2.25"]),
.image-viewer-stage:has(img[style*="scale(2.5"]),
.image-viewer-stage:has(img[style*="scale(2.75"]),
.image-viewer-stage:has(img[style*="scale(3"]),
.image-viewer-stage:has(img[style*="scale(3.25"]),
.image-viewer-stage:has(img[style*="scale(3.5"]),
.image-viewer-stage:has(img[style*="scale(3.75"]),
.image-viewer-stage:has(img[style*="scale(4"]){ place-items: start center; }

@media (max-width: 700px) {
  .theme-switch-copy { display: none; }
  .theme-switch { padding: 5px 7px; }
  .survey-section > .attachment-grid .attachment-thumb-link { min-height: 220px; max-height: 58vh; }
  .image-zoom-controls { order: -1; }
}

/* v14 — professional password controls */
.password-control {
  position: relative;
  display: block;
  width: 100%;
}
.password-control .input { padding-right: 52px; }
.password-toggle {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, background .15s ease, transform .15s ease;
}
.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--text);
  background: rgba(66,200,238,.09);
  outline: none;
}
.password-toggle:active { transform: translateY(-50%) scale(.96); }
.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.password-policy {
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(7,18,27,.42);
  gap: 10px;
}
.password-strength-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}
.password-strength-row strong { color: var(--muted); }
.password-strength-row strong[data-level="medium"] { color: var(--yellow); }
.password-strength-row strong[data-level="strong"] { color: var(--success); }
.password-strength {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.password-strength i {
  height: 4px;
  border-radius: 999px;
  background: rgba(133,153,169,.18);
  transition: background .18s ease, transform .18s ease;
}
.password-strength i.active { background: var(--azure); transform: scaleY(1.08); }
.password-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
}
.password-rules > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  transition: color .15s ease;
}
.password-rules > span b {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: transparent;
  font-size: 10px;
  transition: all .15s ease;
}
.password-rules > span.valid { color: var(--success); }
.password-rules > span.valid b {
  color: #071019;
  border-color: var(--success);
  background: var(--success);
}
.password-rules > span.invalid { color: #f58c96; }

:root[data-theme="light"] .password-policy { background: rgba(255,255,255,.72); }
:root[data-theme="light"] .password-toggle:hover,
:root[data-theme="light"] .password-toggle:focus-visible { background: rgba(14,119,166,.08); }

@media (max-width: 640px) {
  .password-rules { display: grid; grid-template-columns: 1fr 1fr; }
}


/* v18 localized date controls + immediate autosave feedback */
.localized-date-control { display:grid; grid-template-columns: minmax(92px,.7fr) minmax(140px,1.2fr) minmax(105px,.8fr); gap:8px; }
.localized-date-control[data-kind="month"] { grid-template-columns:minmax(150px,1.2fr) minmax(110px,.8fr); }
.localized-date-control .select { min-width:0; }
.permission-autosave-row { display:flex; align-items:center; justify-content:space-between; min-height:24px; padding:0 2px; }
[data-permission-save-state][data-state="saving"] { color:var(--yellow); }
[data-permission-save-state][data-state="saved"] { color:var(--green); }
[data-permission-save-state][data-state="error"] { color:#ff8fa1; }
.survey-choice.is-selected { border-color:rgba(66,200,238,.5); background:rgba(66,200,238,.085); }
@media (max-width: 700px) {
  .localized-date-control, .localized-date-control[data-kind="month"] { grid-template-columns:1fr; }
}

/* v20: reusable respondent lists + broadcast distribution */
.report-respondents-button { justify-self:end; }
.respondents-modal .table-wrap { max-height:min(52vh,560px); overflow:auto; }
.respondent-source {
  display:grid;
  gap:6px;
  padding:16px 18px;
  border:1px solid var(--border);
  border-radius:16px;
  background:rgba(66,200,238,.045);
}
.respondent-source > strong { font-size:16px; line-height:1.35; }
.respondent-answer {
  display:inline-flex;
  width:fit-content;
  max-width:100%;
  padding:7px 10px;
  border-radius:10px;
  background:rgba(66,200,238,.10);
  border:1px solid rgba(66,200,238,.22);
  font-weight:700;
}
.recipient-preset-banner {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 16px;
  border:1px solid rgba(66,200,238,.32);
  border-radius:14px;
  background:linear-gradient(135deg,rgba(66,200,238,.09),rgba(255,204,70,.05));
}
.recipient-preset-banner > div { display:grid; gap:4px; min-width:0; }
.recipient-preset-banner strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.all-participants-choice {
  align-items:flex-start;
  padding:14px 16px;
  border:1px solid rgba(78,219,164,.28);
  border-radius:14px;
  background:rgba(78,219,164,.055);
}
.all-participants-choice > span { display:grid; gap:3px; }
.all-participants-choice small { color:var(--muted); font-weight:500; }
.send-recipient-table,
[data-send-manual-control] { transition:opacity .16s ease, filter .16s ease; }
.send-recipient-table.is-disabled,
[data-send-manual-control].is-disabled { opacity:.42; filter:saturate(.6); }
.is-preset-recipient { background:rgba(66,200,238,.045); }
:root[data-theme="light"] .respondent-source { background:rgba(14,119,166,.045); }
:root[data-theme="light"] .recipient-preset-banner { background:linear-gradient(135deg,rgba(14,119,166,.07),rgba(209,153,0,.05)); }
:root[data-theme="light"] .all-participants-choice { background:rgba(12,142,91,.045); }
@media (max-width:700px) {
  .recipient-preset-banner { align-items:stretch; flex-direction:column; }
  .recipient-preset-banner .button { width:100%; }
  .respondents-modal .table-wrap { max-height:48vh; }
}


/* v21: clean access display + professional profile/date UX */
.active-permissions-box { gap:10px; }
.active-permission-list { display:grid; gap:8px; }
.active-permission { display:flex; align-items:center; gap:10px; min-height:42px; padding:9px 11px; border:1px solid rgba(69,211,154,.20); border-radius:12px; background:rgba(69,211,154,.055); }
.active-permission-check { flex:0 0 22px; width:22px; height:22px; display:grid; place-items:center; border-radius:50%; background:rgba(69,211,154,.16); color:var(--success); font-weight:900; }
.empty-permissions { display:flex; align-items:center; gap:10px; min-height:44px; padding:10px 12px; border:1px dashed var(--border); border-radius:12px; color:var(--muted); }
.required-mark { color:#ff8fa1; font-style:normal; font-weight:900; }
.field-help { display:block; margin-top:6px; color:var(--muted); font-size:11px; line-height:1.4; }
.birth-date-control.localized-date-control { grid-template-columns:minmax(155px,1.25fr) minmax(125px,.75fr); padding:10px; border:1px solid var(--border); border-radius:14px; background:rgba(0,0,0,.10); }
.date-segment { display:grid; gap:5px; min-width:0; }
.date-segment-label { color:var(--muted); font-size:10px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.date-validation { grid-column:1/-1; min-height:0; max-height:0; overflow:hidden; color:#ff8fa1; font-size:11px; font-weight:700; opacity:0; transition:max-height .16s ease, opacity .16s ease, margin .16s ease; }
.date-validation.visible { max-height:40px; margin-top:2px; opacity:1; }
.birth-date-control:has(select:invalid) { border-color:rgba(255,143,161,.30); }
:root[data-theme="light"] .birth-date-control.localized-date-control { background:rgba(255,255,255,.62); }
@media (max-width:700px) { .birth-date-control.localized-date-control { grid-template-columns:1fr; } }

/* v22: locked permissions, structured profile selectors, age validation and richer reports */
.permission-lock-card {
  display:grid;
  gap:8px;
  padding:16px;
  border:1px solid rgba(255,180,93,.28);
  border-radius:14px;
  background:rgba(255,180,93,.055);
}
.permission-lock-card strong { line-height:1.45; }
.birth-age-help { margin-top:8px; }

.report-results-panel { margin-top:18px; }
.report-results-head { align-items:flex-start; gap:16px; }
.report-results-head > div { display:grid; gap:4px; }
.report-breakdown { display:grid; gap:18px; }
.report-breakdown-card {
  display:grid;
  gap:16px;
  padding:18px;
  border:1px solid var(--border);
  border-radius:18px;
  background:linear-gradient(145deg,rgba(66,200,238,.035),rgba(255,255,255,.008));
}
.report-breakdown-head h3 { margin:5px 0 0; font-size:18px; line-height:1.4; }
.report-breakdown-grid {
  display:grid;
  grid-template-columns:minmax(0,1.55fr) minmax(260px,.75fr);
  gap:18px;
  align-items:stretch;
}
.report-option-list { display:grid; gap:12px; }
.report-option-card {
  position:relative;
  display:grid;
  gap:10px;
  padding:14px;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:15px;
  background:rgba(0,0,0,.105);
}
.report-option-card::before {
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:3px;
  background:var(--option-color);
}
.report-option-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.report-option-answer { display:flex; align-items:baseline; gap:10px; min-width:0; }
.report-option-answer strong { flex:0 0 auto; font-size:22px; letter-spacing:-.03em; color:var(--text); }
.report-option-answer span { overflow-wrap:anywhere; font-weight:750; }
.report-option-count { flex:0 0 auto; color:var(--muted); font-size:11px; font-weight:700; }
.report-option-progress { height:7px; overflow:hidden; border-radius:999px; background:rgba(255,255,255,.055); }
.report-option-progress > span {
  display:block;
  width:var(--pct);
  height:100%;
  border-radius:inherit;
  background:linear-gradient(90deg,var(--option-color),color-mix(in srgb,var(--option-color) 68%,#fff 32%));
  animation:reportGrow .45s ease both;
}
.report-option-participants { display:grid; gap:8px; }
.report-option-participants-head { display:flex; align-items:center; justify-content:space-between; gap:10px; color:var(--muted); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
.respondent-aliases { display:flex; flex-wrap:wrap; gap:6px; }
.respondent-alias-chip {
  display:inline-flex;
  align-items:center;
  max-width:180px;
  padding:5px 8px;
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--option-color) 34%,transparent);
  border-radius:999px;
  background:color-mix(in srgb,var(--option-color) 9%,transparent);
  color:var(--text);
  font-size:11px;
  font-weight:700;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.report-chart {
  display:grid;
  align-content:start;
  gap:14px;
  padding:15px;
  border:1px solid var(--border);
  border-radius:16px;
  background:rgba(255,255,255,.018);
}
.report-chart-title { color:var(--muted); font-size:10px; font-weight:850; letter-spacing:.06em; text-transform:uppercase; }
.report-donut-wrap { position:relative; width:min(230px,100%); aspect-ratio:1; margin:0 auto; }
.report-donut { display:block; width:100%; height:100%; transform:rotate(-90deg); filter:drop-shadow(0 12px 25px rgba(0,0,0,.18)); }
.report-donut-base { stroke:rgba(255,255,255,.055); }
.report-donut-segment { stroke-linecap:butt; animation:reportDonut .55s ease both; }
.report-donut-center { position:absolute; inset:28%; display:grid; place-content:center; text-align:center; border-radius:50%; background:var(--surface); box-shadow:inset 0 0 0 1px var(--border); }
.report-donut-center strong { font-size:30px; letter-spacing:-.04em; }
.report-donut-center span { color:var(--muted); font-size:10px; }
.report-chart-legend { display:grid; gap:8px; }
.report-chart-legend > div { display:grid; grid-template-columns:12px minmax(0,1fr) auto; gap:8px; align-items:center; font-size:11px; }
.report-chart-legend > div > span:nth-child(2) { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.legend-dot { width:9px; height:9px; border-radius:50%; background:var(--legend); box-shadow:0 0 0 3px color-mix(in srgb,var(--legend) 15%,transparent); }
.report-multi-chart { align-content:start; }
.multi-chart-row { display:grid; gap:6px; }
.multi-chart-label { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:11px; }
.multi-chart-track { height:12px; overflow:hidden; border-radius:999px; background:rgba(255,255,255,.055); }
.multi-chart-track > span { display:block; width:var(--pct); height:100%; border-radius:inherit; background:var(--bar); animation:reportGrow .45s ease both; }
@keyframes reportGrow { from { width:0; opacity:.3; } to { width:var(--pct); opacity:1; } }
@keyframes reportDonut { from { opacity:.15; stroke-dasharray:0 100; } to { opacity:1; } }

:root[data-theme="light"] .permission-lock-card { background:rgba(196,121,16,.05); }
:root[data-theme="light"] .report-breakdown-card { background:linear-gradient(145deg,rgba(14,119,166,.025),rgba(255,255,255,.72)); }
:root[data-theme="light"] .report-option-card { background:rgba(255,255,255,.76); }
:root[data-theme="light"] .report-chart { background:rgba(255,255,255,.62); }
:root[data-theme="light"] .report-option-progress,
:root[data-theme="light"] .multi-chart-track,
:root[data-theme="light"] .report-donut-base { background:rgba(39,69,91,.08); stroke:rgba(39,69,91,.09); }

@media (max-width:980px) {
  .report-breakdown-grid { grid-template-columns:1fr; }
  .report-chart { order:-1; }
  .report-donut-wrap { width:min(210px,72vw); }
}
@media (max-width:600px) {
  .report-breakdown-card { padding:13px; }
  .report-option-head { align-items:stretch; flex-direction:column; gap:5px; }
  .report-option-count { align-self:flex-start; }
  .report-option-participants-head { align-items:flex-start; flex-direction:column; }
  .report-option-participants-head .button { width:100%; }
}

/* v23: exact leader lookup, deadline UX, creator analytics/discussion, avatars */
.field.birth-field { grid-column: span 2; min-width: 0; }
.birth-date-control.localized-date-control {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.birth-date-control .date-segment,
.birth-date-control .select { min-width: 0; width: 100%; }

.leader-lookup { display: grid; gap: 8px; }
.leader-search-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.leader-search-result {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px dashed var(--border);
  border-radius: 13px;
  background: rgba(255,255,255,.018);
}
.leader-search-result.found { border-style: solid; border-color: rgba(69,211,154,.28); background: rgba(69,211,154,.055); }
.leader-search-result > span:last-child { display: grid; gap: 2px; min-width: 0; }
.leader-search-result small { color: var(--muted); }
.leader-result-avatar { width: 36px; height: 36px; border-radius: 50%; }

.avatar.has-photo { overflow: hidden; background: transparent; }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-edit-button {
  margin-top: -4px;
  border: 0;
  background: transparent;
  color: var(--azure);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.profile-head-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.profile-page-avatar { width: 64px; height: 64px; border-radius: 50%; font-size: 20px; }
.comment-avatar, .report-creator-avatar { width: 42px; height: 42px; border-radius: 50%; }

.deadline-card {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr);
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(66,200,238,.055), rgba(74,141,255,.025)),
    rgba(255,255,255,.012);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
.deadline-card-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 14px;
  color: var(--azure);
  background: rgba(66,200,238,.08);
  border: 1px solid rgba(66,200,238,.18);
}
.deadline-card-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.deadline-card-main { display: grid; gap: 12px; min-width: 0; }
.deadline-card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.deadline-card-head > div { display: grid; gap: 4px; }
.deadline-card-head strong { font-size: 17px; }
.deadline-none { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.deadline-controls { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(150px,.5fr); gap: 12px; align-items: end; transition: opacity .16s ease, filter .16s ease; }
.deadline-controls.is-disabled { opacity: .38; filter: saturate(.5); pointer-events: none; }
.deadline-date-field, .deadline-time-field { min-width: 0; }
.deadline-time-field .input { min-height: 44px; }

.report-creators { display: grid; gap: 14px; margin-bottom: 18px; }
.report-creators-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.report-creators-title p { margin: 0; }
.report-creator-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.012);
}
.report-creator-head { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.report-creator-head > div { display: grid; gap: 2px; }
.report-survey-list { display: grid; }
.report-survey-row {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, transform .16s ease;
}
.report-survey-row:last-child { border-bottom: 0; }
.report-survey-row:hover, .report-survey-row.active { background: rgba(66,200,238,.055); }
.report-survey-row.active { box-shadow: inset 3px 0 0 var(--azure); }
.report-survey-index { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: rgba(66,200,238,.09); color: var(--azure); font-weight: 900; }
.report-survey-copy { display: grid; gap: 4px; min-width: 0; }
.report-survey-copy strong, .report-survey-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-survey-copy small { color: var(--muted); }
.report-survey-open { color: var(--azure); font-size: 12px; font-weight: 800; }
.report-detail-shell { scroll-margin-top: 18px; }
.report-detail-toolbar { margin-top: 8px; }

.report-discussion { margin-top: 18px; }
.comment-thread { display: grid; gap: 10px; }
.survey-comment { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.018); }
.comment-body { min-width: 0; }
.comment-body p { margin: 6px 0 0; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.comment-meta time { color: var(--muted); font-size: 10px; }
.comment-composer { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: end; }
.comment-composer .textarea { min-height: 86px; resize: vertical; }
.compact-empty { min-height: 70px; }

:root[data-theme="light"] .leader-search-result,
:root[data-theme="light"] .report-creator-card,
:root[data-theme="light"] .survey-comment { background: rgba(255,255,255,.68); }
:root[data-theme="light"] .deadline-card { background: linear-gradient(135deg, rgba(14,119,166,.045), rgba(255,255,255,.8)); }

@media (max-width: 980px) {
  .field.birth-field { grid-column: 1 / -1; }
  .deadline-controls { grid-template-columns: 1fr; }
  .report-survey-row { grid-template-columns: 34px minmax(0,1fr); }
  .report-survey-open { grid-column: 2; }
}
@media (max-width: 700px) {
  .birth-date-control.localized-date-control { grid-template-columns: 1fr; }
  .leader-search-row { grid-template-columns: 1fr; }
  .leader-search-row .button { width: 100%; }
  .deadline-card { grid-template-columns: 1fr; }
  .deadline-card-icon { display: none; }
  .deadline-card-head { align-items: flex-start; flex-direction: column; }
  .comment-composer { grid-template-columns: 1fr; }
  .comment-composer .button { width: 100%; }
  .profile-head-identity { align-items: flex-start; }
  .profile-page-avatar { width: 54px; height: 54px; }
}

/* v24 — inline analytics, quiz answer keys and a locale-aware calendar. */
.auth-login-heading { margin: 0 0 5px; }
.report-survey-entry { min-width: 0; }
.report-survey-entry + .report-survey-entry { border-top: 1px solid var(--border); }
.report-survey-entry .report-survey-row { border-bottom: 0; }
.report-survey-row:focus-visible, .calendar-display:focus-visible, .calendar-popover button:focus-visible,
.calendar-popover select:focus-visible { outline: 2px solid var(--azure); outline-offset: 2px; }
.report-expanded { padding: 4px 16px 20px; background: color-mix(in srgb,var(--surface-2) 46%,transparent); animation: reportExpand .24s ease-out; }
@keyframes reportExpand { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.report-loading { padding: 30px 12px; text-align:center; color:var(--muted); }
.report-detail-shell { width:100%; max-width:100%; scroll-margin-top:22px; }
.report-detail-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:12px 0; }
.report-detail-heading strong { min-width:0; overflow-wrap:anywhere; font-size:17px; }
.report-filters { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:12px; }
.report-filters > * { flex:1 1 175px; min-width: 0; }
.report-correct-badge, .choice-correct-label { display:inline-flex; align-items:center; padding:3px 8px; border-radius:99px;
  border:1px solid color-mix(in srgb,var(--green) 45%,transparent); background:color-mix(in srgb,var(--green) 11%,transparent);
  color:var(--green); font-size:11px; font-weight:800; line-height:1.4; }
.report-option-answer { align-items:center; flex-wrap:wrap; }
.builder-correct-heading { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:8px 0 0; }
.builder-correct-heading .field-help { margin:0; }
.builder-answer-row { display:grid; grid-template-columns:44px minmax(0,1fr) auto; gap:10px; align-items:end; min-width:0; }
.builder-answer-row .field { min-width:0; }
.builder-correct-choice { position:relative; display:grid; place-items:center; min-height:44px; border:1px solid var(--border-strong);
  border-radius:12px; background:var(--surface-2); color:var(--muted); cursor:pointer; transition:background .17s ease,border-color .17s ease,color .17s ease; }
.builder-correct-choice input { position:absolute; inset:0; margin:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.builder-correct-choice span { display:grid; place-items:center; width:22px; height:22px; border:2px solid currentColor; border-radius:50%; font-weight:900; transition:all .16s ease; }
.builder-correct-choice:has(input[type='checkbox']) span { border-radius:6px; }
.builder-correct-choice:has(input:checked) { border-color:color-mix(in srgb,var(--green) 65%,transparent); color:var(--green); background:color-mix(in srgb,var(--green) 12%,var(--surface)); }
.builder-correct-choice input:focus-visible + span { outline:2px solid var(--azure); outline-offset:3px; }
.builder-correct-choice:has(input:checked) span { border-color:var(--green); background:var(--green); color:var(--bg); }
.builder-correct-choice:hover { border-color:var(--azure); }

/* Consistent custom date picker in both color schemes, including mobile. */
.calendar-field { position:relative; min-width:0; isolation:isolate; }
.calendar-display { display:flex; align-items:center; gap:10px; width:100%; min-height:46px; padding:10px 13px;
  border:1px solid var(--border-strong); border-radius:12px; background:var(--surface); color:var(--muted); cursor:pointer;
  text-align:left; transition:background .18s ease,border-color .18s ease,box-shadow .18s ease; }
.calendar-display.selected { color:var(--text); }
.calendar-display:hover,.calendar-display[aria-expanded='true'] { border-color:var(--azure); box-shadow:0 0 0 3px color-mix(in srgb,var(--azure) 8%,transparent); }
.calendar-display svg { flex:0 0 20px; width:20px; height:20px; stroke:var(--azure); stroke-width:1.7; fill:none; stroke-linecap:round; stroke-linejoin:round; }
.calendar-display > span:nth-child(2) { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.calendar-chevron { margin-left:auto; color:var(--muted); }
.calendar-popover { position:absolute; z-index:110; top:calc(100% + 6px); left:0; width:min(360px, calc(100vw - 46px));
  padding:13px; border:1px solid var(--border-strong); border-radius:18px; background:var(--surface-2); color:var(--text);
  box-shadow:0 24px 58px rgba(0,0,0,.42); animation:calendarShow .16s ease-out; }
@keyframes calendarShow { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }
.calendar-head { display:grid; grid-template-columns:32px minmax(0,1fr) 79px 32px; gap:6px; align-items:center; }
.calendar-head button,.calendar-footer button { min-height:32px; border:0; border-radius:10px; background:transparent; color:var(--text); cursor:pointer; }
.calendar-head button { font-size:27px; line-height:1; }
.calendar-head select { min-width:0; width:100%; padding:7px 5px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text); font-size:12px; }
.calendar-head button:hover,.calendar-footer button:hover { background:color-mix(in srgb,var(--azure) 14%,transparent); }
.calendar-weekdays,.calendar-days { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); align-items:center; text-align:center; }
.calendar-weekdays { margin:15px 0 4px; color:var(--muted); font-size:10px; font-weight:800; }
.calendar-weekdays span { padding:7px 0; }
.calendar-days { gap:2px; }
.calendar-day,.calendar-blank { display:grid; place-items:center; min-height:38px; border:1px solid transparent; border-radius:10px; color:var(--text); background:transparent; font-size:13px; }
.calendar-day { cursor:pointer; }
.calendar-day:hover { background:color-mix(in srgb,var(--azure) 15%,transparent); }
.calendar-day.today { border-color:color-mix(in srgb,var(--azure) 55%,transparent); }
.calendar-day.selected { background:linear-gradient(135deg,var(--azure),var(--blue)); color:#061423; font-weight:900; }
.calendar-footer { display:flex; justify-content:space-between; margin-top:12px; padding-top:9px; border-top:1px solid var(--border); }
.calendar-footer button { color:var(--azure); font-size:12px; font-weight:750; }
:root[data-theme='light'] .calendar-popover { background:#fff; box-shadow:0 18px 45px rgba(25,49,67,.20); }
:root[data-theme='light'] .calendar-display { background:#fff; }
:root[data-theme='light'] .builder-correct-choice { background:rgba(255,255,255,.8); }
:root[data-theme='light'] .report-expanded { background:rgba(236,246,253,.72); }
@media(max-width:620px) {
 .report-expanded { padding:4px 10px 14px; }
 .report-detail-heading { align-items:flex-start; flex-direction:column; }
 .builder-answer-row { grid-template-columns:38px minmax(0,1fr); }
 .builder-answer-row > .button { grid-column:2; justify-self:start; }
 .calendar-popover { max-width:calc(100vw - 50px); }
 .calendar-day,.calendar-blank { min-height:34px; }
}
@media(prefers-reduced-motion:reduce) { .report-expanded,.calendar-popover { animation:none; } }

/* v25 — calendars take up space in the form; no overlay or clipped controls. */
.calendar-field { position:static; isolation:auto; }
.calendar-inline-slot { display:flex; width:100%; min-width:0; padding:0 0 8px; }
.calendar-inline-slot .calendar-popover {
  position:relative; inset:auto; z-index:1;
  width:min(420px,100%); max-width:100%; margin:0;
  box-shadow:0 12px 28px rgba(0,0,0,.20);
  animation:calendarShow .16s ease-out;
}
.deadline-card-main .calendar-inline-slot { width:100%; }
.auth-mode-footer { margin:12px 0 0; display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:5px; font-size:13px; color:var(--muted); }
.auth-mode-link { display:inline; padding:5px 3px; border:0; border-radius:6px; background:transparent; color:var(--azure); cursor:pointer; font:inherit; font-weight:750; text-underline-offset:3px; }
.auth-mode-link:hover { text-decoration:underline; }
.auth-mode-link:focus-visible { outline:2px solid var(--azure); outline-offset:2px; }
@media (max-width: 620px) { .calendar-inline-slot .calendar-popover { width:100%; } }

/* v25 second-block quality: visibly selected favorites and completion status. */
.topic-builder-row{display:flex;gap:8px;align-items:end;min-width:0}.topic-builder-row>.field{flex:1;min-width:0}.topic-builder-row>.button{flex-shrink:0;white-space:nowrap}
.topic-edit-row{display:flex;gap:9px;min-width:0}.topic-edit-row .input{flex:1;min-width:0}.topic-edit-row .button{flex-shrink:0}
.favorite-toggle{font-size:23px;min-width:46px;min-height:44px;transition:background .2s ease,border-color .2s ease,transform .2s ease}
.favorite-toggle.is-favorite{background:rgba(255,202,72,.19);color:#ffd166;border-color:rgba(255,202,72,.64);box-shadow:inset 0 0 0 1px rgba(255,202,72,.20)}
.favorite-toggle.is-favorite:hover{transform:scale(1.05)}
.survey-journal-card.is-unanswered{border-left:4px solid #f6b55c}
.survey-journal-card.is-completed{border-left:4px solid #5bd699}
.survey-journal-card.is-unanswered .survey-journal-title{font-weight:850}
.modal-close-button{font-size:25px;line-height:1;min-width:44px;min-height:44px;border-width:1.5px;font-weight:850}
:root[data-theme="light"] .favorite-toggle.is-favorite{background:#fff2c7;color:#805800;border-color:#b08525}
:root[data-theme="light"] .survey-journal-card.is-unanswered{border-left-color:#a96319}
@media(max-width:740px){.topic-builder-row{flex-wrap:wrap}.topic-builder-row>.button{max-width:100%}.topic-edit-row{flex-wrap:wrap}.topic-edit-row>.button{flex:1}}

.nav-btn{position:relative}.nav-unread-count{position:absolute;top:4px;right:3px;min-width:17px;min-height:17px;border-radius:99px;background:#e85c4d;color:#fff;font-size:10px;font-weight:800;display:inline-grid;place-items:center;padding:2px}.menu-unread-count{min-width:22px;height:22px;border-radius:20px;display:inline-grid;place-items:center;background:#d85d4e;color:#fff;font-size:11px;font-weight:850}

.recent-credentials{margin:16px 0 20px;padding:14px;border:1px solid var(--border-strong);border-radius:15px;background:var(--surface-elevated,rgba(25,55,73,.7));display:grid;gap:10px}.recent-credentials>.button{justify-self:start}

.user-card-button{position:relative}.account-unread-count{position:absolute;top:-5px;right:-6px;min-width:20px;min-height:20px;border-radius:99px;display:inline-grid;place-items:center;padding:3px 5px;color:white;background:#ce4d48;border:2px solid var(--bg,#091621);font-size:10px;font-weight:850;box-sizing:border-box}


/* v26: calendar opens in the document flow and never overlays the due-date card. */
form[data-builder] { align-content: start; }
form[data-builder] > .calendar-inline-slot,
[data-deadline-card] .calendar-inline-slot {
  display: block;
  position: static;
  float: none;
  clear: both;
  width: 100%;
  min-width: 0;
  height: auto;
  padding: 0;
}
form[data-builder] > .calendar-inline-slot > .calendar-popover,
[data-deadline-card] .calendar-inline-slot > .calendar-popover {
  position: static !important;
  inset: auto !important;
  z-index: auto;
  display: block;
  width: min(420px, 100%);
  height: auto;
  margin: 0;
  max-width: 100%;
}
form[data-builder] > .calendar-inline-slot > .calendar-popover { margin-left: auto; }
[data-deadline-card] .calendar-inline-slot > .calendar-popover { margin-left: 0; }
.birth-selection-hint { display: none; grid-column: 1 / -1; font-size: 12px; color: var(--azure); line-height: 1.5; }
.birth-selection-hint.visible { display: block; }
.auth-mode-footer--login { margin: 17px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; }
.auth-mode-footer--login .auth-mode-link { font-size: 12px; font-weight: 700; }
@media (max-width: 620px) {
  form[data-builder] > .calendar-inline-slot > .calendar-popover,
  [data-deadline-card] .calendar-inline-slot > .calendar-popover { width: 100%; }
}

/* v27: sign-up is an unobtrusive link BELOW the only sign-in action. */
.login-form .auth-login-heading { margin-bottom: 12px; }
.auth-mode-footer--login { gap: 4px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }
.auth-mode-footer--login .auth-mode-link { font-weight: 750; color: var(--azure); }
.app-version { display: block; width: fit-content; margin: 24px 0 0 auto; font-size: 10px; letter-spacing: .08em; color: var(--muted); opacity: .65; }

/* v28: restrained pseudonym opt-in and credential link */
.nickname-field { display:flex; flex-direction:column; gap:9px; min-width:0; }
.nickname-field > .field { width:100%; }
.nickname-visibility { display:flex; align-items:flex-start; gap:8px; font-size:12px; color:var(--muted); cursor:pointer; line-height:1.45; }
.nickname-visibility input { accent-color:var(--azure); margin:2px 0 0; flex:none; }
.credential-site-link { display:inline-flex; align-items:center; padding:2px 0; font-size:13px; font-weight:650; width:fit-content; }

/* V29: unobtrusive verification state in both themes. */
.email-verification-banner { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; font-size:0.9rem; line-height:1.5; border:1px solid var(--border, #52606b); border-radius:12px; padding:12px 14px; margin:0 0 14px; }
.email-verification-banner.verified { border-color:rgba(36,165,102,.35); background:rgba(36,165,102,.09); }
.email-verification-banner.unverified { border-color:rgba(236,176,76,.42); background:rgba(236,176,76,.09); }
.email-verification-banner .auth-mode-link { font-weight:650; }

/* V30: compact, accessible one-time-code flow and administrator mail setup. */
.verification-code-input { font-variant-numeric: tabular-nums; letter-spacing: .3em; font-size: 1.3rem; font-weight: 750; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.verify-code-form .button { min-height: 46px; }
.email-verify-inline { display:flex; gap:10px; align-items:end; flex-wrap:wrap; margin:0 0 18px; padding:12px; background:var(--surface-2); border:1px solid var(--border); border-radius:12px; }
.email-verify-inline .field { min-width:180px; flex:1 1 185px; }
.email-verify-inline .button { flex:0 0 auto; min-height:44px; }
.mail-settings-panel { margin-bottom:18px; }
.mail-settings-panel .panel-head { gap:12px; flex-wrap:wrap; }
.mail-settings-panel .panel-body { min-width:0; }
.mail-settings-panel form > .field { min-width:0; }
.mail-settings-panel form > .field input { width:100%; }
.mail-settings-actions { display:flex; gap:10px; flex-wrap:wrap; justify-content:start; }
.mail-settings-panel .panel-head > .badge.verified { color:var(--green); border-color:rgba(85,217,150,.35); }
@media(max-width:620px){ .mail-settings-actions>.button { width:100%; } .email-verify-inline>.button { width:100%; } }
.mail-settings-panel form[data-mail-active-provider="smtp"] [data-mail-provider-only="resend"],
.mail-settings-panel form[data-mail-active-provider="resend"] [data-mail-provider-only="smtp"] { display:none; }

/* V32. Registration is a single blue action UNDER the sign-in form, never a top-level tab. */
.auth-card .auth-mode-footer--login {
  margin-top: 22px; padding: 14px 0 0; border-top: 1px solid var(--border);
  font-size: 13px; line-height: 1.5; justify-content: flex-start;
}
.auth-card .auth-mode-footer--login .auth-mode-link {
  color: #42c8ee; font-size: 13px; font-weight: 850; padding: 2px 4px;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px;
  background: transparent; border: 0; box-shadow: none;
}
.auth-card .auth-mode-footer--login .auth-mode-link:hover { color: #83e2ff; }
:root[data-theme="light"] .auth-card .auth-mode-footer--login .auth-mode-link { color: #087ac8; }
:root[data-theme="light"] .auth-card .auth-mode-footer--login .auth-mode-link:hover { color: #07589e; }
.mail-setup-shortcut { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.mail-setup-shortcut svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
@media(max-width:750px) { .mail-setup-shortcut span { display: none; } .mail-setup-shortcut { min-width: 42px; justify-content: center; } }

/* V34: clear, accessible controls for recipients and email preferences. */
.recipient-selection-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.email-registration-options { display: flex; gap: 8px; flex-direction: column; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line, #dce3ee); }
.email-registration-options .choice { display: flex; align-items: center; gap: 10px; }
.email-registration-options .choice:has(input:disabled) { opacity: .55; }
.survey-email-pref { margin-bottom: 14px; }

/* V33.17 fixes */
.privacy-choice {align-self:center;min-width:0;padding:7px 10px;}
.survey-section-content {white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.65;}
.custom-answer-input {display:block;min-width:130px;margin:8px 0 0 0;}
.recipient-selection-controls {position:sticky;top:0;z-index:2;background:var(--panel, #fff);padding:8px 0;flex-wrap:wrap;}
