:root {
  --ink: #15100e;
  --ink-soft: #3c302b;
  --paper: #f4efe6;
  --panel: #fffdf8;
  --line: #d9cfc1;
  --ember: #e84617;
  --ember-dark: #a8240d;
  --sun: #ffb12a;
  --red: #c82012;
  --green: #267254;
  --muted: #766a61;
  --shadow: 0 18px 50px rgba(42, 25, 16, .12);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 5%, rgba(255, 177, 42, .14), transparent 28rem),
    var(--paper);
}

a { color: inherit; }

button, input, select { font: inherit; }

button { cursor: pointer; }

.app-header {
  height: 68px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 28px;
  padding: 0 4vw;
  color: #fff;
  background: #17110f;
  border-bottom: 3px solid var(--ember);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .22);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: #fff;
  text-decoration: none;
  font-family: Impact, "Arial Narrow", sans-serif;
  letter-spacing: .12em;
  font-size: 1.22rem;
}

.brand-mark {
  width: 19px;
  height: 30px;
  display: inline-block;
  background: linear-gradient(150deg, var(--sun) 0 34%, var(--ember) 35% 69%, var(--red) 70%);
  clip-path: polygon(56% 0, 100% 0, 68% 38%, 96% 38%, 20% 100%, 35% 56%, 0 56%);
}

.main-nav { display: flex; height: 100%; gap: 7px; }

.main-nav a {
  display: grid;
  place-items: center;
  min-width: 88px;
  padding: 0 18px;
  color: #d9d0ca;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 700;
  border-bottom: 3px solid transparent;
}

