:root {
  --ink: #07141e;
  --ink-soft: #40525e;
  --paper: #e8edeb;
  --paper-bright: #f4f6f4;
  --line: #cad4d7;
  --forest: #08638f;
  --forest-deep: #03121f;
  --lime: #72e6ff;
  --amber: #b4762e;
  --red: #a83c32;
  --red-soft: #f4ded8;
  --shadow: 0 18px 60px rgba(25, 42, 32, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: Manrope, sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .22; z-index: 50; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E"); }
.mono, code { font-family: "DM Mono", monospace; }
.muted { color: #718078; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 10px; color: var(--amber); font: 500 11px/1 "DM Mono", monospace; letter-spacing: .16em; text-transform: uppercase; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; color: inherit; font-size: 13px; font-weight: 700; text-decoration: none; }
.mark { display: grid; place-items: center; width: 31px; height: 31px; color: var(--lime); background: var(--forest); border-radius: 50%; font-family: Newsreader, serif; font-size: 19px; }
.button { min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 7px; font-weight: 700; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; }
.button.primary { color: #fff; background: var(--forest); }
.button.primary:hover:not(:disabled) { background: var(--forest-deep); }
.button.secondary { color: var(--forest); background: transparent; border-color: #9baaa2; }
.button.ghost { min-height: 36px; color: var(--ink-soft); background: transparent; border-color: var(--line); }
.danger-button { color: #fff; background: var(--red); }

.login-body { overflow: hidden; background: var(--paper-bright); }
.login-shell { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); min-height: 100vh; }
.login-context { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 48px 7vw 52px; color: #f8f6ef; background: var(--forest-deep); overflow: hidden; isolation: isolate; }
.login-context::before { content: ""; position: absolute; width: 680px; height: 680px; right: -260px; top: -220px; border: 1px solid rgba(114, 230, 255, .32); border-radius: 50%; box-shadow: 0 0 0 90px rgba(114, 230, 255, .025), 0 0 0 180px rgba(114, 230, 255, .018); }
.login-context::after { content: ""; position: absolute; z-index: 0; inset: 0; background: linear-gradient(90deg, rgba(3,18,31,.98), rgba(3,18,31,.56)), url("/assets/pantotrader-hero-v1.webp") 64% center / cover no-repeat; opacity: .58; }
.login-context > * { position: relative; z-index: 1; }
.login-context .mark { color: var(--forest-deep); background: var(--lime); }
.login-copy h1 { max-width: 750px; margin: 0; font: 650 clamp(56px, 7vw, 104px)/.88 Newsreader, serif; letter-spacing: -.045em; }
.login-copy > p:last-child { max-width: 560px; margin: 28px 0 0; color: #b7c7bf; font-size: 16px; line-height: 1.7; }
.login-route { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 5px 16px; max-width: 500px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.16); }
.login-route span { color: #87a094; font: 500 10px "DM Mono", monospace; letter-spacing: .13em; text-transform: uppercase; }
.login-route b { font-size: 14px; }
.login-route i { grid-column: 1 / -1; width: 100%; height: 1px; margin: 8px 0; background: linear-gradient(90deg, var(--lime), transparent); }
.login-panel { display: flex; flex-direction: column; justify-content: center; gap: 42px; padding: 8vw; background: var(--paper-bright); }
.login-panel h2 { margin: 0 0 12px; font: 650 clamp(36px, 4vw, 58px)/.96 Newsreader, serif; letter-spacing: -.03em; }
.login-panel > div > p:last-child { max-width: 520px; line-height: 1.7; }
.login-panel form { display: grid; gap: 16px; max-width: 520px; }
.login-panel label, .form-panel label { display: grid; gap: 8px; }
.login-panel label span, .form-panel label > span { color: var(--ink-soft); font: 600 11px "DM Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
input { width: 100%; min-height: 46px; padding: 10px 12px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; outline: none; }
input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(23,79,60,.12); }
.form-error { min-height: 22px; margin: 0; color: var(--red); font-size: 13px; }
.login-panel > small { color: #8a958f; line-height: 1.6; }

.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 28px; background: rgba(250,248,242,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(15px); }
.top-actions { display: flex; align-items: center; gap: 14px; font-size: 12px; }
.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.rail { position: sticky; top: 64px; display: flex; flex-direction: column; height: calc(100vh - 64px); padding: 40px 30px 28px; background: #e9e5da; border-right: 1px solid var(--line); }
.rail h1 { margin: 0; font: 650 38px/.98 Newsreader, serif; letter-spacing: -.035em; }
.rail-copy { margin: 16px 0 28px; color: #68766f; font-size: 13px; line-height: 1.65; }
.rail nav { display: grid; }
.rail nav a { padding: 13px 0; color: #76827c; border-bottom: 1px solid rgba(21,36,29,.09); font: 500 11px "DM Mono", monospace; letter-spacing: .05em; text-decoration: none; }
.rail nav a.active { color: var(--forest); font-weight: 700; }
.rail-warning { display: grid; gap: 6px; margin-top: auto; padding: 16px; color: #80362f; background: var(--red-soft); border-left: 3px solid var(--red); font-size: 11px; line-height: 1.55; }
.workspace { min-width: 0; padding: 54px clamp(28px, 5vw, 76px) 100px; }
.view { display: none; max-width: 1240px; margin: 0 auto; animation: rise .36s ease both; }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; margin-bottom: 28px; }
.section-head h2 { margin: 0; font: 650 clamp(38px, 5vw, 64px)/.95 Newsreader, serif; letter-spacing: -.035em; }
.section-head p:last-child { max-width: 720px; margin: 12px 0 0; color: #68766f; font-size: 14px; line-height: 1.7; }
.notice { position: sticky; top: 80px; z-index: 35; max-width: 1240px; margin: 0 auto 22px; padding: 13px 16px; color: var(--forest-deep); background: #e6efc4; border: 1px solid #c9db7b; border-radius: 7px; font-size: 13px; box-shadow: var(--shadow); }
.notice.error { color: #772f29; background: var(--red-soft); border-color: #d99a91; }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric, .panel, .control-card { background: var(--paper-bright); border: 1px solid var(--line); box-shadow: 0 1px 0 rgba(21,36,29,.02); }
.metric { min-height: 145px; padding: 20px; }
.metric span, .live-strip span { color: #75817b; font: 500 10px "DM Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.metric strong { display: block; margin: 26px 0 6px; font: 650 25px Newsreader, serif; }
.metric small { color: #87918c; }
.metric .good { color: var(--forest); }
.metric .bad { color: var(--red); }
.metric .warn { color: var(--amber); }
.panel { margin-top: 14px; padding: 26px; }
.split-panel { display: grid; grid-template-columns: .85fr 1.15fr; gap: 50px; }
.panel-kicker { margin: 0 0 16px; color: #7a8780; font: 500 10px "DM Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.facts { margin: 0; }
.facts div { display: grid; grid-template-columns: 130px 1fr; padding: 10px 0; border-bottom: 1px solid #e5e1d7; }
.facts dt { color: #7d8983; font-size: 12px; }
.facts dd { margin: 0; font: 500 12px "DM Mono", monospace; }
.readiness ol, .audit-panel ol { margin: 0; padding-left: 19px; color: var(--ink-soft); font-size: 13px; line-height: 2; }
.form-panel { padding: 30px; }
.field-grid { display: grid; gap: 16px; margin-bottom: 22px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.field-grid.four { grid-template-columns: repeat(4, 1fr); }
.secret-vault { margin: 30px 0 8px; padding: 22px; border: 1px solid #aec0b6; background: #edf2ed; }
.vault-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.vault-heading h3 { margin: 0 0 7px; font: 650 25px Newsreader, serif; }
.vault-heading p:not(.panel-kicker) { max-width: 740px; margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.65; }
.vault-boundary { margin: -4px 0 0; padding-top: 14px; border-top: 1px solid #c9d5ce; color: #52635a; font-size: 11px; line-height: 1.6; }
.instrument-head { display: flex; align-items: center; justify-content: space-between; margin-top: 28px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.instrument-head > div { display: grid; gap: 4px; }
.instrument-head span { font-weight: 700; }
.instrument-head small { color: #7b8881; }
.instrument-rows { display: grid; gap: 10px; margin: 14px 0 26px; }
.instrument-row { display: grid; grid-template-columns: 1fr 1.6fr 1fr 1fr auto; gap: 10px; align-items: end; padding: 14px; background: #eeebe2; border: 1px solid #ded9cd; }
.instrument-row button { min-width: 42px; min-height: 46px; color: var(--red); background: transparent; border: 1px solid #d4b7b1; border-radius: 6px; }
.acknowledgment { display: grid; gap: 10px; padding: 18px; background: #f0e9db; border-left: 3px solid var(--amber); }
.acknowledgment label { display: flex; grid-template-columns: none; align-items: flex-start; gap: 10px; color: #574c3d; font-size: 12px; line-height: 1.6; }
.acknowledgment input { width: 17px; min-height: 17px; margin-top: 2px; }
.confirmation { margin-top: 20px; }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.form-actions .muted { font-size: 11px; }
.credential-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; color: #f6f5ee; background: var(--forest-deep); border-color: var(--forest-deep); }
.credential-panel h3 { margin: 0 0 7px; font: 650 28px Newsreader, serif; }
.credential-panel p { max-width: 570px; margin: 0; color: #b7c7bf; font-size: 12px; line-height: 1.6; }
.credential-panel .panel-kicker { color: var(--lime); }
.package-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.credential-panel .button.primary { color: var(--forest-deep); background: var(--lime); }
.credential-panel .button.secondary { color: #fff; border-color: #688075; }
.role-chip { flex: 0 0 auto; padding: 8px 12px; color: var(--forest); background: #e1e7ca; border: 1px solid #cdd69f; border-radius: 999px; font: 500 10px "DM Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.instruction-list { margin: 0; padding: 0; counter-reset: steps; list-style: none; border-top: 1px solid var(--line); }
.instruction-list li { position: relative; display: grid; grid-template-columns: 250px 1fr; gap: 45px; padding: 26px 20px 26px 62px; border-bottom: 1px solid var(--line); counter-increment: steps; }
.instruction-list li::before { content: counter(steps, decimal-leading-zero); position: absolute; top: 27px; left: 10px; color: var(--amber); font: 500 11px "DM Mono", monospace; }
.instruction-list b { font: 650 21px Newsreader, serif; }
.instruction-list span { color: #5e6d65; font-size: 13px; line-height: 1.75; }
.instruction-list code { padding: 2px 5px; color: var(--ink); background: #e5e1d7; font-size: 11px; }
.text-button { display: inline; padding: 0; color: var(--forest); background: none; border: 0; border-bottom: 1px solid currentColor; font-weight: 700; }
.verification { display: grid; grid-template-columns: 270px 1fr; gap: 28px; margin-top: 24px; padding: 20px; color: #5d4b27; background: #ece4c8; border-left: 3px solid #b38a31; font-size: 12px; line-height: 1.65; }
.live-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.live-strip > div { min-height: 80px; padding-right: 20px; border-right: 1px solid var(--line); }
.live-strip > div:last-child { border: 0; }
.live-strip strong { display: block; margin-top: 18px; font: 650 23px Newsreader, serif; }
.table-panel { padding: 0; overflow: hidden; }
.panel-title { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-title h3 { margin: 0; font: 650 22px Newsreader, serif; }
.panel-title span { color: #7b8881; font-size: 11px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 13px 22px; text-align: left; border-bottom: 1px solid #e5e1d7; white-space: nowrap; }
th { color: #75817b; background: #efebe2; font: 500 10px "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
td { font-family: "DM Mono", monospace; }
.control-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.control-card { display: flex; flex-direction: column; min-height: 290px; padding: 24px; }
.control-card.danger { color: #fff; background: #762f29; border-color: #762f29; }
.control-card.danger .panel-kicker, .control-card.danger p { color: #eac6c1; }
.control-card h3 { margin: 0; font: 650 30px Newsreader, serif; }
.control-card p { color: #6c7972; font-size: 12px; line-height: 1.65; }
.control-card input { margin: auto 0 10px; }
.control-card .button { margin-top: auto; }
.audit-panel { margin-top: 28px; }

@media (max-width: 1050px) {
  .status-grid, .field-grid.three, .field-grid.four { grid-template-columns: repeat(2, 1fr); }
  .control-grid { grid-template-columns: 1fr; }
  .control-card { min-height: 220px; }
  .instrument-row { grid-template-columns: repeat(2, 1fr); }
  .instrument-row button { grid-column: 2; }
}

@media (max-width: 760px) {
  .login-body { overflow: auto; }
  .login-shell { grid-template-columns: 1fr; }
  .login-context { min-height: 55vh; padding: 30px 24px; }
  .login-copy h1 { font-size: 54px; }
  .login-panel { padding: 52px 24px; }
  .topbar { padding: 0 16px; }
  #session-clock { display: none; }
  .shell { display: block; }
  .rail { position: relative; top: 0; height: auto; padding: 24px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail h1, .rail-copy, .rail-warning { display: none; }
  .rail nav { display: flex; gap: 8px; overflow-x: auto; }
  .rail nav { scrollbar-width: none; }
  .rail nav::-webkit-scrollbar { display: none; }
  .rail nav a { flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; }
  .workspace { padding: 36px 16px 80px; }
  .section-head { display: grid; }
  .status-grid, .field-grid.two, .field-grid.three, .field-grid.four, .split-panel, .live-strip { grid-template-columns: 1fr; }
  .vault-heading { display: grid; }
  .live-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .credential-panel { display: grid; }
  .package-actions { justify-content: flex-start; }
  .instruction-list li { grid-template-columns: 1fr; gap: 8px; padding-left: 52px; }
  .verification { grid-template-columns: 1fr; gap: 8px; }
  .instrument-row { grid-template-columns: 1fr; }
  .instrument-row button { grid-column: 1; }
  .form-actions { align-items: stretch; flex-direction: column; }
}
