:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1d2733;
  --muted: #5d6b7a;
  --line: #d6dde4;
  --brand: #1f5f8b;
  --brand-dark: #174a6d;
  --in: #1d7a46;
  --out: #a8521a;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --warn-bg: #fff4d6;
  --ok-bg: #e7f5ec;
  --radius: 8px;
  font-size: 17px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", "Nirmala UI", Latha, Tahoma, Arial, "Noto Sans Arabic", "Noto Sans Tamil", sans-serif; line-height: 1.45;
}
[dir="auto"] { unicode-bidi: plaintext; }
html[lang="ar"] body { font-size: 1.05rem; }

/* header, language switch and navigation */
.top { background: var(--brand); color: #fff; padding: 10px 16px 0; }
.brand-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.brand { font-size: 1.35rem; font-weight: 700; }
.langs { display: flex; gap: 4px; }
button.lang { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.55); min-height: 36px; padding: 4px 14px; font-size: .98rem; }
button.lang:hover { background: var(--brand-dark); }
button.lang.on { background: #fff; color: var(--brand); border-color: #fff; }
/* menu: one slim bar with three dropdown groups */
nav { display: flex; flex-wrap: wrap; gap: 2px; }
.menu { position: relative; }
.menu-btn {
  background: transparent; color: #fff; border: none; border-radius: 8px 8px 0 0; min-height: 42px;
  padding: 8px 18px; font-size: 1.05rem; font-weight: 600; gap: 6px;
}
.menu-btn:hover, .menu:hover .menu-btn, .menu.open .menu-btn { background: var(--brand-dark); }
.menu.active .menu-btn { background: var(--bg); color: var(--brand); }
.caret { font-size: .8em; opacity: .8; }
.menu-list {
  display: none; position: absolute; top: 100%; inset-inline-start: 0; z-index: 60; min-width: 230px;
  background: #fff; border: 1px solid var(--line); border-radius: 0 8px 8px 8px; box-shadow: 0 10px 24px rgba(0,0,0,.18);
  padding: 6px 0;
}
.menu:hover .menu-list, .menu.open .menu-list, .menu:focus-within .menu-list { display: block; }
.menu-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 18px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.02rem;
}
.menu-list a:hover { background: #eaf2f8; color: var(--brand); }
.menu-list a.active { color: var(--brand); background: #f1f6fa; border-inline-start: 4px solid var(--brand); padding-inline-start: 14px; }
@media (hover: none) { .menu:hover .menu-list { display: none; } .menu.open .menu-list { display: block; } }

main { padding: 18px 20px 60px; max-width: 1400px; margin: 0 auto; }
h1 { font-size: 1.6rem; margin: 4px 0 14px; }
h2 { font-size: 1.25rem; margin: 22px 0 10px; }
h3 { font-size: 1.08rem; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }

/* banner */
#banner .warn-box { margin: 0; border-radius: 0; }
.warn-box { background: var(--danger-bg); color: var(--danger); border: 2px solid var(--danger); padding: 12px 18px;
  font-weight: 600; font-size: 1.05rem; border-radius: var(--radius); margin-bottom: 14px; }
.warn-box a { color: var(--danger); }
.info-box { background: var(--warn-bg); border: 1px solid #e6c15a; padding: 10px 14px; border-radius: var(--radius); margin: 10px 0; }
.ok-box { background: var(--ok-bg); border: 1px solid #9ccfae; padding: 10px 14px; border-radius: var(--radius); margin: 10px 0; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 4px; position: relative; }
.field.wide { grid-column: 1 / -1; }
.field label, .lbl { font-weight: 600; }
.req::after { content: " *"; color: var(--danger); }
input, select, textarea {
  font: inherit; font-size: 1.05rem; padding: 10px 12px; border: 1px solid #b8c3ce; border-radius: 6px;
  background: #fff; color: var(--ink); min-height: 46px; width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid #9cc3e0; border-color: var(--brand); }
input[readonly], input:disabled, select:disabled { background: #eef1f4; color: #3d4955; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); border-width: 2px; }
.err { color: var(--danger); font-weight: 600; font-size: .93rem; min-height: 0; }
.hint { color: var(--muted); font-size: .9rem; }

button, .btn {
  font: inherit; font-weight: 600; font-size: 1.02rem; border: 1px solid #9aa8b5; background: #fff; color: var(--ink);
  padding: 9px 16px; border-radius: 6px; cursor: pointer; min-height: 44px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
button:hover, .btn:hover { background: #eef3f7; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-dark); }
button.big { font-size: 1.25rem; padding: 14px 34px; min-height: 58px; min-width: 220px; }
button.danger { color: var(--danger); border-color: #d9a29e; }
button.danger:hover { background: var(--danger-bg); }
button.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
button.small, .btn.small { font-size: .9rem; padding: 5px 10px; min-height: 34px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.toolbar .field { min-width: 180px; }
.toolbar .grow { flex: 1 1 260px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; min-height: 44px; }
.check input { width: 22px; height: 22px; min-height: 0; }

/* chips (filter buttons) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; align-items: center; }
.chip { border-radius: 20px; padding: 6px 14px; min-height: 38px; font-size: .95rem; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.main { font-weight: 700; }
.chip-sep { width: 1px; height: 28px; background: var(--line); margin: 0 4px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .98rem; }
th, td { padding: 9px 11px; border-bottom: 1px solid #e6ebef; text-align: start; vertical-align: top; }
th { background: #eaf0f5; font-weight: 700; position: sticky; top: 0; white-space: nowrap; }
td.num, th.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f1f6fa; }
tr.neg td { background: var(--danger-bg); }
tr.neg td.stock { color: var(--danger); font-weight: 800; }
td.stock { font-weight: 700; }
tr.inactive td { color: #8a96a3; font-style: italic; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .85rem; font-weight: 700; }
.tag.in { background: #dff1e6; color: var(--in); }
.tag.out { background: #fbe9dc; color: var(--out); }
.tag.off { background: #e8ebee; color: #66717c; }
.empty { padding: 18px; color: var(--muted); text-align: center; }
.date { white-space: nowrap; }

/* groups on the vehicles page */
.group-main { margin-top: 18px; }
.group-main > h2 { border-bottom: 3px solid var(--brand); padding-bottom: 4px; }
.group-sub { margin: 10px 0 18px; }
.group-sub h3 { display: flex; gap: 10px; align-items: baseline; }
.count { background: #e4ecf3; color: var(--brand-dark); border-radius: 12px; padding: 1px 9px; font-size: .85rem; }

/* autocomplete */
.ac-list {
  position: absolute; top: 100%; inset-inline: 0; z-index: 30; background: #fff; border: 1px solid #9aa8b5; border-radius: 0 0 6px 6px;
  max-height: 340px; overflow-y: auto; box-shadow: 0 8px 18px rgba(0,0,0,.14);
}
.ac-item { padding: 10px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #eef1f4; }
.ac-item:hover, .ac-item.sel { background: #e4eef7; }
.ac-item .meta { color: var(--muted); white-space: nowrap; font-size: .92rem; }
.ac-item .meta.neg { color: var(--danger); font-weight: 700; }
.stock-note { font-weight: 600; }
.stock-note.neg { color: var(--danger); }

/* modal and toast */
.modal-back { position: fixed; inset: 0; background: rgba(15, 25, 35, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 10px; max-width: 620px; width: 100%; padding: 20px 22px; box-shadow: 0 12px 40px rgba(0,0,0,.3); max-height: 92vh; overflow-y: auto; }
.modal h2 { margin-top: 0; }
.modal.danger h2 { color: var(--danger); }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1f3b2b; color: #fff;
  padding: 12px 22px; border-radius: 8px; font-weight: 600; font-size: 1.05rem; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 200; }
#toast.show { opacity: 1; }
#toast.bad { background: var(--danger); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { font-weight: 600; color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
details summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.logbox { font-family: Consolas, monospace; font-size: .85rem; background: #f7f9fb; border: 1px solid var(--line); padding: 8px; max-height: 260px; overflow: auto; white-space: pre-wrap; }
.back-link { display: inline-block; margin-bottom: 8px; }
.print-only { display: none; }

@media (max-width: 760px) {
  :root { font-size: 16px; }
  main { padding: 12px 10px 50px; }
  .menu-btn { padding: 8px 12px; }
  .two-col { grid-template-columns: 1fr; }
  button.big { width: 100%; }
}

@media print {
  .no-print, nav, #banner, .toolbar, .actions, button { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; font-size: 12pt; }
  main { padding: 0; max-width: none; }
  .table-wrap, .panel { border: none; padding: 0; }
  th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr { page-break-inside: avoid; }
}

/* sign-in, user menu, badges */
.head-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.who { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.who-name { font-weight: 600; margin-inline-end: 4px; }
.badge { background: #d93025; color: #fff; border-radius: 10px; padding: 0 7px; font-size: .8rem; margin-inline-start: 6px; font-weight: 700; }

.panel.narrow { max-width: 460px; margin: 30px auto; }
.panel.narrow .field { margin-bottom: 12px; }
code { background: #eef1f4; padding: 2px 6px; border-radius: 4px; font-size: 1.02rem; }

tr.recent td { background: #fff4d6; }
.tag.soon { background: #fff0c2; color: #8a5a00; }
