/* MCA Mailer — BidMyLeads theme.
   Palette taken from the logo: navy ink, amber accent, cyan support, cream page.
   Contrast rules that must hold:
     white on navy  14.3:1  -> primary buttons
     navy on amber   6.8:1  -> amber buttons carry NAVY text
     white on amber  2.8:1  -> never used
   Chart series are the validated dataviz slots 1-2 (blue/orange), which also
   happen to be the logo's own arrow colours. */

:root {
  color-scheme: light;

  --page:            #f3f1e9;
  --surface:         #ffffff;
  --surface-2:       #faf8f2;
  --surface-3:       #ebe7db;

  --text-primary:    #0d2b4e;
  --text-secondary:  #46596f;
  --text-muted:      #8592a3;

  --border:          rgba(13, 43, 78, 0.10);
  --border-strong:   rgba(13, 43, 78, 0.18);
  --shadow:          0 10px 30px rgba(13, 43, 78, 0.08);
  --shadow-sm:       0 2px 8px rgba(13, 43, 78, 0.06);
  --shadow-lift:     0 14px 38px rgba(13, 43, 78, 0.14);

  --navy:            #0d2b4e;
  --navy-soft:       #16406f;
  --amber:           #e8a812;
  --amber-deep:      #cf8f00;
  --amber-soft:      rgba(232, 168, 18, 0.16);
  --cyan:            #2e86c1;
  --cyan-soft:       rgba(46, 134, 193, 0.13);

  /* Primary action = navy + white. Accent = amber + navy. */
  --accent:          var(--amber);
  --accent-ink:      #0d2b4e;
  --btn-bg:          var(--navy);
  --btn-ink:         #ffffff;

  --series-1:        #2a78d6;   /* sent    */
  --series-2:        #eb6834;   /* replied */

  --status-good:     #0ca30c;
  --status-warn:     #b8860b;
  --status-critical: #d03b3b;
  --status-skip:     #8592a3;

  --grid:            #e7e4d9;
  --axis:            #cfcabb;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --tile-a: linear-gradient(140deg, #fbe3ad 0%, #f5c46a 48%, #eba23a 100%);
  --tile-b: linear-gradient(140deg, #cfe4f4 0%, #9dc6e6 50%, #6ba9d6 100%);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --fast: .16s;
  --med: .28s;
  --slow: .45s;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --page:            #0b131c;
  --surface:         #16202c;
  --surface-2:       #1c2836;
  --surface-3:       #263447;

  --text-primary:    #eef3f8;
  --text-secondary:  #b3c2d2;
  --text-muted:      #7f8fa3;

  --border:          rgba(190, 214, 238, 0.13);
  --border-strong:   rgba(190, 214, 238, 0.24);
  --shadow:          0 12px 34px rgba(0, 0, 0, 0.5);
  --shadow-sm:       0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-lift:     0 18px 46px rgba(0, 0, 0, 0.62);

  --navy:            #24425f;
  --navy-soft:       #2d5680;
  --amber:           #f0a028;
  --amber-deep:      #d98b12;
  --amber-soft:      rgba(240, 160, 40, 0.18);
  --cyan:            #58a8dd;
  --cyan-soft:       rgba(88, 168, 221, 0.18);

  --accent:          var(--amber);
  --accent-ink:      #10202f;
  --btn-bg:          var(--amber);
  --btn-ink:         #10202f;

  --series-1:        #3987e5;
  --series-2:        #d95926;

  --status-good:     #2fbf4f;
  --status-warn:     #f0b429;
  --status-critical: #ef5f5f;
  --status-skip:     #7f8fa3;

  --grid:            #223044;
  --axis:            #2e3f56;

  --tile-a: linear-gradient(140deg, #6a4c1b 0%, #8a5f1c 50%, #a06f20 100%);
  --tile-b: linear-gradient(140deg, #1d3d59 0%, #245474 50%, #2c6a92 100%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.55;
  transition: background var(--med) var(--ease), color var(--med) var(--ease);
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--cyan); }

/* ------------------------------------------------------------- animations */

@keyframes fadeUp   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn    { 0% { opacity: 0; transform: scale(.94); } 100% { opacity: 1; transform: none; } }
@keyframes slideDown{ from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes ringGrow { from { stroke-dashoffset: 427; } }

.stagger > * { animation: fadeUp var(--slow) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------------------------------------------------------------- shell */

.shell {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) var(--aside-w, 348px);
  min-height: 100vh;
  transition: grid-template-columns var(--med) var(--ease);
}
.shell.aside-collapsed { --aside-w: 58px; }

.rail {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail-logo {
  width: 44px; height: 44px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  margin-bottom: 14px;
  overflow: hidden;
  transition: transform var(--med) var(--ease-out), box-shadow var(--med) var(--ease);
}
.rail-logo:hover { transform: translateY(-2px) scale(1.04); box-shadow: var(--shadow-sm); }
.rail-logo img { width: 34px; height: 34px; object-fit: contain; display: block; }

.rail-btn {
  width: 46px; height: 44px;
  border: 0; border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  display: grid; place-items: center;
  cursor: pointer;
  position: relative;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              transform var(--fast) var(--ease);
}
.rail-btn:hover { background: var(--surface-3); color: var(--text-primary); transform: translateY(-1px); }
.rail-btn:active { transform: translateY(0) scale(.94); }
.rail-btn.active { background: var(--amber-soft); color: var(--text-primary); }
.rail-btn.active::before {
  content: ""; position: absolute; left: -12px; top: 50%;
  width: 3px; height: 22px; border-radius: 0 3px 3px 0;
  background: var(--amber);
  transform: translateY(-50%);
  animation: popIn var(--med) var(--ease-out);
}
.rail-btn svg { width: 20px; height: 20px; }

.rail-btn::after {
  content: attr(data-label);
  position: absolute; left: 56px;
  background: var(--text-primary); color: var(--surface);
  padding: 5px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transform: translateX(-6px);
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
  z-index: 60;
}
.rail-btn:hover::after { opacity: 1; transform: none; }

.rail-spacer { flex: 1; }

.main { padding: 30px 34px 56px; min-width: 0; }

.aside {
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 28px 24px 48px;
  overflow-y: auto;
  max-height: 100vh;
  position: sticky;
  top: 0;
  transition: padding var(--med) var(--ease);
}
.shell.aside-collapsed .aside { padding: 22px 8px; overflow: hidden; }
.shell.aside-collapsed .aside-body { display: none; }

.aside-toggle {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-secondary); cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.aside-toggle:hover { background: var(--surface-3); }
.aside-toggle:active { transform: scale(.92); }
.aside-toggle svg { width: 16px; height: 16px; transition: transform var(--med) var(--ease); }
.shell.aside-collapsed .aside-toggle svg { transform: rotate(180deg); }

.aside-rail-label {
  display: none;
  writing-mode: vertical-rl;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 12px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase;
}
.shell.aside-collapsed .aside-rail-label { display: block; }

/* --------------------------------------------------------------- header */

.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.topbar h1 { font-size: 23px; font-weight: 700; margin: 0 0 2px; letter-spacing: -.02em; }
.topbar .sub { color: var(--text-muted); font-size: 13px; }
.topbar .grow { flex: 1; }

.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 9px 16px; min-width: 230px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.search:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.search input { border: 0; background: transparent; outline: none; width: 100%; color: var(--text-primary); }
.search svg { width: 16px; height: 16px; color: var(--text-muted); flex: none; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer;
  display: grid; place-items: center; flex: none;
  box-shadow: var(--shadow-sm);
  transition: transform var(--fast) var(--ease), color var(--fast) var(--ease),
              background var(--fast) var(--ease);
}
.icon-btn:hover { color: var(--text-primary); background: var(--surface-2); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.spinning svg { animation: spin .7s linear infinite; }

.role-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-3); border-radius: 999px;
  padding: 5px 11px; font-size: 12px; font-weight: 700;
  text-transform: capitalize; color: var(--text-secondary);
}
.role-chip .sq { width: 7px; height: 7px; border-radius: 2px; background: var(--amber); }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px 32px;
  transition: box-shadow var(--med) var(--ease), transform var(--med) var(--ease);
}
.card + .card { margin-top: 24px; }
.card h2 { font-size: 18px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.card .card-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 26px; }

.grid-top {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.tiles.one { grid-template-columns: 1fr; }
.tiles-wrap { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

/* profile */
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; }
.profile-head { display: flex; width: 100%; justify-content: space-between; align-items: center; }
.profile-head span { font-size: 14.5px; font-weight: 600; }
.ring-wrap { position: relative; width: 148px; height: 148px; margin: 16px 0 12px; }
.ring-wrap svg { transform: rotate(-90deg); }
#quotaRing { transition: stroke-dashoffset var(--slow) var(--ease-out); }
.avatar {
  position: absolute; inset: 14px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--navy), var(--navy-soft));
  color: #fff; display: grid; place-items: center;
  font-size: 32px; font-weight: 700; letter-spacing: -.02em;
  animation: popIn var(--slow) var(--ease-out);
}
.profile .name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.profile .role { color: var(--text-muted); font-size: 13px; margin-top: 2px; word-break: break-word; }
.chips { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; justify-content: center; }
.chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600;
  transition: transform var(--fast) var(--ease);
}
.chip:hover { transform: translateY(-1px); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* gradient stat tiles */
.tile {
  border-radius: var(--radius-lg);
  padding: 20px;
  min-height: 186px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #0d2b4e;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--med) var(--ease-out), box-shadow var(--med) var(--ease);
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.tile.a { background: var(--tile-a); }
.tile.b { background: var(--tile-b); }
:root[data-theme="dark"] .tile { color: #f4f8fc; }
.tile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tile-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.25; max-width: 62%; }
.tile-badge {
  width: 38px; height: 38px; border-radius: 12px;
  background: rgba(255,255,255,.55); display: grid; place-items: center; flex: none;
  transition: transform var(--med) var(--ease-out);
}
.tile:hover .tile-badge { transform: rotate(-8deg) scale(1.06); }
:root[data-theme="dark"] .tile-badge { background: rgba(255,255,255,.15); }
.tile-badge svg { width: 18px; height: 18px; }
.tile .value { font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.tile .value small { font-size: 21px; font-weight: 600; }
.tile .caption { font-size: 12.5px; opacity: .78; margin-top: 6px; }

/* connections strip */
.strip {
  background: var(--surface-3);
  border-radius: var(--radius-lg);
  padding: 15px 20px;
  display: flex; align-items: center; gap: 16px;
}
.strip .label { font-size: 14.5px; font-weight: 600; }
.strip .sub { color: var(--text-secondary); font-size: 12.5px; margin-top: 2px; }
.strip .grow { flex: 1; }
.conns { display: flex; align-items: center; }
.conn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--surface-3);
  margin-left: -8px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform var(--fast) var(--ease-out), z-index 0s;
}
.conn:hover { transform: translateY(-3px) scale(1.08); z-index: 2; }
.conn:first-child { margin-left: 0; }
.conn .pip {
  position: absolute; right: -1px; bottom: -1px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--surface);
}
.pip.on    { background: var(--status-good); }
.pip.warn  { background: var(--status-warn); }
.pip.error { background: var(--status-critical); }
.pip.off   { background: var(--text-muted); }

