:root {
  --bg: #07130f;
  --ink: #10231c;
  --muted: #71867d;
  --line: #dfe8e3;
  --card: #ffffff;
  --soft: #f4faf7;
  --soft2: #eef8f4;
  --brand: #10a37f;
  --brand2: #19c79b;
  --red: #e55353;
  --blue: #3182ce;
  --amber: #b7791f;
  --shadow: 0 18px 50px rgba(5, 20, 14, 0.1);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--sans);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  min-height: 100vh;
  background: #f3f6f5;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); }

.shell {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.hero {
  min-height: 96px;
  border-radius: 8px;
  padding: 20px 22px;
  color: white;
  background: #123f34;
  box-shadow: 0 8px 24px rgba(6, 54, 40, .14);
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-start;
}
.hero h1 {
  margin: 8px 0 8px;
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: 0;
}
.hero p {
  margin: 0;
  color: rgba(255,255,255,.82);
  max-width: 760px;
  line-height: 1.5;
}
.hero code {
  color: #d6fff2;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.16);
  padding: 2px 7px;
  border-radius: 8px;
}
.eyebrow {
  color: #b8f7e4;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}
.hero-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.layout {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}
.side {
  position: sticky;
  top: 16px;
  align-self: start;
}
.brandbox {
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(223,232,227,.9);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 4px 16px rgba(5, 20, 14, .06);
  margin-bottom: 12px;
}
.brandbox b { display:block; font-size: 15px; margin-bottom: 6px; }
.brandbox span { display:block; color: var(--muted); font-size: 12px; line-height: 1.55; word-break: break-all; }
.brandbox code { color: #47645b; font-size: 11px; }
.nav {
  background: rgba(255,255,255,.76);
  border: 1px solid rgba(223,232,227,.9);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 4px 16px rgba(5, 20, 14, .06);
}
.nav a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 13px;
  border-radius: 6px;
  color: #48635a;
  font-size: 13px;
  font-weight: 950;
  transition: background .15s ease, color .15s ease, transform .05s ease;
}
.nav a:hover { background: #edf8f3; color: #0f745d; }
.nav a:active { transform: translateY(1px); }
.nav a.active {
  background: #e2f8ef;
  color: #08785f;
  box-shadow: inset 0 0 0 1px #c6ecdf;
}
.nav small {
  min-width: 24px;
  text-align: center;
  color: #7f978e;
  font-family: var(--mono);
  font-size: 11px;
}
.content { min-width: 0; }

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.metric {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(223,232,227,.95);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 3px 12px rgba(5, 20, 14, .05);
  overflow: hidden;
  position: relative;
}
.metric:after { content: none; }
.metric .num {
  color: #0e8f70;
  font-size: 25px;
  font-weight: 1000;
  line-height: 1;
  letter-spacing: 0;
  word-break: break-word;
}
.metric .label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}
.metric.blue .num { color: var(--blue); }
.metric.red .num { color: var(--red); }
.metric.gray .num { color: #64748b; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 390px;
  gap: 12px;
}
.card {
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(223,232,227,.95);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 4px 16px rgba(5, 20, 14, .06);
  margin-bottom: 12px;
  scroll-margin-top: 18px;
}
.card h2 { margin: 0 0 8px; font-size: 16px; letter-spacing: 0; }
.card h3 { font-size: 13px; margin: 0 0 8px; }
.card-h {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.subtle, .hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}
.hint { font-size: 11px; }

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form label, .label-line, label.compact {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #456258;
  font-size: 12px;
  font-weight: 900;
}
.form label.full { grid-column: 1 / -1; }
.form label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 10px 0 0;
  color: #456258;
}
.checkline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 12px;
  font-weight: 900;
  color: #456258;
  white-space: nowrap;
}
.checkline input, .form label.check input { width: auto; }
label.compact { min-width: 160px; }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  border: 1px solid #dce8e2;
  border-radius: 6px;
  background: #fbfefd;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #8de1c8;
  box-shadow: 0 0 0 4px rgba(16,163,127,.10);
  background: #fff;
}
textarea {
  min-height: 92px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

.actions, .toolbar, .bulkbar, .row-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.actions { margin-top: 16px; }
.toolbar { margin-top: 14px; }
.toolbar-tight { margin-top: 0; }
.bulkbar {
  background: #f7fbf9;
  border: 1px solid #e4eee9;
  border-radius: 6px;
  padding: 10px;
  margin: 10px 0;
}

.btn, button.primary, button.secondary, button.danger, a.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 6px;
  padding: 10px 15px;
  font-size: 12px;
  font-weight: 1000;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .05s ease, filter .15s ease, background .15s ease, border-color .15s ease;
  user-select: none;
}
.btn:active, button.primary:active, button.secondary:active, button.danger:active { transform: translateY(1px); }
.primary, .btn.primary, button.primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 10px 22px rgba(16,163,127,.22);
}
.secondary, .btn.secondary, .btn.ghost, button.secondary {
  background: #eef8f4;
  color: #08785f;
  border: 1px solid #c9ecdf;
}
.danger, .btn.danger, button.danger {
  background: #fff1f1;
  color: #b42323;
  border: 1px solid #ffd0d0;
}
.btn:hover, button.primary:hover, button.secondary:hover, button.danger:hover { filter: brightness(.985); }
.btn.sm { padding: 7px 10px; font-size: 11px; }

