
.auth-hidden { display: none !important; }
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, #e0f2fe, transparent 34%), #f4f6fb;
}
.auth-card {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 18px 0 6px; }
.auth-brand { border-bottom: 0; padding-bottom: 0; }
.auth-form { display: grid; gap: 8px; margin-top: 18px; }
.auth-form label { font-size: 13px; font-weight: 700; color: #374151; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.google-btn { width: 100%; margin: 10px 0; padding: 11px 13px; border-radius: 12px; font-weight: 800; color: #111827; background: #fff; border: 1px solid var(--line); }
.auth-alert { margin-top: 14px; border-radius: 14px; padding: 11px 12px; background: #eff6ff; color: #1e3a8a; font-size: 13px; }
.auth-alert.error { background: #fee2e2; color: #991b1b; }
.auth-alert.ok { background: #dcfce7; color: #166534; }
.account-card strong { display: block; font-size: 15px; color: #fff; margin-bottom: 4px; }
.role-pill { display: inline-block; margin: 8px 0; padding: 4px 8px; border-radius: 999px; background: #e0f2fe; color: #075985; font-size: 12px; font-weight: 800; }
.logout-btn { width: 100%; margin-top: 10px; padding: 9px 10px; border-radius: 10px; background: rgba(255,255,255,.14); color: #fff; font-weight: 800; }
.sync-pill { display: inline-flex; align-items: center; padding: 10px 12px; border-radius: 999px; background: #f3f4f6; color: #374151; font-size: 12px; font-weight: 800; }
.sync-pill.ok { background: #dcfce7; color: #166534; }
.sync-pill.saving { background: #fef3c7; color: #92400e; }
.sync-pill.error { background: #fee2e2; color: #991b1b; }
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #1f2937;
  --primary-2: #374151;
  --accent: #2563eb;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --chip: #eef2ff;
  --shadow: 0 12px 30px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select, textarea {
  font: inherit;
}
button {
  border: 0;
  cursor: pointer;
}
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}
.sidebar {
  background: #111827;
  color: #fff;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #fff;
  color: #111827;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.brand strong { display: block; font-size: 17px; }
.brand span { display: block; color: #cbd5e1; font-size: 12px; margin-top: 2px; }
.role-card {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  padding: 14px;
  border-radius: 16px;
}
.role-card label, .role-card small { display: block; color: #cbd5e1; margin-bottom: 8px; }
.role-card select {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.2);
  background: #0f172a;
  color: #fff;
}
.nav { display: grid; gap: 8px; }
.nav button {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  background: transparent;
  color: #cbd5e1;
}
.nav button:hover, .nav button.active {
  background: #fff;
  color: #111827;
}
.main {
  padding: 24px;
  overflow-x: hidden;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.topbar h1 { margin: 0; font-size: 28px; }
.topbar p { margin: 6px 0 0; color: var(--muted); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page { display: none; }
.page.active { display: block; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.metric span { display: block; color: var(--muted); margin-bottom: 10px; }
.metric strong { font-size: 34px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 14px; font-size: 20px; }
.panel h3 { margin: 18px 0 10px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head h2 { margin: 0; }
.split-grid {
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
  gap: 18px;
  align-items: start;
}
.form-panel label {
  display: block;
  margin: 12px 0 6px;
  color: #374151;
  font-weight: 650;
  font-size: 13px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; }
.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.location-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.primary, .secondary, .ghost, .danger {
  padding: 10px 13px;
  border-radius: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.primary { background: var(--primary); color: #fff; width: 100%; margin-top: 14px; }
.primary:hover { background: var(--primary-2); }
.secondary { background: #e5e7eb; color: #111827; }
.ghost { background: #f3f4f6; color: #111827; }
.danger { background: #fee2e2; color: var(--danger); }
.lookup-box {
  margin-top: 8px;
  padding: 11px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: #f9fafb;
}
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0; }
.notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
  padding: 12px;
  border-radius: 14px;
  margin-top: 16px;
}
.guide { padding-left: 20px; color: #374151; line-height: 1.7; }
.card-list { display: grid; gap: 12px; }
.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.card-title { font-weight: 800; font-size: 16px; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--chip);
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
  margin: 2px 4px 2px 0;
}
.tag.green { background: #dcfce7; color: #166534; }
.tag.yellow { background: #fef3c7; color: #92400e; }
.tag.red { background: #fee2e2; color: #991b1b; }
.tag.gray { background: #f3f4f6; color: #374151; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #374151; font-size: 13px; background: #f9fafb; }
tr:hover td { background: #fcfcfd; }
.item-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafafa;
}
.item-grid {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 8px;
}
.item-meta {
  font-size: 13px;
  color: #374151;
  margin-top: 8px;
}
.barcode-box {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px;
  border-radius: 12px;
}
.barcode-svg text { font-family: monospace; font-size: 13px; }
.report-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.report-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.report-card h3 { margin: 0 0 10px; }
dialog {
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow);
  width: min(640px, 94vw);
}
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#reader { min-height: 320px; }
@media print {
  body * { visibility: hidden; }
  .printable, .printable * { visibility: visible; }
  .printable { position: fixed; left: 0; top: 0; }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
  }
  .nav { grid-template-columns: repeat(2, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .split-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
}
@media (max-width: 560px) {
  .main { padding: 14px; }
  .metric-grid, .report-grid, .location-grid { grid-template-columns: 1fr; }
  .nav { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
  .card-head { flex-direction: column; }
}

/* v2 refinements */
.title-row { display: flex; align-items: flex-start; gap: 12px; }
.hamburger {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
}
.mobile-backdrop { display: none; }
.notice.compact { margin: 0 0 16px; }
.side-stack { display: grid; gap: 18px; }
.mechanic-layout { grid-template-columns: minmax(340px, 520px) 1fr; }
.code-preview { margin-top: 8px; font-weight: 800; color: #111827; }
.drive-path {
  margin-top: 8px;
  font-size: 12px;
  color: #475569;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 8px 10px;
  word-break: break-word;
}
.media-list { display: grid; gap: 10px; margin: 10px 0 4px; }
.media-card {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fafafa;
}
.media-card img, .media-card video {
  width: 130px;
  height: 110px;
  object-fit: cover;
  border-radius: 12px;
  background: #e5e7eb;
}
.media-info b { display: block; word-break: break-word; }
.media-info small { display: block; color: var(--muted); margin: 3px 0 8px; }
.media-info label { margin-top: 0; }
.media-summary {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.media-line {
  margin-top: 7px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 13px;
}
.media-line span { color: #475569; }
.small-pad { padding: 8px 0; }
.red-text { color: var(--danger); }
.nav button[style*="display: none"] { display: none !important; }
@media (max-width: 980px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 310px);
    height: 100vh;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s ease;
    overflow-y: auto;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 40;
  }
  body.sidebar-open .mobile-backdrop { display: block; }
  .hamburger { display: grid; place-items: center; flex: 0 0 auto; }
  .nav { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
@media (max-width: 700px) {
  .topbar { gap: 12px; }
  .topbar h1 { font-size: 24px; }
  .top-actions { width: 100%; }
  .top-actions button { flex: 1; }
  .panel-head { flex-direction: column; align-items: stretch; }
  .media-card { grid-template-columns: 1fr; }
  .media-card img, .media-card video { width: 100%; height: 180px; }
  .item-grid { grid-template-columns: 1fr 80px; }
}

/* v3 role/workflow refinements */
.status-section-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}
.status-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  min-height: 112px;
}
.status-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.status-count {
  float: right;
  min-width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 900;
}
.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
  margin-top: 7px;
  font-size: 13px;
}
.mini-row span { color: var(--muted); text-align: right; }
.people-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 7px 0;
  color: #475569;
  font-size: 12px;
}
.people-row span {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 4px 8px;
}
.owner-note {
  color: #7c2d12;
  background: #fff7ed;
  border-radius: 10px;
  padding: 7px 9px;
}
.section-divider {
  margin: 18px 0 12px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.mini-desc {
  margin: 4px 0 0;
  font-size: 13px;
}
.compact-list { gap: 8px; }
.compact-card { padding: 10px; }
.compact-card .card-title { font-size: 14px; }
.compact-card .drive-path, .compact-card .media-summary { display: none; }
@media (max-width: 980px) {
  .status-section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .status-section-grid { grid-template-columns: 1fr; }
}

/* v4 layout refinements */
.mechanic-form-only {
  max-width: 760px;
  margin: 0 auto;
}
.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.pill-title {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  background: #111827;
  color: #fff;
}
.pill-title.light {
  background: #e5e7eb;
  color: #111827;
}
.modern-section {
  margin-top: 18px;
}
.warehouse-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #fff, #f8fafc);
}
.warehouse-hero h2 { margin: 0 0 6px; }
.warehouse-mini-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
}
.warehouse-mini-metrics span {
  display: block;
  min-width: 120px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}
.warehouse-mini-metrics b {
  display: block;
  font-size: 26px;
}
.warehouse-mini-metrics small {
  color: var(--muted);
}
.warehouse-grid {
  grid-template-columns: repeat(2, minmax(320px, 1fr));
}
@media (max-width: 980px) {
  .warehouse-grid { grid-template-columns: 1fr; }
  .warehouse-hero { flex-direction: column; align-items: stretch; }
  .warehouse-mini-metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  body { overflow-x: hidden; }
  .main { width: 100%; max-width: 100vw; }
  .topbar { align-items: stretch; }
  .title-row { align-items: flex-start; }
  .title-row > div { min-width: 0; }
  .topbar h1 { overflow-wrap: anywhere; }
  .topbar p { overflow-wrap: anywhere; }
  input, select, textarea, button { max-width: 100%; }
  .inline-field { grid-template-columns: minmax(0, 1fr) auto; }
  .inline-field .ghost { padding-left: 10px; padding-right: 10px; }
  .panel { border-radius: 16px; }
  .warehouse-mini-metrics { grid-template-columns: 1fr; }
}

/* v5 master data tab fix */
.tab-btn {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 800;
  background: #e5e7eb;
  color: #111827;
  cursor: pointer;
}
.tab-btn.active {
  background: #111827;
  color: #fff;
}
.tab-btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .35);
  outline-offset: 2px;
}
.master-tab-content { display: none; }
.master-tab-content.active { display: block; }
.master-motor-section { margin-top: 0; }
@media (max-width: 720px) {
  .section-tabs { position: sticky; top: 0; z-index: 5; padding: 6px 0; background: #f1f5f9; }
  .tab-btn { flex: 1 1 auto; justify-content: center; }
}

/* v6 mechanic stock fast + import templates */
.mechanic-tab-content { display: none; }
.mechanic-tab-content.active { display: block; }
.import-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #f8fafc;
  margin: 12px 0;
}
.file-label {
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: 12px !important;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.completion-box {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #14532d;
  font-size: 13px;
}
#selfTakeReviewList .media-summary { margin-top: 8px; }
@media (max-width: 980px) {
  .warehouse-mini-metrics { grid-template-columns: repeat(3, minmax(100px, 1fr)); }
}
@media (max-width: 700px) {
  .header-actions { width: 100%; justify-content: space-between; }
  .header-actions .secondary { flex: 1; }
}
@media (max-width: 560px) {
  .warehouse-mini-metrics { grid-template-columns: 1fr; }
  .section-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { white-space: nowrap; }
}

/* v8 checkout proof + OCR auto-fill + media preview */
.media-gallery-wrap { margin-top: 10px; }
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.media-tile {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #f8fafc;
}
.media-tile img,
.media-tile video {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  background: #e5e7eb;
}
.media-link-preview,
.media-file-placeholder {
  display: grid;
  place-items: center;
  height: 150px;
  background: #e5e7eb;
  color: #111827;
  font-weight: 800;
  text-decoration: none;
}
.media-tile-body { padding: 9px; }
.media-tile-body b { display: block; word-break: break-word; font-size: 13px; }
.media-tile-body span { display: block; margin-top: 4px; color: #475569; font-size: 12px; }
.checkout-dialog { width: min(980px, 96vw); }
.checkout-form label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 750;
  color: #374151;
  font-size: 13px;
}
.checkout-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}
.full-lite { width: 100%; margin-top: 8px; }
.dialog-actions { justify-content: flex-end; }
.dialog-primary { width: auto; min-width: 220px; }
.total-preview {
  margin-top: 8px;
  padding: 11px 12px;
  border-radius: 12px;
  background: #ecfdf5;
  color: #14532d;
  border: 1px solid #bbf7d0;
}
.checkout-proof-box {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #eff6ff;
}
.proof-head {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.proof-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 14px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
}
.proof-grid span { color: #475569; }
.ocr-details { margin-top: 8px; }
.ocr-details pre {
  white-space: pre-wrap;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  max-height: 180px;
  overflow: auto;
}
@media (max-width: 760px) {
  .checkout-layout { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-primary { width: 100%; }
}

.gemini-demo-box {
  margin: 14px 0;
}
.success-text {
  color: #138a42;
  font-weight: 700;
}

/* v11: full media preview modal + checkout delivery/insurance controls */
.media-open { cursor: zoom-in; }
.open-preview-btn {
  width: calc(100% - 18px);
  margin: 8px 9px 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: #e5e7eb;
  font-weight: 800;
  cursor: zoom-in;
}
.media-preview-dialog {
  width: min(980px, 96vw);
  max-height: 96vh;
  border: 0;
  border-radius: 20px;
  padding: 16px;
}
.media-preview-dialog::backdrop { background: rgba(15, 23, 42, .68); }
.media-preview-body {
  display: grid;
  place-items: center;
  background: #0f172a;
  border-radius: 16px;
  min-height: 240px;
  overflow: auto;
}
.media-preview-body img,
.media-preview-body video {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
}
.media-preview-note {
  margin-top: 10px;
  color: #475569;
  font-size: 14px;
  white-space: pre-wrap;
}
#checkoutInsurance:disabled {
  background: #f1f5f9;
  color: #64748b;
}
@media (max-width: 560px) {
  .media-preview-dialog { width: 98vw; padding: 10px; }
  .media-preview-body { min-height: 180px; }
}

/* v12: monitor motor + WhatsApp auto report + responsive review */
.monitor-panel { overflow: hidden; }
.monitor-summary { margin-top: 12px; }
.motor-status-summary.ready { border-color: #bbf7d0; }
.motor-status-summary.maintenance { border-color: #fecaca; }
.motor-status-summary.ongoing_maintenance { border-color: #fde68a; }
.monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.motor-status-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 8px 20px rgba(15,23,42,.05);
  min-width: 0;
}
.motor-status-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.motor-code { font-size: 20px; font-weight: 900; }
.motor-info-grid {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 6px 10px;
  font-size: 13px;
}
.motor-info-grid span { color: var(--muted); }
.motor-info-grid b { word-break: break-word; }
.motor-detail-dialog {
  width: min(1050px, 96vw);
  max-height: 94vh;
  overflow: auto;
}
.motor-detail-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(135deg, #fff, #f8fafc);
  margin-bottom: 14px;
}
.detail-hero h3 { margin: 0 0 4px; }
.detail-hero p { margin: 0; color: var(--muted); }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.detail-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}
.detail-box span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.detail-box b { display: block; word-break: break-word; }
.whatsapp-panel { margin-top: 18px; }
.wa-log-list { display: grid; gap: 10px; }
.wa-log-card {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  border-radius: 16px;
  padding: 12px;
}
.wa-log-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.wa-log-card pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  max-height: 220px;
  overflow: auto;
}
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .monitor-grid { grid-template-columns: 1fr; }
  .motor-status-top, .detail-hero { flex-direction: column; }
  .motor-info-grid { grid-template-columns: 1fr; }
  .motor-info-grid span { margin-top: 6px; }
  .detail-grid { grid-template-columns: 1fr; }
  .motor-detail-dialog { width: 98vw; padding: 10px; }
}

/* v13 additions */
.admin-owner-overview:empty { display: none; }
.overview-kpi-panel { margin: 18px 0; }
.overview-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric.soft { background: #f8fafc; border: 1px solid #e2e8f0; box-shadow: none; }
.metric.soft.wide { grid-column: span 2; align-items: flex-start; }
.fast-list { width: 100%; margin-top: 8px; }
.mini-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px dashed #e2e8f0; }
.mini-row:last-child { border-bottom: 0; }
.receive-proof-box { border-color: #bfdbfe; background: #eff6ff; }
.report-card.accent { background: linear-gradient(135deg, #eef2ff, #f8fafc); }
.report-card.wide-report { grid-column: span 2; }
.receive-dialog .media-list { margin-top: 10px; }
@media (max-width: 900px) {
  .overview-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric.soft.wide, .report-card.wide-report { grid-column: span 2; }
}
@media (max-width: 560px) {
  .overview-kpi-grid { grid-template-columns: 1fr; }
  .metric.soft.wide, .report-card.wide-report { grid-column: span 1; }
  .mini-row { align-items: flex-start; flex-direction: column; gap: 2px; }
}

/* v14: Compact dropdown detail for Admin & Owner cards */
.detail-dropdown {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  overflow: hidden;
}
.detail-dropdown > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}
.detail-dropdown > summary::-webkit-details-marker { display: none; }
.detail-dropdown > summary span:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-dropdown > summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.detail-dropdown .chevron {
  transition: transform .18s ease;
  color: var(--muted);
  font-weight: 800;
}
.detail-dropdown[open] .chevron { transform: rotate(180deg); }
.detail-dropdown-body {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}
.detail-dropdown-body .checkout-proof-box { margin-top: 0; }
.detail-dropdown-body .media-list { margin-top: 0; }
@media (max-width: 760px) {
  .detail-dropdown > summary { padding: 11px 12px; }
  .detail-dropdown-body { padding: 10px 12px 12px; }
}


/* v15 production: Master Data mobile card table */
@media (max-width: 760px) {
  #spareparts .split-grid { grid-template-columns: 1fr; }
  #spareparts .panel-head { align-items: stretch; flex-direction: column; }
  #spareparts .location-grid { grid-template-columns: 1fr; }
  #spareparts .table-wrap { overflow-x: visible; }
  #sparepartList table.master-table,
  #motorList table.master-table,
  #sparepartList table.master-table thead,
  #motorList table.master-table thead,
  #sparepartList table.master-table tbody,
  #motorList table.master-table tbody,
  #sparepartList table.master-table tr,
  #motorList table.master-table tr,
  #sparepartList table.master-table td,
  #motorList table.master-table td { display: block; min-width: 0; width: 100%; }
  #sparepartList table.master-table thead,
  #motorList table.master-table thead { display: none; }
  #sparepartList table.master-table tr,
  #motorList table.master-table tr {
    border: 1px solid var(--line);
    border-radius: 16px;
    margin-bottom: 12px;
    padding: 10px;
    background: #fff;
  }
  #sparepartList table.master-table td,
  #motorList table.master-table td {
    border-bottom: 1px dashed #e5e7eb;
    padding: 9px 4px;
  }
  #sparepartList table.master-table td:last-child,
  #motorList table.master-table td:last-child { border-bottom: 0; }
  #sparepartList table.master-table td::before,
  #motorList table.master-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  #sparepartList .barcode-box svg { max-width: 100%; height: auto; }
  #sparepartList td[data-label="Aksi"],
  #motorList td[data-label="Aksi"] { display: flex !important; gap: 8px; flex-wrap: wrap; }
  .auth-row { grid-template-columns: 1fr; }
  .top-actions { width: 100%; }
  .sync-pill { width: 100%; justify-content: center; }
}

/* v16 Owner-managed user access */
.user-management-grid {
  align-items: start;
}
.user-access-list {
  display: grid;
  gap: 12px;
}
.user-access-card {
  display: grid;
  grid-template-columns: 1.2fr auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}
.user-role-stack {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.auth-card .auth-row {
  grid-template-columns: 1fr;
}
@media (max-width: 900px) {
  .user-access-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .user-role-stack,
  .row-actions {
    justify-content: flex-start;
  }
  .user-management-grid {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 640px) {
  #spareparts .split-grid,
  #spareparts .master-motor-section,
  #spareparts .panel,
  #spareparts .form-panel {
    min-width: 0;
    width: 100%;
  }
  #sparepartList,
  #motorList {
    overflow-x: visible;
  }
  .user-access-card .row-actions button {
    width: 100%;
  }
}

/* V17 - Pengiriman / Retur Motor */
.transfer-layout {
  display: grid;
  grid-template-columns: minmax(320px, 460px) 1fr;
  gap: 18px;
  align-items: start;
}
.compact-grid { gap: 10px; }
.transfer-card .detail-dropdown { margin-top: 10px; }
.mini-transfer-card {
  border: 1px solid var(--border, #dde4ee);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  margin: 8px 0;
}
.danger-lite {
  background: #fee2e2 !important;
  color: #991b1b !important;
}
@media (max-width: 980px) {
  .transfer-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .transfer-layout .panel { padding: 14px; }
  .compact-grid { grid-template-columns: 1fr !important; }
  .transfer-card .card-head { gap: 10px; }
  .transfer-card .card-head > div:first-child { min-width: 0; }
  .mini-transfer-card { padding: 10px; }
}

/* V18 - Location stock motor HQ/Canggu */
.location-summary-grid {
  margin-top: 14px;
}
.location-section .mini-row {
  margin-top: 6px;
}
.mini-form-section {
  border: 1px solid var(--border, #dde4ee);
  background: #f8fafc;
  border-radius: 16px;
  padding: 12px;
  margin: 12px 0;
}
.mini-form-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.transfer-delta {
  margin: 10px 0 4px;
  background: #eef6ff;
}
@media (max-width: 640px) {
  .location-summary-grid,
  #transferSummary {
    grid-template-columns: 1fr !important;
  }
  .mini-form-section {
    padding: 10px;
  }
}
