:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --panel: #ffffff;
  --panel-soft: #f9fbf7;
  --ink: #18231e;
  --muted: #66736d;
  --line: #dce5df;
  --line-strong: #c7d3cc;
  --green: #2f6c54;
  --green-dark: #184532;
  --teal: #1e7580;
  --amber: #b47522;
  --blue: #315e9e;
  --danger: #a13a3a;
  --shadow: 0 18px 50px rgba(31, 42, 32, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0)),
    var(--bg);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(47,108,84,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(49,94,158,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000 0, transparent 72%);
}

button, input, select { font: inherit; }
button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
button:hover { background: var(--green-dark); transform: translateY(-1px); }
button.secondary { background: #fff; color: var(--green); border-color: rgba(255,255,255,0.5); }
button.secondary:hover { color: #fff; border-color: var(--green-dark); }
button.ghost { background: transparent; color: #dce8e1; border-color: rgba(255,255,255,0.22); }
button.ghost:hover { background: rgba(255,255,255,0.1); }
button:disabled, button:disabled:hover { opacity: 0.62; cursor: not-allowed; transform: none; }
button.secondary:disabled, button.secondary:disabled:hover { background: #fff; color: var(--green); border-color: var(--line); }

h1, h2, p { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(24px, 2.3vw, 36px); line-height: 1.08; }
h2 { font-size: 18px; line-height: 1.2; }
main { width: min(1480px, calc(100vw - 40px)); margin: 22px auto 48px; position: relative; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 128px;
  padding: 28px clamp(24px, 4vw, 54px);
  background:
    linear-gradient(120deg, rgba(30,117,128,0.34), transparent 42%),
    linear-gradient(135deg, #102b20 0%, #173d2d 58%, #213f49 100%);
  color: #fff;
  overflow: hidden;
  position: relative;
}
.topbar::after {
  content: "";
  position: absolute;
  inset: auto -10% 0 -10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: sweep 4.8s linear infinite;
}
.brandBlock, .topbarRight, .sectionHead, .filterRow { display: flex; align-items: center; }
.brandBlock { gap: 14px; position: relative; z-index: 1; }
.brandBlock p:not(.eyebrow) { margin-top: 8px; color: #d7e2dc; }
.brandMark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,0.26);
  border-radius: 8px;
  background: rgba(255,255,255,0.12);
  font-weight: 800;
  color: #fff;
}
.topbarRight { gap: 10px; flex-wrap: wrap; justify-content: flex-end; position: relative; z-index: 1; }
.sessionEmail { color: #d7e2dc; font-size: 14px; }
.eyebrow {
  margin-bottom: 7px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar .eyebrow { color: #9fd7cf; }
.muted { color: var(--muted); font-size: 13px; }

.loginShell {
  display: grid;
  grid-template-columns: minmax(340px, 460px);
  gap: 22px;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 210px);
}
.loginCard, .summaryBand, .panelBlock {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.authVisual {
  position: relative;
  overflow: hidden;
  min-height: 500px;
  background:
    linear-gradient(150deg, rgba(47,108,84,0.18), transparent 48%),
    linear-gradient(120deg, #f8faf6, #eef4f0 58%, #f6f4ef);
}
.signalGrid {
  position: absolute;
  inset: 26px;
  border: 1px solid rgba(47,108,84,0.18);
  border-radius: 8px;
  background-image:
    linear-gradient(rgba(47,108,84,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(49,94,158,0.12) 1px, transparent 1px);
  background-size: 34px 34px;
  animation: gridShift 12s linear infinite;
}
.flowLine {
  position: absolute;
  left: -18%;
  width: 56%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  opacity: 0.75;
  animation: flow 4.6s linear infinite;
}
.flowLineA { top: 32%; }
.flowLineB { top: 62%; animation-delay: 1.5s; background: linear-gradient(90deg, transparent, var(--amber), transparent); }
.miniBoard {
  position: absolute;
  right: 46px;
  bottom: 54px;
  width: min(430px, calc(100% - 92px));
  border: 1px solid rgba(24,69,50,0.18);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 44px rgba(31,42,32,0.16);
}
.miniTop, .miniMetric, .miniRows span {
  display: block;
  border-radius: 5px;
  background: #dfe8e2;
}
.miniTop { width: 42%; height: 15px; margin-bottom: 18px; background: #b8ccc1; }
.miniMetric { display: inline-block; width: 24%; height: 72px; margin-right: 10px; background: #edf2ef; }
.miniMetric.wide { width: 34%; background: rgba(47,108,84,0.18); }
.miniMetric.accent { background: rgba(180,117,34,0.2); }
.miniRows { display: grid; gap: 10px; margin-top: 18px; }
.miniRows span { height: 12px; animation: rowPulse 2.8s ease-in-out infinite; }
.miniRows span:nth-child(2) { width: 84%; animation-delay: .3s; }
.miniRows span:nth-child(3) { width: 92%; animation-delay: .6s; }
.miniRows span:nth-child(4) { width: 76%; animation-delay: .9s; }
.loginCard { padding: 34px; align-self: center; width: 100%; }
.loginCard h2 { font-size: 28px; }
.loginHint { margin: 8px 0 22px; color: var(--muted); }
.loginCard button { width: 100%; margin-top: 14px; }
.errorText { min-height: 20px; margin-top: 12px; color: var(--danger); }

label { display: grid; gap: 7px; margin-top: 14px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(30,117,128,0.14); }

.summaryBand, .panelBlock { padding: 20px; margin-bottom: 18px; }
.sectionHead { justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.sectionHead.compact { align-items: flex-start; }
.metricsGrid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.metric {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: linear-gradient(180deg, #fff, var(--panel-soft));
  position: relative;
  overflow: hidden;
}
.metric::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--green);
}
.metric[data-tone="teal"]::before { background: var(--teal); }
.metric[data-tone="blue"]::before { background: var(--blue); }
.metric[data-tone="danger"]::before { background: var(--danger); }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 8px; font-size: 30px; line-height: 1; }
.metric small { display: block; margin-top: 10px; color: var(--muted); }
.notice { min-height: 20px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.notice.error { color: var(--danger); }
.contentGrid { display: grid; grid-template-columns: minmax(360px, 0.9fr) minmax(580px, 1.6fr); gap: 18px; align-items: start; }
.filterRow { gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.filterRow input { width: min(300px, 44vw); }
.filterRow select { width: 168px; }
.filterRow button { min-height: 42px; }
.tableWrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.compactTable table { min-width: 560px; }
table { width: 100%; min-width: 980px; border-collapse: collapse; }
th, td { padding: 13px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; background: #f7faf8; }
td { font-size: 14px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfb; }
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  background: #f8faf7;
}
.status.sent { color: var(--green-dark); background: rgba(47,108,84,0.1); border-color: rgba(47,108,84,0.22); }
.status.dry_run { color: var(--blue); background: rgba(49,94,158,0.1); border-color: rgba(49,94,158,0.22); }
.status.failed { color: var(--danger); background: rgba(161,58,58,0.1); border-color: rgba(161,58,58,0.22); }
.status.skipped { color: var(--amber); background: rgba(180,117,34,0.12); border-color: rgba(180,117,34,0.24); }
.detailCell { max-width: 340px; color: var(--muted); }

@keyframes sweep { from { transform: translateX(-40%); } to { transform: translateX(40%); } }
@keyframes gridShift { from { background-position: 0 0; } to { background-position: 68px 68px; } }
@keyframes flow { from { transform: translateX(0); } to { transform: translateX(220%); } }
@keyframes rowPulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

@media (max-width: 1100px) {
  .loginShell, .contentGrid { grid-template-columns: 1fr; }
  .metricsGrid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}
@media (max-width: 720px) {
  main { width: min(100% - 24px, 1480px); margin-top: 14px; }
  .topbar { align-items: flex-start; flex-direction: column; padding: 22px; }
  .brandBlock { align-items: flex-start; }
  .brandMark { width: 40px; height: 40px; }
  .metricsGrid { grid-template-columns: 1fr; }
  .sectionHead { align-items: flex-start; flex-direction: column; }
  .filterRow, .filterRow input, .filterRow select, .filterRow button { width: 100%; }
  .authVisual { display: none; }
  .loginCard { padding: 24px; }
}
.authVisual { display: none; }
