/* ==========================================================================
   HMS - Hospital Management System
   Design tokens, layout, components, welcome page, login page, responsive.
   No inline styles are used anywhere (Content-Security-Policy: style-src 'self').
   ========================================================================== */

:root {
    --primary: #0b7285;
    --primary-dark: #0a5566;
    --primary-soft: #e6f4f6;
    --accent: #12b886;
    --navy: #0b2545;
    --bg: #f3f6fa;
    --surface: #ffffff;
    --text: #1f2a37;
    --muted: #5b6b7f;
    --border: #e2e8f0;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #059669;
    --info: #2563eb;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(11, 37, 69, 0.08);
    --shadow-lg: 0 24px 60px rgba(11, 37, 69, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

h1, h2, h3 { color: var(--navy); line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--primary); }
code {
    background: #eef2f7;
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    font-size: 0.85em;
    font-family: Consolas, "Courier New", monospace;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 560px; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: -9999px; top: 0; background: var(--surface);
    padding: 0.5rem 1rem; z-index: 100; border-radius: 8px; box-shadow: var(--shadow);
}
.skip-link:focus { left: 1rem; top: 1rem; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.full { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- Brand --- */
.brand {
    display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none;
    font-weight: 700; color: var(--navy); font-size: 1.1rem;
}
.brand-mark {
    width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
    font-size: 1.4rem; line-height: 1; font-weight: 800;
}
.brand-light { color: #fff; }
.brand-light .brand-mark { background: #fff; color: var(--primary); }

/* ---------------------------------------------------------------- Buttons -- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.6rem 1.05rem; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    background: var(--surface); color: var(--text); transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef2f7; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-light { background: #fff; color: var(--navy); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.875rem; border-radius: 8px; }
.btn-lg { padding: 0.8rem 1.4rem; font-size: 1.05rem; border-radius: 12px; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }
.inline-form + .inline-form, .actions > * + * { margin-left: 0.35rem; }
/* ----------------------------------------------------------- Staff layout -- */
.topbar {
    position: sticky; top: 0; z-index: 50; background: var(--surface);
    border-bottom: 1px solid var(--border); box-shadow: 0 2px 10px rgba(11, 37, 69, 0.04);
}
.topbar-inner {
    max-width: 1280px; margin: 0 auto; padding: 0.6rem 16px;
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.main-nav { display: flex; flex-wrap: wrap; gap: 0.2rem; flex: 1; }
.main-nav a {
    padding: 0.45rem 0.7rem; border-radius: 9px; color: var(--muted);
    text-decoration: none; font-weight: 600; font-size: 0.92rem;
}
.main-nav a:hover { background: #eef2f7; color: var(--text); }
.main-nav a.active { background: var(--primary-soft); color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.user-chip { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user-chip strong { color: var(--navy); font-size: 0.9rem; }
.user-chip span { color: var(--muted); font-size: 0.78rem; }
.nav-toggle {
    display: none; background: var(--primary-soft); color: var(--primary); border: 0;
    border-radius: 9px; padding: 0.45rem 0.8rem; font: inherit; font-weight: 600; cursor: pointer;
}

main#content { min-height: 60vh; padding-bottom: 2rem; }
main.container { padding-top: 0.5rem; }

.lang-switch {
    display: inline-flex; background: #eef2f7; border-radius: 999px; padding: 3px; gap: 2px;
}
.lang-switch a {
    padding: 0.25rem 0.7rem; border-radius: 999px; text-decoration: none;
    color: var(--muted); font-weight: 700; font-size: 0.8rem;
}
.lang-switch a.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

.site-footer { border-top: 1px solid var(--border); padding: 1.1rem 0; color: var(--muted); font-size: 0.875rem; background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }

/* -------------------------------------------------------------- Page parts -- */
.page-head {
    display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap;
    gap: 1rem; margin: 1.5rem 0 1rem;
}
.page-head h1 { margin-bottom: 0.2rem; }
.page-head p { margin: 0; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.eyebrow {
    text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.74rem;
    color: var(--primary); font-weight: 700; margin: 0 0 0.3rem;
}
.toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 0.5rem 0 1rem; }
.toolbar input[type="search"], .toolbar select, .toolbar input[type="date"] {
    padding: 0.5rem 0.75rem; min-width: 200px;
}
.inline-field { display: inline-flex; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 1.25rem; margin: 1rem 0;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.card > h2:first-child { margin-top: 0; }

.alert {
    padding: 0.8rem 1rem; border-radius: 10px; margin: 0.75rem 0; border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.badge {
    display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
    font-size: 0.74rem; font-weight: 700; white-space: nowrap; vertical-align: middle;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-neutral { background: #e2e8f0; color: #334155; }

/* Stat tiles on the dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; margin: 1rem 0; }
.stat {
    display: flex; flex-direction: column; gap: 0.3rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem;
    text-decoration: none; color: inherit; box-shadow: var(--shadow); border-left: 4px solid var(--primary);
}
a.stat:hover { border-color: var(--primary); }
.stat-label { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.stat-value { font-size: 1.8rem; color: var(--navy); line-height: 1.1; }
.stat-alert { border-left-color: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.data th, table.data td { padding: 0.65rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: #f8fafc; }
table.data tbody tr:hover { background: #f8fbfd; }
table.data tfoot th, table.data tfoot td { border-bottom: 0; }
table.data tfoot th { text-transform: none; color: var(--text); background: transparent; font-size: 0.93rem; }
table.data .empty { text-align: center; color: var(--muted); padding: 2rem; }
table.data .actions { white-space: nowrap; }
table.data .actions form { margin: 0.15rem 0; }
.item-table input { width: 100%; padding: 0.45rem 0.55rem; }
.table-wrap.full, .full .table-wrap { grid-column: 1 / -1; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 1.1rem; align-items: start; }
/* Dropdowns inside table action cells take only the width they need */
.compact-actions select { width: auto; min-width: 8rem; max-width: 14rem; padding: 0.35rem 0.5rem; }
.form-grid h2 { grid-column: 1 / -1; margin: 0.8rem 0 0; padding-top: 0.6rem; border-top: 1px solid var(--border); font-size: 1.02rem; }
.form-grid h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-note { margin: 0; }
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.field.field-full { grid-column: 1 / -1; }
.field-label { font-weight: 600; font-size: 0.9rem; color: var(--navy); }
.req { color: var(--danger); }
.help { color: var(--muted); font-size: 0.8rem; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    font: inherit; width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #cbd5e1;
    border-radius: 10px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid rgba(18, 184, 134, 0.25); outline-offset: 0; }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.93rem; grid-column: 1 / -1; }
.form-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-top: 0.4rem; }
.form-actions.full { grid-column: 1 / -1; }
.inline-details { margin: 0.75rem 0; }
.inline-details > summary {
    cursor: pointer; color: var(--primary); font-weight: 700; list-style: none; display: inline-block;
    padding: 0.4rem 0.8rem; background: var(--primary-soft); border-radius: 9px;
}
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details[open] > summary { margin-bottom: 0.9rem; }
.inline-details form { padding-top: 0.2rem; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.split > .card { margin: 1rem 0; }
.split > .form-grid { align-content: start; }
.split .card .split { gap: 1rem; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1rem; margin: 0; }
.details dt { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.details dd { margin: 0; }

.timeline-item { border-top: 1px solid var(--border); padding: 0.9rem 0; }
.timeline-item:first-of-type { border-top: 0; }
.timeline-item header { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.35rem; }
.vitals span { display: inline-block; margin-right: 1rem; color: var(--muted); }
.plain-list { padding-left: 1.1rem; margin: 0; }
.plain-list li { margin: 0.4rem 0; }
.quick-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.tabs {
    display: flex; gap: 0.2rem; flex-wrap: wrap; border-bottom: 1px solid var(--border);
    margin: 0.5rem 0 1rem;
}
.tabs a {
    padding: 0.55rem 0.9rem; color: var(--muted); text-decoration: none; font-weight: 600;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.card .tabs { border-bottom: 0; margin: 0; }

/* Error page */
.page-error .card { margin-top: 3rem; text-align: center; }

/* ================================================================ Auth page -- */
body.page-auth { background: var(--bg); }
.auth-page { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-brand {
    background:
        radial-gradient(circle at 20% 20%, rgba(18, 184, 134, 0.35), transparent 45%),
        linear-gradient(150deg, var(--navy) 0%, var(--primary) 100%);
    color: #e6f4f6; padding: 3rem clamp(1.5rem, 5vw, 4.5rem);
    display: flex; flex-direction: column; justify-content: center; gap: 1rem;
}
.auth-brand h2 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.15; margin: 1rem 0 0.4rem; }
.auth-brand p { font-size: 1.05rem; opacity: 0.92; max-width: 34rem; }
.auth-points { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.6rem; }
.auth-points li {
    padding: 0.6rem 0.9rem 0.6rem 2.2rem; background: rgba(255, 255, 255, 0.08); border-radius: 10px;
    position: relative; font-size: 0.95rem;
}
.auth-points li::before {
    content: ""; position: absolute; left: 0.85rem; top: 50%; width: 8px; height: 8px;
    margin-top: -4px; border-radius: 50%; background: var(--accent);
}
.auth-card {
    background: var(--surface); padding: 2.2rem clamp(1.4rem, 4vw, 3rem);
    display: flex; flex-direction: column; justify-content: center; max-width: 520px; width: 100%; margin: 0 auto;
}
.auth-card h1 { font-size: 1.7rem; margin-top: 1.25rem; }
.auth-card-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.link-muted { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.login-form { display: grid; gap: 1rem; margin-top: 1.25rem; }
.login-form .field input { padding: 0.75rem 0.9rem; font-size: 1rem; }
.login-note { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* =============================================================== Welcome page -- */
body.page-welcome { background: var(--surface); }
.site-header {
    position: sticky; top: 0; z-index: 60; background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.75rem; padding-bottom: 0.75rem; flex-wrap: wrap; }
.site-nav { display: flex; gap: 0.25rem; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; padding: 0.4rem 0.7rem; border-radius: 9px; }
.site-nav a:hover { background: #eef2f7; color: var(--text); }
.site-header-actions { display: flex; align-items: center; gap: 0.75rem; }

.hero {
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(18, 184, 134, 0.18), transparent 60%),
        radial-gradient(800px 500px at -10% 10%, rgba(11, 114, 133, 0.16), transparent 60%),
        linear-gradient(180deg, #f7fbfd 0%, #ffffff 100%);
    padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem);
}
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center; }
.hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); line-height: 1.08; letter-spacing: -0.02em; margin-bottom: 1rem; }
.lead { font-size: clamp(1.02rem, 1.6vw, 1.2rem); color: var(--muted); max-width: 36rem; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1.5rem 0; }
.hero-actions .btn-outline { background: #fff; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li {
    padding: 0.35rem 0.8rem; background: #fff; border: 1px solid var(--border);
    border-radius: 999px; font-size: 0.85rem; color: var(--navy); font-weight: 600;
}

.preview-card {
    background: #fff; border: 1px solid var(--border); border-radius: 18px;
    box-shadow: var(--shadow-lg); padding: 1.2rem;
}
.preview-head { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.6rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-red { background: #f87171; }
.dot-amber { background: #fbbf24; }
.dot-green { background: #34d399; }
.preview-title { margin-left: 0.5rem; font-weight: 700; color: var(--navy); font-size: 0.95rem; }
.preview-note { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.9rem; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 0.9rem; }
.tile { background: var(--primary-soft); border-radius: 12px; padding: 0.8rem; }
.tile-label { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 1.5rem; color: var(--navy); }
.preview-list { list-style: none; padding: 0; margin: 0; }
.preview-list li {
    display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.6rem 0;
    border-top: 1px solid var(--border); font-size: 0.92rem;
}
.preview-list li span:first-child { font-weight: 700; color: var(--primary); min-width: 3.2rem; }
.preview-list .badge { margin-left: auto; }

.strip { background: var(--navy); color: #fff; padding: 1.6rem 0; }
.strip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; text-align: center; }
.strip strong { display: block; font-size: 2rem; line-height: 1.1; }
.strip span { font-size: 0.9rem; opacity: 0.8; }

.section { padding: clamp(3rem, 6vw, 5rem) 0; }
.section-alt { background: #f7fafc; }
.section-head { max-width: 720px; margin: 0 auto 2.2rem; text-align: center; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 0.6rem; }
.section-head p { margin: 0 auto; }

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 1rem; }
.module-card {
    background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem;
    display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.module-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #b9dfe6; }
.module-card.planned { background: #fbfcfd; }
.module-card.planned h3 { color: #475569; }
.module-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.7rem; }
.module-icon { font-size: 1.8rem; line-height: 1; }
.module-card p { color: var(--muted); font-size: 0.92rem; margin-bottom: 0.9rem; }
.module-link { margin-top: auto; font-weight: 700; text-decoration: none; }

.lang-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.lang-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 1.5rem; box-shadow: var(--shadow); }
.lang-label { color: var(--primary); font-weight: 800; text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.08em; margin-bottom: 0.2rem; }
.lang-card dl { display: grid; grid-template-columns: 1fr auto; gap: 0.55rem 1rem; margin: 1rem 0; }
.lang-card dt { color: var(--muted); }
.lang-card dd { margin: 0; font-weight: 800; color: var(--navy); text-align: right; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.feature { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 1.2rem; }
.feature h3 { font-size: 1rem; }
.feature p { color: var(--muted); font-size: 0.92rem; margin: 0; }
.disclaimer {
    margin: 1.5rem 0 0; padding: 1rem 1.1rem; background: #fff7ed; border-left: 4px solid var(--warning);
    border-radius: 10px; font-size: 0.92rem; color: #7c2d12;
}

.cta-band {
    background: linear-gradient(120deg, var(--navy) 0%, var(--primary) 100%); color: #fff; padding: 3rem 0;
}
.cta-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.cta-band h2 { color: #fff; font-size: 1.8rem; margin-bottom: 0.3rem; }
.cta-band p { margin: 0; opacity: 0.9; }

/* ============================================================ Printed documents -- */
.print-sheet { max-width: 820px; margin: 0 auto; padding: 2rem; }
.print-head { border-bottom: 2px solid var(--primary); padding-bottom: 0.6rem; margin-bottom: 1rem; }
.document-body { white-space: normal; font-size: 1.02rem; margin: 1.5rem 0 2.5rem; }
.signature { margin-top: 3rem; border-top: 1px solid var(--border); padding-top: 1rem; }

@media print {
    .topbar, .site-footer, .no-print, .skip-link, .alert { display: none !important; }
    body { background: #fff; }
    main#content, .container { max-width: none; padding: 0; }
    .card { box-shadow: none; border: 0; }
}

/* ================================================================ Staff sidebar -- */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
    width: 252px; flex: 0 0 252px; background: var(--surface); border-right: 1px solid var(--border);
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 0.9rem; padding: 1rem 0.9rem;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0 0.3rem; }
.sidebar .main-nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.sidebar .main-nav a {
    display: block; padding: 0.55rem 0.75rem; border-radius: 9px; color: var(--muted);
    text-decoration: none; font-weight: 600; font-size: 0.93rem;
}
.sidebar .main-nav a:hover { background: #eef2f7; color: var(--text); }
.sidebar .main-nav a.active { background: var(--primary-soft); color: var(--primary); }
.app-topbar {
    display: flex; justify-content: flex-end; align-items: center;
    padding: 0.7rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.app-topbar .topbar-right { width: auto; justify-content: flex-end; }
.app-topbar .user-chip { text-align: right; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-main main.container { flex: 1; width: 100%; max-width: none; margin: 0; padding: 0.5rem 1.25rem 0; }
.app-main .site-footer { margin-top: auto; }

@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    .sidebar { position: static; width: 100%; flex: none; height: auto; overflow: visible; padding: 0.7rem 0.8rem; gap: 0.6rem; }
    .sidebar .main-nav { display: none; }
    .sidebar .main-nav.open { display: flex; padding-top: 0.4rem; }
    .sidebar .nav-toggle { display: inline-flex; }
}

/* ==================================================================== Responsive -- */
@media (max-width: 1000px) {
    .module-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 900px) {
    .nav-toggle { display: inline-flex; }
    .main-nav { display: none; width: 100%; flex-direction: column; padding-top: 0.4rem; }
    .main-nav.open { display: flex; }
    .main-nav a { padding: 0.65rem 0.8rem; }
    .topbar-right { width: 100%; justify-content: space-between; }
    .user-chip { text-align: left; }

    .hero-grid, .split, .lang-compare, .auth-page { grid-template-columns: 1fr; }
    .auth-page { min-height: 0; }
    .auth-brand { padding: 2rem 1.25rem; }
    .auth-card { padding: 1.8rem 1.25rem; max-width: none; }
    .site-nav { display: none; }
    .strip-grid { grid-template-columns: repeat(2, 1fr); }
    .cta-inner { text-align: center; justify-content: center; }
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .toolbar input[type="search"], .toolbar select, .toolbar input[type="date"] { min-width: 0; width: 100%; }
    .inline-field { width: 100%; }
    .tiles { grid-template-columns: 1fr; }
    .details { grid-template-columns: 1fr; gap: 0.1rem; }
    .details dd { margin-bottom: 0.6rem; }
    .site-footer .footer-inner { flex-direction: column; }
    .hero-actions .btn { width: 100%; }
    .stat-value { font-size: 1.5rem; }
    .brand-name { font-size: 1rem; }
    .lang-card dl { grid-template-columns: 1fr auto; }
}