/* ---------------------------------------------------------------- chart */

.chart-card { position: relative; }
.chart-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.chart-head .grow { flex: 1; min-width: 160px; }

.select {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  transition: border-color var(--fast) var(--ease);
}
.select:focus-within { border-color: var(--amber); }
.select select { border: 0; background: transparent; outline: none; color: var(--text-primary); font-weight: 600; cursor: pointer; }

.chart-body { display: flex; gap: 14px; }
.month-rail {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding-top: 8px; color: var(--text-muted); font-size: 12.5px; flex: none;
}
.month-rail .m {
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              transform var(--fast) var(--ease);
}
.month-rail .m:hover { background: var(--surface-3); transform: translateX(2px); }
.month-rail .m.on { background: var(--amber); color: var(--accent-ink); font-weight: 700; }
.month-rail .arrow { color: var(--text-muted); opacity: .5; }

.plot { flex: 1; min-width: 0; position: relative; }
.plot svg { display: block; width: 100%; overflow: visible; }
.plot .series-line {
  stroke-dasharray: var(--len); stroke-dashoffset: var(--len);
  animation: drawLine 1.1s var(--ease-out) forwards;
}

.chart-foot {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-top: 20px; flex-wrap: wrap;
}
.legend { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.legend-item {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px;
  color: var(--text-secondary); cursor: default;
}
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; }

