:root {
  --black-6: #101820;
  --bright-red: #ff321f;
  --pantone-421: #b7bbb8;
  --pantone-4195: #5f6364;
  --pantone-1365: #ffb549;
  --bg: #f3f4f2;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --ink: var(--black-6);
  --muted: #646969;
  --line: #d4d7d4;
  --brand: var(--bright-red);
  --brand-dark: #d92718;
  --accent: var(--pantone-1365);
  --danger: #d92718;
  --ok-bg: #eef5ef;
  --ok: #17633c;
  --off-bg: #eceeed;
  --off: var(--pantone-4195);
  --shadow: 0 18px 42px rgba(16, 24, 32, .10);
  --footer-height: 28px;
  --powerbi-bottom-chrome-height: 68px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; width: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); padding-bottom: var(--footer-height); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.site-footer {
  align-items: center;
  background: var(--black-6);
  border-top: 1px solid rgba(255, 255, 255, .08);
  bottom: 0;
  color: rgba(255, 255, 255, .74);
  display: flex;
  font-size: 11px;
  font-weight: 800;
  height: var(--footer-height);
  justify-content: center;
  left: 0;
  letter-spacing: .04em;
  position: fixed;
  right: 0;
  text-align: center;
  width: 100%;
  z-index: 50;
}

.topbar {
  align-items: center;
  background: var(--black-6);
  border-bottom: 3px solid var(--bright-red);
  box-shadow: 0 12px 30px rgba(16, 24, 32, .18);
  color: white;
  display: flex;
  gap: 20px;
  min-height: 64px;
  padding: 0 28px;
}

.brand {
  align-items: flex-start;
  color: white;
  display: inline-grid;
  gap: 0;
  line-height: 1;
  min-width: 150px;
}
.brand-logo {
  display: block;
  height: auto;
  width: 150px;
}
.brand-subtitle {
  color: rgba(255, 255, 255, .72);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .32em;
  line-height: 1;
  margin-left: 2px;
  margin-top: 7px;
}
.nav { display: flex; flex: 1; gap: 14px; }
.nav a {
  color: rgba(255, 255, 255, .72);
  font-size: 14px;
  font-weight: 800;
  position: relative;
}
.nav a:hover { color: white; }
.nav a.active {
  color: white;
}
.nav a.active::after {
  background: linear-gradient(90deg, var(--bright-red), var(--accent));
  border-radius: 999px;
  bottom: -9px;
  content: "";
  height: 3px;
  left: 0;
  position: absolute;
  right: 0;
}

.page { margin: 0 auto; max-width: 1180px; padding: 32px 24px 56px; }
.page.narrow { max-width: 720px; }
.page-title { align-items: center; display: flex; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-title h1, .login-panel h1, .dashboard-title h1 { margin: 0; }
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 900; letter-spacing: .06em; margin: 0 0 6px; text-transform: uppercase; }
.muted { color: var(--muted); }

.login-shell {
  align-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 181, 73, .32), transparent 28%),
    radial-gradient(circle at 82% 26%, rgba(255, 50, 31, .28), transparent 30%),
    linear-gradient(135deg, #101820 0%, #252b2d 58%, #5f6364 100%);
  display: flex;
  justify-content: center;
  min-height: calc(100vh - var(--footer-height));
  overflow: hidden;
  padding: 24px;
  position: relative;
}
.login-shell::before,
.login-shell::after {
  animation: floatGlow 12s ease-in-out infinite alternate;
  border-radius: 999px;
  content: "";
  filter: blur(2px);
  opacity: .85;
  position: absolute;
  z-index: 0;
}
.hero-particles {
  z-index: 1;
}
.login-shell::before {
  background: linear-gradient(135deg, rgba(255, 50, 31, .45), rgba(255, 181, 73, .36));
  height: 320px;
  left: -120px;
  top: 12%;
  width: 320px;
}
.login-shell::after {
  animation-delay: -4s;
  background: linear-gradient(135deg, rgba(183, 187, 184, .24), rgba(255, 181, 73, .32));
  bottom: -140px;
  height: 360px;
  right: -120px;
  width: 360px;
}
.login-panel, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}
.login-panel {
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, .94);
  border-color: rgba(255, 255, 255, .52);
  max-width: 440px;
  position: relative;
  width: 100%;
  z-index: 2;
}
.login-brand {
  color: var(--black-6);
  display: inline-grid;
  margin-bottom: 26px;
}
.login-brand .brand-logo {
  width: 220px;
}
.login-brand .brand-subtitle {
  color: var(--pantone-4195);
  font-size: 11px;
  letter-spacing: .38em;
  margin-left: 4px;
  margin-top: 11px;
}

