:root {
  --page-bg: #d8e6f2;
  --panel-bg: rgba(252, 254, 255, 0.9);
  --panel-strong: #ffffff;
  --line: #9fb9d4;
  --line-soft: rgba(31, 52, 84, 0.12);
  --ink: #112039;
  --muted: #506784;
  --accent: #19224c;
  --primary: #1b1d59;
  --brand-blue: #59abe2;
  --brand-blue-soft: #cfeafd;
  --brand-blue-strong: #3290d6;
  --brand-ice: #f1f9ff;
  --brand-shadow: rgba(21, 35, 75, 0.18);
  --general-row: #ffffff;
  --secondary-row: #ffe97a;
  --current-row: #70ff38;
  --next-row: #d8ffb2;
  --comment-row: #050505;
  --comment-ink: #ffffff;
  --past-row: #747b85;
  --past-ink: #ffffff;
  --keyer-pink: #ff4dc4;
  --gpi-start: #ff8a88;
  --gpi-end: #7ab6ff;
  --gpi-bstart: #ffb36d;
  --gpi-bend: #6e8fff;
  --gpi-medium: #dce4ef;
  --row-height: 34px;
  --table-font-size: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 26%),
    radial-gradient(circle at 88% 0%, rgba(89, 171, 226, 0.3), transparent 28%),
    linear-gradient(180deg, #eff7fd 0%, #d6e6f3 48%, #cbdced 100%);
  color: var(--ink);
  font-family: "Bahnschrift", "Malgun Gothic", "Segoe UI", sans-serif;
}

.layout {
  width: min(1900px, calc(100vw - 32px));
  margin: 16px auto;
  display: grid;
  gap: 16px;
}

.hero,
.toolbar,
.summary-card,
.board,
.settings-panel,
.login-card {
  backdrop-filter: blur(14px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 14%, rgba(89, 171, 226, 0.36), transparent 24%),
    linear-gradient(140deg, rgba(26, 29, 88, 0.98), rgba(20, 44, 90, 0.96) 54%, rgba(44, 120, 181, 0.88));
  color: #f7fbff;
  box-shadow: 0 24px 64px var(--brand-shadow);
  overflow: hidden;
}

.hero-copy h1 {
  margin: 8px 0 10px;
  font-size: clamp(30px, 3.8vw, 42px);
  line-height: 1.02;
}

.hero-copy p {
  margin: 4px 0 0;
  max-width: 820px;
  color: rgba(247, 251, 255, 0.82);
}

.hero-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(245, 251, 255, 0.16);
  border: 1px solid rgba(207, 234, 253, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  flex: 0 0 auto;
}

.brand-badge-mark {
  display: block;
  width: 34px;
  height: auto;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.8;
}

.toolbar {
  position: relative;
  z-index: 15;
  display: grid;
  grid-template-columns: minmax(360px, 1.3fr) minmax(340px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.filters,
.summary-grid {
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--panel-bg);
  box-shadow: 0 16px 40px rgba(30, 51, 79, 0.12);
  min-height: 104px;
}

.filters {
  position: relative;
  z-index: 16;
  overflow: visible;
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.date-filter {
  position: relative;
  z-index: 17;
}

.filters label,
.settings-form label,
.login-form label {
  display: grid;
  gap: 6px;
}

.filters label span,
.settings-form label span,
.login-form label span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

select,
input,
textarea,
button,
.secondary-link,
.ghost-button,
.button-link {
  font: inherit;
}

select,
input,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.45;
}

button,
.secondary-link,
.ghost-button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
}

.primary-button,
.login-form button {
  background: linear-gradient(180deg, #23327f, #151b59);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(27, 29, 89, 0.22);
}

.secondary-link,
.button-link {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 255, 0.96));
  color: var(--accent);
  border-color: rgba(89, 171, 226, 0.42);
  font-weight: 800;
}

button:disabled,
.secondary-link:disabled {
  cursor: wait;
  opacity: 0.68;
}

.ghost-button,
.icon-button {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(207, 234, 253, 0.22);
  color: #ffffff;
}

.icon-button {
  width: 46px;
  min-width: 46px;
  padding: 0;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.settings-panel .icon-button {
  background: rgba(89, 171, 226, 0.12);
  border-color: rgba(89, 171, 226, 0.24);
  color: var(--accent);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 12px;
  align-content: stretch;
}

.summary-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(237, 247, 255, 0.84));
  border: 1px solid rgba(89, 171, 226, 0.14);
}

.summary-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 0;
}

.summary-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.summary-card strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
  word-break: break-word;
}