.hero-figure { text-align: right; flex: none; }
.hero-figure .n { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.hero-figure .l { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow-lift);
  font-size: 12.5px; min-width: 128px; opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.tooltip.show { opacity: 1; transform: none; }
.tooltip .t-date { font-weight: 700; margin-bottom: 6px; }
.tooltip .t-row { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.tooltip .t-row .sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.tooltip .t-row .t-k { color: var(--text-secondary); flex: 1; }
.tooltip .t-row .t-v { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ side panel */

.aside h2 { font-size: 17px; font-weight: 700; margin: 0 0 3px; letter-spacing: -.01em; }
.aside .aside-sub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 14px; }
.aside-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.aside-section { margin-bottom: 38px; animation: fadeUp var(--slow) var(--ease-out) both; }
.aside-section:nth-child(2) { animation-delay: .06s; }
.aside-section:nth-child(3) { animation-delay: .12s; }

.queue-row {
  display: flex; gap: 14px; padding: 16px 0;
  border-bottom: 1px solid var(--border);
  animation: slideDown var(--med) var(--ease-out) both;
  transition: transform var(--fast) var(--ease);
}
.queue-row:hover { transform: translateX(3px); }
.queue-row:last-child { border-bottom: 0; }
.queue-time { width: 56px; flex: none; }
.queue-time .d { font-size: 11.5px; color: var(--text-muted); }
.queue-time .t { font-size: 14px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.queue-main { flex: 1; min-width: 0; }
.queue-main .title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-main .meta { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12px; margin-top: 4px; min-width: 0; }
.queue-main .meta .sub-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.state-badge {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-secondary);
}
.state-badge .sq { width: 7px; height: 7px; border-radius: 2px; }

.bar-row { margin-bottom: 20px; }
.bar-top { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.bar-top .nm { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-top .pc { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; border-radius: 999px; background: var(--surface-3); margin-top: 7px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 999px; background: var(--amber); width: 0;
  transition: width .9s var(--ease-out);
}
.bar-sub { color: var(--text-muted); font-size: 11.5px; margin-top: 5px; }

/* --------------------------------------------------------------- tables */

.view { display: none; }
.view.on { display: block; animation: fadeUp var(--med) var(--ease-out); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-weight: 600; color: var(--text-muted);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  padding: 0 14px 14px; border-bottom: 1px solid var(--border);
}
td { padding: 15px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background var(--fast) var(--ease); }
tbody tr:hover { background: var(--surface-2); }
.tbl-wrap { overflow-x: auto; }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-secondary);
}
.pill.sent { background: var(--cyan-soft); color: var(--cyan); }
.pill.queued { background: var(--amber-soft); color: var(--amber-deep); }
.pill.replied { background: rgba(12,163,12,.15); color: var(--status-good); }
.pill.bounced, .pill.failed { background: rgba(208,59,59,.15); color: var(--status-critical); }
.pill.unsubscribed { background: var(--amber-soft); color: var(--amber-deep); }
:root[data-theme="dark"] .pill.unsubscribed { color: var(--amber); }

/* --------------------------------------------------------------- inputs */

.field { margin-bottom: 22px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.field .hint { font-size: 12.5px; color: var(--text-muted); margin-top: 8px; line-height: 1.6; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=time], select, textarea {
  width: 100%; padding: 12px 15px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-primary); outline: none;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease),
              background var(--fast) var(--ease);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--amber); background: var(--surface);
  box-shadow: 0 0 0 3px var(--amber-soft);
}
textarea { min-height: 130px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.6; }
input[type=checkbox] { accent-color: var(--amber); width: auto; }

