:root {
    color-scheme: light;
    font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    --title: #0f6cbd;
    --title-dark: #0b5798;
    --accent: #0f6cbd;
    --accent-soft: #e9f3fb;
    --canvas: #f3f4f6;
    --surface: #ffffff;
    --surface-muted: #f8f9fb;
    --border: #d8dce3;
    --border-strong: #c6cad2;
    --text: #1b1b1f;
    --muted: #616672;
    --success: #107c10;
    --danger: #c42b1c;
    --title-height: 48px;
    --status-height: 26px;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    color: var(--text);
    background: var(--canvas);
}

button,
input {
    font: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Shared unauthenticated desktop shell */
.auth-page {
    overflow: hidden;
}

.auth-desktop {
    display: grid;
    grid-template-rows: var(--title-height) minmax(0, 1fr) var(--status-height);
    width: 100%;
    height: 100vh;
    min-height: 520px;
}

.auth-title-bar {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
    align-items: center;
    color: #fff;
    background: linear-gradient(90deg, var(--title-dark), var(--title));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24);
}

.auth-app-identity {
    align-self: stretch;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 0 16px;
}

.auth-app-logo {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.auth-app-logo img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

.auth-app-identity strong,
.auth-app-identity small {
    display: block;
    white-space: nowrap;
}

.auth-app-identity strong {
    font-size: 14px;
}

.auth-app-identity small {
    color: rgba(255, 255, 255, 0.72);
    font-size: 10px;
}

.auth-title-context {
    font-size: 13px;
    font-weight: 600;
}

.auth-security-state {
    justify-self: end;
    padding: 0 16px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 10px;
}

.auth-security-state span {
    margin-right: 5px;
    color: #6ccb5f;
}

.auth-workspace {
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: 32px 20px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.72), rgba(243, 244, 246, 0.86)),
        repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(15, 108, 189, 0.035) 32px),
        repeating-linear-gradient(90deg, transparent 0, transparent 31px, rgba(15, 108, 189, 0.035) 32px);
}

.auth-window {
    width: min(100%, 470px);
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--surface);
    box-shadow: 0 12px 35px rgba(20, 35, 50, 0.17);
}

.auth-window-title {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    border-radius: 3px 3px 0 0;
    background: var(--surface-muted);
    color: #44484f;
    font-size: 11px;
}

.auth-window-title span {
    color: var(--accent);
}

.auth-window-title strong {
    font-weight: 600;
}

.auth-window-body {
    padding: 26px 28px 24px;
}

.auth-heading {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin-bottom: 20px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 4px;
    color: #fff;
    background: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.service-desk-brand-mark {
    overflow: hidden;
    padding: 0;
    background: transparent;
}

.service-desk-brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 5px;
    font-size: 21px;
    font-weight: 600;
}

.intro {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.field-group {
    margin-top: 14px;
}

.field-group label,
.form-grid label {
    display: block;
    margin: 0 0 5px;
    color: #363a41;
    font-size: 11px;
    font-weight: 600;
}

.field-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.field-label-row label {
    margin-bottom: 5px;
}

input {
    width: 100%;
    height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    background: #fff;
    color: var(--text);
}

input:hover {
    border-color: #9ca3ad;
}

input:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.text-link {
    color: var(--accent);
    font-size: 11px;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

.message {
    min-height: 18px;
    margin: 13px 0 0;
    color: var(--danger);
    font-size: 11px;
    line-height: 1.4;
}

.message.success {
    color: var(--success);
}

.auth-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e7e9ed;
}

.access-note {
    margin-right: auto;
    color: var(--muted);
    font-size: 10px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    min-height: 32px;
    padding: 6px 13px;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    background: #fff;
    color: var(--text);
    font-size: 11px;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    border-color: #9ca3ad;
    background: #f6f6f6;
}

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

.button-primary:hover {
    border-color: var(--title-dark);
    background: var(--title-dark);
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.auth-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    border-top: 1px solid var(--border-strong);
    background: #f7f7f8;
    color: #60656e;
    font-size: 10px;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 4px;
    border-radius: 50%;
    background: #8a8f98;
}

.status-dot.online {
    background: #16a34a;
}

/* The one-time installer reuses the same control standard. */
.install-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px 20px;
    background: var(--canvas);
}

.install-card {
    width: min(100%, 880px);
    padding: 26px 28px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 12px 35px rgba(20, 35, 50, 0.14);
}

.install-card > .brand-mark {
    margin-bottom: 12px;
}

.install-card > .eyebrow {
    margin-top: 0;
}

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

