* { box-sizing: border-box; }
[hidden] { display: none !important; }
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .72);
}
.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}
.login-card h2 { margin-bottom: 10px; }
.login-help { margin: 0 0 20px; color: #64748b; }
.login-card label { display: block; margin-bottom: 7px; font-weight: 800; }
.login-card label:not(:first-of-type) { margin-top: 14px; }
.login-card input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 16px;
}
.login-card button {
  width: 100%;
  margin-top: 14px;
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-actions .secondary,
.actions .secondary { background: #fff; border-color: #cbd5e1; color: #334155; }
.login-error { min-height: 20px; margin: 8px 0 0; color: #b91c1c; font-size: 13px; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 198px minmax(0, 1fr);
  font-family: Arial, "Malgun Gothic", sans-serif;
  background: #f3f5f9;
  color: #0f172a;
}
aside {
  background: #172741;
  color: #fff;
  padding: 18px 14px;
}
aside h1 {
  margin: 0 0 22px;
  font-size: 18px;
  letter-spacing: 0;
}
aside button {
  display: block;
  width: 100%;
  height: 42px;
  margin: 3px 0;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #dce8ff;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
aside button.active,
aside button:hover {
  background: #2c4365;
  color: #fff;
}
main { min-width: 0; }
header {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid #d8e0ec;
}
h2 { margin: 0; font-size: 24px; line-height: 1.2; }
h3 { margin: 0 0 14px; font-size: 16px; }
.eyebrow {
  margin: 0 0 5px;
  color: #64748b;
  font-size: 12px;
}
.actions {
  display: flex;
  gap: 8px;
}
button {
  min-height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #0f172a;
  padding: 8px 13px;
  font-weight: 800;
  cursor: pointer;
}
#importExisting,
#createJob {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.toolbar,
.cards,
#content {
  padding-left: 22px;
  padding-right: 22px;
}
.toolbar {
  padding-top: 16px;
}
.notice {
  padding: 12px 14px;
  border: 1px solid #c8d7ee;
  border-radius: 8px;
  background: #eef6ff;
  color: #334155;
  font-size: 13px;
}

.snapshot-notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #f1c56b;
  border-radius: 8px;
  background: #fff8e8;
  color: #7a4b00;
  font-size: 13px;
  line-height: 1.5;
}

.data-quality {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid currentColor;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.filter-block {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #dce4ef;
  border-radius: 8px;
  background: #fff;
}
.filter-title {
  margin-bottom: 10px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip,
.date-chip,
.mini-tab {
  min-height: 34px;
  border-radius: 999px;
  background: #fff;
  color: #26364f;
  border: 1px solid #d8e0ec;
}
.chip.active,
.date-chip.active,
.mini-tab.active {
  background: #183052;
  border-color: #183052;
  color: #fff;
}
.date-row { gap: 7px; }
.date-chip { min-width: 62px; padding: 6px 11px; }
.tab-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  border-bottom: 1px solid #d8e0ec;
}
.mini-tab {
  border-radius: 7px 7px 0 0;
  border-bottom: 0;
}
.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  padding-top: 16px;
}
.card,
.panel {
  background: #fff;
  border: 1px solid #d8e0ec;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
}
.card {
  min-height: 92px;
  padding: 15px 16px;
}
.label {
  color: #64748b;
  font-size: 12px;
  margin-bottom: 8px;
}
.value {
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
}
.muted {
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
}
#content {
  padding-top: 16px;
  padding-bottom: 32px;
}
.panel {
  padding: 16px;
  margin-bottom: 16px;
  overflow: auto;
}
.chart-panel {
  padding-bottom: 10px;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}
.legend span {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
}
.legend .revenue { background: #38c995; }
.legend .spend { background: #4f8df7; }
.legend .roas { background: #5966d8; }
.chart {
  display: block;
  width: 100%;
  min-width: 760px;
  height: 310px;
}
.axis {
  stroke: #cbd5e1;
  stroke-width: 1;
}
.bar-revenue {
  fill: #34c98b;
  opacity: .82;
}
.bar-spend {
  fill: #4f8df7;
  opacity: .82;
}
.roas-line {
  fill: none;
  stroke: #5966d8;
  stroke-width: 3;
}
.line-dot {
  fill: #fff;
  stroke: #21b78d;
  stroke-width: 3;
}
.chart text {
  fill: #64748b;
  font-size: 11px;
}
.grid-line {
  stroke: #e7edf5;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.chart-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  color: #64748b;
  font-size: 14px;
}
.selection-summary {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) repeat(4, minmax(130px, 1fr));
  gap: 0;
  padding: 0;
}
.selection-summary > div {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 14px 18px;
  border-right: 1px solid #e5ebf3;
}
.selection-summary > div:last-child { border-right: 0; }
.selection-summary span,
.selection-summary small { color: #64748b; font-size: 12px; }
.selection-summary b { font-size: 18px; }
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  position: sticky;
  top: 0;
  background: #172741;
  color: #fff;
  padding: 10px 11px;
  text-align: left;
  white-space: nowrap;
}
td {
  border-bottom: 1px solid #e8eef6;
  padding: 9px 11px;
  white-space: nowrap;
}
td.num,
th.num { text-align: right; }
.badge {
  display: inline-block;
  min-width: 68px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}
.danger { background: #fee2e2; color: #b91c1c; }
.warning { background: #ffedd5; color: #c2410c; }
.good { background: #dcfce7; color: #15803d; }
.badge.muted { background: #e2e8f0; color: #475569; }
.bar-wrap {
  display: flex;
  width: 100%;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf8;
}
.bar.search { background: #4f8df7; }
.bar.nonsearch { background: #34c98b; }
.bar.other { background: #f59e0b; }
.exposure-list p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 13px 0 0;
  color: #334155;
  font-size: 13px;
}
.exposure-list span {
  color: #64748b;
  text-align: right;
}
.filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: center;
}
.filter-grid input,
.filter-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d8dee9;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.section-head h3 { margin-bottom: 4px; }
.section-head .muted { margin: 0; }
.automation-form {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) repeat(3, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}
.automation-form label:not(.toggle-field) > span {
  display: block;
  margin-bottom: 7px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}
.automation-form input[type="time"],
.automation-form input[type="number"] {
  width: 100%;
  height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 0 11px;
  background: #fff;
  font-size: 15px;
}
.toggle-field {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}
.toggle-field input { width: 18px; height: 18px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 34px !important; }
.input-suffix em {
  position: absolute;
  right: 11px;
  top: 13px;
  color: #64748b;
  font-size: 12px;
  font-style: normal;
}
.automation-form .primary {
  height: 42px;
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.automation-status {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 7px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
}
.automation-status b { margin-left: 6px; color: #0f172a; }
.form-message { min-height: 18px; margin: 8px 0 0; font-size: 13px; }
.good-text { color: #15803d; }
.danger-text { color: #b91c1c; }
.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #2563eb;
  text-decoration: underline;
  cursor: pointer;
}
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #eff6ff; }
@media (max-width: 1100px) {
  body { grid-template-columns: 1fr; }
  aside {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 10px;
  }
  aside h1 { display: none; }
  aside button { width: auto; white-space: nowrap; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .selection-summary { grid-template-columns: repeat(2, 1fr); }
  .selection-summary > div { border-bottom: 1px solid #e5ebf3; }
  .automation-form { grid-template-columns: 1fr 1fr; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  header { align-items: flex-start; height: auto; padding: 14px; flex-direction: column; gap: 12px; }
}
