/* ==========================================================================
   Campaign Dashboard — "2016" skin
   ========================================================================== */

@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700');

* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --surface-1: #ffffff;
  --surface-2: #ffffff;
  --page-plane: #ecf0f5;
  --text-primary: #333333;
  --text-secondary: #555555;
  --text-muted: #999999;
  --gridline: #f4f4f4;
  --baseline: #d2d6de;
  --border: #d2d6de;
  --shadow-sm: 0 1px 1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25);
  --series-1: #3c8dbc;
  /* AdminLTE "skin-blue" primary */
  --series-1-soft: #d0e2f0;
  --status-good: #00a65a;
  --status-warning: #f39c12;
  --status-critical: #dd4b39;
  --success-text: #00a65a;
  /* era chrome */
  --sidebar-bg: #222d32;
  --sidebar-hover: #1e282c;
  --sidebar-text: #b8c7ce;
  --sidebar-heading: #4b646f;
  --brand-bg: #367fa9;
  --box-radius: 3px;
}

/* 2016 admin panels were light-only; the theme toggle stays wired for parity
   but there is no separate dark palette to swap in. */
:root[data-theme="dark"],
:root[data-theme="light"] {
  color-scheme: light;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.42857143;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: none;
  margin: 0;
  padding: 15px 15px 40px;
}

/* ---------- Top bar (era: content-header + navbar hybrid) ---------- */
.topbar {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 12px;
  margin: 0 0 15px;
  background: transparent;
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

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

.topbar-title h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0;
  color: #444;
}

.disclaimer {
  display: none;
}

/* ---------- Buttons (Bootstrap 3 btn-default) ---------- */
.ghost-btn {
  background-color: #f4f4f4;
  background-image: linear-gradient(to bottom, #ffffff 0%, #e0e0e0 100%);
  background-repeat: repeat-x;
  border: 1px solid #ccc;
  color: #333;
  border-radius: var(--box-radius);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.42857143;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 120ms ease;
}

.ghost-btn:hover {
  background-image: none;
  background-color: #e6e6e6;
  border-color: #adadad;
  transform: none;
}

.ghost-btn:active {
  background-image: none;
  background-color: #d4d4d4;
  border-color: #8c8c8c;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
  transform: none;
}

.ghost-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ---------- Small-box stat tiles (AdminLTE info-box vibe) ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-top: 3px solid var(--series-1);
  border-radius: var(--box-radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0;
  color: #333;
  font-variant-numeric: proportional-nums;
}

.skeleton .stat-value {
  color: var(--text-muted);
}

/* ---------- Chart rows ---------- */
.chart-row {
  display: grid;
  gap: 15px;
  margin-bottom: 15px;
}

.chart-row--primary {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
}

.chart-row--secondary {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

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

/* ---------- Boxes (AdminLTE .box) ---------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-top: 3px solid var(--series-1);
  border-radius: var(--box-radius);
  padding: 0 12px 12px;
  box-shadow: var(--shadow-sm);
}

.chart-card h2 {
  margin: 0 -12px 12px;
  padding: 10px 12px;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0;
  color: #444;
  border-bottom: 1px solid #f4f4f4;
}

.muted-sub {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
}

.chart-surface {
  position: relative;
  width: 100%;
  height: 240px;
}

.chart-surface--compact {
  height: 156px;
}

/* The 2016 map is a completely different renderer (see renderMapFlat in
   app.js): a flat jVectorMap-style vector map, the kind AdminLTE bundled in
   2016. Light sea, solid grey-green continents with white region borders, and
   flat red pin markers. Light, so it sits naturally in the light dashboard. */
.chart-surface--map {
  height: clamp(260px, 32vw, 420px);
  overflow: hidden;
  border-radius: var(--box-radius);
  border: 1px solid var(--border);
  box-shadow: none;
  background: #a5cdff;
  /* jVectorMap-style light blue sea */
}

.chart-surface--map svg {
  display: block;
}

.map-caption {
  margin: 10px 0 0;
}

.split-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Flat vector map */
.vmap-sea {
  fill: #a5cdff;
}

.vmap-land {
  fill: #c8d2c4;
  /* muted grey-green land */
  stroke: #ffffff;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.vmap-marker {
  fill: var(--status-critical);
  stroke: #ffffff;
  stroke-width: 1.5;
  cursor: pointer;
}

.vmap-marker-pulse {
  fill: none;
  stroke: var(--status-critical);
  stroke-width: 1.5;
  opacity: 0;
  animation: vmap-pulse 2.6s ease-out infinite;
  pointer-events: none;
}

@keyframes vmap-pulse {
  0% {
    r: 4;
    opacity: 0.5;
  }

  100% {
    r: 18;
    opacity: 0;
  }
}

.map-legend-scale {
  width: 90px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, #f4c7c0, var(--status-critical));
}

/* 2016 admin panels were light-only; the modern skin's dark-mode toggle has no
   effect here, so hide the control rather than leave a dead button. */
#theme-toggle {
  display: none;
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 12px 0 0;
  padding: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend .swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  display: inline-block;
}

/* ---------- Horizontal bar lists ---------- */
.bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 128px) 1fr 36px;
  align-items: center;
  gap: 10px;
  height: 28px;
  font-size: 13px;
}

.bar-row .bar-label {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  background: #f4f4f4;
  border-radius: 2px;
  height: 18px;
  overflow: hidden;
  border: 1px solid #eee;
}

.bar-fill {
  height: 100%;
  border-radius: 0;
  background: var(--series-1);
  transition: width 400ms ease;
}