.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 11px 19px;
  font-weight: 600; cursor: pointer;
  background: var(--btn-bg); color: var(--btn-ink);
  transition: transform var(--fast) var(--ease), filter var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease);
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.btn.accent { background: var(--amber); color: var(--accent-ink); }
.btn.ghost { background: var(--surface-3); color: var(--text-primary); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn.danger { background: var(--status-critical); color: #fff; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; }

.banner {
  border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 22px;
  font-size: 13px; line-height: 1.65; border: 1px solid;
  animation: slideDown var(--med) var(--ease-out);
}
.banner.warn { background: var(--amber-soft); border-color: rgba(232,168,18,.45); }
.banner.err  { background: rgba(208,59,59,.10); border-color: rgba(208,59,59,.4); }
.banner.ok   { background: rgba(12,163,12,.10); border-color: rgba(12,163,12,.35); }
.banner.info { background: var(--cyan-soft); border-color: rgba(46,134,193,.32); }
.banner ul, .banner ol { margin: 12px 0 0; padding-left: 22px; }
.banner li { margin-bottom: 10px; line-height: 1.65; }
.banner ol { counter-reset: none; }
.banner code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }

.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  background: var(--navy); color: #fff;
  padding: 13px 18px; border-radius: 12px; box-shadow: var(--shadow-lift);
  font-size: 13.5px; max-width: 420px;
  transform: translateY(16px) scale(.97); opacity: 0; pointer-events: none;
  transition: opacity var(--med) var(--ease), transform var(--med) var(--ease-out);
}
:root[data-theme="dark"] .toast { background: var(--amber); color: var(--accent-ink); }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--status-critical); color: #fff; }