.summary-value {
  display: flex;
  align-items: center;
  min-height: 28px;
}

.summary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(89, 171, 226, 0.12);
  color: var(--brand-blue-strong);
  flex: 0 0 auto;
}

.summary-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.board {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 22px 56px rgba(33, 55, 86, 0.16);
}

.table-scroll {
  max-height: calc(100vh - 275px);
  overflow: auto;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--table-font-size);
}

.board-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, #eef7ff 0%, #d6e7f5 100%);
  color: #1f3154;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: calc(var(--table-font-size) - 1px);
}

.board-table th,
.board-table td {
  height: var(--row-height);
  min-height: var(--row-height);
  padding: 6px 10px;
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 rgba(42, 58, 82, 0.08);
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
  background-clip: padding-box;
}

.board-table tbody tr {
  background: var(--general-row);
}

.board-table tbody tr.event-secondary {
  background: var(--secondary-row);
}

.board-table tbody tr.event-current {
  background: var(--current-row);
}

.board-table tbody tr.event-next {
  background: var(--next-row);
}

.board-table tbody tr.event-comment {
  background: var(--comment-row);
  color: var(--comment-ink);
}

.board-table tbody tr.event-past {
  background: var(--past-row);
  color: var(--past-ink);
}

.board-table tbody tr.event-comment td,
.board-table tbody tr.event-past td {
  color: inherit;
}

.cell-title {
  max-width: 440px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  border-bottom: 0 !important;
  box-shadow: inset 0 -1px 0 rgba(42, 58, 82, 0.08) !important;
  background-image: none;
  outline: none;
}

.cell-title,
.cell-title * {
  text-decoration: none !important;
}

.cell-keyer {
  color: var(--keyer-pink);
  font-weight: 800;
}

.cell-video-live,
.cell-type-unknown {
  background: rgba(255, 77, 196, 0.2);
  color: #7a124f;
  font-weight: 800;
}

.gpi-cell {
  font-weight: 800;
}

.gpi-start {
  background: var(--gpi-start);
}

.gpi-end {
  background: var(--gpi-end);
}

.gpi-bstart {
  background: var(--gpi-bstart);
}

.gpi-bend {
  background: var(--gpi-bend);
  color: #ffffff;
}

.gpi-medium {
  background: var(--gpi-medium);
}

.empty {
  margin: 0;
  padding: 24px;
  color: var(--muted);
}

.settings-drawer {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 20;
}

.settings-drawer.is-open {
  display: block;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 15, 26, 0.46);
}

.settings-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(680px, 100vw);
  height: 100%;
  padding: 24px;
  background: linear-gradient(180deg, rgba(246, 251, 255, 0.99), rgba(227, 239, 250, 0.99));
  border-left: 1px solid rgba(20, 32, 49, 0.12);
  box-shadow: -18px 0 48px rgba(20, 32, 49, 0.16);
  overflow: auto;
}

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

.settings-head h2 {
  margin: 8px 0 0;
  font-size: 28px;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.settings-tab {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(89, 171, 226, 0.22);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-weight: 800;
}

.settings-tab.is-active {
  background: linear-gradient(180deg, #23327f, #151b59);
  border-color: rgba(35, 50, 127, 0.45);
  color: #ffffff;
}

.settings-tab-panel {
  display: none;
}

.settings-tab-panel.is-active {
  display: block;
}

.settings-form small {
  color: var(--muted);
}

.settings-subsection,
.api-account-browser {
  padding: 16px;
  border: 1px solid rgba(89, 171, 226, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.64);
}

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

.subsection-head.compact {
  margin-bottom: 10px;
}

.subsection-head h3,
.subsection-head h4 {
  margin: 6px 0 0;
  color: var(--ink);
}

.subsection-head h3 {
  font-size: 18px;
}

.subsection-head h4 {
  font-size: 15px;
}

.eyebrow-muted {
  color: var(--muted);
  opacity: 1;
}

.api-settings-layout {
  display: grid;
  gap: 16px;
}

.api-account-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.api-account-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(89, 171, 226, 0.18);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  cursor: pointer;
}

.api-account-list-item.is-active {
  border-color: rgba(35, 50, 127, 0.42);
  background: linear-gradient(180deg, rgba(35, 50, 127, 0.12), rgba(255, 255, 255, 0.92));
}

.api-account-list-copy {
  display: grid;
  gap: 2px;
  text-align: left;
}

.api-account-list-copy strong {
  font-size: 14px;
}

.api-account-list-copy span {
  font-size: 12px;
  color: var(--muted);
}

.api-account-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(89, 171, 226, 0.12);
  color: var(--brand-blue-strong);
  font-size: 12px;
  font-weight: 800;
}

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

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.checkbox-grid-channels {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 220px;
  overflow: auto;
}

