:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --panel-soft: #eef3ef;
  --ink: #17211d;
  --muted: #63716b;
  --line: #dfe7e2;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --green: #15803d;
  --amber: #b7791f;
  --red: #b42318;
  --red-soft: #fff0ee;
  --amber-soft: #fff7e6;
  --green-soft: #edf8ef;
  --shadow: 0 20px 60px rgba(23, 33, 29, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--ink); }
body.is-locked { background: #17211d; }
button, input, select, textarea { font: inherit; }
button, select, label.file-button { cursor: pointer; }
.auth-screen { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: #17211d; }
.auth-panel { display: grid; width: min(420px, 100%); gap: 18px; border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius); padding: 24px; background: var(--panel); box-shadow: var(--shadow); }
.auth-brand { color: var(--ink); }
.auth-brand span { color: var(--muted); }
.auth-panel h1 { margin-bottom: 0; font-size: 34px; line-height: 1.05; }
.auth-hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.auth-submit { width: 100%; }
.auth-status { min-height: 20px; margin: -6px 0 0; color: var(--red); font-size: 13px; font-weight: 800; }
.app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 28px; padding: 24px 18px; background: #17211d; color: #f8fbf8; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { display: block; width: 132px; max-width: 46vw; height: auto; border-radius: 4px; background: #1d0a78; object-fit: contain; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: var(--radius); background: #f6c453; color: #17211d; font-weight: 900; }
.brand strong, .brand span { display: block; }
.brand div { min-width: 0; }
.brand span { margin-top: 2px; color: #b8c8bf; font-size: 13px; }
.auth-panel .brand-logo { width: 160px; max-width: 52vw; }
.sidebar .brand { align-items: flex-start; flex-direction: column; gap: 8px; }
.sidebar .brand-logo { width: 180px; max-width: 100%; }
.nav-list { display: grid; gap: 8px; }
.nav-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-height: 44px; border: 1px solid transparent; border-radius: var(--radius); padding: 0 12px; background: transparent; color: #f8fbf8; text-align: left; }
.nav-item:hover, .nav-item.is-active, .nav-item.is-enabled { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.09); }
.nav-dot { width: 10px; height: 10px; border-radius: 999px; }
.dot-all { background: #f6c453; } .dot-due { background: #f59e0b; } .dot-expired { background: #ef4444; } .dot-ok { background: #22c55e; }
.nav-count { min-width: 28px; border-radius: 999px; padding: 2px 8px; background: rgba(255,255,255,.14); color: #f8fbf8; font-size: 12px; text-align: center; }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; color: #dce8e1; font-size: 13px; }
.sidebar-footer input { width: 100%; min-height: 40px; border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius); padding: 0 12px; background: rgba(255,255,255,.09); color: #fff; }
.company-card { display: grid; gap: 4px; margin-top: 10px; border-top: 1px solid rgba(255,255,255,.18); padding-top: 12px; color: #dce8e1; font-size: 11px; line-height: 1.35; }
.company-card strong { color: #fff; font-size: 12px; }
.company-card span, .company-card a { overflow-wrap: anywhere; color: #dce8e1; text-decoration: none; }
.company-card a:hover { color: #fff; text-decoration: underline; }
.main-panel { min-width: 0; padding: 26px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 4px; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; } h1 { margin-bottom: 0; font-size: clamp(28px, 4vw, 44px); line-height: 1; letter-spacing: 0; } h2 { margin-bottom: 0; font-size: 24px; letter-spacing: 0; } h3 { margin-bottom: 14px; font-size: 15px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.primary-button, .danger-button, .secondary-button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border: 0; border-radius: var(--radius); padding: 0 14px; font-weight: 800; }
.primary-button { background: var(--teal); color: white; } .primary-button:hover { background: var(--teal-dark); }
.danger-button { background: var(--red-soft); color: var(--red); } .danger-button:hover { background: #ffe0dc; }
.secondary-button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.secondary-button:hover, .secondary-button.is-enabled { border-color: rgba(15, 118, 110, .35); background: #e8f6f4; color: var(--teal); }
.settings-button { min-width: 104px; }
.install-button { min-width: 118px; }
.icon-button { width: 42px; padding: 0; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.icon-button:hover, .ghost:hover { border-color: #b7c9c1; background: var(--panel-soft); } .ghost { background: transparent; } .file-button input { display: none; }
button:disabled, input:disabled, select:disabled, textarea:disabled, .file-button.is-disabled { cursor: not-allowed; opacity: .58; }
[data-icon] { display: inline-flex; width: 18px; height: 18px; flex: 0 0 18px; } [data-icon] svg { width: 18px; height: 18px; stroke: currentColor; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { min-height: 98px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--panel); }
.stat span { display: block; color: var(--muted); font-size: 13px; } .stat strong { display: block; margin-top: 10px; font-size: 30px; line-height: 1; overflow-wrap: anywhere; }
.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 250px; gap: 12px; margin-bottom: 18px; }
.search-field { display: flex; align-items: center; gap: 10px; min-height: 46px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; background: var(--panel); color: var(--muted); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.toolbar select, label input, label select, label textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); }
.toolbar select, label input, label select { min-height: 46px; padding: 0 12px; } label textarea { min-height: 86px; resize: vertical; padding: 10px 12px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 430px); gap: 18px; align-items: start; }
.vehicle-list { display: grid; gap: 12px; }
.vehicle-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.vehicle-card.is-selected { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.vehicle-main { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px; }
.plate { display: inline-flex; width: 100%; max-width: 168px; min-height: 46px; align-items: center; justify-content: center; border: 2px solid #17211d; border-left: 14px solid #1d4ed8; border-radius: 4px; background: #fff; font-size: 20px; font-weight: 900; letter-spacing: 0; color: #111827; }
.vehicle-title { display: grid; gap: 4px; min-width: 0; } .vehicle-title strong { overflow-wrap: anywhere; font-size: 18px; } .vehicle-title span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 6px; }
.document-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.doc-tile { display: grid; gap: 6px; min-height: 116px; padding: 14px; background: #fbfdfb; } .doc-tile strong { font-size: 13px; } .doc-tile span { color: var(--muted); font-size: 13px; }
.status-pill { justify-self: start; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-style: normal; font-weight: 800; }
.status-ok { background: var(--green-soft); color: var(--green); } .status-due { background: var(--amber-soft); color: var(--amber); } .status-expired { background: var(--red-soft); color: var(--red); } .status-empty { background: #edf0f2; color: #64748b; }
.editor-panel { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
form { display: grid; gap: 18px; padding: 18px; } .editor-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.form-section { border-top: 1px solid var(--line); padding-top: 18px; } .field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; } label.wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 18px; }
.empty-state { display: grid; place-items: center; min-height: 280px; border: 1px dashed #b8c8bf; border-radius: var(--radius); background: rgba(255,255,255,.62); color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 18px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 10; max-width: min(420px, calc(100vw - 36px)); border-radius: var(--radius); padding: 12px 14px; background: #17211d; color: #fff; box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; pointer-events: none; transition: 180ms ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.install-prompt { position: fixed; right: 18px; bottom: 18px; z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; width: min(560px, calc(100vw - 36px)); border: 1px solid rgba(15,118,110,.28); border-radius: var(--radius); padding: 14px; background: var(--panel); box-shadow: var(--shadow); }
.install-prompt strong, .install-prompt span { display: block; overflow-wrap: anywhere; }
.install-prompt span { margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.install-prompt-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 1080px) { .app-shell { grid-template-columns: 1fr; } .sidebar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr; gap: 14px; padding: 14px; } .nav-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } .sidebar-footer { display: none; } .content-grid { grid-template-columns: 1fr; } .editor-panel { position: static; max-height: none; } }
@media (max-width: 760px) { .main-panel { padding: 18px 12px; } .topbar { display: grid; align-items: stretch; } .topbar-actions { justify-content: stretch; } .topbar-actions .primary-button, .topbar-actions .secondary-button { flex: 1; } .stats-grid, .toolbar, .document-grid, .vehicle-main, .field-grid, .nav-list, .install-prompt { grid-template-columns: 1fr; } .install-prompt { align-items: stretch; } .install-prompt-actions { justify-content: stretch; } .install-prompt-actions button { flex: 1; } .document-grid { gap: 0; } .doc-tile + .doc-tile { border-top: 1px solid var(--line); } .card-actions { justify-content: flex-end; } h1 { font-size: 30px; line-height: 1.05; } }

.attachment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.attachment-box { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fbfdfb; }
.attachment-box.is-disabled { opacity: .72; }
.attachment-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.attachment-head strong { font-size: 13px; }
.attachment-upload { display: inline-flex; width: auto; min-height: 36px; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; background: var(--panel); color: var(--teal); font-size: 12px; font-weight: 800; }
.attachment-upload:hover { border-color: #b7c9c1; background: var(--panel-soft); }
.attachment-upload input { display: none; }
.attachment-upload:has(input:disabled) { cursor: not-allowed; color: var(--muted); }
.attachment-list { display: grid; gap: 8px; min-height: 28px; }
.attachment-empty { color: var(--muted); font-size: 12px; }
.attachment-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; border-radius: var(--radius); background: #f2f6f3; padding: 8px; }
.attachment-meta { min-width: 0; display: grid; gap: 2px; }
.attachment-meta strong, .attachment-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-meta strong { color: var(--ink); font-size: 12px; }
.attachment-meta span { color: var(--muted); font-size: 11px; }
.attachment-actions { display: flex; gap: 4px; }
.attachment-actions .icon-button { width: 32px; min-height: 32px; }
@media (max-width: 760px) { .attachment-grid { grid-template-columns: 1fr; } }

.icon-button.is-enabled { border-color: rgba(15, 118, 110, .35); background: #e8f6f4; color: var(--teal); }
.icon-button.is-blocked { border-color: rgba(180, 35, 24, .28); background: var(--red-soft); color: var(--red); }

.email-alert-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; border: 1px solid #f4d58d; border-radius: var(--radius); padding: 12px 14px; background: #fff7e6; color: #7a4b00; }
.email-alert-banner strong { color: #5f3700; }
.email-alert-banner button { flex: 0 0 auto; }
@media (max-width: 760px) { .email-alert-banner { align-items: stretch; flex-direction: column; } }

.security-panel[hidden] { display: none; }
.security-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(23, 33, 29, .56); }
.security-dialog { position: fixed; inset: 24px 24px 24px auto; z-index: 31; display: flex; flex-direction: column; width: min(760px, calc(100vw - 48px)); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.security-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 18px; background: var(--panel); }
.security-header span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.settings-mode-notice { display: grid; gap: 4px; margin: 18px 18px 0; border-radius: var(--radius); padding: 12px 14px; font-size: 13px; font-weight: 700; }
.settings-mode-notice strong, .settings-mode-notice span { display: block; }
.settings-mode-notice.ok { background: var(--green-soft); color: var(--green); }
.settings-mode-notice.warn { background: var(--amber-soft); color: var(--amber); }
.settings-mode-notice.bad { background: var(--red-soft); color: var(--red); }
.security-summary { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fbfdfb; }
.security-summary article { display: grid; gap: 6px; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--panel); }
.security-summary span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.security-summary strong { overflow-wrap: anywhere; font-size: 14px; }
.security-block { display: grid; gap: 12px; border-bottom: 1px solid var(--line); padding: 18px; }
.security-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.security-warning-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.security-warning-list li { border-radius: var(--radius); padding: 10px 12px; color: var(--ink); font-size: 13px; font-weight: 800; }
.security-warning-list li.ok { background: var(--green-soft); color: var(--green); }
.security-warning-list li.warn { background: var(--amber-soft); color: var(--amber); }
.security-warning-list li.bad { background: var(--red-soft); color: var(--red); }
.permission-row, .permission-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.permission-tag { display: inline-flex; min-height: 26px; align-items: center; border-radius: 999px; padding: 5px 9px; background: #edf0f2; color: #475569; font-size: 12px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.permission-check { display: inline-flex; width: auto; min-height: 34px; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; background: #fbfdfb; color: var(--ink); font-size: 12px; font-weight: 800; }
.permission-check input, .inline-check input { width: auto; min-height: auto; }
.backup-command-row, .backup-actions, .user-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.backup-list, .user-list { display: grid; gap: 10px; }
.backup-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fbfdfb; }
.backup-row strong, .backup-row span { display: block; overflow-wrap: anywhere; }
.backup-row span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.security-empty { border: 1px dashed #b8c8bf; border-radius: var(--radius); padding: 14px; color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; }
.role-matrix { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.role-matrix article, .company-settings-card { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fbfdfb; }
.role-matrix article strong, .company-settings-card strong { color: var(--ink); }
.role-matrix article span, .company-settings-card span { overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }
.role-matrix article > span { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.role-matrix article > span .permission-tag { color: #475569; font-size: 12px; }
.user-create, .user-card { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fbfdfb; }
.user-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.user-card-head strong, .user-card-head span { display: block; overflow-wrap: anywhere; }
.user-card-head span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.notification-admin { display: grid; gap: 12px; }
.notification-targets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.notification-targets fieldset { display: grid; gap: 8px; min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fbfdfb; }
.notification-targets legend { color: var(--ink); font-size: 13px; font-weight: 900; }
.notification-target-list { display: flex; flex-wrap: wrap; gap: 8px; }
.notification-history { display: grid; gap: 8px; }
.notification-row { display: grid; gap: 5px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #fbfdfb; }
.notification-row strong, .notification-row span { display: block; overflow-wrap: anywhere; }
.notification-row span { color: var(--muted); font-size: 12px; }
.field-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.inline-check { align-content: end; grid-auto-flow: column; justify-content: start; align-items: center; }
@media (max-width: 860px) {
  .security-dialog { inset: 12px; width: auto; max-height: calc(100vh - 24px); }
  .security-summary, .field-grid.compact, .role-matrix, .notification-targets { grid-template-columns: 1fr; }
  .backup-row { grid-template-columns: 1fr; }
}
