:root {
  --primary: #0d47a1;
  --primary-light: #1976d2;
  --background: #f5f5f5;
  --text: #212121;
  --muted: #757575;
  --line: #dedede;
  --pending: #757575;
  --progress: #ef8f00;
  --review: #1976d2;
  --approved: #388e3c;
  --failed: #d32f2f;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
.topbar { position: sticky; top: 0; z-index: 3; background: var(--primary); color: white; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px max(16px, calc((100% - 1120px) / 2)); box-shadow: 0 2px 6px #0002; }
.topbar h1 { font-size: 1.1rem; margin: 0; flex: 1; }
.topbar button { color: white; border: 0; background: transparent; padding: 8px; }
.user-badge { font-size: .85rem; white-space: nowrap; opacity: .95; }
.container { width: min(1120px, 100%); margin: 0 auto; padding: 20px 16px 70px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--muted); margin: 4px 0 18px; font-size: .9rem; }
.crumbs button { border: 0; padding: 0; background: none; color: var(--primary); }
.toolbar, .filters, .actions, .stats, .photo-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.toolbar { justify-content: space-between; margin-bottom: 14px; }
.toolbar h2, .section h2 { font-size: 1.05rem; margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 12px; }
.card, .section, .login-card { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 16px; box-shadow: 0 1px 3px #0000000a; }
.node-card { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.node-card:hover { box-shadow: 0 4px 15px #0002; transform: translateY(-1px); }
.node-card h3, .vehicle-card h3 { margin: 0 0 5px; font-size: 1rem; }
.muted { color: var(--muted); font-size: .88rem; }
.card-actions { display: flex; gap: 6px; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 13px; border: 1px solid #c8c8c8; border-radius: 7px; background: white; color: var(--text); text-decoration: none; }
.btn.primary { color: white; background: var(--primary); border-color: var(--primary); }
.btn.danger { color: #b71c1c; }
.btn.small { padding: 6px 9px; font-size: .86rem; }
.btn.active { color: white; background: var(--primary-light); border-color: var(--primary-light); }
.input, input, select, textarea { width: 100%; padding: 10px 11px; border: 1px solid #bdbdbd; border-radius: 7px; background: white; }
.input:focus, input:focus, select:focus, textarea:focus { outline: 2px solid #1976d244; border-color: var(--primary-light); }
.field { display: grid; gap: 5px; margin: 0 0 12px; }
.field label { color: #424242; font-size: .9rem; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); padding: 25px; }
.login-card h1 { margin: 0 0 5px; color: var(--primary); }
.login-card form { margin-top: 22px; }
.section { margin: 15px 0; }
.stats { margin: 12px 0; }
.stat { min-width: 88px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: white; }
.stat strong { display: block; font-size: 1.15rem; }
.filters { margin: 14px 0; }
.filters .search { flex: 1 1 190px; }
.vehicle-card { display: flex; align-items: center; gap: 12px; }
.vehicle-info { flex: 1; min-width: 0; }
.status { display: inline-block; font-size: .78rem; font-weight: 650; border-radius: 99px; padding: 4px 9px; background: #eee; color: var(--pending); }
.status.in-progress { background: #fff3e0; color: #a45b00; }
.status.pending-audit { background: #e3f2fd; color: #07599f; }
.status.audited { background: #e8f5e9; color: #246c28; }
.status.audit-failed { background: #ffebee; color: #b71c1c; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.check-row { display: flex; flex-wrap: wrap; gap: 18px; margin: 12px 0; }
.check-row label { display: inline-flex; align-items: center; gap: 7px; }
.check-row input { width: auto; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.photo { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fafafa; }
.photo img { width: 100%; height: 145px; object-fit: cover; display: block; }
.photo .photo-view { height: auto; max-height: 80vh; object-fit: contain; }
.photo-action { display: inline-flex; gap: 5px; align-items: center; }
.proof-preview { display: block; max-width: 240px; max-height: 180px; object-fit: contain; margin-top: 8px; }
.photo p { margin: 7px 9px; font-size: .8rem; overflow-wrap: anywhere; }
.camera { width: min(600px, 100%); background: #111; border-radius: 9px; }
.camera video { display: block; width: 100%; max-height: 55vh; object-fit: contain; }
.offline { background: #fff3cd; color: #6b4c00; text-align: center; padding: 8px 12px; font-size: .88rem; }
.empty { padding: 28px 14px; color: var(--muted); text-align: center; background: white; border: 1px dashed #bbb; border-radius: 9px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: .9rem; }
.vehicle-table { min-width: 760px; }
.vehicle-table tbody tr { cursor: pointer; }
.vehicle-table tbody tr:hover { background: #f3f7fc; }
dialog { width: min(600px, calc(100% - 24px)); max-height: 90vh; overflow: auto; border: 0; border-radius: 10px; padding: 20px; box-shadow: 0 12px 50px #0004; }
dialog::backdrop { background: #0007; }
#toast { position: fixed; right: 16px; bottom: 16px; z-index: 8; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; background: #263238; color: white; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
.loading { padding: 20px; }
@media (max-width: 600px) {
  .topbar { gap: 5px; padding: 8px 10px; }
  .user-badge { font-size: .75rem; }
  .container { padding: 14px 11px 55px; }
  .form-grid { grid-template-columns: 1fr; }
  .vehicle-card { align-items: flex-start; }
  .stats { gap: 6px; }
  .stat { min-width: 75px; padding: 7px; }
}
