:root {
    --bg: #0f1419;
    --bg-card: #1a2332;
    --bg-hover: #243044;
    --border: #2d3a4f;
    --text: #e8edf4;
    --text-muted: #8b9cb3;
    --accent: #3b9eff;
    --accent-hover: #2d8ae8;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --radius: 10px;
    --sidebar-w: 240px;
    --panel-bg: linear-gradient(to bottom left, var(--bg-card), color-mix(in srgb, var(--bg-card) 68%, #070b10));
}
html { color-scheme: dark; }
html[data-theme="light"] {
    color-scheme: light;
    --bg: #f3f5f8;
    --bg-card: #ffffff;
    --bg-hover: #e8eef5;
    --border: #d4dde8;
    --text: #1a2332;
    --text-muted: #5a6b80;
    --accent: #1d7ad9;
    --accent-hover: #1566b8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --panel-bg: linear-gradient(to bottom left, var(--bg-card), color-mix(in srgb, var(--bg-card) 86%, #8b9cb3));
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 0 0;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; gap: 8px; padding: 0 24px 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sidebar-brand-mark { width: 40px; height: 40px; flex: 0 0 auto; display: block; }
.sidebar-brand h1 { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.sidebar-brand span, .auth-intro span { display: block; font-size: 0.75rem; color: var(--text-muted); }
.sidebar-nav { flex: 1; overflow-y: auto; }
.sidebar nav a, .sidebar-nav a {
    display: flex;
    padding: 10px 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: var(--bg-hover);
    color: var(--text);
    border-left: 3px solid var(--accent);
    padding-left: 21px;
}
.sidebar-footer { margin-top: auto; padding: 16px 16px 20px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.sidebar-user:hover, .sidebar-user.active { background: var(--bg-hover); color: var(--text); }
.sidebar-user.active { box-shadow: inset 3px 0 0 var(--accent); }
.avatar-frame {
    display: block; box-sizing: border-box; border-radius: 50%; overflow: hidden;
    position: relative; flex-shrink: 0; background: var(--bg);
}
.avatar-frame img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; user-select: none; }
.avatar-frame img.is-positioned {
    object-position: var(--ax, 50%) var(--ay, 50%);
    transform: scale(var(--az, 1));
    transform-origin: var(--ax, 50%) var(--ay, 50%);
}
.sidebar-avatar { width: 40px; height: 40px; border: 2px solid var(--border); }
.avatar-initials { display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; }
.sidebar-user-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; }
.sidebar-user-link-label, .sidebar-logout { font-size: 0.75rem; color: var(--text-muted); }
.sidebar-logout { display: block; margin-top: 8px; padding: 8px 12px; font-size: 0.85rem; border-radius: 8px; }
.sidebar-logout:hover { background: var(--bg-hover); color: var(--text); }
.main { margin-left: var(--sidebar-w); padding: 32px 40px; width: calc(100% - var(--sidebar-w)); max-width: 1400px; }
.main-full { max-width: none; }
.page-header { margin-bottom: 24px; }
.page-header h2, .print-main h1 { font-size: 1.5rem; font-weight: 600; }
.page-header p, .muted { color: var(--text-muted); margin-top: 4px; }
.page-header-with-actions, .page-header-actions, .filters, .form-row, .inline-form, .split {
    display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap;
}
.page-header-with-actions { justify-content: space-between; }
.page-header-with-actions > div:first-child { flex: 1; min-width: 240px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.orders-table { width: 100%; table-layout: fixed; }
.orders-table th, .orders-table td { white-space: normal; vertical-align: top; padding: 10px 8px; }
.orders-table td.wrap { overflow-wrap: anywhere; }
.orders-actions { text-align: right; }
.order-dialog { width: min(920px, calc(100vw - 32px)); }
.order-details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.detail-row { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.detail-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.detail-value { font-size: 0.95rem; line-height: 1.45; white-space: normal; }
.modal-section-title { margin: 22px 0 10px; font-size: 1rem; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: normal; }
.order-items-table { width: 100%; }
.order-items-table th, .order-items-table td { white-space: normal; }
@media (max-width: 720px) { .order-details-grid { grid-template-columns: 1fr; } }
.orders-table .muted { display: block; font-size: 0.8rem; }
.nowrap { white-space: nowrap; }

.howapply-date { position: relative; display: inline-block; width: 220px; max-width: 100%; vertical-align: middle; }
.form-group .howapply-date { display: block; width: 100%; }
.howapply-date .form-control { width: 100%; padding-right: 40px; cursor: text; }
.howapply-date-open {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 28px;
    height: 28px;
    transform: translateY(-50%);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%238b9cb3' stroke-width='1.6'><rect x='2.5' y='3.5' width='13' height='12' rx='1.5'/><path d='M2.5 7.5h13M6 2.5v3M12 2.5v3'/></svg>") center no-repeat;
    cursor: pointer;
}
.howapply-date-open:hover { background-color: var(--bg-hover); }
.howapply-date-pop {
    position: fixed;
    z-index: 80;
    width: 300px;
    padding: 10px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
    color: #212529;
}
.howapply-date-pop[hidden] { display: none; }
.howapply-date-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0 0 8px; color: #00334a; font-weight: 700; }
.howapply-date-month, .howapply-date-year { height: 32px; margin: 0; padding: 0 4px; border: 1px solid #dee2e6; border-radius: 6px; background: #fff; color: #212529; font: inherit; font-weight: 600; }
.howapply-date-month { flex: 1; }
.howapply-date-year { width: 78px; }
.howapply-date-nav, .howapply-date-day { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; color: #212529; font: inherit; line-height: 32px; cursor: pointer; }
.howapply-date-nav { width: 32px; height: 32px; border-radius: 6px; font-size: 1.2rem; }
.howapply-date-nav:hover, .howapply-date-day:hover { background: #f4f8fa; }
.howapply-date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.howapply-date-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.howapply-date-months .howapply-date-day { height: 36px; line-height: 36px; font-size: 0.82rem; text-transform: capitalize; }
.howapply-date-dow { padding: 4px 0; color: #6c757d; font-size: .75rem; }
.howapply-date-day { height: 32px; border-radius: 6px; }
.howapply-date-day.is-today { box-shadow: inset 0 0 0 1px #00334a; }
.howapply-date-day.is-selected, .howapply-date-day.is-selected:hover { background: #f08008; color: #fff; }

.users-card { padding: 8px 0; }
.users-table-wrap { overflow-x: auto; }
.users-table { min-width: 720px; }
.users-table th { letter-spacing: 0.04em; font-size: 0.75rem; }
.users-table td { vertical-align: middle; }
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover td { background: var(--bg-hover); }
.users-table th:first-child, .users-table td:first-child { padding-left: 20px; }
.users-table th:last-child, .users-table td:last-child { width: 1%; text-align: right; padding-right: 20px; white-space: nowrap; }
.users-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.users-avatar {
    width: 36px; height: 36px; border: 0; background: var(--bg-hover);
    color: var(--text); font-size: 0.72rem; font-weight: 700;
}
.users-person-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.users-person-name-row { display: flex; align-items: center; gap: 8px; }
.users-person-name { font-weight: 600; }
.users-person-email { font-size: 0.8rem; color: var(--text-muted); }
.users-login { white-space: nowrap; color: var(--text-muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.users-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.users-actions form { display: inline-flex; margin: 0; }
.card-hint { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.hub-dialog.order-dialog { width: min(920px, calc(100vw - 32px)); }
.bol-table td, .bol-table th { font-size: 0.82rem; }
.bol-table .btn-sm { width: 100%; padding: 0 4px; box-sizing: border-box; }
.bol-detail td { background: var(--bg-hover); }
.bol-detail .order-items-table { width: 100%; margin-top: 8px; }
.card .subtle { margin-top: 12px; color: var(--text-muted); font-size: 0.85rem; }
.filters label { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }
.filters .btn { align-self: end; }
.hub-dialog {
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    margin: auto;
    padding: 20px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel-bg);
    color: var(--text);
}
.hub-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.hub-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.hub-dialog-head h3 { margin: 0 0 4px; font-size: 1.05rem; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: normal; }
.hub-dialog-actions { display: flex; justify-content: flex-end; }
.password-field { display: flex; flex-direction: column; gap: 10px; }
.password-actions { display: flex; align-items: center; gap: 12px; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.card h3 {
    font-size: 1rem; margin-bottom: 16px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.statement-block + .statement-block { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.statement-block h3 { margin: 0 0 4px; font-size: 0.75rem; }
.statement-block tr:last-child td { border-bottom: 0; }
.line-hint { margin-left: 8px; color: var(--text-muted); font-size: 0.75rem; font-weight: 500; }
.statement-posts {
    display: block;
    margin: 4px 0 0 auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}
.statement-posts:hover { text-decoration: underline; }
.statement-note { margin-top: 16px; }
.stat { text-align: center; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.kpi-list { list-style: none; margin-top: 16px; }
.kpi-list li { padding: 6px 0; font-size: 0.9rem; }
.kpi-list .is-ok { color: var(--success); }
.kpi-list .is-warn { color: var(--warning); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }
tr.is-strong td { font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.form-group { margin-bottom: 16px; flex: 1; min-width: 160px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--text-muted); }
.form-control, textarea.form-control {
    width: 100%; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font: inherit; font-size: 0.9rem;
}
.form-control:focus { outline: none; border-color: var(--accent); }
select.form-control {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    background-color: var(--bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%238b9cb3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
}
html[data-theme="light"] select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%235a6b80' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
}
.filters .form-control { width: auto; min-width: 180px; }
.filters .howapply-date { width: 180px; }
.filters .howapply-date .form-control { width: 100%; min-width: 0; }
.password-field { display: flex; flex-direction: column; gap: 10px; }
.password-input-wrap { position: relative; display: flex; align-items: center; }
.password-input-wrap .form-control { padding-right: 44px; }
.password-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px;
    background: transparent; color: var(--text-muted); cursor: pointer;
}
.password-toggle:hover { color: var(--text); background: var(--bg-hover); }
.password-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.password-strength { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 140px; }
.password-strength[hidden] { display: none; }
.password-strength-bar { flex: 1; height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.password-strength-bar span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width 0.2s ease, background 0.2s ease; }
.password-strength[data-level="very-weak"] .password-strength-bar span { background: var(--danger); }
.password-strength[data-level="weak"] .password-strength-bar span { background: #f97316; }
.password-strength[data-level="fair"] .password-strength-bar span { background: var(--warning); }
.password-strength[data-level="good"] .password-strength-bar span { background: #86efac; }
.password-strength[data-level="strong"] .password-strength-bar span { background: var(--success); }
html[data-theme="light"] .password-strength[data-level="good"] .password-strength-bar span { background: #16a34a; }
.password-strength-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; min-width: 72px; }
.password-strength[data-level="very-weak"] .password-strength-label { color: var(--danger); }
.password-strength[data-level="weak"] .password-strength-label { color: #f97316; }
.password-strength[data-level="fair"] .password-strength-label { color: var(--warning); }
.password-strength[data-level="good"] .password-strength-label { color: #86efac; }
html[data-theme="light"] .password-strength[data-level="good"] .password-strength-label { color: #15803d; }
.password-strength[data-level="strong"] .password-strength-label { color: var(--success); }
.profile-card { max-width: 560px; }
.profile-header { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.profile-avatar-stage { width: 160px; height: 160px; border: 3px solid var(--border); cursor: grab; touch-action: none; }
.profile-avatar-stage:active { cursor: grabbing; }
.profile-avatar-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.profile-avatar-pick { position: relative; cursor: pointer; margin: 0; }
.profile-avatar-pick input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.profile-avatar-zoom { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); }
.profile-avatar-zoom[hidden] { display: none; }
.profile-avatar-zoom input[type="range"] { width: 110px; accent-color: var(--accent); }
.profile-header-info h3 { font-size: 1.2rem; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: normal; margin-bottom: 4px; }
.profile-header-info p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 6px; }
.profile-gravatar-hint { font-size: 0.75rem; color: var(--text-muted); }
.profile-gravatar-hint a { color: var(--accent); }
.profile-section { margin: 28px 0 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.profile-section-plain { margin: 0; padding-top: 0; border-top: 0; }
.profile-section h4 { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.profile-section-hint { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }
.profile-cancel { margin-top: 10px; }
.totp-status { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.totp-status h4 { margin-bottom: 0; }
.totp-qr-figure { margin: 8px 0 20px; }
.totp-qr-figure figcaption { margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); }
.totp-manual { margin: 0 0 20px; }
.totp-manual summary { cursor: pointer; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 12px; }
.totp-secret-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.totp-secret { font-size: 0.95rem; letter-spacing: 0.08em; word-break: break-all; }
.totp-code-input { font-size: 1.25rem; letter-spacing: 0.28em; text-align: center; font-variant-numeric: tabular-nums; }
.backup-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; list-style: none; margin: 0; padding: 0; }
.backup-codes code { font-size: 0.95rem; letter-spacing: 0.06em; }
.badge-warning { background: rgba(251,191,36,0.15); color: var(--warning); }
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px; border: 1px solid transparent; border-radius: 8px;
    font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; color: var(--text);
}
.btn-primary, a.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary, a.btn-secondary, a.btn-secondary:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border); }
a.btn-primary, a.btn-primary:hover { color: #fff; }
.btn-secondary.is-active, a.btn-secondary.is-active, a.btn-secondary.is-active:hover {
    background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-danger { background: rgba(248,113,113,0.12); color: var(--danger); border-color: rgba(248,113,113,0.45); }
.btn-danger:hover { background: rgba(248,113,113,0.2); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 0.8rem; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.alert-success { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.3); color: var(--success); }
.alert-danger { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3); color: var(--danger); }
.alert-warning { background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.3); color: var(--warning); }
.alert-info { background: rgba(59,158,255,0.1); border: 1px solid rgba(59,158,255,0.3); color: var(--accent); }
.auth-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-intro { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.auth-intro h1 { font-size: 1.1rem; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; }
.auth-card h1 { font-size: 1.25rem; margin-bottom: 8px; }
.auth-card p, .auth-back { color: var(--text-muted); margin: 16px 0; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--bg-hover); font-size: 0.75rem; font-weight: 600; }
.badge-success { background: rgba(52,211,153,0.15); color: var(--success); }
.badge-info { background: rgba(59,158,255,0.15); color: var(--accent); }
.badge-translator { background: rgba(167,139,250,0.18); color: #a78bfa; }
.badge-muted { background: rgba(139,156,179,0.16); color: var(--text-muted); }
.badge-ok { background: rgba(52,211,153,0.15); color: var(--success); }
html[data-theme="light"] .badge-translator { background: rgba(109,40,217,0.12); color: #6d28d9; }
.totp-qr { width: fit-content; padding: 14px; background: #fff; border-radius: 8px; margin: 12px 0; }
.totp-qr svg { display: block; width: 200px; height: 200px; }
.totp-manual { margin: 12px 0 20px; color: var(--text-muted); }
.code-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; list-style: none; margin: 12px 0 20px; }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; }
.profile-card { max-width: 560px; }
.print-body { background: #fff; color: #111; }
.print-main { max-width: 720px; margin: 32px auto; }
.print-main table td { border-bottom: 1px solid #ddd; }
.sidebar-nav { flex: 1; overflow-y: auto; }
.sidebar-footer { margin-top: auto; }
a.sidebar-credit {
    display: block;
    margin: 12px -16px -20px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.72rem;
    line-height: 1.3;
    text-align: center;
    color: var(--text-muted);
}
a.sidebar-credit:hover { background: var(--bg-hover); color: var(--text); }

.theme-toggle {
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1;
    text-align: left;
    cursor: pointer;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }
.theme-toggle:focus { outline: none; }
.theme-toggle-copy { display: flex; align-items: center; gap: 8px; min-width: 0; }
.theme-toggle-copy svg { display: block; width: 16px; height: 16px; flex-shrink: 0; }
.theme-toggle-sun, .theme-toggle-moon { display: none; }
html:not([data-theme="light"]) .theme-toggle-moon,
html[data-theme="light"] .theme-toggle-sun { display: flex; }
.theme-toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    margin-left: auto;
    flex-shrink: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.theme-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    transition: transform 0.15s ease;
}
html[data-theme="light"] .theme-toggle-track { background: var(--accent); border-color: var(--accent); }
html[data-theme="light"] .theme-toggle-thumb { background: #fff; transform: translateX(16px); }

.portal-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.portal-kpis .card, .portal-charts .card, .portal-channel-grid .card { margin-bottom: 0; }
.portal-kpis .stat-fail { color: var(--danger); }
.portal-periods { display: flex; flex-wrap: wrap; gap: 8px; margin: -12px 0 24px; }
.portal-charts {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 20px;
    margin-bottom: 20px;
}
.portal-chart-header h3 {
    margin: 0 0 4px;
    font-size: 1.05rem;
    color: var(--text);
    text-transform: none;
    letter-spacing: normal;
}
.portal-chart-header p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.portal-chart-wrap { height: 280px; margin-top: 16px; }
.portal-chart-wrap-time { height: 340px; }
.portal-chart-empty { margin: 48px 0 0; color: var(--text-muted); }
.section-title {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 8px 0 16px;
    font-weight: 600;
}
.portal-channel-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.portal-channel-grid h3 { margin: 0; font-size: 1.05rem; text-transform: none; letter-spacing: normal; color: var(--text); }
.portal-channel-key { margin: 2px 0 12px; color: var(--text-muted); font-size: 0.8rem; }
.portal-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.portal-meta dt { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.portal-meta dd { margin: 2px 0 0; font-weight: 600; }
.import-table { margin-top: 8px; }

@media (max-width: 1100px) {
    .portal-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .portal-charts, .portal-channel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
    .sidebar { position: relative; width: 100%; height: auto; }
    .app { flex-direction: column; }
    .main { margin-left: 0; width: 100%; padding: 20px; }
    .portal-kpis, .portal-meta { grid-template-columns: 1fr; }
}