.form-grid label {
    margin-top: 4px;
}

.install-card button[type="submit"] {
    margin-top: 20px;
}

.security-note {
    margin: 18px 0 0;
    padding: 9px 11px;
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    color: #49515b;
    font-size: 11px;
    line-height: 1.5;
}

/* Guided v1.0 installation wizard */
.installer-page { overflow: auto; }
.installer-header { display:flex; gap:14px; align-items:center; padding-bottom:18px; border-bottom:1px solid var(--border); }
.installer-header .brand-mark { flex:0 0 auto; }
.installer-steps { display:grid; grid-template-columns:repeat(5,1fr); gap:0; margin:22px 0 26px; padding:0; list-style:none; border:1px solid var(--border); border-radius:4px; overflow:hidden; }
.installer-steps li { display:flex; align-items:center; justify-content:center; gap:7px; min-height:42px; padding:8px; border-right:1px solid var(--border); background:var(--surface-muted); color:var(--muted); font-size:11px; font-weight:600; }
.installer-steps li:last-child { border-right:0; }
.installer-steps li span { display:grid; place-items:center; width:21px; height:21px; border:1px solid var(--border-strong); border-radius:50%; background:#fff; font-size:10px; }
.installer-steps li.active { color:var(--accent); background:var(--accent-soft); }
.installer-steps li.active span { border-color:var(--accent); color:#fff; background:var(--accent); }
.installer-steps li.done { color:var(--success); }
.installer-steps li.done span { border-color:var(--success); color:#fff; background:var(--success); }
.installer-panel { display:none; min-height:330px; }
.installer-panel.active { display:block; }
.installer-panel h2 { margin:0 0 6px; font-size:17px; font-weight:600; }
.installer-panel .form-grid { margin-top:20px; }
.form-grid .span-2 { grid-column:1 / -1; }
.check-list { margin-top:20px; border:1px solid var(--border); border-radius:4px; overflow:hidden; }
.check-row { display:grid; grid-template-columns:72px 1fr; gap:12px; align-items:center; min-height:58px; padding:10px 13px; border-bottom:1px solid var(--border); }
.check-row:last-child { border-bottom:0; }
.check-row strong,.check-row small { display:block; }
.check-row small { margin-top:2px; color:var(--muted); font-size:10px; }
.check-state { padding:4px 6px; border-radius:3px; background:#eceff3; color:var(--muted); font-size:10px; font-weight:700; text-align:center; }
.check-row.ok .check-state { background:#e9f5e9; color:var(--success); }
.check-row.failed .check-state { background:#fdecea; color:var(--danger); }
.installer-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:20px; padding-top:15px; border-top:1px solid var(--border); }
.install-summary { margin-top:20px; border:1px solid var(--border); border-radius:4px; }
.install-summary dl { margin:0; }
.install-summary dl div { display:grid; grid-template-columns:180px 1fr; gap:12px; padding:9px 12px; border-bottom:1px solid var(--border); }
.install-summary dl div:last-child { border-bottom:0; }
.install-summary dt { color:var(--muted); font-size:11px; }
.install-summary dd { margin:0; font-size:11px; font-weight:600; overflow-wrap:anywhere; }
.install-progress,.install-complete { margin-top:20px; padding:18px; border:1px solid var(--border); border-radius:4px; background:var(--surface-muted); }
.install-progress { display:flex; gap:13px; align-items:center; }
.install-progress[hidden],.install-complete[hidden] { display:none; }
.install-progress strong,.install-progress small { display:block; }
.install-progress small { margin-top:3px; color:var(--muted); font-size:10px; }
.spinner { width:24px; height:24px; border:3px solid #d6dbe2; border-top-color:var(--accent); border-radius:50%; animation:installer-spin .8s linear infinite; }
.install-complete { border-color:#a9d5a9; background:#f1faf1; }
.install-complete strong { color:var(--success); font-size:15px; }
.install-complete p { margin:5px 0 14px; color:var(--muted); }
@keyframes installer-spin { to { transform:rotate(360deg); } }

@media (max-width: 700px) {
    .auth-title-bar {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .auth-title-context {
        display: none;
    }

    .auth-security-state {
        padding-left: 6px;
    }

    .auth-workspace {
        place-items: start center;
        padding: 20px 12px;
    }

    .auth-window-body {
        padding: 22px 20px 20px;
    }

    .auth-heading {
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 11px;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
    }

    .access-note {
        display: none;
    }

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

    .install-card {
        padding: 22px 20px;
    }
}