.main-nav a:hover, .main-nav a:focus-visible { color: #fff; border-color: var(--sun); }

.user-menu { justify-self: end; display: flex; align-items: center; gap: 14px; color: #d9d0ca; font-size: .88rem; }
.user-menu form { margin: 0; }

.page-wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 80px; }
.narrow-wrap { width: min(860px, calc(100% - 40px)); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(230px, .72fr) minmax(540px, 1.55fr);
  gap: 34px 48px;
  align-items: start;
}

.hero-copy { position: sticky; top: 112px; padding-top: 18px; }

.eyebrow {
  color: var(--ember-dark);
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .19em;
  text-transform: uppercase;
}

h1, h2 { margin-top: 0; }

.hero-copy h1, .page-heading h1, .job-heading h1 {
  font-family: Impact, "Arial Narrow", sans-serif;
  font-weight: 500;
  letter-spacing: .025em;
}

.hero-copy h1 {
  margin: 14px 0 18px;
  font-size: clamp(3.1rem, 5.2vw, 5.4rem);
  line-height: .9;
  text-transform: uppercase;
}

.hero-copy h1 span { color: var(--ember); }
.hero-copy p { max-width: 380px; color: var(--ink-soft); font-size: 1.08rem; line-height: 1.65; }

.panel {
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(111, 83, 63, .18);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.transfer-panel { overflow: hidden; }

.form-section {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 7px;
  padding: 28px 30px 30px 20px;
  border-bottom: 1px solid var(--line);
}

.section-number { color: var(--ember); font-family: Impact, sans-serif; font-size: 1.05rem; letter-spacing: .08em; }
.form-section-body { min-width: 0; }

label { display: block; margin-bottom: 8px; font-size: .84rem; font-weight: 800; letter-spacing: .02em; }

input, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bdb1a4;
  border-radius: 8px;
  outline: none;
}

input:focus, select:focus { border-color: var(--ember); box-shadow: 0 0 0 3px rgba(232, 70, 23, .13); }
input::placeholder { color: #9a8e83; }

.input-action { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.input-action .button { min-width: 106px; }

.field-help { margin: 8px 0 0; color: var(--muted); font-size: .79rem; line-height: 1.45; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.label-row h2 { margin-bottom: 0; font-size: 1.05rem; }
.filter-input { min-height: 38px; margin-bottom: 7px; font-size: .86rem; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 9px 17px;
  border: 0;
  border-radius: 7px;
  text-decoration: none;
  font-size: .86rem;
  font-weight: 850;
}

.button-primary { color: #fff; background: linear-gradient(135deg, var(--ember), var(--red)); box-shadow: 0 8px 22px rgba(200, 32, 18, .2); }
.button-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.button-secondary { color: #fff; background: var(--ink); }
.button-secondary:hover:not(:disabled) { background: var(--ink-soft); }
.button-quiet { min-height: 34px; padding: 6px 10px; color: #fff; background: rgba(255, 255, 255, .09); }
.button-large { min-height: 52px; padding: 13px 22px; font-size: .94rem; letter-spacing: .025em; }
.button:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; }
.full-width { width: calc(100% - 60px); margin: 26px 30px 30px; }

.text-button, .text-link {
  padding: 0;
  color: var(--ember-dark);
  background: transparent;
  border: 0;
  text-decoration: none;
  font-size: .79rem;
  font-weight: 800;
}
.text-button:hover, .text-link:hover { text-decoration: underline; }

.notice { margin-top: 12px; padding: 12px 14px; border-radius: 8px; font-size: .84rem; line-height: 1.45; }
.notice-ok { color: #175039; background: #e4f3e9; border: 1px solid #aad2bb; }
.notice-warning { color: #6a3512; background: #fff0d4; border: 1px solid #e9bd73; }
.form-error { margin: 15px 0; padding: 12px 14px; color: #742417; background: #fee8e2; border: 1px solid #e8a092; border-radius: 8px; font-size: .86rem; line-height: 1.45; }
.transfer-panel > form > .form-error { margin-right: 30px; margin-left: 30px; }
.hidden { display: none !important; }

.confirmation-area { padding: 22px 30px 2px 82px; background: #fff7e9; border-bottom: 1px solid #ead3aa; }
.check-row { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 15px; font-size: .84rem; line-height: 1.4; }
.check-row input { width: 18px; min-height: 18px; margin: 1px 0 0; accent-color: var(--ember); }

.search-results { display: grid; gap: 6px; margin-top: 9px; }
.search-result { display: flex; flex-direction: column; align-items: flex-start; padding: 10px 12px; text-align: left; background: #fff9ee; border: 1px solid var(--line); border-radius: 7px; }
.search-result:hover { border-color: var(--ember); }
.search-result span { margin-top: 2px; color: var(--muted); font-size: .77rem; }
.selection-chip { width: fit-content; margin-top: 10px; padding: 7px 10px; color: var(--ink-soft); background: #eee7dc; border-radius: 999px; font-size: .76rem; }

.recent-panel { grid-column: 2; padding: 24px 26px; }
.compact-list { margin-top: 14px; }
.compact-item { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 11px; padding: 13px 3px; text-decoration: none; border-top: 1px solid var(--line); }
.compact-item:hover strong { color: var(--ember-dark); }
.compact-main { min-width: 0; }
.compact-main strong, .compact-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-main strong { font-size: .86rem; }
.compact-main small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.compact-status { color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #999; }
.status-dot.status-succeeded { background: var(--green); }
.status-dot.status-running, .status-dot.status-queued { background: var(--sun); box-shadow: 0 0 0 4px rgba(255, 177, 42, .15); }
.status-dot.status-failed { background: var(--red); }
.empty-state { color: var(--muted); font-size: .88rem; }

.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 25px; }
.page-heading h1 { margin: 7px 0 0; font-size: 3rem; text-transform: uppercase; }
.table-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th { padding: 14px 16px; color: var(--muted); text-align: left; background: #eee7dc; font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; }
td { padding: 16px; vertical-align: top; border-top: 1px solid var(--line); }
.table-subtitle { display: block; margin-top: 4px; color: var(--muted); }

.status-pill { display: inline-flex; padding: 5px 9px; color: #4b423d; background: #e6ded4; border-radius: 999px; text-decoration: none; font-size: .7rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.status-pill.status-succeeded { color: #175039; background: #dcefe3; }
.status-pill.status-running, .status-pill.status-queued { color: #65400e; background: #ffe7af; }
.status-pill.status-failed { color: #7b2318; background: #f8d9d1; }

.back-link { display: inline-block; margin-bottom: 18px; color: var(--ember-dark); text-decoration: none; font-size: .82rem; font-weight: 800; }
.job-panel { padding: 34px; }
.job-heading { display: flex; justify-content: space-between; align-items: start; gap: 25px; }
.job-heading h1 { margin: 9px 0 0; font-size: 2.4rem; }
.job-message { color: var(--ink-soft); font-size: 1rem; }
.error-detail { white-space: pre-wrap; }
.heat-progress { height: 5px; margin: 30px 0 22px; overflow: hidden; background: #eadfd3; border-radius: 999px; }
.heat-progress span { display: block; width: 42%; height: 100%; background: linear-gradient(90deg, var(--red), var(--sun)); animation: heat-scan 1.5s infinite ease-in-out; }
@keyframes heat-scan { from { transform: translateX(-110%); } to { transform: translateX(270%); } }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 28px 0 10px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 10px; }
.detail-grid div { padding: 17px; background: var(--panel); }
.detail-grid dt { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.detail-grid dd { margin: 6px 0 0; overflow-wrap: anywhere; font-size: .88rem; font-weight: 750; }

.users-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 30px; align-items: start; }
.invite-panel { position: sticky; top: 98px; padding: 27px; }
.invite-panel h2 { margin: 7px 0 22px; font-size: 1.7rem; }
.stack-form { display: grid; }
.stack-form label:not(:first-of-type) { margin-top: 16px; }
.stack-form .button { margin-top: 22px; }
.reset-details { margin-top: 6px; color: var(--ember-dark); font-size: .75rem; font-weight: 750; }
.inline-reset { display: flex; gap: 6px; margin-top: 8px; }
.inline-reset input { min-width: 145px; min-height: 36px; }
.inline-reset .button { min-height: 36px; }

.flash { position: fixed; z-index: 10; top: 82px; left: 50%; transform: translateX(-50%); padding: 10px 18px; color: #fff; background: var(--ink); border-left: 4px solid var(--sun); border-radius: 7px; box-shadow: var(--shadow); font-size: .84rem; }

.login-page {
  color: #fff;
  background-image:
    linear-gradient(90deg, rgba(12, 5, 3, .95) 0%, rgba(22, 7, 3, .82) 32%, rgba(133, 22, 5, .25) 70%, rgba(10, 5, 3, .58) 100%),
    url("/static/images/login-poster.webp");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

.login-shell { position: relative; min-height: 100vh; display: grid; align-items: center; width: min(1240px, calc(100% - 42px)); margin: 0 auto; padding: 42px 0; }
.login-card { width: min(650px, 100%); padding: 42px; background: rgba(18, 9, 6, .84); border: 1px solid rgba(255, 169, 69, .3); border-top: 4px solid var(--ember); border-radius: 4px 18px 18px 4px; box-shadow: 0 28px 80px rgba(0, 0, 0, .48); backdrop-filter: blur(10px); }
.login-card .eyebrow { color: #ffb55d; }
.login-card h1 { margin: 8px 0 0; font-family: Impact, "Arial Narrow", sans-serif; font-size: clamp(3.7rem, 8vw, 5.3rem); font-weight: 500; letter-spacing: .055em; line-height: .95; text-shadow: 0 4px 22px rgba(216, 39, 14, .38); }
.login-intro { margin: 9px 0 30px; color: #dfc9bd; font-size: 1.05rem; }
.login-card label { color: #f6e7dd; }
.login-card input { color: #fff; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .24); }
.login-card input:focus { border-color: #ff9c4a; box-shadow: 0 0 0 3px rgba(255, 124, 44, .18); }
.login-note { margin: 22px 0 0; color: #a89489; text-align: center; font-size: .69rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.poster-credit { position: absolute; right: 0; bottom: 18px; color: rgba(255, 255, 255, .68); font-size: .68rem; }

@media (max-width: 900px) {
  .app-header { grid-template-columns: auto 1fr auto; padding: 0 20px; }
  .main-nav { justify-self: center; }
  .main-nav a { min-width: 0; padding: 0 10px; }
  .user-menu > span { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .hero-copy { position: static; padding-top: 0; }
  .hero-copy h1 { max-width: 650px; }
  .recent-panel { grid-column: 1; }
  .users-grid { grid-template-columns: 1fr; }
  .invite-panel { position: static; grid-row: 1; }
}

@media (max-width: 620px) {
  .app-header { height: auto; min-height: 65px; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 16px; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-content: space-around; order: 3; }
  .main-nav a { padding: 8px; }
  .page-wrap { width: min(100% - 24px, 1180px); padding-top: 36px; }
  .hero-copy h1 { font-size: 3.15rem; }
  .form-section { grid-template-columns: 38px 1fr; padding: 23px 16px 25px 12px; }
  .input-action { grid-template-columns: 1fr; }
  .confirmation-area { padding-left: 50px; }
  .full-width { width: calc(100% - 32px); margin-right: 16px; margin-left: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .job-heading { flex-direction: column; }
  .page-heading { align-items: flex-start; gap: 18px; }
  .page-heading h1 { font-size: 2.35rem; }
  .login-shell { width: min(100% - 24px, 1240px); }
  .login-card { padding: 32px 24px; }
}

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