@font-face {
  font-family: Onest;
  src: url("../fonts/onest-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f6f5ee;
  --surface: #fffefa;
  --ink: #142a20;
  --muted: #495e51;
  --line: #d9ddd1;
  --pine: #12291f;
  --pine-deep: #0e221a;
  --signal: #d5f19b;
  --signal-dark: #426326;
  --mint: #e9f1e4;
  --sans: Onest, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --radius: 22px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem / 1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
svg { display: inline-block; flex: none; vertical-align: middle; }
h1, h2, p { margin: 0; }
:where(a, button, input, textarea, summary):focus-visible {
  outline: 3px solid #4b7232;
  outline-offset: 4px;
}

.portal-shell { width: min(calc(100% - 48px), 1120px); margin-inline: auto; }
.skip-link {
  position: fixed;
  z-index: 3;
  inset: 10px auto auto 10px;
  padding: 10px 14px;
  transform: translateY(-160%);
  background: var(--surface);
}
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner, .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-inner { min-height: 77px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 760;
  font-size: 1.22rem;
  letter-spacing: -.045em;
  white-space: nowrap;
}
.brand small { font-size: .84em; font-weight: 500; letter-spacing: -.025em; }
.brand-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: var(--pine);
  color: var(--signal);
}
.header-actions { display: flex; align-items: center; gap: clamp(12px, 2.8vw, 28px); }
.header-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 0;
  font-size: .875rem;
  font-weight: 670;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.header-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .22em; }
.site-footer { margin-top: auto; border-top: 1px solid var(--line); }
.footer-inner { min-height: 66px; font-size: .82rem; color: var(--muted); }
.footer-inner > :first-child { font-weight: 720; color: var(--ink); }