.badge, .tag, .pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 1000;
  background: #eef6f2;
  color: #2f5b4d;
  white-space: nowrap;
}
.badge { background: rgba(255,255,255,.14); color: white; border: 1px solid rgba(255,255,255,.24); }
.badge i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #b7c8c1;
  display: inline-block;
  margin-right: 2px;
}
.badge.run { background: rgba(16,185,129,.22); color: #d6fff2; }
.badge.run i { background: #86efac; box-shadow: 0 0 0 5px rgba(134,239,172,.12); }
.badge.idle i { background: #cbd5d0; }
.tag.ok, .pill.success, .token-yes { background: #dcfce7; color: #166534; }
.tag.bad, .pill.failed, .token-no { background: #fee2e2; color: #991b1b; }
.pill.running { background: #dbeafe; color: #1d4ed8; }
.pill.queue { background: #f1f5f9; color: #475569; }

.run-card .stat, .stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #edf3ef;
  font-size: 12px;
}
.key { color: var(--muted); flex: 0 0 auto; }
.value { font-weight: 950; text-align: right; word-break: break-word; min-width: 0; }
.value .mail-meta { display: inline; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.panel-soft {
  background: #f8fcfa;
  border: 1px solid #e3ece7;
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}
.task-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.msg {
  margin-top: 12px;
  min-height: 18px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}
.msg.ok { color: #15803d; }
.msg.err { color: #dc2626; }
.mail-meta { color: var(--muted); font-size: 12px; line-height: 1.55; }

.log {
  margin: 0;
  height: 390px;
  overflow: auto;
  white-space: pre-wrap;
  padding: 16px;
  border-radius: 6px;
  border: 1px solid rgba(7,19,15,.18);
  background: #07130f;
  color: #d6fff2;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}
.log .line-err { color: #ffb4b4; }
.log .line-ok { color: #86efac; }

.table-wrap {
  overflow: auto;
  border: 1px solid #e3ece7;
  border-radius: 6px;
}
table.acct {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  font-size: 13px;
}
table.acct th, table.acct td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf3ef;
  text-align: left;
  vertical-align: top;
}
table.acct th {
  background: #f8fcfa;
  color: #71867d;
  font-size: 11px;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
}
table.acct tr:hover td { background: #fbfefd; }
table.acct code {
  font-family: var(--mono);
  font-size: 12px;
  color: #315147;
}
.muted { color: #8aa099; }

.foot {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
  padding: 0 4px;
}
.foot code { color: #47645b; font-family: var(--mono); }

@media (max-width: 1120px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .nav { display: grid; grid-template-columns: repeat(6, 1fr); }
  .nav a { justify-content: center; }
  .nav small { display: none; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { width: min(100% - 18px, 1440px); padding-top: 10px; }
  .hero { border-radius: 8px; padding: 18px; flex-direction: column; }
  .nav { grid-template-columns: repeat(2, 1fr); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .form, .form.two, .form.three, .split { grid-template-columns: 1fr; }
  .card { padding: 16px; border-radius: 8px; }
  .metric { padding: 14px; border-radius: 8px; }
}

/* Real tab separation: only the active module is visible. */
.view { display: none; }
.view.active { display: block; }
.grid.view.active { display: grid; }

.span-all { grid-column: 1 / -1; }
.task-board, .mailbox-list, .message-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.empty-card {
  padding: 18px;
  border: 1px dashed #d7e4de;
  border-radius: 8px;
  color: #789087;
  background: #f8fcfa;
}
.empty-card.bad { color: #b42323; background: #fffafa; border-color: #ffd6d6; }
.toolbar.tight { margin: 0; }
.search-input { max-width: 320px; min-width: 220px; }
.mail-library {
  margin-top: 16px;
  border-top: 1px solid #edf3ef;
  padding-top: 16px;
}
.mailbox-card, .task-card, .message-card {
  background: #fff;
  border: 1px solid #e1ebe6;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 8px 22px rgba(5, 20, 14, .045);
}
.mailbox-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
}
.mailbox-email, .task-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 1000;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mailbox-sub, .task-sub, .message-meta {
  margin-top: 4px;
  color: #71867d;
  font-size: 12px;
  line-height: 1.45;
}
.mailbox-reason {
  margin-top: 6px;
  color: #b42323;
  font-size: 11px;
  line-height: 1.45;
  word-break: break-word;
}
.mailbox-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mailbox-actions { display: flex; justify-content: flex-end; }
.mail-viewer {
  display: none;
  margin-top: 14px;
  background: #f8fcfa;
  border: 1px solid #e3ece7;
  border-radius: 8px;
  padding: 14px;
}
.mail-viewer.active { display: block; }
.viewer-head, .task-head, .message-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.message-title b { max-width: 760px; }
.message-card pre {
  margin: 10px 0 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  padding: 12px;
  border-radius: 6px;
  background: #07130f;
  color: #d6fff2;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
}
.task-card.running { border-color: #93c5fd; background: #eff6ff; }
.task-card.success { border-color: #86efac; background: #f0fdf4; }
.task-card.skipped { border-color: #f2d39a; background: #fffaf0; }
.task-card.failed { border-color: #fecaca; background: #fef2f2; }
.task-card.cancelled { border-color: #e2e8f0; background: #f8fafc; }
.task-steps {
  margin-top: 10px;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 6px;
  background: rgba(255,255,255,.68);
  padding: 8px 10px;
  max-height: 178px;
  overflow: auto;
}
.task-step {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.65;
  color: #4f675e;
  word-break: break-word;
}
.task-step span {
  display: inline-block;
  color: #8aa099;
  margin-right: 8px;
}
@media (max-width: 760px) {
  .mailbox-card { grid-template-columns: 1fr; align-items: stretch; }
  .mailbox-tags, .mailbox-actions { justify-content: flex-start; }
  .search-input { min-width: 0; max-width: none; }
}

.mailbox-inline-viewer {
  display: none;
  grid-column: 1 / -1;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid #edf3ef;
}
.mailbox-inline-viewer.active { display: block; }
.inline-viewer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.inline-viewer-head b {
  font-size: 13px;
  color: var(--ink);
}

.mailbox-card {
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
}
.mailbox-select { display:flex; align-items:center; justify-content:center; }
.compact-message pre { display:none; }
.message-actions { margin-top: 8px; }
.modal-mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(7, 19, 15, .62);
  padding: 28px;
  align-items: center;
  justify-content: center;
}
.modal-mask.active { display: flex; }
.modal-box {
  width: min(960px, 100%);
  max-height: calc(100vh - 56px);
  background: #fff;
  border: 1px solid #dfe8e3;
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0,0,0,.28);
  padding: 18px;
  overflow: hidden;
}
.mail-modal-box { width: min(980px, 100%); }
.modal-title-row {
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:flex-start;
  margin-bottom: 12px;
}
.modal-title { font-weight: 1000; font-size: 16px; color: var(--ink); }
.mail-frame {
  width: 100%;
  height: min(720px, calc(100vh - 170px));
  border: 1px solid #e3ece7;
  border-radius: 6px;
  background: white;
}
.pager-info { color: #71867d; font-size: 12px; font-weight: 900; }
button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 760px) {
  .mailbox-card { grid-template-columns: 1fr; }
  .mailbox-select { justify-content:flex-start; }
  .modal-mask { padding: 10px; }
  .mail-frame { height: calc(100vh - 150px); }
}

/* ---- Login page ---- */
.login-body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f3f5f4;
  font-family: var(--sans);
  color: #1a1a1a;
}
.login-card {
  width: min(360px, 100%);
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  padding: 32px 28px 28px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
}
.login-card h1 {
  margin: 0 0 22px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
  color: #111;
}
.login-form {
  display: grid;
  gap: 12px;
}
.login-form input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.login-form input:focus {
  border-color: #10a37f;
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.12);
}
.login-form button {
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  background: #10a37f;
  color: #fff;
  cursor: pointer;
}
.login-form button:hover { background: #0e9372; }
.login-form button:disabled { opacity: .55; cursor: not-allowed; }
.login-msg {
  min-height: 18px;
  margin-top: 2px;
  font-size: 13px;
  text-align: center;
  color: transparent;
}
.login-msg.err { color: #dc2626; }
.secret-mask {
  color: #5b6f67;
  background: #f0f6f3;
  border: 1px solid #dce9e3;
  border-radius: 8px;
  padding: 2px 7px;
}

/* ---- Console UI v2 ----------------------------------------------------- */
:root {
  --bg: #f4f5f7;
  --ink: #202329;
  --muted: #737984;
  --line: #e3e6ea;
  --card: #ffffff;
  --soft: #f7f8fa;
  --soft2: #f0f2f4;
  --brand: #0e9f6e;
  --brand2: #087f5b;
  --red: #d94b4b;
  --blue: #3478c7;
  --amber: #c47a18;
  --shadow: 0 1px 2px rgba(24, 27, 32, .04), 0 8px 24px rgba(24, 27, 32, .04);
}

* { letter-spacing: 0 !important; }
body { background: var(--bg); color: var(--ink); }
button, input, select, textarea { color: inherit; }

.shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  grid-template-rows: 72px minmax(calc(100vh - 108px), auto) 36px;
}

.layout { display: contents; }

.side {
  grid-column: 1;
  grid-row: 1 / -1;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px 14px;
  background: #181b20;
  color: #f7f8fa;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 50;
}

.brandbox {
  min-height: 44px;
  margin: 0 4px 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #10a777;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

.brand-copy { min-width: 0; line-height: 1.2; }
.brand-copy b { margin: 0; color: #fff; font-size: 14px; font-weight: 720; }
.brand-copy small { display: block; margin-top: 3px; color: #8f959f; font-size: 10px; font-weight: 650; }

.nav {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav a {
  position: relative;
  min-height: 42px;
  padding: 0 10px;
  border-radius: 6px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  justify-content: initial;
  gap: 8px;
  color: #a8aeb7;
  font-size: 12px;
  font-weight: 650;
  transition: color .15s ease, background .15s ease;
}
.nav a:hover { background: #22262c; color: #f4f5f7; }
.nav a:active { transform: none; }
.nav a.active {
  background: #292d33;
  color: #fff;
  box-shadow: inset 3px 0 0 #18b985;
}
.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #7f8792;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}
.nav a.active .nav-icon { color: #36d19d; }
.nav small {
  min-width: 22px;
  padding: 2px 4px;
  border-radius: 4px;
  background: #22262b;
  color: #767d87;
  font-size: 9px;
  font-weight: 700;
}
.nav a.active small { background: #343940; color: #b8bec6; }

.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.ops-grid .span-all { grid-column: 1 / -1; }
.ops-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-top: 16px;
  border: 1px solid var(--line);
  background: var(--line);
}
.ops-metrics > div { padding: 16px; background: #fff; }
.ops-metrics strong { display: block; font-size: 24px; }
.ops-metrics span, .ops-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.reason-list { margin-top: 12px; }
.reason-list > div, .ops-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.reason-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-list { max-height: 310px; overflow: auto; }
.ops-row > div:first-of-type { min-width: 0; }
.ops-row b { overflow-wrap: anywhere; }
.ops-row.selectable { justify-content: flex-start; cursor: pointer; }
.upload-state { display: block; margin-top: 4px; font-size: 9px; }
.upload-state.success { color: var(--green); }
.upload-state.failed { color: var(--red); }

.operation-progress {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #ccd5dc;
  border-left: 4px solid #2683d8;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(21, 28, 36, .05);
}
.operation-progress-head, .operation-progress-meta, .operation-progress-detail,
.inline-progress > div:first-child, .resource-progress > div:first-child,
.failure-chart-title, .failure-bar > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.operation-progress-head { margin-bottom: 10px; }
.operation-progress-head span, .operation-progress-detail, .inline-progress small { color: var(--muted); font-size: 10px; }
.operation-progress-list { display: grid; gap: 10px; }
.operation-progress-meta { font-size: 11px; }
.operation-progress-meta b { min-width: 155px; }
.operation-progress-meta span { flex: 1; color: #56616c; }
.operation-progress-meta strong { font-variant-numeric: tabular-nums; }
.operation-progress-track, .inline-progress-track, .resource-track, .failure-track {
  position: relative;
  height: 7px;
  margin: 6px 0;
  overflow: hidden;
  border-radius: 2px;
  background: #e7ebef;
}
.operation-progress-track i, .inline-progress-track i, .resource-track i, .failure-track i {
  display: block;
  width: 0;
  height: 100%;
  background: #2683d8;
  transition: width .28s ease;
}
.operation-progress-row.success .operation-progress-track i { background: #12a878; }
.operation-progress-row.failed .operation-progress-track i { background: #df4c52; }
.inline-progress { margin-top: 14px; padding: 12px; border: 1px solid #cfd8df; border-radius: 5px; background: #f8fafb; }
.inline-progress.card { margin: 0 0 16px; background: #fff; }
.inline-progress > div:first-child { font-size: 11px; }
.run-progress { margin-top: 14px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 220px minmax(340px, 1fr) minmax(280px, .85fr);
  gap: 20px;
  margin-top: 18px;
}
.dashboard-score, .dashboard-resources, .failure-chart {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}
.dashboard-score { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring {
  display: grid;
  width: 132px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#12a878 var(--score), #dfe5ea 0deg);
}
.score-ring::before { content: ""; grid-area: 1 / 1; width: 96px; aspect-ratio: 1; border-radius: 50%; background: #fff; }
.score-ring > div { z-index: 1; grid-area: 1 / 1; text-align: center; }
.score-ring strong { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.score-ring span, .score-caption span { color: var(--muted); font-size: 10px; }
.score-caption { margin-top: 12px; text-align: center; }
.score-caption b, .score-caption span { display: block; }
.resource-progress + .resource-progress { margin-top: 18px; }
.resource-progress > div:first-child { font-size: 11px; }
.resource-progress small { color: var(--muted); font-size: 9px; }
.resource-progress .resource-track i { background: #12a878; }
.resource-progress.account-health .resource-track i { background: #2683d8; }
.dashboard-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.dashboard-kpis > div { padding: 10px; border: 1px solid var(--line); background: #fff; }
.dashboard-kpis strong, .dashboard-kpis span { display: block; }
.dashboard-kpis strong { font-size: 20px; }
.dashboard-kpis span { color: var(--muted); font-size: 9px; }
.failure-chart-title { margin-bottom: 14px; font-size: 11px; }
.failure-chart-title span { color: var(--muted); font-size: 9px; }
.failure-bar + .failure-bar { margin-top: 10px; }
.failure-bar > div:first-child { font-size: 9px; }
.failure-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.failure-track { height: 6px; }
.failure-track i { background: #df4c52; }
.dashboard-empty { display: grid; min-height: 128px; place-items: center; color: var(--muted); font-size: 10px; }

@media (max-width: 900px) {
  .ops-grid { grid-template-columns: 1fr; }
  .ops-grid .span-all { grid-column: auto; }
  .ops-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); border: 0; background: transparent; gap: 1px; }
  .ops-metrics > div { border: 1px solid var(--line); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-score { flex-direction: row; gap: 20px; }
  .score-caption { margin-top: 0; text-align: left; }
  .operation-progress-meta { align-items: flex-start; flex-wrap: wrap; }
  .operation-progress-meta b { min-width: 0; width: 100%; }
}

.hero {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 72px;
  padding: 0 26px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  box-shadow: none;
  align-items: center;
  backdrop-filter: blur(12px);
}
.page-heading { min-width: 0; }
.hero h1 { margin: 3px 0 0; font-size: 17px; line-height: 1.25; font-weight: 730; color: #1f2329; }
.hero p { margin: 3px 0 0; color: #858b94; font-size: 11px; line-height: 1.3; }
.eyebrow { color: #999fa8; font-size: 8px; line-height: 1; font-weight: 750; }
.hero-actions { flex-wrap: nowrap; gap: 8px; }

.content {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  max-width: 1560px;
  min-width: 0;
  margin: 0 auto;
  padding: 22px 26px 28px;
}

.metrics { gap: 10px; margin-bottom: 14px; }
.metric {
  min-width: 0;
  min-height: 88px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(24, 27, 32, .025);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.metric .num { color: #168760; font-size: 24px; line-height: 1.1; font-weight: 740; }
.metric .label { margin: 0; color: #828892; font-size: 10px; font-weight: 650; }
.metric.blue .num { color: var(--blue); }
.metric.red .num { color: var(--red); }
.metric.gray .num { color: #626a75; }

.grid { grid-template-columns: minmax(0, 1.4fr) minmax(300px, .72fr); gap: 14px; }
.card {
  margin-bottom: 14px;
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 5px; color: #24282e; font-size: 14px; font-weight: 720; }
.card h3 { color: #353a42; font-size: 12px; font-weight: 700; }
.card-h { margin-bottom: 16px; align-items: center; }
.subtle, .hint { color: #858b95; font-size: 11px; line-height: 1.55; }
.hint { font-size: 10px; }

.form { gap: 13px 14px; margin-top: 10px; }
.form label, .label-line, label.compact {
  gap: 6px;
  color: #555c66;
  font-size: 10px;
  font-weight: 680;
}
.form label.check { color: #555c66; }
.checkline { color: #555c66; font-size: 10px; font-weight: 680; }
input[type="checkbox"] { accent-color: var(--brand); }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid #d9dde2;
  border-radius: 5px;
  background: #fff;
  color: #252a31;
  font-size: 12px;
}
input::placeholder, textarea::placeholder { color: #a6abb3; }
input:hover, select:hover, textarea:hover { border-color: #bfc5cc; }
input:focus, select:focus, textarea:focus {
  border-color: #25a77a;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(14,159,110,.1);
}
textarea { min-height: 96px; line-height: 1.55; }

.actions, .toolbar, .bulkbar, .row-btns { gap: 7px; }
.actions { margin-top: 16px; }
.toolbar { margin-top: 13px; }
.bulkbar {
  margin: 12px 0 0;
  padding: 9px 10px;
  border: 1px solid #e5e8ec;
  border-radius: 5px;
  background: #f8f9fa;
}

.btn, button.primary, button.secondary, button.danger, a.btn {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}
.primary, .btn.primary, button.primary { background: #0e9f6e; color: #fff; box-shadow: none; }
.primary:hover, .btn.primary:hover, button.primary:hover { background: #0b8b60; filter: none; }
.secondary, .btn.secondary, .btn.ghost, button.secondary {
  border: 1px solid #dcdfe4;
  background: #fff;
  color: #4d545e;
}
.secondary:hover, .btn.secondary:hover, button.secondary:hover { border-color: #c4c9d0; background: #f7f8f9; filter: none; }
.danger, .btn.danger, button.danger { border: 1px solid #f0cccc; background: #fff7f7; color: #c33e3e; }
.danger:hover, .btn.danger:hover, button.danger:hover { border-color: #e5aaaa; background: #fff1f1; filter: none; }
#btnRefresh::before { content: "↻"; font-size: 14px; font-weight: 500; }
#btnLogout::before { content: "↪"; font-size: 13px; font-weight: 500; }
#btnStart::before { content: "▶"; font-size: 9px; }
#btnStop::before { content: "■"; font-size: 9px; }

.badge, .tag, .pill {
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef1f3;
  color: #59616c;
  font-size: 9px;
  font-weight: 720;
}
.badge { border: 1px solid #dde1e5; background: #f7f8f9; color: #555d67; }
.badge i { width: 6px; height: 6px; margin-right: 3px; background: #959ca5; }
.badge.run { border-color: #a8e5cf; background: #e9faf4; color: #087a55; }
.badge.run i { background: #13a875; box-shadow: 0 0 0 3px rgba(19,168,117,.12); }
.tag.ok, .pill.success, .token-yes { background: #e8f8f1; color: #087a55; }
.tag.bad, .pill.failed, .token-no { background: #fff0f0; color: #b53636; }
.pill.running { background: #edf5ff; color: #286bb7; }
.pill.queue { background: #f0f2f4; color: #646c76; }

.run-card .stat, .stat { padding: 11px 0; border-bottom-color: #eceef1; font-size: 11px; }
.key { color: #858b94; }
.value { color: #363c44; font-weight: 680; }
.panel-soft {
  padding: 15px;
  border: 1px solid #e4e7eb;
  border-radius: 5px;
  background: #f8f9fa;
}
.task-title-row { align-items: center; }
.msg { color: #767d87; font-size: 11px; font-weight: 620; }

.log {
  height: min(560px, calc(100vh - 230px));
  padding: 16px;
  border: 1px solid #292e34;
  border-radius: 5px;
  background: #15181c;
  color: #cfd5dc;
  font-size: 11px;
  line-height: 1.65;
  box-shadow: none;
}
.log .line-ok { color: #65d6aa; }
.log .line-err { color: #ff8b8b; }

.table-wrap { border-color: #e3e6ea; border-radius: 5px; }
table.acct { font-size: 11px; }
table.acct th, table.acct td { padding: 10px 11px; border-bottom-color: #eceef1; }
table.acct th { background: #f7f8fa; color: #737a84; font-size: 9px; font-weight: 730; }
table.acct tr:hover td { background: #fafbfc; }
table.acct code { color: #454d56; font-size: 10px; }

.empty-card {
  padding: 18px;
  border: 1px dashed #d4d8de;
  border-radius: 5px;
  background: #fafbfc;
  color: #858c95;
  font-size: 11px;
  text-align: center;
}
.mailbox-card, .task-card, .message-card {
  padding: 12px 13px;
  border: 1px solid #e2e5e9;
  border-radius: 5px;
  background: #fff;
  box-shadow: none;
}
.mailbox-card:hover, .task-card:hover { border-color: #ccd1d7; }
.mailbox-email, .task-name { color: #2f343b; font-size: 11px; font-weight: 700; }
.mailbox-sub, .task-sub, .message-meta { color: #858c95; font-size: 10px; }
.mail-viewer, .task-steps {
  border-color: #e3e6ea;
  border-radius: 5px;
  background: #f8f9fa;
}
.task-card.running { border-color: #8fc1ec; border-left: 3px solid #3478c7; background: #fff; }
.task-card.success { border-color: #9bd8c1; border-left: 3px solid #0e9f6e; background: #fff; }
.task-card.skipped { border-color: #e6c98f; border-left: 3px solid #b7791f; background: #fff; }
.task-card.failed { border-color: #e8b3b3; border-left: 3px solid #d94b4b; background: #fff; }
.task-card.cancelled { border-left: 3px solid #8a929d; background: #fff; }
.task-step { color: #535b65; font-size: 10px; }
.task-step span { color: #9298a1; }
.search-input { min-width: 220px; }
.mail-library { border-top-color: #e7e9ec; }
.pager-info { color: #7c838d; font-size: 10px; font-weight: 650; }

.modal-mask { background: rgba(20,23,28,.64); backdrop-filter: blur(3px); }
.modal-box {
  padding: 18px;
  border-color: #dfe3e7;
  border-radius: 7px;
  box-shadow: 0 24px 70px rgba(17,20,24,.24);
}
.modal-title { color: #24282e; font-size: 14px; font-weight: 720; }
.mail-frame { border-color: #e2e5e9; border-radius: 5px; }

.foot {
  grid-column: 2;
  grid-row: 3;
  margin: 0;
  padding: 0 26px;
  align-items: center;
  border-top: 1px solid #e6e8eb;
  color: #999fa7;
  background: #f7f8f9;
  font-size: 9px;
}
.foot code { color: #777e87; }

/* Login uses the same restrained console language. */
.login-body {
  background: #f1f3f5;
  color: #22262c;
}
.login-shell { width: min(392px, 100%); }
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}
.login-brand .brand-mark { width: 36px; height: 36px; flex-basis: 36px; }
.login-brand b { display: block; font-size: 14px; }
.login-brand span:last-child { color: #7d838c; font-size: 10px; line-height: 1.35; }
.login-card {
  width: 100%;
  padding: 28px;
  border: 1px solid #dfe3e7;
  border-radius: 7px;
  box-shadow: 0 16px 45px rgba(24,27,32,.08);
}
.login-card h1 { margin: 0; color: #202329; font-size: 18px; text-align: left; }
.login-lead { margin: 6px 0 20px; color: #858b94; font-size: 11px; }
.login-form { gap: 13px; }
.login-form label { display: grid; gap: 6px; color: #555c66; font-size: 10px; font-weight: 680; }
.login-form input { min-height: 40px; padding: 9px 11px; border-radius: 5px; font-size: 12px; }
.login-form button { min-height: 40px; margin-top: 5px; border-radius: 5px; background: #0e9f6e; font-size: 12px; }
.login-form button:hover { background: #0b8b60; }
.login-msg { margin: 0; font-size: 11px; }

@media (max-width: 1120px) {
  .shell { grid-template-columns: 204px minmax(0, 1fr); }
  .layout { display: contents; }
  .side { position: sticky; }
  .nav { display: flex; }
  .nav a { justify-content: initial; }
  .nav small { display: inline-block; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .shell { display: block; min-height: 100vh; }
  .hero {
    position: sticky;
    min-height: 64px;
    padding: 0 14px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .hero h1 { font-size: 15px; }
  .hero p { display: none; }
  .hero-actions { gap: 6px; }
  .icon-command { width: 34px; padding: 0; font-size: 0 !important; }
  .icon-command::before { font-size: 14px !important; }
  .side {
    position: sticky;
    top: 64px;
    width: 100%;
    height: 51px;
    padding: 6px 10px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .brandbox { display: none; }
  .nav { min-width: max-content; flex-direction: row; gap: 3px; }
  .nav a {
    min-height: 38px;
    padding: 0 10px;
    grid-template-columns: 20px auto;
    gap: 5px;
  }
  .nav a.active { box-shadow: inset 0 -2px 0 #18b985; }
  .nav-icon { width: 18px; height: 20px; }
  .nav small { display: none; }
  .content { padding: 14px 12px 22px; }
  .foot { min-height: 34px; padding: 0 12px; }
}

@media (max-width: 560px) {
  .hero-actions .tag { display: none !important; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .metric { min-height: 76px; padding: 12px; }
  .metric .num { font-size: 20px; }
  .form, .form.two, .form.three, .split { grid-template-columns: 1fr; }
  .card { padding: 15px; border-radius: 6px; }
  .toolbar.tight { width: 100%; }
  .search-input { min-width: 0; max-width: none; }
  .mailbox-card { grid-template-columns: 1fr; }
  .mailbox-select, .mailbox-tags, .mailbox-actions { justify-content: flex-start; }
  .actions .btn, .actions button { flex: 1 1 auto; }
  .modal-mask { padding: 8px; }
}

/* Login alignment with the white console shell. */
.login-body { background: #fff; }
.login-brand .brand-mark {
  border: 1px solid #18181b;
  border-radius: 50%;
  background: #18181b;
  box-shadow: none;
}
.login-card {
  border-color: #e4e4e7;
  border-radius: 7px;
  box-shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 18px 50px rgba(24, 24, 27, .06);
}
.login-form input { border-color: #d4d4d8; border-radius: 6px; }
.login-form input:focus {
  border-color: #71717a;
  box-shadow: 0 0 0 3px rgba(39, 39, 42, .08);
}
.login-form button {
  border: 1px solid #18181b;
  border-radius: 6px;
  background: #18181b;
}
.login-form button:hover { background: #3f3f46; }
