/* Tarmac Designs — light theme built on the logo's brand colours:
   plane blue #0000FF, wordmark navy #2E266D. */
:root {
  --brand-blue: #0000ff;
  --brand-navy: #2e266d;

  --bg: #ffffff;
  --panel: #ffffff;
  --panel2: #f5f6fa;      /* subtle fill: inputs, table heads, image placeholders */
  --line: #e4e6f0;
  --text: #2e266d;        /* brand navy reads as body text at 13:1 on white */
  --muted: #6f6d8c;
  --accent: #0000ff;
  --accent-hover: #0000cc;
  --good: #0a7c53;
  --error: #c62828;
  --shadow: 0 1px 2px rgba(46, 38, 109, 0.05), 0 1px 3px rgba(46, 38, 109, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--error); min-height: 1.2em; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.pill { background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }

/* Brand */
.logo-lockup { display: block; width: 240px; max-width: 70vw; height: auto; margin: 0 auto 4px; }
.topbar .logo { height: 30px; width: auto; display: block; }
.brand-divider { width: 1px; height: 22px; background: var(--line); }

/* Inputs / buttons */
input, textarea, button, select {
  font: inherit; color: var(--text);
  background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px;
}
input::placeholder, textarea::placeholder { color: #9a98b0; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent;
}
button {
  background: var(--accent); color: #fff; border: 1px solid transparent;
  cursor: pointer; font-weight: 600;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .55; cursor: default; }
button.ghost { background: #fff; border: 1px solid var(--line); color: var(--text); }
button.ghost:hover { background: var(--panel2); }

/* Login */
#login-view { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--panel2); }
.login { width: min(380px, 92vw); display: flex; flex-direction: column; gap: 12px; background: #fff; }
.login h1 { margin: 0; font-size: 20px; text-align: center; }
.login > p { text-align: center; margin: 0 0 4px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

/* Topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #fff; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand #who { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.cart-toggle { display: none; } /* shown on mobile */

/* Filter bar */
.filterbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 51px; background: #fff; z-index: 15;
}
.filterbar #search { flex: 1 1 220px; min-width: 160px; }
.filterbar select { flex: 0 1 auto; max-width: 220px; }
.count { margin-left: auto; font-size: 13px; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg { background: #fff; color: var(--muted); border: none; border-radius: 0; padding: 8px 12px; font-size: 13px; }
.seg:hover { background: var(--panel2); }
.seg.active { background: var(--accent); color: #fff; }

/* Layout */
.layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; padding: 16px; align-items: start; }

/* Catalog — LIST (default) */
.catalog.list { display: flex; flex-direction: column; gap: 6px; }
.catalog.list .product {
  display: grid; grid-template-columns: 48px 1fr auto auto; gap: 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
.catalog.list .product:hover { border-color: #cfd2e4; }
.catalog.list .product img, .catalog.list .thumb { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--panel2); }
.catalog.list .body { min-width: 0; }
.catalog.list .title { font-size: 14px; font-weight: 600; }
.catalog.list .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.catalog.list .price { text-align: right; white-space: nowrap; }

/* Catalog — GRID */
.catalog.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.catalog.grid .product { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.catalog.grid .product img, .catalog.grid .thumb { width: 100%; height: 130px; border-radius: 0; object-fit: cover; background: var(--panel2); }
.catalog.grid .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.catalog.grid .title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.catalog.grid .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.catalog.grid .price { margin-top: 4px; }

/* Shared product bits */
.price .retail { color: var(--muted); text-decoration: line-through; font-size: 12px; margin-right: 6px; }
.price .wholesale { color: var(--good); font-weight: 700; }
.chip { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.badge { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: rgba(10, 124, 83, 0.10); color: var(--good); font-weight: 600; }
.qty { width: 62px; text-align: center; padding: 6px; }

/* Cart */
.cart { position: sticky; top: 104px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 120px); }
.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-head h2 { margin: 0; font-size: 17px; }
.cart-close { display: none; }
.cart-lines { display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.cart-line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.cart-line .ct { color: var(--muted); }
.cart-total { display: flex; justify-content: space-between; align-items: center; font-size: 16px; padding-top: 6px; border-top: 1px solid var(--line); }
.note-sm { font-size: 12px; margin: -4px 0 0; }
.result { font-size: 13px; }
.result a { color: var(--accent); }
.result .ok { color: var(--good); font-weight: 600; }
.cart-backdrop { position: fixed; inset: 0; background: rgba(46, 38, 109, 0.35); z-index: 25; }

/* ---- Mobile ---- */
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; padding: 12px; }
  .filterbar select { flex: 1 1 46%; max-width: none; }
  .count { flex-basis: 100%; margin-left: 0; }
  .cart-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .topbar .logo { height: 26px; }

  .cart {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 88vw);
    max-height: 100vh; border-radius: 0; z-index: 30; transform: translateX(100%);
    transition: transform .2s ease; overflow: auto;
  }
  .cart.open { transform: translateX(0); }
  .cart-close { display: inline-block; }
  .catalog.list .product { grid-template-columns: 40px 1fr auto; }
  .catalog.list .product .price { grid-column: 2 / 3; text-align: left; }
  .catalog.list .product .qty { grid-column: 3; }
}
