/* ===========================================================================
   GARAGE OPERATIONS & EFFICIENCY SYSTEM — design tokens
   Built for a garage floor: high contrast, large touch targets, readable
   outdoors, red accent (mechanic-uniform red) used sparingly for action/status.
   =========================================================================== */

:root {
  --ink:        #16181B;
  --ink-soft:   #4B5157;
  --paper:      #F2F3F1;
  --panel:      #FFFFFF;
  --line:       #DEE1DD;
  --brand:      #C81E1E;      /* mechanic-uniform red — action/critical accent only */
  --brand-dark: #9A1616;
  --dark:       #14171A;      /* sidebar / chrome */
  --dark-soft:  #262B30;
  --ok:         #1F7A3F;
  --ok-bg:      #E7F5EC;
  --warn:       #B7791F;
  --warn-bg:    #FBF1DF;
  --danger-bg:  #FBE9E7;
  --info-bg:    #E9EEF7;
  --info:       #2A4E8C;
  --radius:     6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }

/* ---------- App shell -------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--dark);
  color: #E7E9EC;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.sidebar-brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 12px;
}
.sidebar-brand .name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.sidebar-brand .tag { font-size: .78rem; color: #9AA1A8; margin-top: 2px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: var(--radius);
  color: #C7CBD1; text-decoration: none; font-size: .94rem;
}
.sidebar nav a:hover { background: var(--dark-soft); color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 12px 20px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { font-size: .85rem; color: #9AA1A8; padding-top: 12px; }
.sidebar-user strong { color: #fff; display: block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar .greeting { font-weight: 600; font-size: 1.05rem; }
.content { padding: 24px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ---------- Cards -------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 0 0 4px; }
.card-row { display: flex; gap: 16px; flex-wrap: wrap; }
.card-row > .card { flex: 1 1 200px; }

.stat { }
.stat .value { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; font-family: var(--mono); }
.stat .label { color: var(--ink-soft); font-size: .88rem; margin-top: 2px; }

/* ---------- Buttons / actions ------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: var(--radius); padding: 12px 18px; font-weight: 600;
  cursor: pointer; text-decoration: none; font-size: .95rem;
  min-height: 46px;
}
.btn:hover { background: #F3F4F2; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 18px 20px; font-size: 1.05rem; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }

/* big tappable action tiles for mechanic dashboard */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; min-height: 92px; text-decoration: none; color: var(--ink);
}
.tile:hover { border-color: var(--brand); }
.tile .icon { font-size: 1.5rem; }
.tile .label { font-weight: 700; font-size: 1rem; }

/* ---------- Forms --------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); min-height: 46px;
}
.field textarea { min-height: 90px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
.search-box { position: relative; }
.search-results { border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--radius) var(--radius); background: var(--panel); max-height: 320px; overflow-y: auto; }
.search-results .result { padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.search-results .result:hover { background: var(--paper); }

/* ---------- Tables / lists ------------------------------------------ */
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }

.job-list { display: flex; flex-direction: column; gap: 10px; }
.job-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; text-decoration: none; color: var(--ink);
}
.job-row:hover { border-color: var(--brand); }
.job-row .job-main .job-number { font-family: var(--mono); font-size: .82rem; color: var(--ink-soft); }
.job-row .job-main .job-title { font-weight: 700; margin-top: 2px; }
.job-row .job-main .job-sub { font-size: .87rem; color: var(--ink-soft); margin-top: 2px; }

/* ---------- Badges / status ------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
}
.badge-neutral { background: #ECEDEB; color: var(--ink-soft); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-danger { background: var(--danger-bg); color: var(--brand-dark); }
.badge-info { background: var(--info-bg); color: var(--info); }

.attention-list { display: flex; flex-direction: column; gap: 8px; }
.attention-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: var(--radius); background: var(--danger-bg);
  border-left: 3px solid var(--brand);
}
.attention-item .label { font-weight: 700; font-family: var(--mono); font-size: .88rem; }
.attention-item .detail { color: var(--ink-soft); font-size: .87rem; }

/* ---------- Timeline -------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--line);
}
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 2px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--brand);
}
.timeline .time { font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); }
.timeline .desc { font-weight: 600; margin-top: 2px; }
.timeline .actor { font-size: .82rem; color: var(--ink-soft); }

/* ---------- Login page ------------------------------------------------ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--dark); padding: 20px; }
.login-card { background: var(--panel); border-radius: 10px; padding: 36px 32px; width: 100%; max-width: 380px; }
.login-card .brand-mark { width: 44px; height: 44px; border-radius: 8px; background: var(--brand); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; margin-bottom: 18px; }
.login-card h1 { font-size: 1.3rem; margin: 0 0 4px; }
.login-card p.sub { color: var(--ink-soft); margin: 0 0 24px; font-size: .92rem; }
.alert { padding: 12px 14px; border-radius: var(--radius); font-size: .9rem; margin-bottom: 16px; }
.alert-error { background: var(--danger-bg); color: var(--brand-dark); }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.demo-hint { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--ink-soft); }
.demo-hint code { background: var(--paper); padding: 2px 6px; border-radius: 4px; font-family: var(--mono); }

/* ---------- Connection state banner (offline-first §41) --------------- */
.conn-banner { display: none; padding: 8px 24px; font-size: .84rem; font-weight: 600; text-align: center; }
.conn-banner.show { display: block; }
.conn-offline { background: var(--warn-bg); color: var(--warn); }
.conn-syncing { background: var(--info-bg); color: var(--info); }

/* ---------- Utility ----------------------------------------------------- */
.muted { color: var(--ink-soft); }
.mono { font-family: var(--mono); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 12px; }
.empty-state { padding: 32px; text-align: center; color: var(--ink-soft); }

/* ---------- Bottom nav (mobile, §47) ----------------------------------- */
.bottom-nav { display: none; }

@media (max-width: 820px) {
  .sidebar { display: none; }
  .content { padding: 16px; padding-bottom: 88px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 66px;
    background: var(--dark); border-top: 1px solid rgba(255,255,255,.08); z-index: 20;
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: #9AA1A8; text-decoration: none; font-size: .68rem; font-weight: 600;
  }
  .bottom-nav a.active { color: #fff; }
  .bottom-nav a .icon { font-size: 1.25rem; }
  .card-row { flex-direction: column; }
  .card-row > .card { flex: 1 1 auto; }
}
