:root {
    color-scheme: dark;

    --background: #10151e;
    --surface: #1e2735;
    --surface-alt: #151d29;
    --border: #344052;
    --text: #f0f4fa;
    --muted: #a8b4c5;

    --accent: #1769cf;
    --accent-text: #86baff;
    --on-accent: #ffffff;

    --success: #5bc99b;
    --warning: #f4ba65;
    --danger: #f87171;

    --radius: 14px;
    --nav-height: 72px;
    --header-height: 62px;

    font-family:
        system-ui, -apple-system,
        BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
    color-scheme: light;

    --background: #f5f7fa;
    --surface: #ffffff;
    --surface-alt: #edf2f7;
    --border: #cbd5e1;
    --text: #172033;
    --muted: #526175;

    --success: #14734e;
    --warning: #925500;
    --danger: #b91c1c;
}

:root[data-accent="blue"] {
    --accent: #1769cf;
    --accent-text: #86baff;
}

:root[data-accent="green"] {
    --accent: #147552;
    --accent-text: #72d8b1;
}

:root[data-accent="red"] {
    --accent: #bd3333;
    --accent-text: #ff9a9a;
}

:root[data-accent="neutral"] {
    --accent: #525b69;
    --accent-text: #c4cbd6;
}

:root[data-theme="light"][data-accent="blue"] {
    --accent-text: #1458ad;
}

:root[data-theme="light"][data-accent="green"] {
    --accent-text: #126647;
}

:root[data-theme="light"][data-accent="red"] {
    --accent-text: #a92525;
}

:root[data-theme="light"][data-accent="neutral"] {
    --accent-text: #465160;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-padding-top: 80px;
    scroll-padding-bottom: 100px;
}

body {
    margin: 0;
    min-height: 100dvh;
    background: var(--background);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

h1, h2, h3, p {
    margin: 0;
}

h1 {
    font-size: 25px;
    line-height: 1.25;
}

h2 {
    font-size: 19px;
}

h3 {
    font-size: 16px;
}

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

button {
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--surface-alt);
    color: var(--text);
    touch-action: manipulation;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--accent-text);
    outline-offset: 2px;
}

input, select, textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    padding: 12px;
    font-size: 16px;
}

label {
    display: block;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

form {
    display: grid;
    gap: 14px;
}

.primary {
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
}

.secondary {
    border: 1px solid var(--border);
    background: transparent;
}

.full {
    width: 100%;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.card {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: var(--radius);
}

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

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

.grow {
    flex: 1;
    min-width: 0;
}

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

.loading-screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 24px;
}

.brand-logo {
    width: 80px;
    height: 80px;
    display: block;
}

.auth-page {
    width: min(100%, 440px);
    min-height: 100dvh;
    margin: auto;
    padding: 24px 20px;
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
}

.auth-brand {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 12px;
    padding: 16px 0;
}

.auth-card {
    padding: 22px;
}

.password-row {
    display: flex;
    gap: 8px;
}

.password-row input {
    flex: 1;
    min-width: 0;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
}

.icon {
    width: 23px;
    height: 23px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.error {
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
}

.notice {
    color: var(--success);
    border: 1px solid var(--success);
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
}

[hidden] {
    display: none !important;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: var(--header-height);
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.header-brand img {
    width: 33px;
    height: 33px;
}

.app-main {
    padding: 16px;
    padding-bottom: calc(
        var(--nav-height) +
        env(safe-area-inset-bottom) + 24px
    );
    min-width: 0;
}

.bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    z-index: 30;
    inset: auto 0 0 0;
    min-height: var(--nav-height);
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 6px 4px;
    padding-bottom: calc(
        6px + env(safe-area-inset-bottom)
    );
}

.nav-button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 6px 2px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    border-radius: 8px;
}

.nav-button[aria-current="page"] {
    color: var(--accent-text);
    background: var(--surface-alt);
}

.kpi-value {
    display: block;
    font-weight: 750;
    font-size: 24px;
}

.tile {
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
}

details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

summary {
    cursor: pointer;
    min-height: 48px;
    padding: 14px;
    font-weight: 600;
}

.details-content {
    padding: 14px;
    border-top: 1px solid var(--border);
}

.danger-button {
    color: var(--danger);
    border: 1px solid var(--danger);
    background: transparent;
}

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

.status-warning {
    color: var(--warning);
}

.status-danger {
    color: var(--danger);
}

/* Package 3A - shared business screens */

.field {
    display: grid;
    gap: 6px;
}

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

.detail-row > strong {
    text-align: right;
    min-width: 0;
}

.accent-icon {
    display: flex;
    color: var(--accent-text);
}

.expand-card {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.expand-head {
    display: flex;
    align-items: stretch;
}

.expand-toggle {
    display: flex;
    align-items: center;
    text-align: left;
    gap: 10px;
    flex: 1;
    min-width: 0;
    background: transparent;
    border-radius: 0;
    padding: 14px;
}

.expand-indicator {
    color: var(--muted);
    font-size: 22px;
}

.row-label {
    display: grid;
    gap: 4px;
}

.row-value {
    font-weight: 700;
    text-align: right;
}

.detail-button {
    min-width: 50px;
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-left: 1px solid var(--border);
    border-radius: 0;
    color: var(--accent-text);
    background: transparent;
}

.expand-body {
    padding: 14px;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
}

.tile > .icon {
    color: var(--accent-text);
}

button.primary {
    min-height: 48px;
}

.progress-track {
    height: 7px;
    border-radius: 99px;
    background: var(--border);
    overflow: hidden;
}

.progress-track progress {
    width: 100%;
    height: 7px;
    display: block;
    accent-color: var(--accent);
}

textarea {
    resize: vertical;
}


input[type="checkbox"] {
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px;
    accent-color: var(--accent);
}


.role-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 76px;
}

.activation-code {
    user-select: text;
    font-family: monospace;
    font-size: 18px;
    overflow-wrap: anywhere;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-alt);
}