.stack { display: grid; gap: 16px; }
label { color: var(--ink); display: grid; font-size: 14px; font-weight: 700; gap: 8px; }
input, select, textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--bright-red);
  box-shadow: 0 0 0 3px rgba(255, 181, 73, .35);
  outline: none;
}
textarea { resize: vertical; }
.check { align-items: center; display: flex; gap: 10px; }
.check input { min-height: auto; width: auto; }

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
}
.button.primary { background: var(--brand); color: white; }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { background: white; border-color: var(--pantone-421); color: var(--ink); }
.button.secondary:hover { border-color: var(--pantone-4195); }
.button.danger { background: #fff1ef; border-color: #ffb2aa; color: var(--danger); }
.button.danger.solid { background: var(--danger); border-color: var(--danger); color: white; }
.button.danger.solid:hover { background: #b82015; border-color: #b82015; }
.topbar .button.secondary { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); color: white; }
.topbar .button.secondary:hover { background: rgba(255,255,255,.14); }
.button.full { width: 100%; }
.button.icon {
  min-width: 38px;
  padding: 9px;
}
.button.icon svg {
  display: block;
}
.auth-link {
  color: var(--pantone-4195);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}
.auth-link:hover {
  color: var(--bright-red);
}
.turnstile-widget {
  display: block;
  min-height: 65px;
  width: 100%;
}
.turnstile-widget .cf-turnstile {
  width: 100%;
}
.actions { align-items: center; display: flex; gap: 8px; justify-content: flex-end; }
.actions-cell { text-align: right; white-space: nowrap; width: 1%; }
.actions-cell form { display: inline; margin: 0; }

.pagination {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 14px;
}
.pagination-summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.pagination-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.pagination-link {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  min-height: 34px;
  padding: 7px 10px;
}
.pagination-link.active {
  background: var(--black-6);
  border-color: var(--black-6);
  color: white;
}

.modal-open {
  overflow: hidden;
}
.confirm-overlay {
  align-items: center;
  background: rgba(16, 24, 32, .58);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 100;
}
.confirm-dialog {
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid rgba(16, 24, 32, .08);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(16, 24, 32, .28);
  display: grid;
  gap: 16px;
  grid-template-columns: auto 1fr;
  max-width: 480px;
  padding: 22px;
  width: min(100%, 480px);
}
.confirm-icon {
  align-items: center;
  background: #fff1ef;
  border: 1px solid #ffb2aa;
  border-radius: 999px;
  color: var(--danger);
  display: flex;
  font-size: 18px;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  width: 36px;
}
.confirm-copy h2 {
  font-size: 18px;
  margin: 0 0 8px;
}
.confirm-copy p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.alert { background: #fff1ef; border: 1px solid #ffb2aa; border-radius: 6px; color: #b82114; padding: 10px 12px; }
.notice { background: #fff8e8; border: 1px solid #ffd18a; border-radius: 6px; color: #785215; padding: 10px 12px; }
.badge { border-radius: 999px; display: inline-flex; font-size: 12px; font-weight: 800; padding: 4px 9px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--off-bg); color: var(--off); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip, .category-filter a {
  background: #fff8e8;
  border: 1px solid #ffd18a;
  border-radius: 6px;
  color: #785215;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 9px;
}
.tag-chip {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .42);
}
.tag-tone-1 { background: #fff2d8; border-color: #ffc86c; color: #6c4509; }
.tag-tone-2 { background: #ffe7e3; border-color: #ffb5aa; color: #8b2419; }
.tag-tone-3 { background: #eceeed; border-color: #c9cecb; color: #3f4545; }
.tag-tone-4 { background: #eef5ef; border-color: #bfd8c8; color: #17633c; }
.tag-tone-5 { background: #f2edf8; border-color: #d4c2e8; color: #563875; }
.card .tag-row {
  gap: 9px;
  padding-right: 54px;
}
.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 18px;
}
.category-filter a { background: white; color: var(--pantone-4195); }
.category-filter a.active {
  background: var(--pantone-1365);
  border-color: var(--pantone-1365);
  color: var(--black-6);
}
.tag-editor {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  padding: 8px;
}
.tag-editor:focus-within {
  border-color: var(--bright-red);
  box-shadow: 0 0 0 3px rgba(255, 181, 73, .35);
}
.tag-editor input {
  border: 0;
  box-shadow: none;
  min-height: 28px;
  padding: 2px;
}
.tag-editor input:focus {
  box-shadow: none;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-token {
  background: var(--pantone-1365);
  border: 0;
  border-radius: 4px;
  color: var(--black-6);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 8px;
}
.category-selector {
  display: grid;
  gap: 10px;
}
.category-selector-head h2 {
  font-size: 16px;
  margin: 0;
}
.tag-section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  margin: 0;
  text-transform: uppercase;
}
.tag-suggestions {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  padding: 10px;
}
.tag-suggestion {
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--pantone-4195);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 9px;
}
.tag-suggestion.is-selected {
  background: var(--pantone-4195);
  border-color: var(--pantone-4195);
  color: white;
}

.metric-grid, .card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.metric, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}
.metric { border-top: 4px solid var(--accent); }
.card { min-height: 154px; position: relative; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.card:hover {
  border-color: var(--bright-red);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.metric strong { display: block; font-size: 34px; }
.metric span, .card p { color: var(--muted); }
.card h2 { margin: 16px 0 8px; }
.new-ribbon {
  background: var(--pantone-1365);
  border: 1px solid rgba(16, 24, 32, .08);
  border-radius: 4px;
  color: var(--black-6);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1;
  padding: 4px 7px;
  position: absolute;
  right: 12px;
  top: 12px;
}

.account-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, .75fr) minmax(420px, 1.4fr);
}
.account-summary {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 84px;
}
.account-summary h2 {
  margin: 0 0 6px;
}
.account-summary p {
  margin: 0 0 4px;
}
.account-forms {
  display: grid;
  gap: 18px;
}
.account-forms h2 {
  font-size: 20px;
  margin: 0;
}
.profile-avatar {
  align-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(16, 24, 32, .08);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .34);
  color: white;
  display: flex;
  font-size: clamp(42px, 9vw, 74px);
  font-weight: 900;
  justify-content: center;
  line-height: 1;
  max-width: 220px;
  overflow: hidden;
  text-shadow: 0 3px 14px rgba(16, 24, 32, .32);
  width: 100%;
}
.profile-avatar img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}
.profile-avatar.has-image {
  background: var(--panel-soft);
  box-shadow: none;
  text-shadow: none;
}
.admin-profile-avatar {
  font-size: 42px;
  max-width: 120px;
}

.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.filter-panel {
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, .9fr) minmax(260px, 1.25fr) max-content;
  margin-bottom: 14px;
  padding: 12px;
}
.filter-panel label {
  font-size: 12px;
  gap: 5px;
}
.filter-panel select {
  min-height: 38px;
  padding: 8px 10px;
}
.filter-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}
.filter-actions .button {
  min-height: 38px;
  padding: 8px 12px;
}
table { border-collapse: collapse; min-width: 760px; table-layout: auto; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 14px 16px; text-align: left; vertical-align: middle; }
th { background: #eceeed; color: var(--pantone-4195); font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf5ee; }

.split { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 18px; }
.assignment-row { align-items: center; border-top: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; padding: 12px 0; }
.access-section {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 14px;
  padding-top: 18px;
}
.access-section h2 {
  font-size: 18px;
  margin: 0 0 4px;
}
.access-section p {
  margin: 0;
}
.check-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.check-option {
  align-items: flex-start;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  min-height: 72px;
  padding: 12px;
}
.check-option input {
  margin-top: 3px;
  min-height: auto;
  width: auto;
}
.check-option span {
  display: grid;
  gap: 3px;
}
.check-option small {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
}
.check-option.is-hidden {
  display: none;
}

.dashboard-page {
  background: var(--black-6);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--footer-height));
  min-height: calc(100vh - var(--footer-height));
  overflow: hidden;
  width: 100%;
}
.dashboard-title { align-items: center; background: var(--black-6); border-bottom: 3px solid var(--bright-red); color: white; display: flex; flex: 0 0 auto; justify-content: space-between; padding: 14px 24px; }
.dashboard-title .muted { color: rgba(255,255,255,.72); }
.powerbi-frame-host {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}
.powerbi-frame {
  border: 0;
  display: block;
  flex: 1 1 auto;
  height: calc(100% + var(--powerbi-bottom-chrome-height));
  margin-bottom: calc(-1 * var(--powerbi-bottom-chrome-height));
  min-height: 0;
  width: 100%;
}

@keyframes floatGlow {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(42px, -28px, 0) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell::before,
  .login-shell::after,
  .card {
    animation: none;
    transition: none;
  }
}

@media (max-width: 720px) {
  .topbar { align-items: stretch; flex-direction: column; gap: 12px; padding: 16px; }
  .nav, .actions, .page-title, .dashboard-title { align-items: stretch; flex-direction: column; }
  .account-layout { grid-template-columns: 1fr; }
  .account-summary { position: static; }
  .filter-panel { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination-links { justify-content: flex-start; }
}
