/* Vehicle Selector Pro — Fitment Command Center
   Visual language aligned to the Manus baseline, wired for Rails + static demo. */

:root {
  --ink: #18202b;
  --muted: #5c6573;
  --canvas: #f3eee4;
  --sidebar: #ece8dc;
  --paper: #fbf7ef;
  --line: #ddd4c4;
  --navy: #17324f;
  --navy-2: #1e4468;
  --blue: #1f4ea8;
  --blue-hover: #183d86;
  --live: #1f7a52;
  --review: #c06a1e;
  --danger: #b42318;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body.cc-body {
  font-family: var(--sans);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.cc-shell { display: flex; min-height: 100vh; }
.cc-sidebar {
  width: 268px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
}
.cc-brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; }
.cc-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--navy); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.cc-brand h1 { margin: 0; font-size: 14.5px; letter-spacing: -0.02em; }
.cc-brand p {
  margin: 2px 0 0; font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.cc-store {
  display: flex; gap: 10px; align-items: center;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 22px;
}
.cc-store-badge {
  width: 32px; height: 32px; border-radius: 10px;
  background: #9e2a2b; color: #fff; font-weight: 800; font-size: 11px;
  display: grid; place-items: center;
}
.cc-store strong { display: block; font-size: 12px; }
.cc-store span { font-size: 11px; color: var(--muted); }
.cc-nav-label {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 0 10px; margin: 10px 0 6px;
}
.cc-nav a, .cc-nav button {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  text-align: left; border: 0; background: transparent; cursor: pointer;
  color: var(--ink); text-decoration: none; font-size: 13.5px;
  padding: 9px 10px; border-radius: 10px; font-family: inherit;
}
.cc-nav a:hover, .cc-nav button:hover { background: rgba(255,255,255,0.55); }
.cc-nav a.active, .cc-nav button.active { background: #fff; font-weight: 650; box-shadow: 0 1px 0 var(--line); }
.cc-count {
  font-size: 11px; color: var(--muted); background: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px;
}
.cc-sidebar-foot { margin-top: auto; padding-top: 16px; }
.cc-status, .cc-user {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 8px; font-size: 12px;
}
.cc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.cc-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: #fff; display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
}

.cc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cc-topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 28px 0; gap: 12px;
}
.cc-crumb { font-size: 13px; color: var(--muted); }
.cc-crumb strong { color: var(--ink); }
.cc-live { 
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--live);
  cursor: default;
}
.cc-live.degraded { color: var(--danger); }
.cc-live i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 0 4px rgba(31,122,82,0.18);
  display: inline-block;
}
.cc-live.degraded i { background: var(--danger); box-shadow: 0 0 0 4px rgba(180,35,24,0.18); }
.cc-banner {
  margin: 14px 28px 0; background: #e8f1fb; color: #1d4a7a;
  border-radius: 8px; padding: 9px 14px; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
}
.cc-banner a { color: #1d4a7a; font-weight: 650; text-decoration: none; }
.cc-banner-ok { background: #e4f4ea; color: #14603e; }
.cc-banner-ok a { color: #14603e; }
.cc-banner-degraded { background: #fde8e6; color: var(--danger); }
.cc-banner-degraded a { color: var(--danger); }
.cc-page { padding: 22px 28px 40px; }
.cc-page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.cc-page-head h2 {
  font-family: var(--serif); font-size: 34px; font-weight: 560;
  margin: 0 0 6px; letter-spacing: -0.03em;
}
.cc-page-head p { margin: 0; color: var(--muted); max-width: 520px; line-height: 1.5; }
.cc-kicker { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.cc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 650;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  font-family: inherit; background: #fff; color: var(--ink); border-color: var(--line);
}
.btn:hover { background: #f6f1e8; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-hover); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }

.cc-hero {
  display: grid; grid-template-columns: 1.15fr 0.85fr; min-height: 280px;
  border-radius: 18px; overflow: hidden; background: #d7cbb8;
  margin-bottom: 18px;
}
.cc-hero-photo {
  background:
    linear-gradient(90deg, rgba(20,28,38,0) 40%, rgba(23,50,79,0.55) 100%),
    url("https://images.unsplash.com/photo-1503376780353-7e6692767b70?auto=format&fit=crop&w=1400&q=80") center/cover;
}
.cc-hero-copy {
  background: var(--navy); color: #e8eef6; padding: 28px 26px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.cc-hero-copy h3 {
  font-family: var(--serif); font-size: 28px; font-weight: 520;
  margin: 8px 0 10px; letter-spacing: -0.03em;
}
.cc-hero-copy p { margin: 0; font-size: 14px; line-height: 1.55; color: #c5d2e2; }
.cc-bar { height: 6px; background: rgba(255,255,255,0.18); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.cc-bar span { display: block; height: 100%; background: #7eb8ff; }

.cc-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cc-stat {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 16px 14px;
  min-width: 0; /* let the tile shrink inside auto-fit grids */
}
.cc-stat label { display: block; font-size: 12px; color: var(--muted); }
.cc-stat b { display: block; font-size: 28px; margin: 6px 0 4px; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.cc-stat em { font-style: normal; font-size: 12px; color: var(--live); overflow-wrap: anywhere; }
.cc-stat em.warn { color: var(--review); }

.cc-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
  /* Default inner padding: card content never touches the border. Views
     that want a tighter inset set their own padding inline. */
  padding: 20px;
}
/* Header strip above a table: a normal in-flow section header inside the
   padded card (no full-bleed negative-margin tricks). */
.cc-card > .cc-card-pad { margin: 0 0 14px; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.cc-card-pad { padding: 18px 18px 8px; }
.cc-table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
  /* Responsive: a wide table scrolls horizontally INSIDE its card instead
     of escaping the card and getting clipped at the page edges. */
  display: block; overflow-x: auto;
}
.cc-table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.cc-table td { padding: 14px 16px; border-bottom: 1px solid #efe7d8; vertical-align: top; overflow-wrap: break-word; }
.cc-table tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 2px 8px; font-size: 11px; font-weight: 700;
  white-space: nowrap; /* percent labels like "100% fit" never wrap or escape */
}
.badge-live { background: #e4f4ea; color: var(--live); }
.badge-review { background: #f8ead8; color: var(--review); }
.badge-pending { background: #f8ead8; color: var(--review); }
.badge-info { background: #e4eef8; color: #1d4a7a; }

.cc-preview {
  position: relative; margin-top: 18px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px;
}
.cc-preview h4 { margin: 0 0 4px; font-size: 14px; }
.cc-selects { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.cc-selects label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.cc-selects select, .cc-field, input[type="text"], input[type="number"], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 10px; font: inherit; background: #fff; color: var(--ink);
}

.cc-navy-note {
  background: var(--navy); color: #d7e3f0; border-radius: 14px;
  padding: 16px 18px; display: flex; justify-content: space-between; gap: 16px; align-items: center;
  margin-top: 14px;
}
.cc-navy-note h4 { margin: 0 0 4px; color: #fff; font-size: 15px; }
.cc-navy-note p { margin: 0; font-size: 13px; color: #b9c7d8; }

.cc-rule {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center;
  padding: 16px 18px; border-bottom: 1px solid #efe7d8;
}
.cc-rule:last-child { border-bottom: 0; }
.cc-idx { font-size: 12px; color: var(--muted); font-weight: 700; }

.cc-log { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid #efe7d8; }
.cc-log:last-child { border-bottom: 0; }

.video-bar {
  position: sticky; top: 0; z-index: 40;
  background: #121820; color: #fff; padding: 10px 16px;
  display: none; align-items: center; justify-content: space-between; gap: 12px;
}
.cc-body.demo-on .video-bar { display: flex; }
.video-cursor {
  pointer-events: none; position: fixed; z-index: 9999; width: 22px; height: 22px;
  display: none; transition: all 0.55s cubic-bezier(0.25, 1, 0.5, 1);
}
.cc-body.demo-on .video-cursor { display: block; }

.hidden { display: none !important; }
.flash-ok { background: #e4f4ea; color: var(--live); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.flash-bad { background: #fde8e6; color: var(--danger); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }

@media (max-width: 1100px) {
  .cc-hero, .cc-metrics, .cc-selects { grid-template-columns: 1fr 1fr; }
  .cc-hero { min-height: auto; }
}
@media (max-width: 860px) {
  .cc-shell { flex-direction: column; }
  .cc-sidebar { width: 100%; }
  .cc-metrics, .cc-selects { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/* Polaris-compat components (admin sync + bulk-import views).         */
/* Styled with Shopify Polaris design tokens so these pages match the  */
/* "styled with Polaris CSS" requirement.                             */
/* ------------------------------------------------------------------ */
.polaris-card {
  background: #fff;
  border: 1px solid #e1e3e5;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(26, 26, 26, 0.06);
}
.polaris-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; font-family: var(--sans); font-size: 14px; font-weight: 600;
  line-height: 1; padding: 11px 18px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.polaris-btn-primary { background: #008060; color: #fff; }
.polaris-btn-primary:hover { background: #006e52; }
.polaris-btn-secondary { background: #fff; color: #202223; border-color: #c9cccf; }
.polaris-btn-secondary:hover { background: #f6f6f7; }
.polaris-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.polaris-table th {
  text-align: left; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: #6d7175; padding: 10px 12px; border-bottom: 1px solid #e1e3e5;
}
.polaris-table td { padding: 12px; border-bottom: 1px solid #f1f2f3; vertical-align: top; color: #202223; }
.polaris-table tr:last-child td { border-bottom: 0; }
.polaris-banner {
  border-radius: 10px; padding: 14px 16px; margin-bottom: 20px;
  background: #e4f8f4; border: 1px solid #97e2d3; color: #0c5145; font-size: 14px;
}
.polaris-banner-alert { background: #fff0f0; border-color: #fed3d1; color: #bf0711; }
.badge-success { background: #e4f4ea; color: #108043; }
.badge-warning { background: #fff5ea; color: #c06a1e; }
.badge-alert { background: #fde8e6; color: var(--danger); }

/* ---------------------------------------------------------------- */
/* Overflow hardening: icon + label rows never let text escape the   */
/* box on long names (shop/store names, nav labels).                 */
/* ---------------------------------------------------------------- */
.cc-brand > div, .cc-store > div { min-width: 0; flex: 1 1 auto; }
.cc-brand h1, .cc-brand p, .cc-store strong, .cc-store span {
  overflow-wrap: anywhere;
}
.cc-nav a, .cc-nav button { min-width: 0; overflow-wrap: anywhere; }
.cc-nav a .cc-count, .cc-nav button .cc-count { flex: none; margin-left: 8px; }
.cc-sidebar { min-width: 0; }

/* Demo mode (GitHub Pages demo only): seeded sample data, never a live store. */
.cc-dot.cc-dot-demo { background: #b7791f; }
.cc-live.cc-demo-pill { color: #8a5a00; background: #fff4db; border: 1px solid #f0d28a; border-radius: 999px; padding: 5px 10px; }
.cc-live.cc-demo-pill i { background: #b7791f; box-shadow: 0 0 0 4px rgba(183,121,31,0.18); animation: none; }
.cc-banner.cc-banner-demo { background: #fff4db; color: #6b4600; border: 1px solid #f0d28a; }
.cc-banner.cc-banner-demo a { color: #6b4600; }