.button {
  display: inline-flex;
  min-height: 47px;
  max-width: 100%;
  width: fit-content;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 720;
  line-height: 1.32;
  text-decoration: none;
  text-align: center;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.button-primary { background: var(--pine); color: #fffefa; }
.button-primary:hover { background: #244b36; }
.button-subtle { background: var(--surface); color: var(--ink); border-color: #cbd6c7; }
.button-subtle:hover { background: var(--mint); border-color: #8ba186; }
.button-dark { color: var(--signal); background: #203b2b; border-color: #527154; }
.button-dark:hover { background: #35543b; border-color: #92ac81; }
.button-dark:focus-visible, .account-status:focus-visible { outline-color: var(--signal); }
.button-wide { width: 100%; justify-content: space-between; }
.text-link {
  color: #31552e;
  font-weight: 690;
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
}
.text-link:hover { color: #142e1a; text-decoration-thickness: 2px; }
.text-link svg { margin-inline-start: 2px; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  color: var(--signal-dark);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .105em;
  text-transform: uppercase;
}
.eyebrow-light { color: var(--signal); }
.signal-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
}
.eyebrow-light .signal-dot, .account-status .signal-dot { box-shadow: 0 0 0 4px #d5f19b26; }

.auth-main { padding-block: clamp(28px, 5.5vw, 69px); }
.admin-login-main { max-width: 560px; }
.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr);
  gap: 18px;
}
.auth-card, .auth-story { min-width: 0; border-radius: var(--radius); }
.auth-card {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: clamp(23px, 5vw, 61px);
}
.auth-card h1, .story-copy h2, .dashboard-heading h1 {
  font-weight: 670;
  letter-spacing: -.045em;
  line-height: 1.06;
}
.auth-card h1 { font-size: clamp(2.1rem, 4.6vw, 3.65rem); }
.admin-login-card h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
.auth-intro { max-width: 36ch; margin-top: 15px; color: var(--muted); }
.portal-form { display: grid; gap: 14px; }
.auth-card .portal-form { margin-top: 27px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: .9rem; font-weight: 690; }
.field input, .field textarea, .secret-value {
  width: 100%;
  min-width: 0;
  min-height: 47px;
  padding: 10px 12px;
  border: 1px solid #cbd4c6;
  border-radius: 9px;
  background: #f9faf5;
  color: var(--ink);
}
.field input:hover, .field textarea:hover { border-color: #8fa089; }
.field textarea, .secret-value { resize: vertical; }
.field :is(input, textarea)::placeholder { color: #596c60; }
.form-note, .auth-switch { color: var(--muted); font-size: .875rem; }
.auth-switch {
  margin-top: 23px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.auth-story {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(100px, 13vw, 164px);
  min-height: 100%;
  padding: clamp(23px, 4vw, 45px);
  background: var(--pine);
  color: #f8f9ed;
}
.story-copy, .story-foot { position: relative; z-index: 1; }
.story-copy h2 { max-width: 14ch; font-size: clamp(1.95rem, 4.65vw, 3.75rem); }
.story-copy > p:last-child { max-width: 33ch; margin-top: 16px; color: #c4d1c4; }
.route-art {
  position: absolute;
  z-index: -1;
  width: 110%;
  height: auto;
  max-width: none;
  inset: auto -9% 7% auto;
  pointer-events: none;
}
.story-foot {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 15px;
  border-top: 1px solid #517056;
}
.story-foot p { max-width: 31ch; color: #c4d1c4; font-size: .82rem; }
.story-foot strong { color: #f8f9ed; font-size: .9rem; }

.dashboard-main { padding-block: clamp(23px, 4.5vw, 50px) clamp(35px, 6vw, 65px); }
.dashboard-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 25px;
  padding: clamp(24px, 5vw, 51px);
  border-radius: var(--radius);
  background: var(--pine);
  color: #f8f9ed;
}
.dashboard-hero .route-art { width: min(65%, 640px); right: -7%; bottom: -39%; opacity: .72; }
.dashboard-heading, .dashboard-account { min-width: 0; }
.dashboard-heading h1 { font-size: clamp(2.55rem, 5.5vw, 4.45rem); }
.dashboard-heading > p:last-child { margin-top: 13px; color: #c4d1c4; }
.dashboard-account {
  width: min(100%, 220px);
  padding: 14px 16px;
  border: 1px solid #547259;
  border-radius: 12px;
  background: var(--pine-deep);
  overflow-wrap: anywhere;
}
.account-name { font-weight: 720; }
.account-id { color: #bdcdbf; font: .76rem / 1.5 var(--mono); }
.account-status {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--signal);
  font-size: .8rem;
  font-weight: 700;
  text-underline-offset: .2em;
}
.account-status-neutral { color: #dfebd8; }

.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.method-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: clamp(19px, 3.3vw, 34px);
}
.method-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.method-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 12px; }
.method-icon-wireguard { background: #e5efde; color: #2f5236; }
.method-icon-vless { background: #e9efd3; color: #3e5426; }
.method-tag {
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 9px;
  color: var(--muted);
  font: .75rem / 1.3 var(--mono);
  white-space: nowrap;
}
.method-card h2, .section-heading h2, .extras-section h2 {
  font: 650 clamp(1.75rem, 3.2vw, 2.55rem) / 1.12 var(--sans);
  letter-spacing: -.045em;
}
.method-intro { min-height: 3.1em; margin-top: 8px; color: var(--muted); }
.profile-row, .empty-state { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.profile-name { margin-bottom: 10px; font-weight: 720; overflow-wrap: anywhere; }
.profile-name > span { display: block; color: var(--muted); font-size: .83rem; font-weight: 450; }
.method-note { margin-top: 12px; color: var(--muted); font-size: .81rem; }
.empty-state p + p, .empty-state .text-link { margin-top: 5px; }
.empty-state p + p { color: var(--muted); }
.empty-state .text-link { display: inline-block; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary > .disclosure-icon { transform: rotate(180deg); }
.disclosure-icon { display: inline-flex; align-items: center; color: var(--muted); }
.sub-detail, .secret-detail { font-size: .85rem; }
.sub-detail > summary, .secret-detail > summary {
  display: flex;
  width: fit-content;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  color: #31552e;
  font-weight: 680;
}
.sub-detail > summary:hover, .secret-detail > summary:hover { text-decoration: underline; text-underline-offset: .22em; }
.detail-body { display: grid; gap: 8px; color: var(--muted); }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-top: 3px; }
.copy-group { display: grid; justify-items: start; min-width: 0; }
.secret-detail { width: 100%; }
.secret-value { display: block; font: .82rem / 1.45 var(--mono); overflow-wrap: anywhere; }
.copy-feedback { color: var(--signal-dark); font-size: .83rem; }
.copy-feedback:empty { display: none; }

.access-section, .extras-section { margin-top: 32px; scroll-margin-top: 20px; }
.access-section {
  padding: clamp(19px, 3.3vw, 34px);
  border: 1px solid #d4dfd0;
  border-radius: var(--radius);
  background: #edf2e8;
}
.section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.section-heading p:last-child { margin-top: 7px; color: var(--muted); }
.access-list, .expired-list { margin: 16px 0 0; padding: 0; list-style: none; }
.access-list li, .expired-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 7px 13px;
  border-top: 1px solid #d5dfd0;
  padding: 10px 0;
  font-size: .88rem;
}
.access-list li:last-child, .expired-list li:last-child { padding-bottom: 0; }
.access-list small { display: block; color: var(--muted); }
.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e3e9df;
  color: #32493c;
  font-size: .76rem;
  font-weight: 690;
}
.status-active, .status-non_renewing { background: #dcebcf; color: #355326; }
.status-pending, .status-partial { background: #f2eacb; color: #6a5024; }
.status-failed, .status-revoked { background: #f6e1db; color: #7a382b; }
.extras-section h2 { margin-bottom: 10px; }
.access-disclosure { border-bottom: 1px solid var(--line); scroll-margin-top: 20px; }
.access-disclosure > summary { display: flex; align-items: center; min-height: 52px; gap: 9px; }
.access-disclosure > summary > .disclosure-icon { margin-left: auto; }
.disclosure-count {
  min-width: 24px;
  padding: 3px 6px;
  border-radius: 99px;
  background: #e4ebe0;
  color: #435e47;
  font: .76rem / 1.35 var(--mono);
  text-align: center;
}
.access-detail-content { padding: 0 0 14px; color: var(--muted); }
.access-item { margin-top: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.access-item .profile-name { color: var(--ink); }

.portal-help {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #efefe7;
  scroll-margin-top: 20px;
}
.dashboard-main .portal-help { margin-top: 32px; }
.help-heading { display: flex; min-height: 73px; align-items: center; gap: 13px; padding: 10px 16px; }
.help-heading strong { display: block; }
.help-symbol {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 10px;
  background: #dfe8db;
  color: #395641;
}
.help-caption { display: block; color: var(--muted); font-size: .84rem; }
.help-heading .disclosure-icon { margin-left: auto; }
.help-body { max-width: 700px; padding: 0 16px 17px; }
.help-body > p { margin-bottom: 12px; color: var(--muted); }

.flash {
  margin-bottom: 14px;
  padding: 12px 15px;
  border: 1px solid #a8c29e;
  border-radius: 10px;
  background: #e9f2e2;
  color: #24432b;
  overflow-wrap: anywhere;
}
.flash-danger, .flash-error { border-color: #ddb3a7; background: #f8e8e1; color: #70372c; }

@media (max-width: 760px) {
  .portal-shell { width: calc(100% - 32px); }
  .header-inner { min-height: 63px; }
  .auth-grid, .method-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .auth-story { gap: clamp(77px, 20vw, 145px); }
  .auth-story .route-art { width: min(100%, 530px); }
  .method-grid { margin-top: 13px; }
  .method-intro { min-height: auto; }
  .dashboard-hero { align-items: start; flex-direction: column; gap: 16px; }
  .dashboard-heading h1 { font-size: clamp(2rem, 7.8vw, 3.55rem); }
  .dashboard-hero .route-art { width: min(94%, 500px); bottom: -18%; }
  .dashboard-account {
    width: fit-content;
    max-width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    padding: 8px 12px;
  }
  .account-id { grid-column: 1; }
  .account-status { grid-column: 2; grid-row: 1 / 3; margin-top: 0; }
}

@media (max-width: 380px) {
  .portal-shell { width: calc(100% - 24px); }
  .header-actions { gap: 10px; }
  .header-link { gap: 3px; font-size: .78rem; }
  .header-link svg { width: 15px; }
  .brand { gap: 6px; font-size: 1.05rem; }
  .brand-icon { width: 31px; height: 31px; }
  .brand-icon svg { width: 28px; height: 28px; }
  .auth-card { padding: 18px; }
  .auth-card h1 { font-size: 2rem; }
  .help-heading { gap: 8px; padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
