:root {
  --bg: #f4efe5;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-strong: #ffffff;
  --text: #17202a;
  --muted: #5d6875;
  --line: rgba(23, 32, 42, 0.1);
  --navy: #12355b;
  --blue: #2f6fed;
  --gold: #e5a823;
  --green: #17966a;
  --red: #c74444;
  --shadow: 0 20px 45px rgba(18, 53, 91, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(47, 111, 237, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(229, 168, 35, 0.22), transparent 30%),
    linear-gradient(135deg, #f5efe3 0%, #e8eef8 100%);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.login-panel,
.login-aside {
  padding: 48px;
}

.login-panel {
  background: rgba(255, 255, 255, 0.74);
}

.login-aside {
  background:
    linear-gradient(180deg, rgba(18, 53, 91, 0.92), rgba(12, 27, 51, 0.92)),
    linear-gradient(135deg, rgba(47, 111, 237, 0.25), transparent);
  color: #f7f9fc;
  display: flex;
  align-items: flex-end;
}

.brand-mark {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 24px;
}

.brand-mark.small {
  width: 30px;
  height: 30px;
  margin-bottom: 0;
  border-radius: 10px;
  font-size: 0.62rem;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.6rem;
  color: var(--muted);
}

.login-aside .eyebrow {
  color: rgba(255, 255, 255, 0.65);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1.05;
  margin-bottom: 8px;
}

.intro {
  max-width: 520px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 28px;
}

.login-form {
  display: grid;
  gap: 14px;
  max-width: 420px;
}

.login-form label {
  font-size: 0.92rem;
  font-weight: 500;
}

.login-form input {
  border: 1px solid rgba(18, 53, 91, 0.12);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  background: rgba(255, 255, 255, 0.88);
}

.login-form input:focus {
  outline: 2px solid rgba(47, 111, 237, 0.24);
  border-color: var(--blue);
}

.login-form button,
.logout-button {
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.login-form button {
  margin-top: 8px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
}

.login-form button:hover,
.logout-button:hover {
  transform: translateY(-1px);
}

.form-message {
  min-height: 24px;
  margin: 0;
  font-size: 0.92rem;
  color: var(--red);
}

.demo-hint {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.aside-card h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
  margin-bottom: 18px;
}

.feature-list {
  margin: 0;
  padding-left: 18px;
  color: rgba(255, 255, 255, 0.84);
  display: grid;
  gap: 12px;
}

.dashboard-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(47, 111, 237, 0.14), transparent 28%),
    linear-gradient(180deg, #f4efe5, #eef2f8);
}

.dashboard-layout {
  min-height: 100vh;
  display: block;
}

.sidebar {
  background: rgba(18, 53, 91, 0.98);
  color: #f6f8fb;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  width: 92px;
  height: 100vh;
  z-index: 20;
  overflow: hidden;
}

.brand-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
  text-align: center;
}

.sidebar-title,
.sidebar-subtitle {
  margin: 0;
}

.sidebar-title {
  font-weight: 700;
  font-size: 0.44rem;
}

.sidebar-subtitle {
  font-size: 0.4rem;
  color: rgba(255, 255, 255, 0.7);
}

.sidebar-nav {
  display: grid;
  gap: 3px;
}

.sidebar-nav a {
  color: rgba(255, 255, 255, 0.76);
  text-decoration: none;
  padding: 5px 3px;
  border-radius: 8px;
  font-size: 0.55rem;
  display: grid;
  justify-items: center;
  gap: 3px;
  text-align: center;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.nav-icon {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 700;
  font-size: 0.5rem;
}

.logout-button {
  background: #fff;
  color: var(--navy);
  padding: 6px 4px;
  border-radius: 8px;
  font-size: 0.55rem;
  width: 100%;
  align-self: stretch;
}

.content {
  padding: 32px;
  margin-left: 92px;
  width: calc(100% - 92px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 14px;
}

.admin-badge {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--muted);
}

.stats-grid,
.panel-grid {
  display: grid;
  gap: 20px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  margin-bottom: 20px;
}

.stat-card,
.panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.stat-card p,
.stat-card span,
.panel-tag,
th {
  color: var(--muted);
}

.stat-card h2 {
  margin: 12px 0 8px;
  font-size: clamp(1.6rem, 2.4vw, 2rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.accent-blue {
  border-top: 5px solid var(--blue);
}

.accent-gold {
  border-top: 5px solid var(--gold);
}

.accent-green {
  border-top: 5px solid var(--green);
}

.accent-red {
  border-top: 5px solid var(--red);
}

.panel-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
}

.large-panel {
  grid-row: span 2;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.video-preview-card {
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(244, 239, 229, 0.7), rgba(255, 255, 255, 0.72));
  border: 1px solid rgba(18, 53, 91, 0.08);
}

.video-title-group {
  max-width: 420px;
}

.video-preview-head h4 {
  margin: 0;
  font-size: 1.05rem;
}

.video-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.video-caption {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.video-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.media-launchers {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.media-launch-button {
  min-width: 170px;
}

.video-nav-button {
  border: 1px solid rgba(18, 53, 91, 0.1);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.video-nav-button:hover {
  background: rgba(47, 111, 237, 0.08);
  transform: translateY(-1px);
}

.video-counter {
  color: var(--muted);
  font-weight: 700;
  min-width: 48px;
  text-align: center;
}

.video-player-shell {
  max-width: 760px;
  margin: 0 auto;
}

.video-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 320px;
  border-radius: 18px;
  background: #000;
  display: block;
  box-shadow: 0 16px 32px rgba(12, 27, 51, 0.14);
}

.media-modal {
  width: min(1100px, calc(100vw - 32px));
}

.media-stage {
  display: grid;
  place-items: center;
  margin-bottom: 18px;
}

.media-player,
.media-image {
  width: min(900px, 100%);
  border-radius: 20px;
  background: #000;
  display: block;
  box-shadow: 0 16px 32px rgba(12, 27, 51, 0.14);
}

.media-player {
  aspect-ratio: 16 / 9;
  max-height: 520px;
}

.media-image {
  background: #fff;
  max-height: 70vh;
  object-fit: contain;
}

.media-modal-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.header-action {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--gold), #f4bf44);
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.table-wrap {
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.72);
}

.table-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

.sample-button {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(18, 53, 91, 0.1);
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sample-button:hover {
  background: rgba(47, 111, 237, 0.16);
}

thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}

.table-tools input {
  width: 100%;
  border: 1px solid rgba(18, 53, 91, 0.12);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.9);
}

.table-tools input:focus {
  outline: 2px solid rgba(47, 111, 237, 0.22);
  border-color: var(--blue);
}

.search-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.alert-list,
.trend-list {
  display: grid;
  gap: 14px;
}

.alert-item {
  padding: 14px;
  border-radius: 18px;
  background: rgba(244, 239, 229, 0.85);
}

.alert-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

.pdf-link {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.pdf-link:hover {
  opacity: 0.92;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 27, 51, 0.5);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 40;
}

.sample-modal {
  width: min(1220px, calc(100vw - 32px));
  background: #fff;
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 26px 60px rgba(12, 27, 51, 0.24);
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-close {
  border: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(18, 53, 91, 0.08);
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.modal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.modal-stat {
  padding: 18px;
  border-radius: 18px;
  background: rgba(244, 239, 229, 0.72);
}

.modal-stat span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.modal-stat strong {
  font-size: 1.3rem;
}

.input-stat {
  display: grid;
  gap: 8px;
  align-content: start;
}

.summary-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.modal-details {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.modal-details p {
  margin: 0;
  color: var(--muted);
}

.modal-details strong {
  color: var(--text);
}

.modal-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.control-card,
.modal-section {
  padding: 18px;
  border-radius: 20px;
  background: rgba(244, 239, 229, 0.56);
}

.control-card {
  display: grid;
  gap: 10px;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
}

.check-option input {
  width: 16px;
  height: 16px;
}

.control-note {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.selection-preview {
  margin: 0;
  color: var(--navy);
  font-weight: 700;
  line-height: 1.5;
}

.modal-section {
  margin-bottom: 20px;
}

.section-label {
  margin: 0 0 10px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.calculation-note {
  margin: 0 0 12px;
  color: var(--muted);
}

.calculation-example {
  margin: 4px 0 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.example-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.example-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 520px;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.example-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(244, 239, 229, 0.7);
}

.example-cycle {
  margin: 0 0 10px;
  color: var(--navy);
  font-weight: 700;
}

.example-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--text);
}

.example-empty {
  margin: 0;
  color: var(--muted);
}

.calc-table-wrap {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow-x: visible;
  overflow-y: auto;
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.calc-table th,
.calc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.96rem;
  word-break: break-word;
}

.count-field {
  width: 100%;
  min-width: 110px;
  border: 1px solid rgba(18, 53, 91, 0.16);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 18px 12px;
}

.calc-table thead th {
  position: static;
  background: #f8fafc;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.trend-row {
  display: grid;
  grid-template-columns: 72px 1fr 46px;
  gap: 12px;
  align-items: center;
}

.bar {
  height: 12px;
  background: rgba(18, 53, 91, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.bar div {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--blue));
}

@media (max-width: 980px) {
  .login-shell,
  .stats-grid,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .login-aside {
    min-height: 260px;
  }

  .large-panel {
    grid-row: auto;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
  }

  .content {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .login-panel,
  .login-aside,
  .content,
  .sidebar {
    padding: 22px;
  }

  .topbar {
    flex-direction: column;
  }

  .trend-row {
    grid-template-columns: 1fr;
  }

  .modal-summary {
    grid-template-columns: 1fr;
  }

  .modal-control-grid {
    grid-template-columns: 1fr;
  }

  .example-head,
  .example-grid {
    grid-template-columns: 1fr;
  }

  .example-head {
    display: grid;
  }

  .sample-modal {
    width: min(100%, calc(100vw - 16px));
    padding: 18px;
  }

  .calc-table-wrap {
    overflow: auto;
  }

  .modal-footer {
    justify-content: stretch;
  }

  .modal-footer .pdf-link {
    width: 100%;
    text-align: center;
  }

  .video-preview-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .video-controls {
    justify-content: flex-start;
  }

  .video-player-shell {
    max-width: 100%;
  }

  .media-launchers {
    width: 100%;
  }

  .media-launch-button {
    width: 100%;
  }
}