.checkbox-card {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(89, 171, 226, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

.checkbox-card input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  box-shadow: none;
}

.checkbox-card span {
  color: inherit !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

.api-settings-form textarea {
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 12px;
}

.inline-metrics {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.date-picker-inline {
  display: grid;
  grid-template-columns: 42px minmax(140px, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.calendar-toggle {
  width: 100%;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  border-color: var(--line);
  font-weight: 700;
}

.date-nav-button {
  min-width: 42px;
  padding: 0;
  background: rgba(89, 171, 226, 0.12);
  color: var(--accent);
  border-color: rgba(89, 171, 226, 0.24);
  font-weight: 800;
}

.refresh-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.calendar-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 60;
  width: min(320px, calc(100vw - 48px));
  padding: 14px;
  border: 1px solid rgba(89, 171, 226, 0.24);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(241, 249, 255, 0.98));
  box-shadow: 0 24px 52px rgba(21, 37, 72, 0.2);
}

.calendar-header {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-header strong {
  text-align: center;
  font-size: 14px;
}

.calendar-month-nav {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  background: rgba(89, 171, 226, 0.12);
  color: var(--accent);
  border-color: rgba(89, 171, 226, 0.24);
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 8px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.calendar-day {
  min-width: 0;
  min-height: 38px;
  padding: 0;
  border: 1px solid rgba(89, 171, 226, 0.14);
  border-radius: 10px;
  background: rgba(248, 252, 255, 0.98);
  color: var(--ink);
  font-weight: 700;
}

.calendar-day-filler {
  min-height: 38px;
}

.calendar-day.has-schedule {
  color: var(--keyer-pink);
  border-color: rgba(255, 77, 196, 0.24);
  background: rgba(255, 77, 196, 0.08);
}

.calendar-day.is-selected {
  background: linear-gradient(180deg, #23327f, #1b1d59);
  color: #ffffff;
  border-color: #1b1d59;
}

.calendar-day.is-selected.has-schedule {
  background: linear-gradient(180deg, #23327f, #4d1742);
  color: #ffffff;
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 2px rgba(112, 255, 56, 0.7);
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(89, 171, 226, 0.2);
  border-radius: 10px;
  background: rgba(89, 171, 226, 0.08);
  font-size: 13px;
}

.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.danger-button {
  border-color: rgba(181, 33, 71, 0.28);
  color: #8b2948;
}

.settings-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 12px;
  color: #ffffff;
  box-shadow: 0 18px 40px rgba(16, 25, 37, 0.22);
  transform: translateY(0);
  opacity: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-success {
  background: linear-gradient(180deg, #193a20, #27612f);
}

.toast-error {
  background: linear-gradient(180deg, #5a1a2f, #8b2948);
}

.toast-info {
  background: linear-gradient(180deg, #23327f, #1b1d59);
}

.toast.is-hiding {
  opacity: 0;
  transform: translateY(8px);
}

.login-page {
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(520px, calc(100vw - 24px));
  padding: 40px 0;
}

.login-card {
  padding: 28px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(241, 249, 255, 0.92));
  border: 1px solid var(--line-soft);
  box-shadow: 0 24px 64px rgba(31, 46, 69, 0.18);
}

.login-brand {
  margin-bottom: 14px;
}

.login-brand-badge {
  background: rgba(27, 29, 89, 0.94);
  border-color: rgba(89, 171, 226, 0.24);
}

.login-head h1 {
  margin: 8px 0 10px;
  font-size: 30px;
}

.login-head p {
  margin: 0 0 20px;
  color: var(--muted);
}

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

.login-error {
  margin: 0;
  color: #b52147;
  font-weight: 700;
}

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

@media (max-width: 720px) {
  .layout {
    width: min(100vw - 16px, 100%);
    margin: 8px auto 16px;
  }

  .hero {
    flex-direction: column;
  }

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

  .inline-metrics {
    grid-template-columns: 1fr;
  }

  .settings-nav,
  .toggle-row,
  .checkbox-grid,
  .checkbox-grid-channels {
    grid-template-columns: 1fr;
  }

  .refresh-actions {
    width: 100%;
  }

  .calendar-popover {
    width: min(100%, calc(100vw - 32px));
  }

  .table-scroll {
    max-height: calc(100vh - 320px);
  }
}
