/* Shared portal interface. Loaded after module styles in both themes. */
:root {
    --ui-bg:#f3f5f8;
    --ui-surface:#fff;
    --ui-soft:#f7f9fc;
    --ui-line:#dde4ec;
    --ui-ink:#1b2b40;
    --ui-muted:#586b81;
    --ui-brand:#23496d;
    --ui-active:#edf3f9;
    --ui-accent:#c96922;
    --ui-danger:#b52f3c;
    --ui-shadow:0 4px 20px rgba(24,43,64,.04);
    --surface:var(--ui-surface);
    --surface-soft:var(--ui-soft);
    --surface-muted:var(--ui-active);
    --text:var(--ui-ink);
    --text-muted:var(--ui-muted);
    --border:var(--ui-line);
}
html[data-theme=dark] {
    --ui-bg:#141c27;
    --ui-surface:#1e2938;
    --ui-soft:#253244;
    --ui-line:#3d4e63;
    --ui-ink:#edf2f8;
    --ui-muted:#b4c1d1;
    --ui-brand:#9fcaf0;
    --ui-active:#2b4058;
    --ui-accent:#f1ae72;
    --ui-danger:#ff9aa5;
    --ui-shadow:none;
    color-scheme:dark;
}
html { background:var(--ui-bg); scroll-padding-top:24px; }
body { background:var(--ui-bg); color:var(--ui-ink); line-height:1.5; }
.session-gate { width:calc(100% - 24px); max-width:440px; margin:clamp(24px,8vh,96px) auto; padding:32px; text-align:center; border:1px solid var(--ui-line); border-radius:20px; background:var(--ui-surface); }
.session-gate .auth-logo { width:88px; height:88px; object-fit:contain; }
button, input, select, textarea { font:inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color:transparent; }
button { touch-action:manipulation; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline:3px solid var(--ui-brand); outline-offset:3px;
}
button:disabled { cursor:default; opacity:.6; }
[hidden] { display:none !important; }

