:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #141414;
  --line: #303030;
  --text: #f3f1ea;
  --muted: #a4a39d;
  --yellow: #f7cf26;
  --yellow-bright: #ffdd4d;
  --danger: #ff7777;
  --success: #8adf91;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-width: 320px; margin: 0; color: var(--text); background: var(--bg); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--yellow); text-underline-offset: 3px; }
a:hover { color: var(--yellow-bright); }

.page { width: min(1440px, calc(100% - 48px)); min-height: 100vh; margin: 0 auto; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px 0 21px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 13px; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; color: #0a0a0a; background: var(--yellow); font-weight: 900; }
.logo { display: block; font-size: 17px; font-weight: 800; letter-spacing: .11em; }
.tagline { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.nav a { padding: 7px 10px; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.nav a:hover { color: var(--yellow); background: #1c1c1c; }
.logout { margin: 0 0 0 auto; }
.logout-button { min-height: 34px; padding: 7px 11px; color: var(--yellow) !important; border-color: #5a4b14; background: transparent; }
.logout-button:hover { color: #111 !important; border-color: var(--yellow); background: var(--yellow); }

.content { min-height: 560px; padding: 38px 0 56px; }
.footer { padding: 18px 0 28px; color: #757575; border-top: 1px solid var(--line); font-size: 12px; }
h1 { margin: 0 0 25px; font-size: clamp(25px, 4vw, 34px); line-height: 1.15; letter-spacing: -.04em; }
h2 { margin: 40px 0 14px; color: var(--text); font-size: 17px; }
p { margin: 0 0 18px; }

button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 37px; padding: 8px 13px; border: 1px solid var(--yellow); border-radius: 2px; color: #111 !important; background: var(--yellow); font: 700 13px/1 Inter, ui-sans-serif, system-ui, sans-serif; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
button:hover, .button:hover { background: var(--yellow-bright); border-color: var(--yellow-bright); }
button:active, .button:active { transform: translateY(1px); }
button.danger { color: var(--danger) !important; border-color: #6d3333; background: transparent; }
button.danger:hover { color: #171010 !important; background: var(--danger); border-color: var(--danger); }

input, textarea, select { max-width: 100%; padding: 9px 10px; border: 1px solid #3a3a3a; border-radius: 2px; outline: none; color: var(--text); background: #101010; font: inherit; transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgb(247 207 38 / 12%); }
textarea { min-height: 86px; resize: vertical; }
small { color: var(--muted); }
code { padding: 2px 5px; color: #f9dd62; background: #202020; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.grid, .form-table, .info, .message { width: 100%; border-collapse: collapse; border: 1px solid var(--line); background: var(--surface); }
.grid th, .form-table th, .info th, .message th { padding: 10px 12px; color: var(--muted); border-bottom: 1px solid var(--line); background: #191919; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.grid td, .form-table td, .info td, .message td { padding: 12px; border-bottom: 1px solid #282828; vertical-align: top; }
.grid tr:last-child td, .form-table tr:last-child td, .info tr:last-child td, .message tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: #1a1a1a; }
.form-table { width: min(880px, 100%); }
.form-table th, .info th { width: 210px; }
.compact { width: min(460px, 100%); }
.description { min-width: 230px; max-width: 440px; white-space: pre-wrap; }
.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 20px; padding: 13px; border: 1px solid var(--line); background: var(--surface); }
.message { margin-bottom: 16px; }
.message > tbody > tr > th { color: var(--text); background: #1c1c1c; font-size: 13px; letter-spacing: 0; text-transform: none; }
.preview { margin: 0; color: #e3e1dc; white-space: pre-wrap; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.inline { display: inline; }
.notice, .warning, .error, .empty { margin: 0 0 20px; padding: 13px 15px; border: 1px solid var(--line); background: var(--surface); }
.notice, .warning { border-left: 3px solid var(--yellow); }
.error { color: #ffd1d1; border-left: 3px solid var(--danger); }
.empty { padding: 45px 25px; color: var(--muted); text-align: center; }
.status { display: inline-flex; padding: 3px 7px; border: 1px solid #474747; border-radius: 999px; color: #cac9c3; background: #202020; font: 700 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.status-running, .status-ready_to_message, .status-approved { color: #a5edac; border-color: #33653a; background: #142b17; }
.status-failed, .status-not_relevant { color: #ffabab; border-color: #713434; background: #331717; }
.status-needs_review, .status-pending_approval { color: #ffe57b; border-color: #675823; background: #302a12; }
.status-messaged, .status-sent, .status-completed { color: #111; border-color: var(--yellow); background: var(--yellow); }
.good { color: var(--success); font-weight: 700; }
.bad { color: var(--danger); }

.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-page { width: min(100%, 440px); }
.login-header { margin-bottom: 28px; }
.login-page h1 { margin: 26px 0 7px; }
.login-card { padding: 24px; border: 1px solid var(--line); background: var(--surface); }
.login-card p { color: var(--muted); }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 7px; color: #d4d2c9; font-size: 13px; font-weight: 650; }
.login-form input { width: 100%; }
.login-form button { width: 100%; margin-top: 4px; }
.login-footer { margin-top: 14px; color: #777; font-size: 12px; text-align: center; }

@media (max-width: 760px) {
  .page { width: min(100% - 28px, 1440px); }
  .masthead { padding-top: 18px; }
  .nav { gap: 1px; }
  .nav a { padding: 7px 6px; font-size: 12px; }
  .logout { margin-left: 0; }
  .content { padding-top: 27px; overflow-x: auto; }
  .grid { min-width: 720px; }
  .form-table { min-width: 650px; }
  .message { min-width: 620px; }
}