.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 16px; }
.health-item {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 18px;
  animation: fadeUp var(--med) var(--ease-out) both;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.health-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.health-item .hn { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; text-transform: capitalize; }
.health-item .hd { color: var(--text-muted); font-size: 12px; margin-top: 6px; line-height: 1.5; word-break: break-word; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.log-line { display: flex; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.log-line .lt { color: var(--text-muted); font-size: 12px; width: 128px; flex: none; font-variant-numeric: tabular-nums; }
.log-line .ls { width: 74px; flex: none; color: var(--text-muted); font-size: 12px; }
.log-line .lm { flex: 1; min-width: 0; }
.log-line .ld { color: var(--text-muted); font-size: 11.5px; margin-top: 3px; word-break: break-word; }
.log-line.error .lm { color: var(--status-critical); }
.log-line.warn .lm { color: var(--amber-deep); }
:root[data-theme="dark"] .log-line.warn .lm { color: var(--amber); }

.empty { text-align: center; color: var(--text-muted); padding: 36px 20px; font-size: 13.5px; }

.section-title {
  font-size: 12.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin: 38px 0 18px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.section-title:first-child { margin-top: 0; }

.preview-frame { width: 100%; height: 440px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: #fff; }

/* bulk scheduling bar — only present once rows are selected */
.bulkbar {
  display: none;
  background: var(--amber-soft);
  border: 1px solid rgba(232, 168, 18, 0.42);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 24px;
  animation: slideDown var(--med) var(--ease-out);
}
.bulkbar.on { display: block; }
.bulkbar-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.bulk-hint { color: var(--text-secondary); font-size: 12.5px; }
.bulk-sep { width: 1px; height: 22px; background: var(--border-strong); margin: 0 4px; }
.bulkbar input[type=date], .bulkbar input[type=number] {
  padding: 7px 10px; background: var(--surface);
}

.plan-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.plan-chip {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 11px; font-size: 12.5px;
}
.plan-chip b { font-variant-numeric: tabular-nums; }

.day-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.day-row:last-child { border-bottom: 0; }
.day-row .d-date { width: 190px; font-weight: 600; font-size: 13.5px; }
.day-row .d-bar { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.day-row .d-fill { height: 100%; background: var(--amber); border-radius: 999px; transition: width .7s var(--ease-out); }
.day-row .d-n { width: 108px; text-align: right; font-size: 12.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.day-row.over .d-fill { background: var(--status-critical); }

.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--status-good); margin-right: 7px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.mergefields { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mf {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;
  background: var(--surface-3); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 6px; cursor: pointer;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.mf:hover { background: var(--amber-soft); transform: translateY(-1px); }

.secret-reveal {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-3); padding: 10px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 700; letter-spacing: .04em; user-select: all;
  word-break: break-all; margin-top: 8px;
}

/* ------------------------------------------------------------ auth pages */

.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 520px at 12% -8%, var(--amber-soft), transparent 62%),
    radial-gradient(900px 460px at 92% 108%, var(--cyan-soft), transparent 60%),
    var(--page);
}
.auth-card {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift); padding: 34px; width: 100%; max-width: 402px;
  animation: fadeUp var(--slow) var(--ease-out);
}
.auth-card .brand { display: flex; justify-content: center; margin-bottom: 20px; }
.auth-card .brand img { width: 190px; max-width: 70%; height: auto; display: block; }
.auth-card h1 { font-size: 19px; margin: 0 0 6px; letter-spacing: -.01em; text-align: center; }
.auth-card p.lead { color: var(--text-muted); font-size: 13px; margin: 0 0 22px; line-height: 1.55; text-align: center; }
.auth-card .btn { width: 100%; padding: 12px; margin-top: 6px; }
.auth-err { color: var(--status-critical); font-size: 13px; margin-top: 12px; min-height: 18px; text-align: center; }

/* ---------------------------------------------------------- responsive */

@media (max-width: 1200px) {
  .shell { grid-template-columns: 70px minmax(0, 1fr); }
  .aside { grid-column: 1 / -1; position: static; max-height: none; border-left: 0; border-top: 1px solid var(--border); }
  .aside-toggle { display: none; }
  .shell.aside-collapsed .aside-body { display: block; }
}
@media (max-width: 880px) {
  .grid-top { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .search { min-width: 0; order: 3; width: 100%; }
  .main { padding: 18px 16px 32px; }
}

/* Deep links inside setup banners need to read as links on the tinted ground. */
.banner a { color: var(--navy); font-weight: 600; text-decoration: underline; }
:root[data-theme="dark"] .banner a { color: var(--amber); }

/* Secondary bulk-scheduling controls stay folded away until asked for. */
.bulk-more {
  display: none;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(232, 168, 18, 0.4);
}
.bulk-more.on { display: block; animation: slideDown var(--med) var(--ease-out); }

/* Row actions are visual noise repeated down a long table — reveal on hover,
   and keep them reachable by keyboard via :focus-within. */
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.row-actions .btn {
  opacity: 0;
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
tbody tr:hover .row-actions .btn,
tbody tr:focus-within .row-actions .btn { opacity: 1; }
@media (hover: none) {
  /* Touch devices get no hover, so always show them. */
  .row-actions .btn { opacity: 1; }
}
