:root {
  --sidebar-bg: #030507;
  --sidebar-text: #f4f6f9;
  --sidebar-muted: #b7bec8;
  --sidebar-active: #2b3139;
  --canvas-bg: #eef1f5;
  --panel-bg: #ffffff;
  --panel-border: #d9dee6;
  --heading: #072a53;
  --muted: #73839a;
  --text-strong: rgb(4, 34, 63);
  --radius-sm: 4px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Rubik", "Helvetica Neue", Arial, sans-serif;
  background: var(--canvas-bg);
  color: #142237;
}

body.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f9fcff;
}

.login-card {
  width: min(420px, 92vw);
  background: #fff;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(10, 30, 60, 0.08);
}

.login-title {
  margin: 0 0 18px;
  color: var(--text-strong);
  font-size: 2rem;
  font-weight: 700;
}

.error-text {
  color: #b02a37;
  font-size: 0.92rem;
  margin-top: 10px;
  min-height: 1.4rem;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 150px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  border-right: 1px solid #161b22;
}

.sidebar-brand {
  height: 82px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid #151a21;
}

.sidebar-brand a {
  color: #ffffff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  width: 100%;
}

.sidebar-brand-logo {
  display: block;
  width: 92px;
  max-width: 100%;
  height: auto;
}

.sidebar-nav {
  padding: 10px 0;
}

.sidebar-nav:first-of-type {
  flex: 1;
}

.sidebar-nav-secondary {
  padding-top: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 12px 10px;
  font-size: 15px;
  font-weight: 500;
}

.sidebar-link i {
  font-size: 14px;
  width: 14px;
  text-align: center;
}

.sidebar-link span {
  white-space: nowrap;
  font-weight: 400;
}

.sidebar-link:hover {
  color: #ffffff;
  background: #121820;
}

.sidebar-link.active {
  background: #31383d;
}

.sidebar-sublink {
  display: flex;
  align-items: center;
  color: var(--sidebar-muted);
  text-decoration: none;
  padding: 8px 10px 8px 34px;
  font-size: 13px;
  font-weight: 400;
}

.sidebar-sublink:hover {
  color: #ffffff;
  background: #121820;
}

.sidebar-sublink.active {
  color: #ffffff;
  background: #1f262d;
}

.sidebar-divider {
  height: 1px;
  margin: 8px 8px;
  background: #39414b;
}

.sidebar-footer {
  padding: 0 0 10px;
}

.sidebar-link-button {
  width: 100%;
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.content-area {
  margin-left: 128px;
  width: calc(100% - 128px);
  padding: 30px 36px;
  background: #f9fcff;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.breadcrumbs {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 8px;
}

.page-title {
  margin: 0;
  font-size: 2.8rem;
  line-height: 1.1;
  color: var(--text-strong);
  letter-spacing: -0.5px;
  font-weight: 700;
}

.page-header-right {
  min-width: 450px;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 18px;
}

.panel-lg {
  padding: 22px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto auto;
  gap: 18px;
  align-items: center;
}

.summary-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}

.summary-value {
  color: #1c3350;
  font-size: 14px;
  font-weight: 700;
}


.dashboard-card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--panel-border);
}

.dashboard-card-body {
  padding: 20px;
}

.modules-card {
  border-radius: 2px;
}

.modules-header {
  padding: 10px 16px;
}

.modules-title {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.1;
  color: rgb(79, 100, 121);
  font-weight: 700;
}

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

.module-tile {
  position: relative;
  min-height: 285px;
  background: #ffffff;
  border: 1px solid #e0e4ea;
  border-radius: 4px;
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
}

.module-hit-area {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 4px;
}