.tile:hover,
.expand-toggle:hover,
.detail-button:hover {
    background: var(--surface-alt);
}


.report-tile {
    display: grid;
    gap: 8px;
    text-align: left;
    min-height: 124px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: var(--radius);
}

.report-tile .kpi-value {
    color: var(--accent-text);
    font-size: 22px;
}

.report-bar {
    display: block;
    width: 100%;
    height: 9px;
    accent-color: var(--accent);
}


/* Package 3A - notifications */

.notification-button {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 19px;
    height: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border-radius: 99px;
    background: #b91c1c;
    color: #ffffff;
    font-size: 10px;
    font-weight: 750;
}

.notification-summary {
    display: flex;
    gap: 10px;
    align-items: center;
}

.notification-dot {
    display: block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent-text);
    flex-shrink: 0;
}

.notification-entry .stack {
    gap: 5px;
}


/* Package 3A - system and security */

.emergency-button {
    min-height: 54px;
    background: #b91c1c;
    color: #ffffff;
    font-weight: 750;
    border: 1px solid #b91c1c;
}

.emergency-button:hover {
    background: #991b1b;
}

.emergency-button:focus-visible {
    outline: 3px solid var(--danger);
    outline-offset: 3px;
}


/* Package 3A - personal appearance */

.theme-choice {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 68px;
    border: 2px solid var(--border);
    font-weight: 650;
}

.theme-light {
    background: #f5f7fa;
    color: #172033;
}

.theme-dark {
    background: #10151e;
    color: #f0f4fa;
}

.theme-choice[aria-pressed="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

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

.accent-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 2px;
    font-size: 12px;
    background: transparent;
}

.accent-swatch {
    display: block;
    width: 37px;
    height: 37px;
    border-radius: 50%;
}

.swatch-blue {
    background: #1769cf;
}

.swatch-green {
    background: #147552;
}

.swatch-red {
    background: #bd3333;
}

.swatch-neutral {
    background: #525b69;
}

.accent-choice[aria-pressed="true"] .accent-swatch {
    outline: 2px solid var(--text);
    outline-offset: 3px;
}

.accent-choice[aria-pressed="true"] .accent-swatch::after {
    content: "✓";
    color: white;
    line-height: 37px;
    font-size: 22px;
    font-weight: 700;
}


.bottom-nav {
    display: flex;
    align-items: stretch;
}

.bottom-nav .nav-button {
    flex: 1;
    min-width: 0;
}

