:root {
    color-scheme: light dark;
    --primary: #0284c7;
    --primary-hover: #0369a1;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    font-family: var(--font-family-base, "Cairo", system-ui, sans-serif);
}

body {
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
}

a {
    color: inherit;
}

.guest-body,
.app-body {
    min-height: 100vh;
}

.guest-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(100%, 430px);
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-panel h1,
.page-title {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.35;
}

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

.form-group {
    display: grid;
    gap: 8px;
    margin-block: 18px;
}

label {
    font-weight: 700;
}

input:not([type="checkbox"]):not([type="radio"]) {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: var(--surface-2, #fff);
    border: 1px solid var(--border);
    border-radius: 6px;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    min-height: 18px;
    max-height: 18px;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

input:focus {
    outline: 3px solid rgba(2, 132, 199, 0.25);
    border-color: var(--brand, #0284c7);
}

.field-error,
.alert-error {
    color: var(--danger);
}

.field-error {
    font-size: 14px;
}

.alert-error {
    padding: 12px;
    background: #fff1f0;
    border: 1px solid #fecdca;
    border-radius: 6px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    background: var(--primary);
    border: 0;
    border-radius: 6px;
}

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

.button-light {
    color: var(--text);
    background: var(--surface-muted);
}

.button-light:hover {
    background: #dde6f0;
}

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

.sidebar {
    padding: 24px;
    color: #fff;
    background: #1f2937;
}

.brand {
    margin-bottom: 28px;
}

.brand-name {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.brand-subtitle {
    margin: 6px 0 0;
    color: #cbd5e1;
    font-size: 14px;
}

.nav-list {
    display: grid;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.nav-link {
    display: block;
    padding: 11px 12px;
    color: #e5e7eb;
    text-decoration: none;
    border-radius: 6px;
}

.nav-link.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.main-column {
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.content {
    padding: 24px;
}

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

.status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.status-item {
    padding: 14px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
}

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

.status-value {
    display: block;
    margin-top: 4px;
    font-weight: 800;
}

.logout-form {
    margin: 0;
}

@media (max-width: 760px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 18px;
    }

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

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .content {
        padding: 18px;
    }

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