.selection-panel {
  padding: 14px 16px;
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.selection-panel-message {
  margin: 0;
  color: rgb(79, 100, 121);
  font-weight: 400;
}

.selection-panel-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.selection-panel-label {
  margin: 0;
  color: rgb(79, 100, 121);
  font-size: 14px;
  font-weight: 400;
}

.selection-panel-value {
  margin: 0;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 500;
}

.selection-panel-action {
  border: 1px solid #0d6efd;
  color: #0d6efd;
  background: #ffffff;
}

.selection-panel-action:hover {
  background: #f1f8ff;
}

.selection-panel-action-primary {
  border: 0;
  color: #ffffff;
  background: #0d6efd;
}

.selection-panel-action,
.selection-panel-action-primary {
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 14px;
}

.selection-panel-action {
  font-weight: 500;
}

.selection-panel-action-primary {
  font-weight: 700;
}

.dma-map,
.dma-detail-map {
  aspect-ratio: 980 / 560;
  position: relative;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: #f9fcff;
  overflow: hidden;
}

.dma-map {
  width: 33vw;
  max-width: 100%;
}

.campaign-dma-map-wrap {
  position: relative;
}

.campaign-dma-map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(249, 252, 255, 0.9);
  color: #214566;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  z-index: 2;
}

.local-home-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 1fr);
  gap: 16px;
  align-items: start;
}

.local-home-grid .dma-map {
  width: 100%;
}

.dma-table-wrap {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
  padding: 8px;
}

.dma-table-wrap .dataTables_wrapper {
  font-size: 13px;
}

.dma-map-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  background: rgba(4, 34, 63, 0.94);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.3;
  padding: 6px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.market-detail-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.market-detail-left,
.market-detail-right {
  min-width: 0;
}

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

.campaign-form-sections {
  display: grid;
  gap: 12px;
}

.campaign-form-sections .form-control,
.campaign-form-sections .form-select,
.campaign-form-sections .input-group-text,
.campaign-form-sections .market-multiselect-toggle {
  font-size: 13px;
}

.campaign-form-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.campaign-selector-row {
  align-items: start;
}

.campaign-form-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.campaign-create-btn {
  border: 1px solid #0a7bb8;
  background-color: #0a7bb8;
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.campaign-create-btn:hover,
.campaign-create-btn:focus,
.campaign-create-btn:active {
  background-color: #002884;
  border-color: #002884;
  color: #ffffff;
}

.campaign-secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #6c757d;
  background-color: var(--panel-bg);
  color: #6c757d;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  vertical-align: middle;
}

.campaign-secondary-btn:hover,
.campaign-secondary-btn:focus,
.campaign-secondary-btn:active {
  border-color: #5c636a;
  background-color: #f8f9fa;
  color: #5c636a;
}

.market-multiselect {
  position: relative;
  width: 100%;
}

.market-multiselect-toggle,
.scenario-week-toggle {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
  color: var(--text-strong);
  text-align: left;
  padding: 6px 10px;
  font-size: 13px;
}

.scenario-week-picker {
  position: relative;
}

.scenario-week-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  width: min(360px, 100%);
  border: 1px solid #cfd7e2;
  border-radius: var(--radius-sm);
  background: #f9fcff;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
  padding: 12px;
}

.scenario-week-toolbar {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.scenario-week-title {
  text-align: center;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
}

.scenario-week-nav {
  width: 32px;
  height: 32px;
  border: 1px solid #cfd7e2;
  border-radius: var(--radius-sm);
  background: #edf8f5;
  color: var(--text-strong);
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.scenario-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.scenario-week-grid-labels {
  margin-bottom: 8px;
}

.scenario-week-grid-labels span {
  text-align: center;
  color: rgb(79, 100, 121);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.scenario-week-day {
  min-height: 36px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
  color: var(--text-strong);
  font-size: 12px;
  line-height: 1;
  padding: 0;
}

.scenario-week-day:hover,
.scenario-week-day:focus {
  background: #edf8f5;
  border-color: #a6cdbc;
  outline: none;
}

.scenario-week-day-other-month {
  color: #9aa7b8;
  background: #f4f7fb;
}

.scenario-week-day-in-range {
  background: #edf8f5;
  border-color: #d7ebe3;
}

.scenario-week-day-boundary {
  background: #5dbb8f;
  border-color: #5dbb8f;
  color: #ffffff;
  font-weight: 600;
}

.scenario-week-help {
  margin: 10px 0 0;
  color: rgb(79, 100, 121);
  font-size: 12px;
}

.market-multiselect-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid #cfd7e2;
  border-radius: var(--radius-sm);
  background: #f1f1f1;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
  padding: 8px 0;
}

.market-multiselect-action {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #212529;
  font-size: 14px;
  line-height: 1.2;
  text-align: left;
  padding: 8px 14px;
  cursor: pointer;
}

.market-multiselect-action:hover {
  background: #e7e7e7;
}

.market-multiselect-options {
  display: grid;
  gap: 2px;
  padding: 0 0 8px;
}

.market-multiselect-empty {
  padding: 8px 14px;
  font-size: 13px;
  color: rgb(79, 100, 121);
}

.market-multiselect-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 14px;
  color: #2f353b;
  text-transform: uppercase;
}

.market-multiselect-option:hover {
  background: #e7e7e7;
}

.market-multiselect-option input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

.station-selection-checkbox {
  margin: 0;
  width: 16px;
  height: 16px;
  border-radius: 2px;
}

.station-selection-checkbox.form-check-input {
  border-color: #0a7bb8;
}

.station-selection-checkbox.form-check-input:checked {
  background-color: #0a7bb8;
  border-color: #0a7bb8;
}

.station-selection-checkbox.form-check-input:focus {
  border-color: #0a7bb8;
  box-shadow: 0 0 0 0.2rem rgba(10, 123, 184, 0.25);
}

.station-select-all-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: rgb(4, 34, 63);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.station-media-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.station-media-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.station-media-chip {
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--panel-bg);
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  padding: 6px 12px;
}

