:root {
  --ink: #102235;
  --muted: #607084;
  --navy: #071c2d;
  --navy-soft: #0e2a40;
  --teal: #087e8b;
  --teal-dark: #06636d;
  --cyan: #47d7e8;
  --cyan-pale: #e9fafd;
  --surface: #ffffff;
  --canvas: #f3f7fa;
  --line: #dbe5ec;
  --success: #197a58;
  --success-bg: #eaf8f1;
  --warning: #9a6410;
  --warning-bg: #fff6df;
  --danger: #ad3540;
  --danger-bg: #fff0f1;
  --shadow: 0 18px 50px rgba(7, 28, 45, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 88% 2%, rgba(71, 215, 232, .13), transparent 28rem), var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.app-shell { min-height: 100vh; }
.topbar { min-height: 74px; display: flex; align-items: center; gap: 34px; padding: 0 4vw; color: #fff; background: var(--navy); border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; white-space: nowrap; }
.brand > span:last-child { display: grid; line-height: 1; }
.brand strong { font-size: 1.03rem; letter-spacing: .01em; }
.brand small { margin-top: 4px; color: #8cabbc; font-size: .72rem; letter-spacing: .17em; text-transform: uppercase; }
.brand__mark { width: 36px; height: 36px; display: grid; place-items: center; position: relative; border: 1px solid rgba(71,215,232,.45); border-radius: 11px; background: rgba(71,215,232,.08); }
.brand__mark::before { content: ""; width: 11px; height: 9px; position: absolute; top: 7px; border: 2px solid var(--cyan); border-bottom: 0; border-radius: 8px 8px 0 0; }
.brand__mark span { width: 16px; height: 13px; position: absolute; bottom: 7px; border-radius: 4px; background: var(--cyan); }
.nav { display: flex; align-self: stretch; gap: 4px; }
.nav a { display: grid; place-items: center; padding: 0 13px; color: #b8cbd6; text-decoration: none; font-size: .9rem; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a:focus-visible { color: #fff; border-color: var(--cyan); }
.account { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.account > div { display: grid; text-align: right; }
.account strong { font-size: .86rem; }
.account small { color: #8cabbc; margin-top: 3px; font-size: .76rem; }
.main { width: min(1440px, 92vw); margin: 0 auto; padding: 42px 0 80px; }
.app-shell--guest { color: #fff; background: radial-gradient(circle at 12% 16%, rgba(71,215,232,.16), transparent 25rem), linear-gradient(135deg, #061926, #0a2b40 70%, #074f59); }
.app-shell--guest .topbar { background: transparent; }
.app-shell--guest .main { min-height: calc(100vh - 74px); display: grid; place-items: center; }

.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.page-heading h1, .auth-copy h1 { margin: 6px 0 9px; letter-spacing: -.035em; line-height: 1.08; }
.page-heading h1 { font-size: clamp(2rem, 4vw, 3rem); }
.page-heading p { max-width: 650px; margin: 0; color: var(--muted); line-height: 1.55; }
.page-heading--credential { align-items: center; }
.eyebrow { color: var(--teal); font-size: .74rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.back-link { display: block; width: max-content; margin-bottom: 17px; color: var(--muted); text-decoration: none; font-size: .9rem; }
.back-link:hover { color: var(--teal); }

.button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 17px; border: 1px solid transparent; border-radius: 10px; font-weight: 750; font-size: .9rem; text-decoration: none; cursor: pointer; transition: transform .15s ease, background .15s ease, border .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(71,215,232,.38); outline-offset: 2px; }
.button:disabled { opacity: .65; cursor: progress; }
.button--primary { color: #fff; background: var(--teal); }
.button--primary:hover:not(:disabled) { background: var(--teal-dark); }
.button--secondary { color: var(--teal-dark); border-color: #a9dfe4; background: #f4fdfe; }
.button--quiet { color: #d5e2e9; border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.06); }
.button--small { min-height: 34px; padding: 6px 11px; font-size: .8rem; }
.button--full { width: 100%; }
.text-link { display: inline-block; margin-top: 20px; color: var(--teal); font-size: .9rem; font-weight: 700; }

.alert { margin-bottom: 18px; padding: 13px 16px; border: 1px solid; border-radius: 11px; font-size: .9rem; }
.alert--success { color: var(--success); border-color: #b6e3cf; background: var(--success-bg); }
.alert--error { color: var(--danger); border-color: #efc2c6; background: var(--danger-bg); }

.auth-layout { width: min(1080px, 100%); display: grid; grid-template-columns: 1.1fr .8fr; align-items: center; gap: clamp(42px, 8vw, 100px); padding: 20px 0; }
.auth-layout--compact { width: min(900px, 100%); }
.auth-copy .eyebrow { color: var(--cyan); }
.auth-copy h1 { max-width: 680px; font-size: clamp(2.6rem, 6vw, 5rem); }
.auth-layout--compact .auth-copy h1 { font-size: clamp(2.5rem, 5vw, 4.4rem); }
.auth-copy > p { max-width: 620px; color: #b9ced9; font-size: 1.08rem; line-height: 1.7; }
.trust-list { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: 32px; color: #d4e4eb; font-size: .88rem; }
.trust-list span { display: flex; align-items: center; gap: 8px; }
.trust-list i { width: 8px; height: 8px; border: 2px solid var(--cyan); border-radius: 50%; box-shadow: 0 0 0 4px rgba(71,215,232,.1); }
.auth-card { padding: clamp(28px, 4vw, 42px); color: var(--ink); border: 1px solid rgba(255,255,255,.35); border-radius: 22px; background: rgba(255,255,255,.97); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.auth-card h2 { margin: 18px 0 6px; font-size: 1.65rem; }
.auth-card > p { margin: 0 0 25px; color: var(--muted); line-height: 1.55; }
.auth-card__icon { width: 50px; height: 50px; display: block; position: relative; border-radius: 15px; background: var(--cyan-pale); }
.auth-card__icon::before { content: ""; width: 16px; height: 13px; position: absolute; top: 9px; left: 15px; border: 3px solid var(--teal); border-bottom: 0; border-radius: 10px 10px 0 0; }
.auth-card__icon::after { content: ""; width: 25px; height: 20px; position: absolute; left: 12px; bottom: 8px; border-radius: 6px; background: var(--teal); }
.auth-card__icon--code::before { width: 24px; height: 24px; left: 13px; top: 13px; border: 2px dashed var(--teal); border-radius: 8px; }
.auth-card__icon--code::after { display: none; }
.fine-print { display: block; margin-top: 18px; color: #7b8998; text-align: center; }

.stack-form { display: grid; gap: 18px; }
label { display: grid; gap: 7px; color: #35485b; font-size: .86rem; font-weight: 750; }
input, select, textarea { width: 100%; color: var(--ink); border: 1px solid #cbd8e1; border-radius: 9px; background: #fff; }
input, select { height: 45px; padding: 0 12px; }
textarea { min-height: 90px; padding: 11px 12px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #9aa8b5; }
label small { color: var(--muted); font-size: .77rem; font-weight: 500; line-height: 1.4; }
.label-note { color: #8b98a5; font-size: .72rem; font-weight: 500; }
.otp-input { height: 60px; font-size: 1.65rem; font-weight: 800; letter-spacing: .28em; text-align: center; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.metric { min-height: 142px; display: flex; flex-direction: column; justify-content: space-between; padding: 21px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 10px 35px rgba(7,28,45,.04); }
.metric span { color: var(--muted); font-size: .87rem; }
.metric strong { font-size: 2.55rem; line-height: 1; }
.metric--warning { border-top: 3px solid #e2aa42; }
.metric--success { border-top: 3px solid #42b986; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 10px 40px rgba(7,28,45,.045); }
.panel__heading { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 21px; border-bottom: 1px solid var(--line); }
.panel__heading h2 { margin: 0; font-size: 1.05rem; }
.panel__heading p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
.panel--form { align-self: start; }
.panel--form > .stack-form, .panel--form > form { padding: 21px; }
.split-layout { display: grid; grid-template-columns: minmax(290px, .68fr) minmax(500px, 1.5fr); gap: 22px; align-items: start; }
.split-layout--wide-form { grid-template-columns: minmax(500px, 1.2fr) minmax(350px, .8fr); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid #edf1f4; vertical-align: middle; }
th { color: #718090; background: #f8fafc; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfe; }
code { padding: 3px 6px; color: #315066; border-radius: 5px; background: #edf3f6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }
.table-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: .77rem; }
.row-link { color: inherit; text-decoration: none; }
.row-link:hover strong { color: var(--teal); }
.panel-empty { padding: 44px 22px; color: var(--muted); text-align: center; }
.panel-empty--large { grid-column: 1 / -1; border: 1px dashed #bfd0da; border-radius: 16px; }
.panel-empty--large h2 { color: var(--ink); }

.status { width: max-content; display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--active { color: var(--success); background: var(--success-bg); }
.status--pending { color: var(--warning); background: var(--warning-bg); }
.status--disabled { color: var(--muted); background: #edf1f4; }

.field-builder { padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: #f8fafc; }
.field-builder__heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 12px; }
.field-builder__heading > div { display: grid; gap: 3px; }
.field-builder__heading small { color: var(--muted); font-weight: 500; }
.field-row { display: grid; grid-template-columns: 1fr 1fr .85fr auto 32px; gap: 9px; align-items: end; padding: 13px 0; border-top: 1px solid var(--line); }
.field-row__hint { grid-column: 1 / 5; }
.check-label { height: 45px; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.check-label input { width: 17px; height: 17px; }
.icon-button { width: 32px; height: 32px; margin-bottom: 6px; color: var(--danger); border: 1px solid #e7c0c4; border-radius: 8px; background: #fff; cursor: pointer; font-size: 1.25rem; }
.type-list { display: grid; }
.type-list article { display: flex; justify-content: space-between; gap: 20px; padding: 18px 21px; border-bottom: 1px solid #edf1f4; }
.type-list article:last-child { border-bottom: 0; }
.type-list p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.type-list span { flex: 0 0 auto; color: var(--teal); font-size: .75rem; font-weight: 800; }

.credential-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 19px; }
.credential-card { min-height: 325px; display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.credential-card__top { display: flex; justify-content: space-between; align-items: flex-start; }
.credential-icon { width: 43px; height: 43px; position: relative; border-radius: 12px; background: var(--cyan-pale); }
.credential-icon::before, .empty-lock::before { content: ""; position: absolute; border: 2px solid var(--teal); border-bottom: 0; border-radius: 8px 8px 0 0; }
.credential-icon::before { width: 13px; height: 11px; left: 14px; top: 8px; }
.credential-icon::after, .empty-lock::after { content: ""; position: absolute; border-radius: 5px; background: var(--teal); }
.credential-icon::after { width: 21px; height: 17px; left: 11px; bottom: 8px; }
.credential-card h2 { margin: 24px 0 7px; font-size: 1.25rem; }
.credential-card p { min-height: 42px; margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.credential-card dl { display: grid; gap: 9px; margin: 22px 0; }
.credential-card dl div { display: flex; justify-content: space-between; gap: 10px; }
.credential-card dt { color: var(--muted); font-size: .77rem; }
.credential-card dd { margin: 0; font-size: .78rem; font-weight: 750; }
.credential-card .button { margin-top: auto; }
.empty-lock { width: 54px; height: 54px; display: inline-block; position: relative; border-radius: 15px; background: var(--cyan-pale); }
.empty-lock::before { width: 17px; height: 13px; left: 17px; top: 9px; }
.empty-lock::after { width: 27px; height: 20px; left: 14px; bottom: 9px; }

.credential-form-layout { display: grid; grid-template-columns: minmax(420px, 1.25fr) minmax(280px, .65fr); gap: 24px; align-items: start; }
.panel--secure-form { padding-bottom: 23px; }
.panel--secure-form form { padding: 23px; }
.secure-banner { display: flex; gap: 13px; padding: 17px 21px; color: #075c65; border-bottom: 1px solid #bce7ea; background: var(--cyan-pale); }
.secure-banner strong { display: block; margin-bottom: 3px; font-size: .9rem; }
.secure-banner p { margin: 0; font-size: .8rem; line-height: 1.45; }
.secure-banner__icon { width: 23px; height: 25px; flex: 0 0 auto; position: relative; border: 2px solid var(--teal); border-radius: 6px; }
.secure-banner__icon::before { content: ""; width: 10px; height: 9px; position: absolute; left: 4px; top: -9px; border: 2px solid var(--teal); border-bottom: 0; border-radius: 6px 6px 0 0; }
.security-note { padding: 26px; color: #d5e5ed; border-radius: 16px; background: var(--navy); box-shadow: var(--shadow); }
.security-note .eyebrow { color: var(--cyan); }
.security-note h2 { margin: 12px 0 10px; color: #fff; font-size: 1.35rem; line-height: 1.25; }
.security-note p, .security-note li { color: #adc3cf; font-size: .87rem; line-height: 1.58; }
.security-note ul { margin: 20px 0 0; padding-left: 19px; }
.security-note li + li { margin-top: 8px; }
.form-message { min-height: 20px; color: var(--muted); font-size: .85rem; }
.form-message--success { color: var(--success); font-weight: 750; }
.form-message--error { color: var(--danger); font-weight: 750; }

.empty-state { width: min(540px, 100%); margin: 7vh auto; padding: 54px 30px; text-align: center; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.empty-state > span { display: inline-grid; min-width: 58px; height: 58px; place-items: center; color: var(--teal); border-radius: 16px; background: var(--cyan-pale); font-weight: 900; }
.empty-state h1 { margin: 18px 0 7px; }
.empty-state p { margin: 0 0 24px; color: var(--muted); }

@media (max-width: 1050px) {
  .nav { order: 3; width: 100%; height: 48px; overflow-x: auto; }
  .topbar { flex-wrap: wrap; padding-top: 12px; }
  .nav a { flex: 0 0 auto; }
  .main { padding-top: 32px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .split-layout, .split-layout--wide-form { grid-template-columns: 1fr; }
  .credential-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .main { width: min(92vw, 620px); }
  .account > div { display: none; }
  .auth-layout { grid-template-columns: 1fr; gap: 34px; padding: 10px 0 34px; }
  .auth-copy h1 { font-size: clamp(2.25rem, 12vw, 3.5rem); }
  .auth-copy > p { font-size: 1rem; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading > .button { width: 100%; }
  .metric-grid, .credential-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .credential-form-layout { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr 1fr 32px; }
  .field-row label:nth-child(3), .field-row .check-label, .field-row__hint { grid-column: 1 / 3; }
  .field-row .icon-button { grid-column: 3; grid-row: 1; }
  .table-wrap { margin-bottom: 2px; }
  th, td { padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
