:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18212f;
  --muted: #5d6878;
  --line: #d9dee7;
  --accent: #176d6a;
  --accent-dark: #0f5553;
  --ok: #1d7f45;
  --warning: #d69e00;
  --overdue: #b42318;
}
* { box-sizing: border-box; }
body { margin: 0; direction: rtl; text-align: right; background: var(--bg); color: var(--text); font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-feature-settings: normal; font-variation-settings: normal; -webkit-tap-highlight-color: transparent; line-height: 1.45; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px clamp(16px, 4vw, 48px); background: #18212f; color: #fff; }
.topbar h1 { margin: 0; font-size: 24px; }
.topbar p { margin: 4px 0 0; color: #c8d0db; }
nav { display: flex; gap: 8px; flex-wrap: wrap; }
nav a, .button, button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 14px; border: 1px solid transparent; border-radius: 6px; background: var(--accent); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
nav a { background: transparent; border-color: #3a4658; }
nav a.active, nav a:hover, .button:hover, button:hover { background: var(--accent-dark); }
.button.secondary { color: var(--text); background: #eef1f5; border-color: var(--line); }
main { width: min(1180px, calc(100% - 24px)); margin: 16px auto 40px; }
.panel, .status-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(24, 33, 47, 0.05); }
.vehicle-panel, .section-head, .card-head, .actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel + .panel, .grid + .panel { margin-top: 24px; }
h2 { margin: 0 0 14px; font-size: 20px; }
.vehicle-panel h2, .card-head h2, .section-head h2 { margin: 0; }
.vehicle-panel p { margin: 4px 0 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
dl { margin: 18px 0 0; }
dl div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; text-align: left; }
.badge { border-radius: 999px; padding: 4px 9px; color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--ok); }
.badge.warning, .badge.due { background: var(--warning); color: #2f2400; }
.badge.overdue { background: var(--overdue); }
form { margin: 0; }
.inline-form, .record-form, .settings-form { display: grid; gap: 14px; }
.inline-form { grid-template-columns: minmax(180px, 260px) auto; align-items: end; }
.record-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-form { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
input, textarea { width: 100%; border: 1px solid #c5ccd8; border-radius: 6px; padding: 10px 12px; color: var(--text); font: inherit; font-weight: 400; background: #fff; }
label small { color: var(--muted); font-weight: 400; line-height: 1.5; }
textarea { resize: vertical; }
.checks, .wide, .actions { grid-column: 1 / -1; }
.checks { display: flex; gap: 16px; flex-wrap: wrap; }
.checks label { display: inline-flex; align-items: center; color: var(--text); }
.checks input { width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 12px 10px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; }
.yes { color: var(--ok); font-weight: 700; }
.no { color: var(--muted); }
.row-actions { display: flex; flex-direction: row; gap: 10px; align-items: center; }
.row-actions a, .link-button { color: var(--accent); font-weight: 700; }
.link-button { min-height: auto; padding: 0; border: 0; background: transparent; }
.link-button:hover { background: transparent; color: var(--accent-dark); }
.empty { color: var(--muted); }
.user-email { display: inline-flex; align-items: center; padding: 0 6px; color: #c8d0db; font-size: 14px; }
.logout-button { background: transparent; border-color: #3a4658; }
.auth-layout {
  min-height: 76vh;
  display: grid;
  justify-content: center;
  align-items: start;
  padding-top: 12px;
  background: #fff;
}
.login-panel {
  width: 506px;
  max-width: 100%;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.auth-heading {
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 34px;
}
.auth-brand { flex: 0 0 auto; display: inline-flex; line-height: 0; }
.auth-brand img { display: block; width: 82px; height: auto; object-fit: contain; }
.auth-copy { flex: 1 1 auto; min-width: 0; text-align: right; }
.auth-title { margin: 0; font-size: 34px; line-height: 1.15; }
.login-panel p, .auth-copy p { margin: 0 0 18px; color: var(--muted); }
.auth-copy p { margin: 8px 0 0; }
.auth-message {
  padding: 12px 14px;
  border: 1px solid #e3a008;
  border-radius: 8px;
  background: #fff7d6;
  color: #713f12 !important;
  font-weight: 700;
  line-height: 1.65;
  box-shadow: 0 1px 2px rgba(113, 63, 18, .08);
}
.auth-message:empty { display: none; }
.google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  margin-top: 10px;
  min-height: 48px;
  padding: 12px 14px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
}
.google-icon { width: 19px; height: 19px; flex: 0 0 auto; }
.google-button.disabled { opacity: .72; }
.auth-divider { height: 1px; background: var(--line); margin: 28px 0 20px; }
.login-panel label { display: block; width: 100%; margin-bottom: 14px; }
.login-panel [hidden], .google-button[hidden], .auth-divider[hidden] { display: none !important; }
.login-panel input {
  display: block;
  width: 100%;
  min-height: 64px;
  border-radius: 8px;
  font-size: 16px;
  padding: 21px 14px 10px;
}
.login-panel .primary {
  width: 100%;
  min-height: 50px;
  margin-top: 2px;
  font-weight: 700;
  font-size: 18px;
}
.auth-link {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  padding: 12px 0 0;
  text-decoration: none;
}
.auth-link:hover,
.auth-link:focus-visible {
  background: transparent;
  color: var(--accent);
}
.auth-link.inline { display: inline; padding: 0; }
.auth-footer {
  border-top: 1px solid var(--line);
  margin: 18px 0 0;
  padding-top: 18px;
  text-align: center;
  color: var(--text);
}
@media (max-width: 860px) {
  .topbar, .vehicle-panel, .section-head, .card-head { align-items: flex-start; flex-direction: column; }
  .grid, .record-form, .settings-form, .inline-form, .auth-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { gap: 14px; padding: 16px 12px; }
  .topbar h1 { font-size: 20px; }
  .topbar p { font-size: 14px; }
  nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  nav a { min-height: 42px; padding: 8px 6px; font-size: 14px; }
  main { width: calc(100% - 16px); margin: 8px auto 24px; }
  .panel, .status-card { padding: 14px; }
  .panel + .panel, .grid + .panel { margin-top: 12px; }
  .grid { gap: 10px; margin-top: 10px; }
  .card-head { gap: 8px; }
  dl { margin-top: 12px; }
  dl div { align-items: flex-start; padding: 8px 0; }
  dt, dd { font-size: 14px; }
  .checks { display: grid; gap: 10px; }
  .actions { display: grid; grid-template-columns: 1fr; }
  .actions .button, .actions button, .inline-form button, .settings-form button { width: 100%; }
  table, thead, tbody, tr, th, td { display: block; }
  table { min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; background: #fff; }
  td { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; padding: 7px 0; border: 0; }
  td::before { content: attr(data-label); color: var(--muted); font-weight: 700; }
  .row-actions { display: grid; grid-template-columns: 112px minmax(0, 1fr); }
  .row-actions a, .row-actions form { grid-column: 2; }
}