:root {
    color-scheme: light;
    --bg: #f4f7f8;
    --panel: #ffffff;
    --text: #172026;
    --muted: #65727c;
    --line: #d8e0e4;
    --accent: #167c80;
    --accent-strong: #0f5f62;
    --ok: #16824a;
    --warn: #b06f00;
    --missing: #b42318;
    --logo-bg: #101820;
    --logo-fg: #ffffff;
    --logo-accent: #31c6b8;
    --shadow: 0 18px 50px rgba(16, 24, 32, 0.10);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1418;
    --panel: #141f24;
    --text: #ecf4f6;
    --muted: #a7b5bc;
    --line: #2b3a42;
    --accent: #47c7bd;
    --accent-strong: #7ee1d8;
    --ok: #41c979;
    --warn: #e5a63a;
    --missing: #ff766c;
    --logo-bg: #e8fbf8;
    --logo-fg: #0d1418;
    --logo-accent: #14968f;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

.topbar {
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

:root[data-theme="dark"] .topbar {
    background: #111b20;
}

.app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: calc(100vh - 100px);
}

.sidebar {
    padding: 22px 16px;
    background: var(--panel);
    border-right: 1px solid var(--line);
}

.primary-nav,
.secondary-nav {
    display: grid;
    gap: 6px;
}

.secondary-nav {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.primary-nav a,
.secondary-nav a {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.primary-nav a:hover,
.secondary-nav a:hover {
    background: #eef5f5;
    color: var(--accent-strong);
}

:root[data-theme="dark"] .primary-nav a:hover,
:root[data-theme="dark"] .secondary-nav a:hover {
    background: #1b2a2e;
}

.primary-nav a[aria-current="page"],
.secondary-nav a[aria-current="page"] {
    background: #e5f3f2;
    color: var(--accent-strong);
}

:root[data-theme="dark"] .primary-nav a[aria-current="page"],
:root[data-theme="dark"] .secondary-nav a[aria-current="page"] {
    background: #173033;
}

.brand-lockup {
    display: flex;
    gap: 14px;
    align-items: center;
    min-width: 220px;
}

.brand-lockup.large {
    align-items: flex-start;
}

.logo-mark {
    position: relative;
    display: grid;
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    grid-template-rows: 1fr 1fr;
    place-items: center;
    overflow: hidden;
    border-radius: 14px;
    background: var(--logo-bg);
    color: var(--logo-fg);
    box-shadow: var(--shadow);
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
}

.logo-mark::before {
    position: absolute;
    inset: 8px auto auto 8px;
    width: 14px;
    height: 14px;
    content: "";
    border: 3px solid var(--logo-accent);
    border-radius: 50%;
}

.logo-mark::after {
    position: absolute;
    right: -12px;
    bottom: -12px;
    width: 40px;
    height: 40px;
    content: "";
    border-radius: 50%;
    background: var(--logo-accent);
    opacity: 0.9;
}

.logo-mark span {
    position: relative;
    z-index: 1;
}

.nav {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 14px;
}

.top-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    color: var(--muted);
    font-size: 14px;
}

.top-actions a {
    color: var(--accent-strong);
    font-weight: 800;
    text-decoration: none;
}

.top-actions a[aria-current="page"] {
    color: var(--text);
}

.nav a {
    color: var(--accent-strong);
    font-weight: 700;
    text-decoration: none;
}

.theme-button {
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--accent-strong);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.nav a[aria-current="page"] {
    color: var(--text);
}

.strong-link {
    color: var(--text);
    font-weight: 900;
    text-decoration: none;
}

.strong-link:hover {
    color: var(--accent-strong);
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 28px;
    line-height: 1.15;
}

h2 {
    margin-bottom: 14px;
    font-size: 18px;
}

.search {
    flex: 1;
    max-width: 520px;
}

.search input {
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}

.layout {
    width: min(1180px, calc(100vw - 32px));
    margin: 28px auto;
}

.narrow-layout {
    width: min(620px, calc(100vw - 32px));
}

.panel {
    margin-bottom: 18px;
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.overview {
    border-left: 4px solid var(--accent);
}

.overview p {
    max-width: 860px;
    margin-bottom: 0;
    color: var(--muted);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.summary-grid div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.summary-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.summary-grid strong {
    display: block;
    margin-top: 4px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.project-tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 18px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.project-tabs a {
    flex: 0 0 auto;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.project-tabs a[aria-current="page"],
.project-tabs a:hover {
    border-color: #b8d8d7;
    background: #e5f3f2;
    color: var(--accent-strong);
}

:root[data-theme="dark"] .project-tabs a[aria-current="page"],
:root[data-theme="dark"] .project-tabs a:hover {
    border-color: #295f62;
    background: #173033;
}

.metric {
    margin-bottom: 10px;
    font-size: 34px;
    font-weight: 900;
    line-height: 1;
}

.list {
    display: grid;
    gap: 12px;
}

.row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    min-height: 48px;
}

.row p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.muted {
    color: var(--muted);
}

.row-action {
    align-self: center;
}

.row-action button {
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--missing);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.status {
    width: 12px;
    height: 12px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--missing);
}

.status.ok {
    background: var(--ok);
}

.status.warn {
    background: var(--warn);
}

.status.planned {
    background: var(--warn);
}

.badge {
    min-width: 72px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e7f3f2;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.tag {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.steps {
    margin: 0;
    padding-left: 22px;
}

code {
    padding: 2px 5px;
    background: #eef3f5;
    border-radius: 4px;
}

:root[data-theme="dark"] code {
    background: #1d2b31;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.utility-bar {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.language-switch {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.language-switch a {
    color: var(--accent-strong);
    text-decoration: none;
}

.login-shell {
    width: min(420px, calc(100vw - 32px));
}

.login-panel {
    padding: 28px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.login-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.login-form input {
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: var(--panel);
    color: var(--text);
}

.login-form select {
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
}

.login-form textarea {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    resize: vertical;
}

.login-form button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: var(--accent-strong);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.alert {
    padding: 10px 12px;
    background: #fff1f0;
    border: 1px solid #f4b7b0;
    border-radius: 6px;
    color: var(--missing);
    font-size: 14px;
    font-weight: 700;
}

.notice {
    padding: 10px 12px;
    background: #edf9f1;
    border: 1px solid #a8dfbb;
    border-radius: 6px;
    color: var(--ok);
    font-size: 14px;
    font-weight: 700;
}

:root[data-theme="dark"] .notice {
    background: #10251a;
    border-color: #245f3c;
}

.account-form {
    max-width: 460px;
}

.service-tags {
    margin-bottom: 14px;
}

.service-form {
    margin-top: 16px;
}

.check-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.check-list legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.check-list label {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
    align-items: center;
    color: var(--text);
    font-weight: 700;
}

.token-box {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid #a8dfbb;
    border-radius: 6px;
    background: #edf9f1;
    color: var(--text);
}

:root[data-theme="dark"] .token-box {
    background: #10251a;
    border-color: #245f3c;
}

.token-box code {
    display: block;
    overflow-wrap: anywhere;
}

.inline-form {
    margin: 16px 0;
}

.inline-form button {
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: var(--accent-strong);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.audit-item {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.audit-item p {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 14px;
}

.diagnostic-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--missing);
    border-radius: 8px;
}

.diagnostic-item.ok {
    border-left-color: var(--ok);
}

.diagnostic-item.warn,
.diagnostic-item.planned {
    border-left-color: var(--warn);
}

.diagnostic-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.diagnostic-details div {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.diagnostic-details dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.diagnostic-details dd {
    margin: 4px 0 0;
    overflow-wrap: anywhere;
    font-weight: 800;
}

.diagnostic-explain p {
    margin-bottom: 6px;
    color: var(--muted);
}

.docs-layout {
    display: grid;
    grid-template-columns: minmax(220px, 300px) 1fr;
    gap: 18px;
}

.docs-nav {
    align-self: start;
}

.docs-nav a {
    display: block;
    padding: 8px 0;
    color: var(--accent-strong);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
}

.docs-nav a.active {
    color: var(--text);
    font-weight: 700;
}

.docs-content pre {
    max-width: 100%;
    overflow: auto;
    margin: 0;
    padding: 16px;
    background: #101820;
    color: #eef6f8;
    border-radius: 6px;
    font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    white-space: pre-wrap;
}

:root[data-theme="dark"] .docs-content pre {
    background: #090f12;
}

@media (max-width: 760px) {
    .topbar {
        display: block;
        padding: 18px;
    }

    .brand-lockup {
        min-width: 0;
    }

    .nav {
        margin-top: 14px;
    }

    .top-actions {
        justify-content: flex-start;
        margin-top: 14px;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        padding: 10px 12px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .primary-nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .secondary-nav {
        display: none;
    }

    .primary-nav a {
        flex: 0 0 auto;
    }

    .utility-bar {
        position: static;
        justify-content: center;
        margin: 14px auto 0;
    }

    .search {
        max-width: none;
        margin-top: 14px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .row-action {
        grid-column: 2;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .diagnostic-details {
        grid-template-columns: 1fr;
    }

    .docs-layout {
        grid-template-columns: 1fr;
    }

    .layout {
        width: min(100vw - 24px, 1180px);
        margin-top: 18px;
    }
}
