:root {
    color-scheme: dark;
    --bg: #070b18;
    --surface: #11182e;
    --surface-soft: #171f39;
    --surface-raised: #1d2643;
    --ink: #f4f6fc;
    --muted: #aeb7d0;
    --subtle: #77839f;
    --line: rgba(179, 189, 218, 0.16);
    --line-strong: rgba(179, 189, 218, 0.28);
    --accent: #9792ff;
    --accent-soft: rgba(151, 146, 255, 0.13);
    --gold: #e5bd70;
    --green: #78dfbf;
    --red: #ff99a8;
    --orange: #f7b56e;
    font-family: 'Outfit', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 88% 3%, rgba(77, 64, 170, 0.24), transparent 34rem), radial-gradient(circle at 4% 85%, rgba(37, 104, 104, 0.12), transparent 28rem), linear-gradient(155deg, #070b18 0%, #0a1022 52%, #090d1c 100%); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.skip-link { position: fixed; z-index: 100; top: 0.6rem; left: 0.6rem; padding: 0.75rem 1rem; border-radius: 9px; background: white; color: #111; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.app-shell { width: min(1880px, calc(100% - 2rem)); margin: 0 auto; }
.topbar { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 0.8rem; min-width: 0; text-decoration: none; }
.brand img { width: 52px; height: 52px; flex: 0 0 auto; object-fit: cover; border: 1px solid var(--line); border-radius: 14px; }
.brand span { display: grid; min-width: 0; }
.brand strong { overflow: hidden; font: 700 1.05rem/1.2 'Playfair Display', Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.brand small { margin-top: 0.18rem; overflow: hidden; color: var(--muted); font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions, .button-row { display: flex; align-items: center; justify-content: flex-end; gap: 0.65rem; flex-wrap: wrap; }
.environment-chip { display: inline-flex; min-height: 34px; align-items: center; gap: 0.5rem; padding: 0.42rem 0.7rem; border: 1px solid rgba(120, 223, 191, 0.22); border-radius: 999px; background: rgba(120, 223, 191, 0.08); color: #a8ead6; font-size: 0.73rem; font-weight: 800; }
.environment-chip span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(120, 223, 191, 0.1); }
main { padding: clamp(1rem, 2vw, 2rem) 0; }
footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem 0 2rem; color: var(--subtle); font-size: 0.74rem; }

.gate-card { min-height: 380px; display: flex; align-items: center; gap: 1.5rem; padding: clamp(1.5rem, 5vw, 4rem); border: 1px solid var(--line); border-radius: 28px; background: rgba(17, 24, 46, 0.86); box-shadow: 0 28px 90px rgba(0, 0, 0, 0.3); }
.gate-card > div:last-child { max-width: 820px; }
.gate-icon { display: grid; width: 54px; height: 54px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(229, 189, 112, 0.24); border-radius: 16px; background: rgba(229, 189, 112, 0.08); color: var(--gold); font-size: 1.35rem; font-weight: 800; }
.loader { width: 38px; height: 38px; flex: 0 0 auto; border: 3px solid rgba(151, 146, 255, 0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.eyebrow { margin: 0 0 0.45rem; color: var(--gold); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0.75rem; font: 700 clamp(2.25rem, 5vw, 4.7rem)/0.96 'Playfair Display', Georgia, serif; letter-spacing: -0.035em; }
h2 { margin-bottom: 0.4rem; font: 700 clamp(1.35rem, 2.2vw, 2rem)/1.12 'Playfair Display', Georgia, serif; }
h3 { margin-bottom: 0.35rem; font: 700 1.05rem/1.2 'Playfair Display', Georgia, serif; }
p { color: var(--muted); line-height: 1.62; }
.gate-card p { max-width: 720px; }
.primary-button, .secondary-button, .danger-button, .quiet-button, .icon-button { min-height: 42px; border-radius: 10px; font-weight: 800; cursor: pointer; }
.primary-button, .secondary-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; padding: 0.7rem 1rem; text-decoration: none; }
.primary-button { border: 0; background: linear-gradient(135deg, #6579ff, #8a65d2); color: white; box-shadow: 0 10px 30px rgba(75, 76, 180, 0.22); }
.secondary-button { border: 1px solid var(--line); background: var(--surface-soft); color: var(--ink); }
.danger-button { border: 1px solid rgba(255, 153, 168, 0.42); background: rgba(138, 34, 52, 0.28); color: #ffd8df; }
.quiet-button, .icon-button { border: 0; background: transparent; color: var(--muted); }
.quiet-button { padding: 0.55rem 0.7rem; text-decoration: underline; text-decoration-color: rgba(174, 183, 208, 0.36); text-underline-offset: 0.2rem; }
.icon-button { width: 42px; padding: 0; font-size: 1.4rem; }
button:hover:not(:disabled), a.secondary-button:hover { filter: brightness(1.11); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
button:disabled { opacity: 0.48; cursor: not-allowed; }
.status-line { min-height: 1.4rem; margin: 0.8rem 0 0; font-size: 0.84rem; }
.status-line[data-state="error"], .workspace-status[data-state="error"] { color: #ffc1ca; }
.status-line[data-state="success"], .workspace-status[data-state="success"] { color: var(--green); }
.mfa-enrollment { display: grid; max-width: 620px; gap: 0.8rem; margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(7, 11, 24, 0.4); }
.mfa-guidance { margin: 0; font-size: 0.8rem; }
.mfa-actions { justify-content: flex-start; }
.secret-output { display: block; margin-top: 0.35rem; padding: 0.8rem; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 10px; background: #070b18; color: var(--gold); font: 700 0.9rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; }

#owner-workspace { display: grid; width: 100%; max-width: 100%; min-width: 0; grid-template-columns: 248px minmax(0, 1fr); gap: clamp(1rem, 2vw, 1.75rem); align-items: start; }
.sidebar { position: sticky; top: 1rem; display: grid; max-height: calc(100vh - 2rem); gap: 1rem; padding: 0.9rem; overflow-y: auto; border: 1px solid var(--line); border-radius: 20px; background: rgba(7, 11, 24, 0.72); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22); }
.sidebar nav { display: grid; gap: 0.25rem; }
.nav-label { margin: 1rem 0.65rem 0.3rem; color: var(--subtle); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 0.2rem; }
.sidebar nav button { display: grid; grid-template-columns: 24px minmax(0, 1fr); min-height: 44px; align-items: center; gap: 0.5rem; padding: 0.65rem 0.7rem; border: 0; border-radius: 11px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.sidebar nav button span { display: grid; place-items: center; color: #9da7c5; }
.sidebar nav button:hover, .sidebar nav button:focus-visible, .sidebar nav button[aria-current="page"] { background: var(--surface-soft); color: var(--ink); }
.sidebar nav button[aria-current="page"] { box-shadow: inset 3px 0 0 var(--gold); }
.privacy-boundary { padding: 0.8rem; border: 1px solid rgba(120, 223, 191, 0.18); border-radius: 12px; background: rgba(120, 223, 191, 0.05); }
.privacy-boundary strong { color: #a8ead6; font-size: 0.76rem; }
.privacy-boundary p { margin: 0.3rem 0 0; font-size: 0.72rem; line-height: 1.45; }
.workspace-main { min-width: 0; }
.hero-panel { display: flex; justify-content: space-between; gap: 2rem; padding: clamp(1.6rem, 4vw, 3rem); border: 1px solid var(--line); border-radius: 27px; background: linear-gradient(125deg, rgba(20, 27, 54, 0.96), rgba(31, 29, 70, 0.78)); box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28); }
.hero-panel > div:first-child { max-width: 970px; }
.hero-panel h1 { max-width: 900px; font-size: clamp(2.1rem, 4.2vw, 4rem); }
.hero-panel p:last-child { margin-bottom: 0; }
.security-stack { display: flex; max-width: 220px; align-content: flex-start; justify-content: flex-end; gap: 0.4rem; flex-wrap: wrap; }
.security-stack span { padding: 0.42rem 0.65rem; border: 1px solid rgba(120, 223, 191, 0.2); border-radius: 999px; background: rgba(120, 223, 191, 0.07); color: #a8ead6; font-size: 0.7rem; font-weight: 800; white-space: nowrap; }
.workspace-status { min-height: 1.4rem; margin: 0.75rem 0; color: var(--muted); font-size: 0.8rem; }
.workspace-view { min-width: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin: 0 0 0.8rem; }
.metric-grid article, .metric-grid > div { min-width: 0; padding: 1.1rem; border: 1px solid var(--line); border-radius: 17px; background: rgba(17, 24, 46, 0.84); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.16); }
.metric-grid span { display: block; color: var(--muted); font-size: 0.74rem; font-weight: 700; }
.metric-grid strong { display: block; margin: 0.65rem 0 0.35rem; overflow-wrap: anywhere; color: var(--accent); font-size: clamp(1.5rem, 2.8vw, 2.25rem); }
.metric-grid small { color: var(--subtle); font-size: 0.7rem; line-height: 1.4; }
.metric-grid.compact { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.content-grid { display: grid; gap: 0.8rem; }
.content-grid.two-one { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.panel { min-width: 0; padding: clamp(1.1rem, 2.5vw, 1.6rem); border: 1px solid var(--line); border-radius: 19px; background: rgba(17, 24, 46, 0.84); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.16); }
.panel-heading, .section-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.section-heading { margin-bottom: 1rem; padding: 0.5rem 0; }
.section-heading > div:first-child { max-width: 900px; }
.section-heading p:last-child { margin-bottom: 0; }
.section-heading > label, .panel label { min-width: min(100%, 280px); }
.stack-list { display: grid; gap: 0.65rem; }
.stack-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 0.85rem; border: 1px solid var(--line); border-radius: 13px; background: rgba(7, 11, 24, 0.32); }
.stack-item h3 { margin: 0; }
.stack-item p { margin: 0.25rem 0 0; font-size: 0.78rem; }
.stack-item time, .muted { color: var(--subtle); font-size: 0.72rem; }
.empty-state { padding: 1.2rem; border: 1px dashed var(--line-strong); border-radius: 13px; color: var(--muted); text-align: center; }
.boundary-card { min-height: 190px; padding: 1rem; border-left: 3px solid var(--gold); background: rgba(229, 189, 112, 0.06); }
.boundary-card strong { display: block; margin-bottom: 0.5rem; color: var(--gold); }
.boundary-card p { margin-bottom: 0; font-size: 0.84rem; }
.table-shell { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: rgba(17, 24, 46, 0.74); }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 0.85rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; background: #121a31; color: var(--gold); font-size: 0.68rem; letter-spacing: 0.07em; text-transform: uppercase; }
td { color: var(--muted); font-size: 0.8rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(151, 146, 255, 0.04); }
.status-pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.28rem 0.48rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.67rem; font-weight: 800; text-transform: capitalize; }
.status-pill[data-state="active"], .status-pill[data-state="healthy"] { border-color: rgba(120, 223, 191, 0.22); background: rgba(120, 223, 191, 0.07); color: var(--green); }
.status-pill[data-state="suspended"], .status-pill[data-state="expired"], .status-pill[data-state="error"] { border-color: rgba(255, 153, 168, 0.25); background: rgba(255, 153, 168, 0.07); color: var(--red); }
.status-pill[data-state="grace"], .status-pill[data-state="warning"] { border-color: rgba(247, 181, 110, 0.25); background: rgba(247, 181, 110, 0.07); color: var(--orange); }
.table-action { min-height: 34px; padding: 0.35rem 0.55rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--ink); font-size: 0.72rem; font-weight: 800; cursor: pointer; }
.pagination { display: flex; justify-content: center; margin-top: 0.8rem; }
label { display: grid; gap: 0.4rem; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 44px; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 10px; background: #0b1124; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.optional { color: var(--subtle); font-weight: 500; }
.confirmation { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 0.7rem; color: var(--ink); }
.confirmation input { width: 20px; min-height: 20px; margin-top: 0.1rem; }
.impact-note { padding: 0.9rem; border-left: 3px solid var(--red); background: rgba(255, 153, 168, 0.06); color: #ffd6dd; font-size: 0.84rem; line-height: 1.5; }
.license-card { padding: 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(17, 24, 46, 0.82); }
.license-card dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.55rem 1rem; margin: 1rem 0; }
.license-card dt { color: var(--subtle); font-size: 0.75rem; }
.license-card dd { margin: 0; color: var(--ink); font-size: 0.8rem; font-weight: 700; overflow-wrap: anywhere; }
.license-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.timeline { display: grid; gap: 0.7rem; }
.timeline-item { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 0.8rem; padding: 0.8rem; border: 1px solid var(--line); border-radius: 13px; background: rgba(17, 24, 46, 0.72); }
.timeline-item > span { width: 10px; height: 10px; margin-top: 0.3rem; border: 2px solid var(--gold); border-radius: 50%; }
.timeline-item h3 { margin: 0; font-size: 0.93rem; }
.timeline-item p { margin: 0.3rem 0 0; font-size: 0.76rem; }

dialog { width: min(620px, calc(100% - 1.5rem)); max-height: calc(100vh - 2rem); padding: 0; overflow: auto; border: 1px solid var(--line-strong); border-radius: 22px; background: #11182e; color: var(--ink); box-shadow: 0 30px 100px rgba(0, 0, 0, 0.55); }
dialog::backdrop { background: rgba(4, 7, 16, 0.78); backdrop-filter: blur(8px); }
.dialog-card { display: grid; gap: 0.85rem; padding: clamp(1.2rem, 4vw, 2rem); }
.dialog-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.dialog-heading h2 { margin-bottom: 0; }

@media (max-width: 1100px) {
    #owner-workspace { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; display: block; min-width: 0; max-width: 100%; max-height: none; overflow: hidden; }
    .sidebar nav { display: flex; width: 100%; min-width: 0; max-width: 100%; gap: 0.35rem; overflow-x: auto; scrollbar-width: thin; }
    .sidebar nav button { flex: 0 0 auto; grid-template-columns: auto auto; white-space: nowrap; }
    .nav-label, .privacy-boundary { display: none; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .app-shell { width: min(100% - 1rem, 1880px); }
    .topbar { min-height: 72px; grid-template-columns: minmax(0, 1fr) auto; display: grid; }
    .topbar-actions { min-width: 0; flex-wrap: nowrap; }
    .brand img { width: 44px; height: 44px; }
    .brand small, .environment-chip { display: none; }
    .brand strong { white-space: normal; }
    .topbar .quiet-button { display: none; }
    .gate-card { min-height: 0; align-items: flex-start; flex-direction: column; padding: 1.2rem; border-radius: 19px; }
    .hero-panel { display: block; padding: 1.25rem; border-radius: 20px; }
    .security-stack { max-width: none; justify-content: flex-start; }
    .metric-grid { grid-template-columns: 1fr; }
    .content-grid.two-one { grid-template-columns: 1fr; }
    .section-heading, .panel-heading { display: grid; }
    .section-heading > label, .panel label { min-width: 0; }
    .stack-item { grid-template-columns: 1fr; }
    footer { display: grid; }
}

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