:root {
    --brand: #C8102E;
    --brand-dark: #9E0C24;
    --ink: #1D2127;
    --muted: #5B6472;
    --line: #E3E5E9;
    --bg: #F4F5F7;
}

html, body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; margin: 0; }
body { background: var(--bg); }

/* ---------- app shell ---------- */
.app-bar { box-shadow: 0 1px 0 rgba(0,0,0,.08) !important; }
.brand { cursor: pointer; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: #fff; color: var(--brand); font-weight: 800; display: grid; place-items: center; font-size: 20px; }
.brand-mark.big { width: 48px; height: 48px; background: var(--brand); color: #fff; font-size: 28px; border-radius: 12px; }
.brand-text { font-weight: 700 !important; letter-spacing: .2px; }
.brand-sub { font-weight: 400; opacity: .85; margin-left: 2px; }
.user-chip { cursor: pointer; padding: 2px 8px; border-radius: 8px; }
.user-chip:hover { background: rgba(255,255,255,.12); }
.user-text { line-height: 1.15; text-align: left; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; opacity: .85; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-btn { min-width: 0; }

.app-drawer { border-right: 1px solid var(--line); }
.nav-section { padding: 14px 16px 4px; color: var(--muted); letter-spacing: .08em; }
.nav-menu .mud-nav-link { border-radius: 8px; margin: 1px 8px; }
.nav-menu .mud-nav-link.active { background: rgba(200,16,46,.10); color: var(--brand); font-weight: 600; }
.nav-menu .mud-nav-link.active .mud-icon-root { color: var(--brand); }

.main-content { background: var(--bg); min-height: 100vh; }
.mud-theme-dark .main-content, .mud-theme-dark body { background: #14161A; }

/* ---------- common building blocks ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-weight: 700 !important; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 48px 16px; text-align: center; color: var(--muted); }

.kpi-card { border-radius: 12px; padding: 16px 18px; border: 1px solid var(--line); background: var(--mud-palette-surface); height: 100%; }
.kpi-card .kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi-card .kpi-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.kpi-card .kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-card.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.kpi-card.clickable:hover { box-shadow: 0 4px 14px rgba(0,0,0,.10); transform: translateY(-1px); }
.kpi-accent { border-left: 4px solid var(--brand); }
.kpi-ok { border-left: 4px solid #1E8E5A; }
.kpi-warn { border-left: 4px solid #E8A317; }
.kpi-bad { border-left: 4px solid #C62828; }

.mud-paper.card { border-radius: 12px; border: 1px solid var(--line); }
.mud-table-root .mud-table-head .mud-table-cell { font-weight: 600; color: var(--muted); }
.status-chip { font-weight: 600; }
.zone-green { color: #1E8E5A; } .zone-orange { color: #E8A317; } .zone-red { color: #C62828; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 24px; background: linear-gradient(160deg, #fff 0%, #f6e9ec 100%); }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 10px 40px rgba(200,16,46,.12); border: 1px solid #f0d8dd; }
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.login-title { font-size: 22px; font-weight: 700; color: var(--ink); }
.login-sub { font-size: 12.5px; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form label { font-size: 12px; color: var(--muted); margin-top: 8px; }
.login-form input { padding: 10px 12px; border: 1px solid #cfd3d9; border-radius: 8px; font-size: 15px; }
.login-form input:focus { outline: 2px solid rgba(200,16,46,.35); border-color: var(--brand); }
.btn-primary { margin-top: 16px; padding: 11px; background: var(--brand); color: #fff; border: 0; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: var(--brand-dark); }
.login-error { background: #fdeaea; color: #8a1c1c; padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-top: 8px; }
.login-lang { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.login-lang a { color: var(--brand); text-decoration: none; }
.demo-card { width: 100%; max-width: 1100px; background: #fff; border-radius: 16px; padding: 20px 24px; border: 1px solid #f0d8dd; }
.demo-title { font-weight: 700; color: var(--ink); }
.demo-hint { font-size: 12.5px; color: var(--muted); margin: 2px 0 14px; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.demo-user { width: 100%; text-align: left; display: flex; flex-direction: column; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.demo-user:hover { border-color: var(--brand); background: #fff7f8; }
.demo-name { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.demo-role { font-size: 12px; color: var(--brand); }
.demo-branch { font-size: 11px; color: var(--muted); }

/* ---------- documents / print ---------- */
.qr-img { image-rendering: pixelated; }

@media (max-width: 960px) {
    .user-text { display: none; }
}
