/* LotMetrics Shared Stylesheet — light + dark mode via data-theme */

:root {
  --logo-h:        52px;  /* 167×52 — matches natural logo aspect ratio */
  --bg:            #f4f6f9;
  --surface:       #ffffff;
  --surface2:      #fafbfc;
  --border:        #e2e6ea;
  --border-light:  #f0f0f0;
  --text:          #1a1a2e;
  --text-muted:    #555;
  --text-dim:      #888;
  --accent:        #1a56db;
  --accent-hover:  #1240a8;
  --accent-soft:   #eff6ff;
  --accent-text:   #1d4ed8;
  --green:         #065f46;
  --green-soft:    #d1fae5;
  --red:           #991b1b;
  --red-soft:      #fee2e2;
  --yellow:        #92400e;
  --yellow-soft:   #fef3c7;
  --input-border:  #d1d5db;
  --shadow:        0 1px 4px rgba(0,0,0,0.06);
  --nav-h:         44px;
}

[data-theme="dark"] {
  --bg:            #0e1117;
  --surface:       #1a1d27;
  --surface2:      #141720;
  --border:        #2d3248;
  --border-light:  #222636;
  --text:          #e2e5f0;
  --text-muted:    #9aa0ba;
  --text-dim:      #6b7280;
  --accent:        #4f8ef7;
  --accent-hover:  #3a78e8;
  --accent-soft:   #1a2340;
  --accent-text:   #7eb0ff;
  --green:         #34d399;
  --green-soft:    #0d2b20;
  --red:           #f87171;
  --red-soft:      #2b1212;
  --yellow:        #fcd34d;
  --yellow-soft:   #2b2004;
  --input-border:  #3d4460;
  --shadow:        0 1px 4px rgba(0,0,0,0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s, color 0.2s;
}

/* ── Header ──────────────────────────────────────────────────────── */
.lm-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.lm-header img   { height: var(--logo-h, 34px); }
.lm-header h1    { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.lm-header-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* Dealer nameplate */
.lm-dealer-nameplate {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

/* ── Nav ─────────────────────────────────────────────────────────── */
.lm-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: var(--nav-h);
  gap: 2px;
}
.lm-nav a {
  display: inline-flex;
  align-items: center;
  height: var(--nav-h);
  padding: 0 14px;
  font-size: 0.84rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color 0.15s;
}
.lm-nav a:hover   { color: var(--text); }
.lm-nav a.active  { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.lm-nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Dark toggle ─────────────────────────────────────────────────── */
.lm-dark-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.lm-dark-btn:hover { background: var(--border); color: var(--text); }

/* ── Logout ──────────────────────────────────────────────────────── */
.lm-logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
}
.lm-logout-btn:hover { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.lm-logout-form { display: inline; }

/* ── Container ───────────────────────────────────────────────────── */
.lm-container { max-width: 1100px; margin: 28px auto; padding: 0 20px; }
.lm-container-md { max-width: 900px;  margin: 28px auto; padding: 0 20px; }
.lm-container-sm { max-width: 700px;  margin: 28px auto; padding: 0 20px; }

/* ── Card ────────────────────────────────────────────────────────── */
.lm-card {
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.lm-card-header {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lm-card-header h3 { font-size: 0.92rem; font-weight: 700; color: var(--text); }
.lm-card-body { padding: 16px 18px; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 4px 11px; font-size: 0.78rem; }

/* ── Flash messages ──────────────────────────────────────────────── */
.lm-flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 14px; font-size: 0.87rem; }
.lm-flash-success { background: var(--green-soft); color: var(--green); }
.lm-flash-error   { background: var(--red-soft);   color: var(--red); }
.lm-flash-info    { background: var(--accent-soft); color: var(--accent-text); }

/* ── Tables ──────────────────────────────────────────────────────── */
.lm-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.lm-table thead th {
  padding: 9px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.lm-table tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border-light); }
.lm-table tbody tr:last-child td { border-bottom: none; }
.lm-table tbody tr:hover { background: var(--surface2); }

/* ── Form fields ─────────────────────────────────────────────────── */
.lm-field { margin-bottom: 14px; }
.lm-field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.lm-field input[type=text],
.lm-field input[type=email],
.lm-field input[type=number],
.lm-field select,
.lm-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 0.87rem;
  background: var(--surface);
  color: var(--text);
}
.lm-field input:focus,
.lm-field select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.lm-field .hint { font-size: 0.76rem; color: var(--text-dim); margin-top: 3px; }

/* ── Badges / pills ──────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.74rem; font-weight: 600; }
.badge-green  { background: var(--green-soft);  color: var(--green); }
.badge-red    { background: var(--red-soft);    color: var(--red); }
.badge-yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge-blue   { background: var(--accent-soft); color: var(--accent-text); }
.badge-gray   { background: var(--surface2);    color: var(--text-dim); border: 1px solid var(--border); }

/* ── Utility ─────────────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }

/* ── Dark mode script (inline in base) ───────────────────────────── */
/* Applied via JS on load, stored in localStorage as 'lm-theme' */
