:root {
    color-scheme: light;
    --ink: #172b3a;
    --muted: #61727d;
    --line: #e1e8eb;
    --paper: #f4f7f7;
    --card: #ffffff;
    --brand: #087e79;
    --brand-dark: #05635f;
    --brand-soft: #e4f5f3;
    --warning: #a24a16;
    --danger: #a3323c;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); min-height: 100vh; line-height: 1.5; }
a { color: var(--brand-dark); }
.topbar { position: relative; z-index: 5; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; gap: .7rem 2rem; padding: 1rem clamp(1rem, 4vw, 3.5rem) .8rem; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-size: 1rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.topbar > .brand { grid-column: 1; grid-row: 1; }
.nav-menu { grid-column: 1 / -1; grid-row: 2; min-width: 0; padding-top: .65rem; border-top: 1px solid var(--line); }
.nav-menu > summary { display: none; }
.topbar nav { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem 1rem; }
.topbar nav a, .link-button { color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 650; }
.topbar nav a { white-space: nowrap; }
.topbar nav a:hover, .link-button:hover { color: var(--brand-dark); }
.user-menu { grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .75rem; color: var(--muted); font-size: .86rem; }
.user-menu form { margin: 0; }
.user-name { max-width: 25vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-button { padding: 0; border: 0; background: none; cursor: pointer; }
.page { width: min(1160px, calc(100% - 2rem)); margin: clamp(1.7rem, 4vw, 3.25rem) auto 4rem; }
.page-heading { margin-bottom: 1.5rem; }
.page-heading h1 { margin: .2rem 0 0; font-size: clamp(1.8rem, 3vw, 2.4rem); line-height: 1.12; letter-spacing: -.04em; overflow-wrap: anywhere; }
.eyebrow { margin: 0; color: var(--brand-dark); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.welcome { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1.3rem; }
.welcome h2 { margin: .85rem 0 .35rem; font-size: 1.35rem; letter-spacing: -.025em; }
.welcome p, .section-heading p, .card > p, .muted { color: var(--muted); line-height: 1.55; }
.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin: 1.25rem 0; }
.quick-links a { display: grid; gap: .3rem; padding: 1rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 13px; text-decoration: none; box-shadow: 0 8px 28px rgba(26, 51, 66, .025); }
.quick-links a:hover { border-color: #9bb5b5; }
.quick-links span { color: var(--muted); font-size: .75rem; }
.quick-links strong { font-size: .9rem; }
.support-card { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.support-card h2 { margin: .35rem 0; font-size: 1.05rem; }
.support-card p { margin: .3rem 0; }
.support-card .muted { max-width: 360px; font-size: .83rem; }
.pill { display: inline-flex; padding: .35rem .65rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand-dark); font-size: .75rem; font-weight: 750; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.stat-card, .card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 28px rgba(26, 51, 66, .035); }
.stat-card { padding: 1.15rem 1.25rem; }
.stat-card span { display: block; color: var(--muted); font-size: .82rem; }
.stat-card strong { display: block; margin-top: .45rem; font-size: 1.85rem; letter-spacing: -.04em; }
.card { padding: clamp(1rem, 2.6vw, 1.6rem); margin-bottom: 1rem; }
.card.narrow { width: min(100%, 540px); margin-inline: auto; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.section-heading h2 { margin: 0 0 .25rem; font-size: 1.1rem; }
.section-heading p { margin: 0; font-size: .88rem; }
.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; margin: 0 -.3rem; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .86rem; }
th { padding: .8rem .7rem; color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .9rem .7rem; border-bottom: 1px solid #edf1f2; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td strong { display: block; font-weight: 750; }
.cell-subtitle { display: block; max-width: 340px; margin-top: .28rem; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.url-cell { display: block; max-width: 300px; overflow-wrap: anywhere; font-size: .78rem; }
.status { display: inline-flex; padding: .34rem .56rem; border-radius: 99px; font-size: .73rem; font-weight: 750; white-space: nowrap; }
.status-active { color: #11634a; background: #e4f5ed; }
.status-stock { color: #345b86; background: #e9f1fa; }
.status-setup { color: #86511d; background: #fff1d7; }
.status-suspended { color: #925218; background: #fff2df; }
.status-archived { color: #58646b; background: #edf0f1; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .68rem 1rem; border: 1px solid transparent; border-radius: 10px; font: inherit; font-size: .86rem; font-weight: 750; text-decoration: none; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--brand); }
.button.primary:hover { background: var(--brand-dark); }
.button.secondary { color: var(--ink); background: white; border-color: var(--line); }
.button.secondary:hover, .button.small:hover { border-color: #9bb5b5; }
.button.small { min-height: 34px; padding: .45rem .68rem; color: var(--brand-dark); background: white; border-color: var(--line); font-size: .78rem; }
.form-stack { display: grid; gap: .75rem; margin-top: 1.25rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: .75rem; }
.form-grid > div { display: grid; gap: .45rem; }
.inline-form { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; margin: .35rem 0; }
.inline-form select { min-width: 190px; }
select { min-height: 40px; padding: .55rem .7rem; color: var(--ink); background: #fff; border: 1px solid #c8d3d8; border-radius: 9px; font: inherit; font-size: .82rem; }
select:focus { outline: 3px solid rgba(8, 126, 121, .18); border-color: var(--brand); }
.danger-button { color: var(--danger); border-color: #ecd0d2; }
.checkbox-label { display: flex; align-items: center; gap: .6rem; }
.checkbox-label input { width: auto; min-height: 0; margin: 0; }
.activity-entry { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.activity-entry:last-child { border-bottom: 0; }
.activity-entry p { margin: .25rem 0; line-height: 1.5; }
.text-stat { font-size: 1.05rem !important; letter-spacing: 0 !important; }
textarea { width: 100%; min-height: 110px; padding: .7rem .8rem; color: var(--ink); background: white; border: 1px solid #c8d3d8; border-radius: 9px; font: inherit; resize: vertical; }
textarea:focus { outline: 3px solid rgba(8, 126, 121, .18); border-color: var(--brand); }
hr { height: 1px; margin: 1.5rem 0; background: var(--line); border: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
label { font-size: .84rem; font-weight: 750; }
input { width: 100%; min-height: 46px; padding: .7rem .8rem; color: var(--ink); background: white; border: 1px solid #c8d3d8; border-radius: 9px; font: inherit; font-size: .94rem; }
input:focus { outline: 3px solid rgba(8, 126, 121, .18); border-color: var(--brand); }
small { color: var(--muted); font-size: .78rem; }
.notice { padding: .9rem 1rem; margin: 0 0 1rem; color: #145b49; background: #e6f5ef; border: 1px solid #c6e9dc; border-radius: 12px; }
.empty-state { padding: 2rem 1rem; text-align: center; border: 1px dashed #cbd7db; border-radius: 13px; }
.empty-state h3 { margin: 0 0 .35rem; font-size: 1rem; }
.empty-state p { margin: 0; color: var(--muted); font-size: .87rem; }
.destination-preview { display: grid; gap: .4rem; padding: 1rem; margin: 1.1rem 0; background: var(--brand-soft); border-radius: 11px; }
.destination-preview span { color: var(--muted); font-size: .75rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.destination-preview a { overflow-wrap: anywhere; }
.footer { padding: 1.3rem; color: #829098; text-align: center; font-size: .76rem; }
.public-message { display: grid; place-content: center; width: min(560px, calc(100% - 2rem)); min-height: 100vh; margin: auto; text-align: center; }
.public-mark { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 1rem; color: white; background: var(--brand); border-radius: 16px; font-size: .82rem; font-weight: 850; letter-spacing: .07em; }
.public-message h1 { margin: .2rem 0 .6rem; font-size: clamp(1.5rem, 5vw, 2rem); letter-spacing: -.04em; }
.public-message p { color: var(--muted); line-height: 1.6; }
.secret-key { display: inline-block; padding: .65rem .8rem; margin-top: .35rem; color: var(--ink); background: #f3f7f7; border: 1px solid var(--line); border-radius: 9px; font-size: .95rem; letter-spacing: .08em; overflow-wrap: anywhere; user-select: all; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem 1.2rem; padding: 1rem 1rem 1rem 2.6rem; background: #f7f9f9; border: 1px solid var(--line); border-radius: 12px; }
.recovery-codes code { font-size: .95rem; letter-spacing: .05em; }

@media (max-width: 760px) {
    .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: .7rem .8rem; padding: .8rem max(.75rem, env(safe-area-inset-right)) .75rem max(.75rem, env(safe-area-inset-left)); }
    .topbar > .brand { grid-column: 1; grid-row: 1; }
    .nav-menu { position: relative; grid-column: 2; grid-row: 1; justify-self: end; padding: 0; border: 0; }
    .nav-menu > summary { display: flex; align-items: center; min-height: 40px; padding: .45rem .75rem; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 9px; font-size: .86rem; font-weight: 700; cursor: pointer; list-style: none; }
    .nav-menu > summary::-webkit-details-marker { display: none; }
    .nav-menu > summary::after { content: '☰'; margin-left: .55rem; color: var(--brand-dark); }
    .nav-menu[open] > summary { border-color: #9bb5b5; }
    .nav-menu > nav { display: none; position: absolute; top: calc(100% + .55rem); right: 0; z-index: 10; width: min(19rem, calc(100vw - 1.5rem)); max-height: min(70vh, 32rem); overflow-y: auto; padding: .45rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(26, 51, 66, .16); }
    .nav-menu[open] > nav { display: flex; flex-direction: column; align-items: stretch; gap: .1rem; }
    .topbar nav a { display: block; padding: .65rem .7rem; border-radius: 8px; white-space: normal; }
    .topbar nav a:hover { background: var(--brand-soft); }
    .user-menu { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; gap: .8rem; padding-top: .55rem; border-top: 1px solid var(--line); }
    .user-name { max-width: min(42vw, 15rem); margin-right: auto; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: .65rem; }
    .stat-card { display: flex; align-items: center; justify-content: space-between; }
    .stat-card strong { margin-top: 0; font-size: 1.5rem; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: .65rem; }
    .support-card { align-items: flex-start; flex-direction: column; gap: .4rem; }
    .form-grid { grid-template-columns: 1fr; }
    .table-wrap { margin-inline: -.4rem; width: calc(100% + .8rem); }
    table { min-width: 760px; }
    .page { width: min(1160px, calc(100% - 1.5rem)); margin-top: 1.5rem; }
    .page-heading { margin-bottom: 1.25rem; }
    .card { border-radius: 13px; }
    .inline-form { align-items: stretch; }
    .inline-form > * { max-width: 100%; }
    .recovery-codes { grid-template-columns: 1fr; }
}

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