.station-media-chip-active {
  border-color: #0a7bb8;
  background: #e8f3fb;
  color: #0a7bb8;
}

.station-rate-input {
  width: 84px;
  min-width: 84px;
  font-size: 13px;
}

.market-multiselect-option span {
  text-transform: none;
}

.market-meta-grid-identity {
  margin-bottom: 12px;
}

.market-meta-grid-metrics {
  margin-bottom: 12px;
}

.market-meta-item {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--panel-bg);
}

.market-meta-item-stations {
  width: calc((100% - 24px) / 3);
  max-width: calc((100% - 24px) / 3);
}

.station-count-link {
  color: rgb(4, 34, 63);
  text-decoration: underline;
}

.station-count-link:hover {
  color: #0b5ed7;
}

.market-meta-label {
  margin: 0 0 4px;
  color: rgb(79, 100, 121);
  font-size: 13px;
}

.market-meta-value {
  margin: 0;
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 600;
}

.dma-detail-map { width: 100%; }

.dma-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 13px;
  color: rgb(79, 100, 121);
}

.dma-map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dma-map-legend-swatch {
  width: 14px;
  height: 14px;
  border: 1px solid #5f7fa1;
  border-radius: 2px;
  display: inline-block;
}

.dma-map-legend-swatch-available {
  background: #edf8f5;
}

.dma-map-legend-swatch-selected {
  background: #5dbb8f;
}

.dma-map-legend-swatch-unavailable {
  background: #ffffff;
}

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

.publisher-controls-card {
  max-width: 100%;
  padding: 14px;
}

.publisher-control-item .form-select {
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-strong);
  font-size: 14px;
}

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

.demo-title {
  margin: 0 0 8px;
  font-size: 14px;
  color: rgb(4, 34, 63);
  font-weight: 600;
}

.demo-col .table > thead th {
  font-size: 13px;
  font-weight: 500;
}

.demo-col .table {
  font-size: 13px;
  font-weight: 400;
  text-transform: capitalize;
}

.demo-value-col {
  width: 112px;
}

.demo-col .table > thead th:nth-child(2),
.demo-col .table > thead th:nth-child(3),
.demo-col .table > tbody td:nth-child(2),
.demo-col .table > tbody td:nth-child(3) {
  text-align: right;
}

:is(#dma-table, #audience-table, #publishers-table, #campaign-table, #scenario-table, #scenario-market-scope-table, #plan-market-table, #plan-status-table, #account-user-table, .station-table).table-striped > tbody > tr:nth-of-type(odd) > *,
.demo-col .table.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: #edf8f5;
}

:is(#dma-table, #audience-table, #publishers-table, #campaign-table, #scenario-table, #scenario-market-scope-table, #plan-market-table, #plan-status-table, #account-user-table, .station-table).table-striped > tbody > tr:nth-of-type(even) > *,
.demo-col .table.table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: #ffffff;
}

.scenario-summary-top {
  grid-template-columns: minmax(0, 1fr) 320px;
  margin-bottom: 16px;
}

