:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #eef3f8;
    --text: #18212f;
    --muted: #667085;
    --line: #d8e0ea;
    --brand: #1769aa;
    --brand-dark: #0f4d7d;
    --accent: #0e9f6e;
    --danger: #c2410c;
    --warning: #a16207;
    --shadow: 0 8px 24px rgba(20, 32, 54, .08);
}

* {
    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;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 6px;
    color: #344054;
    font-weight: 650;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: #475467;
    font-size: 12px;
    text-transform: uppercase;
}

code,
pre {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.sidebar {
    background: #101828;
    color: #fff;
    padding: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    color: #fff;
    font-weight: 800;
    margin-bottom: 18px;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
}

.nav {
    display: grid;
    gap: 4px;
}

.nav a {
    color: #d0d5dd;
    padding: 9px 10px;
    border-radius: 8px;
}

.nav a:hover {
    background: #1d2939;
    color: #fff;
    text-decoration: none;
}

.main {
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

.button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 14px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
}

.button:hover,
.icon-button:hover {
    text-decoration: none;
    background: var(--surface-2);
}

.button.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.button.primary:hover {
    background: var(--brand-dark);
}

.button.danger {
    color: #fff;
    border-color: var(--danger);
    background: var(--danger);
}

.panel,
.stat,
.installer-card,
.auth-card,
.lead-box,
.message-page {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 18px;
    margin-bottom: 18px;
    overflow-x: auto;
}

.panel h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.panel.narrow {
    max-width: 860px;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    padding: 16px;
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.stat strong {
    display: block;
    font-size: 28px;
    margin-top: 6px;
}

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

.form-grid .full,
.form-grid h2,
.form-grid p,
.form-grid button {
    grid-column: 1 / -1;
}

.form-grid.wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-stack {
    display: grid;
    gap: 14px;
}

.inline-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 8px;
    align-items: end;
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    background: #fff;
}

.alert.success,
.check-row.ok {
    border-color: #94d3b8;
    background: #ecfdf3;
    color: #05603a;
}

.alert.danger,
.check-row.fail {
    border-color: #f5b69a;
    background: #fff4ed;
    color: #9a3412;
}

.wizard {
    display: grid;
    grid-template-columns: 310px 1fr;
    gap: 18px;
}

.wizard-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.wizard-steps a {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    gap: 8px;
    padding: 9px;
    border-radius: 8px;
    color: var(--text);
}

.wizard-steps span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--surface-2);
}

.wizard-steps .active a {
    background: #e8f3fb;
    color: var(--brand-dark);
}

.wizard-steps .done span {
    background: var(--accent);
    color: #fff;
}

.installer,
.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.installer-shell,
.auth-card {
    width: min(920px, 100%);
}

.installer-card,
.auth-card {
    padding: 26px;
}

.auth-card {
    max-width: 430px;
}

.auth-brand {
    color: var(--text);
}

.check-list {
    display: grid;
    gap: 10px;
}

.check-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.check-row small {
    grid-column: 1 / -1;
    color: var(--muted);
    word-break: break-word;
}

.public-site {
    background: #fbfcfe;
}

.public-page {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 22px;
}

.breadcrumbs {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.public-content {
    min-width: 0;
}

.public-content h1 {
    font-size: 38px;
    line-height: 1.1;
    margin: 0 0 16px;
}

.public-content h2 {
    margin-top: 28px;
}

.lead-box {
    padding: 18px;
    align-self: start;
    position: sticky;
    top: 18px;
}

.details-list {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.details-list dt {
    color: var(--muted);
}

.details-list dd {
    margin: 0;
}

.honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.message-page {
    width: min(620px, calc(100% - 32px));
    margin: 8vh auto;
    padding: 24px;
}

.log-view {
    max-height: 460px;
    overflow: auto;
    white-space: pre-wrap;
    background: #101828;
    color: #e4e7ec;
    padding: 14px;
    border-radius: 8px;
}

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

@media (max-width: 1100px) {
    .app-shell,
    .wizard,
    .public-page {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
    }

    .nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .lead-box {
        position: static;
    }
}

@media (max-width: 760px) {
    .main {
        padding: 16px;
    }

    .topbar,
    .page-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .grid.two,
    .form-grid,
    .form-grid.wide {
        grid-template-columns: 1fr;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .public-content h1 {
        font-size: 30px;
    }

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

@media (max-width: 520px) {
    .nav,
    .stat-grid {
        grid-template-columns: 1fr;
    }

    th,
    td {
        padding: 9px;
    }
}