.bar-row .bar-value {
  text-align: right;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ---------- Table ---------- */
.table-card {
  margin-bottom: 20px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 -12px 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #f4f4f4;
}

.table-toolbar h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  color: #444;
}

.toolbar-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-controls input,
.toolbar-controls select {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid #ccc;
  border-radius: var(--box-radius);
  padding: 6px 10px;
  font-size: 13px;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}

.toolbar-controls input:focus,
.toolbar-controls select:focus {
  outline: 0;
  border-color: #66afe9;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}

#search-input {
  min-width: 220px;
}

.table-scroll {
  overflow-x: auto;
  border-radius: 0;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 920px;
}

thead th {
  position: sticky;
  top: 0;
  text-align: left;
  color: #555;
  font-weight: 700;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  background: #f9f9f9;
  border-bottom: 2px solid var(--border);
  padding: 8px 12px;
  white-space: nowrap;
}

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #f4f4f4;
  white-space: nowrap;
}

/* zebra striping — a 2016 table staple */
tbody tr:nth-child(odd) {
  background: #f9f9f9;
}

tbody tr {
  transition: background 100ms ease;
}

tbody tr:hover {
  background: #f1f5f9;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.password-cell {
  font-family: "Menlo", "Consolas", "Courier New", monospace;
  white-space: nowrap;
}

.password-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pw-mask,
.pw-plain {
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.pw-mask[hidden],
.pw-plain[hidden] {
  display: none;
}

.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
  background: #fff;
}

.copy-btn {
  border: 1px solid #ccc;
  background: #f4f4f4;
  color: var(--text-muted);
  border-radius: var(--box-radius);
  width: 26px;
  height: 26px;
  min-width: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color 120ms ease, border-color 120ms ease;
}

.copy-btn:hover {
  color: var(--series-1);
  border-color: var(--series-1);
}

.copy-btn:active {
  background: #e6e6e6;
}

.copy-btn.copied {
  color: var(--status-good);
  border-color: var(--status-good);
}

.copy-btn svg {
  width: 14px;
  height: 14px;
}

/* ---------- Status labels (Bootstrap 3 .label — solid pills) ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--box-radius);
  border: none;
  color: #fff;
}

.status-pill.captured {
  background: var(--status-good);
}

.status-pill.mfa_prompted {
  background: var(--status-warning);
}

.status-pill.failed {
  background: var(--status-critical);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 12px;
  padding: 5px 9px;
  border-radius: var(--box-radius);
  z-index: 50;
  transform: translate(-50%, -125%);
  white-space: nowrap;
  box-shadow: var(--shadow-md);
}

/* ---------- App shell + fixed dark sidebar ---------- */
.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: none;
  padding: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  font-weight: 300;
  font-size: 20px;
  letter-spacing: 0;
  color: #fff;
  background: var(--brand-bg);
  padding: 0 15px;
  height: 50px;
  line-height: 50px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--sidebar-text);
  padding: 12px 15px 12px 12px;
  border-radius: 0;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: var(--series-1);
}

.nav-item.active {
  background: var(--sidebar-hover);
  color: #fff;
  font-weight: 400;
  border-left-color: var(--series-1);
}

.sidebar-footer {
  margin-top: auto;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--sidebar-heading);
  border-top: 1px solid #1a2226;
  padding: 12px 15px 0;
  line-height: 1.6;
}

.main-area {
  flex: 1 1 auto;
  min-width: 0;
}

/* ---------- Demo placeholder panel ---------- */
.demo-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
}

.demo-panel[hidden] {
  display: none;
}

.demo-card {
  max-width: 460px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 32px;
  border-top: 3px solid var(--status-warning);
}

.demo-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  background: var(--status-warning);
  border-radius: var(--box-radius);
  padding: 4px 10px;
}

.demo-card h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  color: #444;
  border: none;
  padding: 0;
}

.demo-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.demo-card .ghost-btn {
  margin-top: 8px;
}

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--page-plane);
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 24px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-top: 3px solid var(--series-1);
}

.login-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 400;
  color: #444;
  text-align: center;
}

.login-error {
  background: #f2dede;
  border: 1px solid #ebccd1;
  color: #a94442;
  border-radius: var(--box-radius);
  padding: 10px 12px;
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.login-form input {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid #ccc;
  border-radius: var(--box-radius);
  padding: 8px 12px;
  font-size: 14px;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}

.login-form input:focus {
  outline: 0;
  border-color: #66afe9;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}

/* Bootstrap 3 btn-primary */
.primary-btn {
  background-color: var(--series-1);
  background-image: linear-gradient(to bottom, #4595c4 0%, #367fa9 100%);
  background-repeat: repeat-x;
  color: #fff;
  border: 1px solid #2e6da4;
  border-radius: var(--box-radius);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.primary-btn:hover {
  background-image: none;
  background-color: #2e6da4;
  transform: none;
}

.primary-btn:active {
  background-image: none;
  background-color: #286090;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .chart-row--primary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    padding: 0;
  }

  .sidebar-brand {
    flex-shrink: 0;
  }

  .nav-list {
    flex-direction: row;
    margin: 0;
  }

  .nav-item {
    white-space: nowrap;
    border-left: none;
    border-bottom: 3px solid transparent;
  }

  .nav-item:hover,
  .nav-item.active {
    border-left: none;
    border-bottom-color: var(--series-1);
  }

  .sidebar-footer {
    display: none;
  }
}

@media (max-width: 640px) {
  .split-charts {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  #search-input {
    min-width: 0;
    flex: 1 1 100%;
  }
}