.scenario-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.scenario-summary-map-wrap {
  max-width: 320px;
  margin-left: auto;
}

.scenario-summary-map {
  min-height: 180px;
}

#dma-table > thead > tr > th:nth-child(3),
#dma-table > thead > tr > th:nth-child(4),
#dma-table > tbody > tr > td:nth-child(3),
#dma-table > tbody > tr > td:nth-child(4) {
  text-align: right;
}

#dma-table > thead > tr > th:nth-child(3),
#dma-table > thead > tr > th:nth-child(4) {
  width: 130px;
  white-space: normal;
}

#publishers-table > thead > tr > th:nth-child(2),
#publishers-table > thead > tr > th:nth-child(3),
#publishers-table > thead > tr > th:nth-child(4),
#publishers-table > thead > tr > th:nth-child(5),
#publishers-table > tbody > tr > td:nth-child(2),
#publishers-table > tbody > tr > td:nth-child(3),
#publishers-table > tbody > tr > td:nth-child(4),
#publishers-table > tbody > tr > td:nth-child(5) {
  text-align: right;
}

#scenario-market-scope-table > thead > tr > th:nth-child(n + 2),
#scenario-market-scope-table > tbody > tr > td:nth-child(n + 2) {
  text-align: right;
}

#scenario-market-scope-table > tfoot > tr > th:nth-child(n + 2) {
  text-align: right;
}

#scenario-market-scope-table > thead > tr > th:nth-child(3),
#scenario-market-scope-table > tbody > tr > td:nth-child(3) {
  border-right: 1px solid #c9d6e5;
}

.scenario-market-scope-total-row > th {
  border-top: 2px solid #c9d6e5;
  background-color: #ffffff;
  font-weight: 700;
}

.market-budget-weight-input {
  max-width: 92px;
  margin-left: auto;
  text-align: right;
}

.publishers-network-col {
  width: 30%;
}

.publishers-metric-col {
  width: 17.5%;
}

#publishers-table > thead > tr > th {
  white-space: normal;
  line-height: 1.2;
}

#account-user-table {
  font-size: 13px;
}

#account-user-table > thead > tr > th {
  font-size: 13px;
  font-weight: 500;
  white-space: normal;
  line-height: 1.2;
}

#account-user-table > tbody > tr > td {
  vertical-align: middle;
}

.module-info {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 18px;
  color: #0b2f58;
}

.module-icon-wrap {
  margin-bottom: 18px;
}

.module-icon {
  font-size: 72px;
  color: #3b6f96;
}

.module-name {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.1;
  color: rgb(4, 34, 63);
  font-weight: 700;
}

.section-title {
  font-size: 46px;
  font-weight: 800;
  color: var(--heading);
  margin: 0 0 10px;
}

.subtle-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  color: var(--muted);
  font-size: 13px;
  margin: -8px 0 16px;
}

.subtle-toolbar a {
  color: inherit;
  text-decoration: none;
}

.tab-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.chart-placeholder {
  height: 330px;
  border: 1px solid #e3e7ee;
  border-radius: 2px;
  background: linear-gradient(#f4f6fa, #f4f6fa);
}

.btn-outline-dash {
  border-color: #97a5b8;
  color: #3e5677;
}

.btn-outline-dash:hover {
  border-color: #7f8ea2;
  color: #2f4564;
  background: #f7f9fc;
}

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

.account-section-title {
  margin-bottom: 14px;
}

.account-submit-row {
  display: flex;
  align-items: end;
}

.account-inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.account-checkbox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
}

@media (max-width: 992px) {
  .sidebar {
    width: 74px;
  }

  .sidebar-link span {
    display: none;
  }

  .content-area {
    margin-left: 74px;
    width: calc(100% - 74px);
    padding: 20px;
  }

  .page-header {
    flex-direction: column;
  }

  .page-header-right {
    min-width: 0;
    width: 100%;
  }

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

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

  .local-home-grid {
    grid-template-columns: 1fr;
  }

  .market-detail-top {
    grid-template-columns: 1fr;
  }

  .market-meta-grid {
    grid-template-columns: 1fr;
  }

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

  .publisher-controls {
    grid-template-columns: 1fr;
  }

  .module-name {
    font-size: 36px;
  }

  .account-inline-form {
    display: grid;
  }

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