/* Header and navigation */
#appPage { max-width:1600px; min-width:0; padding:24px 28px 100px; background:transparent; }
.app-header {
    position:relative; top:auto; min-height:84px; padding:14px 20px;
    border:1px solid var(--ui-line); border-radius:18px;
    background:var(--ui-surface); box-shadow:var(--ui-shadow); gap:16px;
}
.app-header .brand { flex:1 1 400px; flex-wrap:nowrap; min-width:0; gap:14px; }
.logo-img { width:54px; height:54px; flex:0 0 54px; object-fit:contain; }
html[data-theme=dark] .logo-img, html[data-theme=dark] .auth-logo { background:#fff; padding:4px; border-radius:10px; }
.company-name { max-width:620px; white-space:normal; font-size:17px; line-height:1.4; color:var(--ui-ink); }
.user-info { gap:10px; min-width:0; }
.user-meta .name { color:var(--ui-ink); max-width:220px; overflow:hidden; text-overflow:ellipsis; }
.user-meta .role { color:var(--ui-brand); background:var(--ui-active); font-size:11px; }
.avatar { width:40px; height:40px; flex:none; border-radius:12px; background:#23496d; box-shadow:none; color:#fff; }
.theme-switcher, .lang-switcher {
    min-height:44px; border:1px solid var(--ui-line); border-radius:11px;
    color:var(--ui-ink); background:var(--ui-surface);
}
.theme-switcher { width:44px; flex-basis:44px; }
.lang-switcher { padding:8px 12px; font-size:13px; }
.logout-btn { min-height:44px; color:var(--ui-danger); font-size:13px; }
.brand-home:hover, .theme-switcher:hover, .lang-switcher:hover { background:var(--ui-soft); }
.portal-nav-caption { display:none; }
.bottom-nav { border:1px solid var(--ui-line); background:var(--ui-surface); box-shadow:var(--ui-shadow); }
.bottom-nav .nav-item { min-height:46px; color:var(--ui-muted); border:0; background:transparent; border-radius:10px; }
.bottom-nav .nav-item:hover { color:var(--ui-ink); background:var(--ui-soft); }
.bottom-nav .nav-item.active { color:var(--ui-brand) !important; background:var(--ui-active) !important; box-shadow:none; }
.bottom-nav .nav-item .label { font-size:13px; font-weight:600; }
.bottom-nav .nav-item .icon svg { width:21px; height:21px; }

/* Page context and quick access, with real permissions and no synthetic totals. */
.portal-heading { display:flex; justify-content:space-between; align-items:center; gap:20px; margin:8px 0 24px; min-width:0; }
.portal-heading > div { min-width:0; }
.portal-heading h1 { color:var(--ui-ink); font-size:clamp(24px,2.3vw,32px); line-height:1.25; letter-spacing:-.7px; font-weight:750; margin:7px 0; overflow-wrap:anywhere; }
.portal-heading p { color:var(--ui-muted); font-size:14px; }
.portal-breadcrumbs { display:flex; align-items:center; flex-wrap:wrap; gap:6px; color:var(--ui-muted); font-size:12px; }
.portal-breadcrumbs button { border:0; padding:3px 0; background:transparent; color:var(--ui-muted); font:inherit; cursor:pointer; }
.portal-breadcrumbs button:hover { color:var(--ui-brand); text-decoration:underline; }
.portal-breadcrumbs [aria-current] { color:var(--ui-ink); }
.portal-breadcrumbs .portal-crumb-divider { color:var(--ui-muted); padding:0 3px; }
.portal-today { flex:none; padding:10px 14px; border:1px solid var(--ui-line); border-radius:12px; background:var(--ui-surface); color:var(--ui-muted); font-size:12px; text-transform:capitalize; }
.portal-shortcuts { grid-column:1 / -1; }
.portal-shortcuts-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:16px; }
.portal-shortcuts h2 { font-size:17px; color:var(--ui-ink); font-weight:700; }
.portal-shortcuts-heading span { color:var(--ui-muted); font-size:12px; }
.portal-shortcut-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:10px; }
.portal-shortcut {
    display:flex; align-items:center; gap:12px; text-align:left; padding:14px;
    border:1px solid var(--ui-line); border-radius:12px; background:var(--ui-soft);
    color:var(--ui-ink); font-size:13px; font-weight:600; min-width:0; cursor:pointer;
}
.portal-shortcut:hover { background:var(--ui-active); border-color:var(--ui-brand); }
.portal-shortcut > span:last-child { min-width:0; overflow-wrap:anywhere; }
.portal-line-icon { display:grid; place-items:center; width:40px; height:40px; border-radius:11px; background:var(--ui-active); color:var(--ui-brand); flex:none; }
.portal-line-icon svg { width:23px; height:23px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }

/* All sections share the same surfaces, readable type and generous hit targets. */
.page { min-width:0; }
.page:not(#page-home) { gap:20px; }
#appPage > .page { align-self:start; width:100%; }
#page-home.active { align-content:start; }
.card, #page-home .card, .subsection-content {
    min-width:0; padding:24px; border:1px solid var(--ui-line); border-radius:16px;
    background:var(--ui-surface); color:var(--ui-ink); box-shadow:var(--ui-shadow);
}
.card-title { color:var(--ui-ink); font-size:18px; font-weight:700; line-height:1.4; gap:12px; margin-bottom:20px; }
.subsection-header { gap:12px; border-color:var(--ui-line); margin-bottom:22px; }
.subsection-header .title { font-size:20px; color:var(--ui-ink); white-space:normal; line-height:1.4; }
.subsection-header .back-btn { min-width:44px; height:44px; padding:0; background:var(--ui-soft); color:var(--ui-ink); border:1px solid var(--ui-line); }
.dept-grid, .folder-grid, .subsection-grid { grid-template-columns:repeat(auto-fit,minmax(205px,1fr)); gap:14px; }
.dept-card, .folder-card, .subsection-card {
    width:100%; min-width:0; min-height:160px; padding:24px 20px; border:1px solid var(--ui-line);
    border-radius:14px; background:var(--ui-surface); color:var(--ui-ink); box-shadow:none;
    font:inherit; cursor:pointer; text-align:left; align-items:flex-start; justify-content:flex-start;
}
.dept-card:hover, .folder-card:hover, .subsection-card:hover { background:var(--ui-soft); border-color:var(--ui-brand); transform:none; box-shadow:none; }
.dept-card .icon, .subsection-card .icon { display:grid; place-items:center; width:44px; height:44px; border-radius:12px; background:var(--ui-active); font-size:26px; margin-bottom:16px; }
.dept-card .name, .folder-card .folder-name, .subsection-card .name { font-size:15px; font-weight:650; color:var(--ui-ink); line-height:1.45; overflow-wrap:anywhere; }
.dept-card .desc, .folder-card .folder-desc { margin-top:7px; font-size:12px; line-height:1.5; color:var(--ui-muted); }
.folder-card .folder-visual { margin:8px 0 16px; }
.folder-card .folder-symbol { border-color:var(--ui-surface); }
.item-card, .tech-card, .check-card, .admin-user {
    padding:18px; border:1px solid var(--ui-line); border-radius:12px; background:var(--ui-surface); color:var(--ui-ink); box-shadow:none;
}
.item-card:hover, .tech-card:hover { background:var(--ui-soft); box-shadow:none; }
.item-card .title { color:var(--ui-ink); font-size:15px; line-height:1.5; }
.item-card .meta, .item-card .description, .tech-details { line-height:1.6; }
.item-card .meta, .tech-details, .check-date, .check-card .field .label { color:var(--ui-muted); font-size:13px; }
.item-card .description { color:var(--ui-ink); white-space:pre-line; }
#newsList { display:grid; gap:12px; }
#newsList .item-card { border-left:3px solid var(--ui-accent); }
.empty-state, .svi-empty { padding:36px 20px; background:var(--ui-soft); color:var(--ui-muted); border:1px dashed var(--ui-line); border-radius:12px; font-size:14px; }
.loading { color:var(--ui-muted); padding:30px 16px; }
.calendar-nav { gap:12px; margin-bottom:18px; color:var(--ui-ink); }
.calendar-nav button { width:44px; height:44px; padding:0; border:1px solid var(--ui-line); border-radius:10px; background:var(--ui-soft); color:var(--ui-ink); }
.calendar-grid { gap:5px; }
.calendar-grid .day { min-height:42px; border:1px solid transparent; border-radius:9px; color:var(--ui-ink); background:var(--ui-soft); cursor:pointer; font-size:14px; }
.calendar-grid .day.other-month { background:transparent; }
.calendar-grid .day:hover { background:var(--ui-active); }
.calendar-grid .day.today { background:#23496d; color:#fff; }
.calendar-grid .day.has-event { border-bottom:3px solid var(--ui-accent); }

/* Actions and forms */
.btn-primary { min-height:48px; background:#23496d; box-shadow:none; border-radius:10px; font-size:15px; }
.btn-primary:hover { background:#183b5d; box-shadow:none; transform:none; }
.btn-add, .btn-edit, .btn-delete, .image-controls button, .portal-draft-bar button { min-height:40px; padding:8px 14px; border-radius:9px; font-size:13px; line-height:1.4; }
.btn-add { background:#23496d; }
.btn-add:hover { background:#183b5d; box-shadow:none; }
.btn-edit { color:var(--ui-brand); background:var(--ui-active); border:1px solid var(--ui-line); }
.btn-edit:hover { border-color:var(--ui-brand); }
.btn-delete { background:transparent; color:var(--ui-danger); border:1px solid var(--ui-line); }
.btn-delete:hover { background:var(--ui-soft); border-color:var(--ui-danger); }
.actions, .tech-actions, .check-actions { gap:8px; flex-wrap:wrap; }
.form-group label { color:var(--ui-ink); font-size:13px; margin-bottom:8px; line-height:1.5; }
.form-group input:not([type=checkbox]):not([type=radio]):not([type=file]), .form-group select, .form-group textarea,
.modal .form-group textarea, .compact-toolbar input, .compact-toolbar select, .drivers-toolbar input, .drivers-toolbar select,
.check-filters input, .check-filters select, .directory-search input, .portal-table-tools input, .income-filter input, .income-filter select {
    min-height:44px; padding:11px 13px; border:1px solid var(--ui-line); border-radius:9px;
    background:var(--ui-surface); color:var(--ui-ink); font-size:14px; box-shadow:none; min-width:0;
}
.form-group textarea { width:100%; resize:vertical; }
.form-group input[type=checkbox], .form-group input[type=radio], .remember-row input { width:18px; height:18px; min-height:0; flex:none; margin-right:5px; accent-color:var(--ui-brand); }
input::placeholder, textarea::placeholder { color:var(--ui-muted); opacity:1; }
.form-group input.error, .form-group select.error, .form-group textarea.error { border-color:var(--ui-danger); }
.form-group .error-message { color:var(--ui-danger); }
.compact-toolbar, .drivers-toolbar, .check-filters, .income-report-toolbar, .portal-table-tools, .portal-draft-bar {
    background:var(--ui-soft); border:1px solid var(--ui-line); border-radius:12px; padding:12px; gap:10px; color:var(--ui-muted);
}
.portal-table-tools span { font-size:12px; }
.portal-draft-bar button { background:var(--ui-surface); color:var(--ui-ink); border-color:var(--ui-line); }
.tech-summary .stat { background:var(--ui-soft); border-color:var(--ui-line); color:var(--ui-ink); padding:10px 14px; box-shadow:none; }

/* Tables remain scrollable inside their own container. */
.portal-table-scroll { border:1px solid var(--ui-line); border-radius:12px; scrollbar-gutter:stable; overscroll-behavior-x:contain; }
.check-table { color:var(--ui-ink); margin:0; }
.check-table:not(.income-table) { table-layout:auto !important; min-width:640px; }
.check-table:not(.income-table) th, .check-table:not(.income-table) td { width:auto !important; }
.check-table:not(.income-table):has(th:nth-child(9)) { min-width:1100px; }
.check-table th, .check-table td { font-size:13px; padding:12px 10px !important; line-height:1.5; border-color:var(--ui-line); }
.portal-table-scroll thead, .portal-table-scroll thead th, .check-table th { background:var(--ui-soft); color:var(--ui-muted); font-weight:650; }
.check-table tbody tr td { background:var(--ui-surface); color:var(--ui-ink); }
.check-table tbody tr:nth-child(even) td { background:var(--ui-soft); }
.check-table tbody tr:hover td { background:var(--ui-active); }
.check-table td button { min-height:36px; }
.check-table td select { min-height:38px; max-width:100%; }
.profile-card, .profile-menu { border:1px solid var(--ui-line); background:var(--ui-surface); box-shadow:none; border-radius:14px; color:var(--ui-ink); }
.profile-name, .profile-details .row .value, .profile-menu .menu-item { color:var(--ui-ink); }
.profile-details .row .label, .profile-role, .profile-field .value { color:var(--ui-muted); }
#profileContent .profile-card { max-width:540px; padding:24px; }
.profile-details .row { display:grid; grid-template-columns:24px 125px minmax(0,1fr); align-items:start; gap:8px; padding:12px 0; text-align:left; }
.profile-details .row .label { width:auto; font-size:13px; }
.profile-details .row .value { min-width:0; overflow-wrap:anywhere; font-size:14px; }
.profile-menu .menu-item { min-height:54px; border-color:var(--ui-line); }
.profile-menu button.menu-item { width:100%; text-align:left; font:inherit; background:transparent; border:0; border-bottom:1px solid var(--ui-line); }
.profile-menu .menu-item:hover { background:var(--ui-soft); }
.profile-menu .menu-item.logout { color:var(--ui-danger); }
.income-metric, .income-breakdown, .order-summary-section, .order-summary-card, .rental-lessor-group { background:var(--ui-surface); border-color:var(--ui-line); border-radius:12px; }
.income-filter, .income-record-count, .income-report-note, .audit-item time { color:var(--ui-muted); }
.income-metric-label, .income-metric-footer, .income-metric-footer span, .income-details-heading small, .income-fuel-stack small { color:var(--ui-muted); font-size:12px; }
html[data-theme=dark] .income-metric-balance .income-metric-heading, html[data-theme=dark] .income-metric-balance > strong { color:#73d8e1; }
html[data-theme=dark] .income-metric-cost .income-metric-heading, html[data-theme=dark] .income-metric-cost > strong { color:#ffb593; }
html[data-theme=dark] .income-metric-income .income-metric-heading, html[data-theme=dark] .income-metric-income > strong { color:#7cdb9b; }
html[data-theme=dark] .income-metric-distance .income-metric-heading, html[data-theme=dark] .income-metric-distance > strong { color:#aecbdc; }
html[data-theme=dark] .income-metric-icon { background:#29465a; }
html[data-theme=dark] .income-metric-cost .income-metric-icon { background:#784333; }
html[data-theme=dark] .income-metric-income .income-metric-icon { background:#2b573b; }
.income-comparison, .income-comparison-cards > div, .income-comparison-note textarea { background:var(--ui-surface); color:var(--ui-ink); border-color:var(--ui-line); }
html[data-theme=dark] .income-comparison, html[data-theme=dark] .income-comparison-cards > div, html[data-theme=dark] .income-comparison-note textarea { background:var(--ui-surface); color:var(--ui-ink); border-color:var(--ui-line); }
.admin-user .info { width:100%; }
.admin-user .actions { width:100%; margin-top:16px; align-items:flex-end; gap:10px; }
.admin-user .actions label { display:grid; gap:6px; flex:1 1 190px; max-width:320px; min-width:0; font-size:12px; color:var(--ui-muted); }
.admin-user select { width:100%; min-width:0; min-height:44px; padding:10px 12px; font-size:14px; border:1px solid var(--ui-line); border-radius:9px; background:var(--ui-surface); color:var(--ui-ink); }
.portal-user-status { display:inline-block; padding:3px 9px; border-radius:7px; font-size:12px; font-weight:600; background:var(--ui-soft); color:var(--ui-ink); }
.portal-user-status.approved { color:#166a46; background:#e8f5ee; }
.portal-user-status.pending { color:#8e5707; background:#fff3dc; }
.portal-user-status.rejected { color:#a12936; background:#fcecf0; }
html[data-theme=dark] .portal-user-status.approved { color:#8be0b1; background:#234338; }
html[data-theme=dark] .portal-user-status.pending { color:#f1cb89; background:#493b27; }
html[data-theme=dark] .portal-user-status.rejected { color:#ffabb6; background:#4c2c38; }

/* Dialogs and tablet inspection forms */
body.portal-dialog-open { overflow:hidden; }
.modal-overlay { background:rgba(13,24,39,.6); padding:24px; }
.modal { padding:24px; border:1px solid var(--ui-line); border-radius:18px; background:var(--ui-surface); color:var(--ui-ink); max-height:90dvh; overscroll-behavior-y:contain; box-shadow:0 24px 80px rgba(10,20,35,.25); animation:none; }
.modal-header { position:sticky; top:-24px; z-index:20; margin:-24px -24px 22px; padding:18px 24px; background:var(--ui-surface); border-bottom:1px solid var(--ui-line); gap:14px; }
.modal-header h2 { font-size:20px; color:var(--ui-ink); line-height:1.4; }
.modal-close { min-width:44px; height:44px; flex:none; display:grid; place-items:center; border-radius:10px; color:var(--ui-muted); background:var(--ui-soft); font-size:28px; }
.modal-close:hover { background:var(--ui-active); color:var(--ui-ink); }
.toast-container { z-index:2000; max-width:min(420px,calc(100vw - 32px)); }
.toast { padding:14px 18px; font-size:14px; border-radius:12px; line-height:1.5; }
.svi { --svi-ink:var(--ui-ink); --svi-line:var(--ui-line); font-size:15px; }
.svi-heading p, .svi-muted { color:var(--ui-muted); }
.svi button { min-height:44px; font-size:14px; }
.svi-steps button { min-height:58px; font-size:12px; line-height:1.35; }
.svi-steps b { width:28px; height:28px; }
.svi-field { font-size:13px; gap:8px; }
.svi-group { font-weight:700; color:var(--ui-muted); font-size:12px; }
.svi-options { flex-wrap:wrap; gap:8px; }
.svi-options label { min-height:44px; padding:8px 12px; border:1px solid var(--svi-line); border-radius:9px; font-size:13px; background:var(--ui-surface); }
.svi-options label:has(input:checked) { border-color:var(--svi-red); background:var(--ui-soft); font-weight:650; }
.svi-options label:has(input[value=fail]:checked) { color:var(--svi-red); }
.svi-signatures canvas { min-height:130px; }
.svi-footer { position:sticky; bottom:-24px; z-index:15; margin:24px -24px -24px; padding:14px 24px 20px; background:var(--ui-surface); border-top:1px solid var(--ui-line); box-shadow:0 -6px 20px rgba(24,43,64,.04); }
.svi-footer .svi-actions { gap:8px; }
.svi-footer .svi-actions > button:first-child { margin-right:auto; }
.svi-ack { min-height:44px; align-items:center; font-size:14px; }
.svi-ack input { flex:none; }
.svi-note textarea { width:100%; }
.svi-record { border-radius:12px; margin:0; }
.svi-records { grid-template-columns:repeat(auto-fill,minmax(min(100%,280px),1fr)); }

/* Authentication */
#loginPage, #registerPage { margin:clamp(24px,8vh,96px) auto; border:1px solid var(--ui-line); background:var(--ui-surface); box-shadow:var(--ui-shadow); border-radius:20px; padding:36px; }
.auth-lang-switcher { display:block; margin:0 0 14px; }
/* The translated label opens the camera/file chooser regardless of OS language. */
.svi-upload { position:relative; cursor:pointer; }
.svi-upload input[type=file] { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.svi-upload:focus-within { outline:2px solid var(--ui-accent); outline-offset:3px; }
#loginPage::before, #registerPage::before { height:4px; background:#23496d; }
#loginPage::after, #registerPage::after { display:none; }
#loginPage .auth-sub, #registerPage .auth-sub { color:var(--ui-ink); text-align:center; font-size:21px; line-height:1.4; margin-bottom:28px; }
#loginPage .auth-sub::after, #registerPage .auth-sub::after { content:none; }
.switch-link { color:var(--ui-muted); font-size:13px; line-height:1.6; }
.switch-link button { min-height:40px; padding:3px 5px; background:transparent; color:var(--ui-brand); border:0; cursor:pointer; font-weight:650; }
.switch-link button:hover { text-decoration:underline; }
.remember-row { min-height:40px; color:var(--ui-muted); font-size:13px; }

@media (min-width:900px) {
    #appPage:not(.hidden) { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:auto auto auto minmax(0,1fr); align-content:start; padding:24px 28px 40px; }
    .app-header { grid-row:1; grid-column:1; margin-bottom:16px; }
    .bottom-nav { grid-row:2; grid-column:1; margin-bottom:18px; padding:6px; border-radius:12px; }
    .portal-heading { grid-row:3; grid-column:1; }
    #appPage > .page { grid-row:4; grid-column:1; }
    #page-home.active { grid-template-columns:minmax(0,1.15fr) minmax(320px,.85fr); gap:20px; }
}
@media (min-width:1200px) {
    #appPage:not(.hidden) { grid-template-columns:210px minmax(0,1fr); grid-template-rows:auto auto minmax(0,1fr); column-gap:24px; }
    .app-header { grid-row:1; grid-column:1 / -1; margin-bottom:20px; }
    .bottom-nav { grid-column:1; grid-row:2 / span 2; position:sticky; top:24px; align-self:start; flex-direction:column; align-items:stretch; gap:6px; padding:14px; margin:8px 0 0; }
    .portal-nav-caption { display:block; padding:8px 6px 14px; color:var(--ui-muted); font-size:10px; font-weight:700; letter-spacing:.8px; text-transform:uppercase; }
    .bottom-nav .nav-item { justify-content:flex-start; min-width:0; width:100%; gap:12px; padding:12px 14px; text-align:left; }
    .portal-heading { grid-column:2; grid-row:2; }
    #appPage > .page { grid-column:2; grid-row:3; }
}
@media (max-width:899px) {
    #appPage { padding:16px 16px 104px; }
    .portal-heading { margin:6px 0 20px; }
    .portal-today { display:none; }
    .bottom-nav { left:16px; right:16px; width:auto; bottom:max(12px,env(safe-area-inset-bottom)); border-radius:16px; min-height:66px; height:auto; padding:6px; }
    .bottom-nav .nav-item { flex:1; padding:8px 5px; gap:4px; }
    #page-home.active { gap:16px; }
    #page-home .card { margin-bottom:0; }
    .toast-container { bottom:96px; }
}
@media (max-width:600px) {
    #appPage { padding:10px 10px 100px; }
    .app-header { padding:12px; gap:10px; border-radius:14px; margin-bottom:18px; }
    .app-header .brand { flex-basis:100%; gap:10px; }
    .logo-img { width:40px; height:40px; flex-basis:40px; }
    .company-name { font-size:12px; line-height:1.4; }
    .user-info { justify-content:flex-start; width:100%; gap:7px; flex-wrap:wrap; }
    .user-info .avatar { display:none; }
    .user-meta { flex:1; min-width:0; }
    .user-meta .name { font-size:12px; max-width:130px; white-space:nowrap; }
    .user-meta .role { font-size:10px; }
    .lang-switcher { padding:8px; font-size:12px; }
    .logout-btn { padding:8px 5px; font-size:12px; }
    .portal-heading h1 { font-size:25px; }
    .portal-heading p { font-size:13px; }
    .portal-shortcuts-heading { flex-wrap:wrap; margin-bottom:12px; }
    .portal-shortcut-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
    .portal-shortcut { flex-direction:column; align-items:flex-start; gap:10px; padding:12px; font-size:12px; }
    .card, #page-home .card, .subsection-content { padding:16px; border-radius:14px; }
    .card-title { font-size:17px; flex-wrap:wrap; margin-bottom:16px; }
    .dept-grid, .folder-grid, .subsection-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
    .dept-card, .folder-card, .subsection-card { min-height:148px; padding:16px 12px; }
    .dept-card .name, .folder-card .folder-name, .subsection-card .name { font-size:13px; }
    .dept-card .desc, .folder-card .folder-desc { font-size:11px; }
    .subsection-header .title { font-size:18px; }
    .item-card, .tech-card, .check-card, .admin-user { padding:14px; }
    #profileContent .profile-card { padding:18px; }
    .profile-details .row { grid-template-columns:22px minmax(0,1fr); gap:3px 8px; }
    .profile-details .row .value { grid-column:2; }
    .compact-toolbar button, .drivers-toolbar button, .check-filters button { min-height:44px; }
    .item-card .actions button, .tech-actions button, .check-card .actions button { min-height:42px; font-size:12px; }
    .form-group input:not([type=checkbox]):not([type=radio]), .form-group select, .form-group textarea { font-size:16px; }
    .bottom-nav { left:10px; right:10px; }
    .bottom-nav .nav-item .label { font-size:11px; }
    .modal-overlay { padding:10px; align-items:center; }
    .modal { width:100%; padding:18px; max-height:92dvh; border-radius:16px; }
    .modal-header { top:-18px; margin:-18px -18px 18px; padding:12px 18px; }
    .modal-header h2 { font-size:18px; }
    .svi-footer { bottom:-18px; margin:20px -18px -18px; padding:12px 18px 18px; }
    .svi-footer .svi-actions { display:grid; grid-template-columns:1fr 1fr; }
    .svi-footer .svi-actions > button:first-child { grid-column:1 / -1; margin:0; }
    .svi-steps button { font-size:11px; padding:9px 5px; }
    .svi-options label { flex:1; justify-content:center; padding:8px; font-size:12px; }
    .svi input:not([type=radio]):not([type=checkbox]), .svi textarea { font-size:16px; }
    #loginPage, #registerPage { width:calc(100% - 24px); padding:30px 24px; margin:24px auto; }
}
@media (prefers-reduced-motion:reduce) { .modal, .toast { animation:none; } }
@media print {
    .portal-heading, .portal-shortcuts, .bottom-nav { display:none !important; }
    #appPage:not(.hidden) { display:block; padding:0; }
    .portal-table-scroll { overflow:visible; max-height:none; border:0; }
    body.portal-dialog-open { overflow:visible; }
}
