/* Flagship — navy + gold theme (fresh build, 2026-11-05) */

:root {
  --navy: #0a1f44;
  --navy-deep: #071831;
  --navy-card: #10294f;
  --gold: #d4af37;
  --gold-dark: #b8962a;
  --gold-soft: #e8c96a;
  --ink: #f4f6fb;
  --muted: #b9c4d8;
  --line: rgba(212, 175, 55, 0.35);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--navy);
  color: var(--ink);
  line-height: 1.6;
}

.wrap { max-width: 1440px; margin: 0 auto; padding: 0 20px; }

a { color: var(--gold-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; font-weight: 700; }
h2 { font-size: 1.9rem; margin-bottom: 10px; text-align: center; }
.section-sub { text-align: center; color: var(--muted); margin-bottom: 36px; }

/* Logo badge: the logo art is a square with a navy field, so crop it to a
   circle — the gold double ring is already circular, so it reads as a badge. */
.logo-badge {
  display: inline-block;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  line-height: 0;
  box-shadow: 0 0 0 2px var(--gold);
}
.logo-badge img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Header */
.site-header {
  background: var(--navy-deep);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand:hover { text-decoration: none; }
.brand .logo-badge { width: 44px; height: 44px; }
.brand-name { font-size: 1.35rem; font-weight: 800; letter-spacing: 0.14em; color: var(--ink); }
.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav a { color: var(--ink); font-size: 0.98rem; }
.main-nav a:hover { color: var(--gold-soft); text-decoration: none; }

/* Header menu — dropdown top right; hamburger on mobile */
.menu-wrap { position: relative; margin-left: auto; }
.menu-btn { display: inline-flex; align-items: center; gap: 10px; background: transparent; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 14px; font-size: 1rem; font-family: inherit; cursor: pointer; }
.menu-btn:hover { border-color: var(--gold); }
.menu-icon { display: inline-flex; flex-direction: column; gap: 4px; width: 18px; }
.menu-icon span { display: block; height: 2px; background: var(--gold); border-radius: 2px; }
.menu-dropdown { display: none; position: absolute; top: calc(100% + 10px); right: 0; min-width: 220px; background: var(--navy-card); border: 1px solid var(--line); border-radius: 12px; padding: 8px; z-index: 60; box-shadow: 0 12px 32px rgba(0,0,0,0.45); }
.menu-dropdown.open { display: block; }
.menu-dropdown a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.menu-dropdown a:hover { background: #1b3a66; text-decoration: none; }
.menu-dropdown .btn { text-align: center; margin-top: 6px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-gold { background: var(--gold); color: #1a1405; }
.btn-gold:hover { background: var(--gold-soft); }
.btn-outline { border-color: var(--gold); color: var(--gold-soft); background: transparent; }
.btn-outline:hover { background: rgba(212, 175, 55, 0.12); }
.btn-small { padding: 8px 18px; font-size: 0.92rem; }
/* Button row that never wraps: the buttons share one line and shrink
   together (smaller text/padding on phones) instead of dropping down. */
.btn-row { display: flex; gap: 10px; flex-wrap: nowrap; }
.btn-row .btn { flex: 1 1 0; min-width: 0; padding-left: 10px; padding-right: 10px; white-space: nowrap; }
@media (max-width: 520px) {
  .btn-row { gap: 8px; }
  .btn-row .btn { font-size: 0.85rem; padding: 10px 8px; }
}
@media (max-width: 380px) {
  .btn-row { gap: 6px; }
  .btn-row .btn { font-size: 0.78rem; padding: 10px 6px; }
}
/* Stacked-list rule (Jim, 2026-11-06): on phones every list table becomes
   cards — one bordered card per row, header hidden, no sideways scroll.
   The doubled class beats the per-page .admin-table rules. */
@media (max-width: 640px) {
  table.admin-table.stack-mobile, table.admin-table.stack-mobile tbody, table.admin-table.stack-mobile tr, table.admin-table.stack-mobile td { display: block; }
  table.admin-table.stack-mobile { border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
  table.admin-table.stack-mobile tr:first-child { display: none; }
  table.admin-table.stack-mobile tr { border: 1px solid rgba(212, 175, 55, 0.35); border-radius: 8px; background: #10294f; padding: 10px 12px; margin-bottom: 8px; }
  table.admin-table.stack-mobile td { border: none; padding: 2px 0; }
  table.admin-table.stack-mobile td:first-child { font-weight: 700; }
  table.admin-table.stack-mobile td:last-child { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
}

/* Hero */
.hero {
  text-align: center;
  padding: 72px 0 84px;
  background: radial-gradient(ellipse at 50% 0%, #123058 0%, var(--navy) 62%);
}
.logo-hero { width: 168px; height: 168px; margin-bottom: 28px; }
.hero h1 { font-size: 2.6rem; max-width: 760px; margin: 0 auto 16px; }
.hero-sub { font-size: 1.18rem; color: var(--muted); max-width: 680px; margin: 0 auto 32px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Features */
.features { padding: 72px 0; background: var(--navy-deep); }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--navy-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px 22px;
}
.feature-card h3 { font-size: 1.15rem; margin: 14px 0 8px; }
.feature-card p { color: var(--muted); font-size: 0.97rem; }
.feature-icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
}
.feature-icon svg { width: 24px; height: 24px; }

/* How it works */
.how { padding: 72px 0; }
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 36px;
}
.step {
  text-align: center;
  padding: 10px 14px;
}
.step-num {
  width: 52px; height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--gold);
  color: #1a1405;
  font-size: 1.4rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 0.97rem; }

/* CTA band */
.cta-band {
  text-align: center;
  padding: 64px 0;
  background: var(--navy-deep);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cta-band h2 { margin-bottom: 10px; }
.cta-band p { color: var(--muted); margin-bottom: 26px; }

/* Footer */
.site-footer { padding: 36px 0; background: var(--navy); }
.footer-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.logo-footer { width: 40px; height: 40px; }
.footer-nav { margin-left: auto; display: flex; gap: 20px; }
.footer-nav a { color: var(--muted); font-size: 0.95rem; }
.copyright { width: 100%; color: #7d8aa3; font-size: 0.88rem; margin-top: 8px; }

/* Forms (subscribe page) */
.form-page { padding: 56px 0 72px; }
.form-page h1 { text-align: center; margin-bottom: 8px; }
.form-page .section-sub { max-width: 560px; margin: 0 auto 36px; }
.form-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--navy-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 28px;
}
.form-card label { display: block; font-weight: 600; margin: 16px 0 6px; }
.form-card label:first-child { margin-top: 0; }
.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="tel"],
.form-card input[type="number"],
.form-card input[type="date"],
.form-card input[type="time"],
.form-card select,
.form-card textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid #35507e;
  background: #0c2347;
  color: var(--ink);
  font-size: 1rem;
  font-family: inherit;
}
.form-card textarea { min-height: 90px; resize: vertical; }
.form-card .btn { width: 100%; margin-top: 24px; }
.form-note { font-size: 0.9rem; color: var(--muted); text-align: center; margin-top: 16px; }
.form-error {
  background: rgba(200, 60, 60, 0.18);
  border: 1px solid rgba(220, 90, 90, 0.6);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
}
.form-success {
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
}
.form-success h2 { margin-bottom: 10px; }
.hp { display: none; }

/* Simple centered page (demo placeholder) */
.center-page { text-align: center; padding: 80px 0; }
.center-page .logo-badge { width: 140px; height: 140px; margin-bottom: 26px; }
.center-page h1 { margin-bottom: 12px; }
.center-page p { color: var(--muted); max-width: 560px; margin: 0 auto 14px; }
.center-page .hero-cta { margin-top: 28px; }

/* Mobile */
@media (max-width: 820px) {
  .feature-grid, .steps { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .hero { padding: 52px 0 64px; }
  .logo-hero { width: 132px; height: 132px; }
  .main-nav { gap: 14px; }
  .main-nav a:not(.btn):not(.nav-login) { display: none; }
  .menu-label { display: none; }
  .menu-btn { padding: 9px 11px; }
  .footer-nav { margin-left: 0; }
  h2 { font-size: 1.6rem; }
}

/* Text line formatted preview on document editors (Jim, 2026-11-08):
   shows the line's formatting on the line itself; click opens the editor. */
.desc-view {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #c3c9d4;
  background: #fff;
  color: #1c2333;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: pointer;
}
.desc-view:empty::before { content: 'Click to edit text'; color: #5a6478; }
.desc-view:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

/* Admin pages: clear breaks between sections — a rule line above each
   section heading, so a button never sits crunched against the next
   heading (Jim, 2026-11-09: the Save Warehouses button touched the
   Temporary warehouses heading on phones). Every heading gets the
   rule, including the first section — the two live checks both called
   out the first section's missing rule. The flagship admin page
   overrides the colour to red in its own styles (oxblood theme). */
.admin-wrap > h2 { margin-top: 40px; padding-top: 28px; border-top: 1px solid rgba(212, 175, 55, 0.35); }

/* List density (Jim, 2026-11-09): vertical space is a valuable resource
   on list pages — more rows in view, without bunching things up. Desktop
   only: the card-style list tables (each pairs .admin-table with its own
   *-table class) get tighter cell padding, a smaller gap between cards
   and a slightly smaller, tighter-set font. Horizontal padding, hairline
   borders and card separation stay. Phone/tablet rules, forms, document
   grids and the dashboard are untouched. */
@media (min-width: 821px) {
  table.leads-table, table.rmas-table, table.quotes-table, table.orders-table,
  table.picks-table, table.deliveries-table, table.invoices-table,
  table.docs-table, table.inv-table, table.job-table,
  table.serial-list, table.serial-events {
    border-spacing: 0 5px;
    font-size: 0.95rem;
    line-height: 1.45;
  }
  table.leads-table th, table.leads-table td,
  table.rmas-table th, table.rmas-table td,
  table.quotes-table th, table.quotes-table td,
  table.orders-table th, table.orders-table td,
  table.picks-table th, table.picks-table td,
  table.deliveries-table th, table.deliveries-table td,
  table.invoices-table th, table.invoices-table td,
  table.docs-table th, table.docs-table td,
  table.inv-table th, table.inv-table td,
  table.job-table th, table.job-table td,
  table.serial-list th, table.serial-list td,
  table.serial-events th, table.serial-events td {
    padding: 6px 12px;
  }
}

/* Admin panel tabs (subadmin.php overhaul, 2026-11-10): four equal
   tabs — Team / Permissions / Settings / Records — sized to fit phone
   width without wrapping. Panels are server-rendered and shown/hidden;
   the [hidden] rule is explicit so no display rule can resurrect one. */
.admin-tabs { display: flex; gap: 8px; margin: 4px 0 28px; }
.admin-tab {
  flex: 1 1 0; min-width: 0; text-align: center;
  padding: 10px 4px; border: 1px solid #35507e; border-radius: 10px;
  background: var(--navy-card); color: var(--ink);
  font-weight: 600; font-size: 0.95rem; text-decoration: none;
}
.admin-tab:hover { border-color: var(--gold); text-decoration: none; }
.admin-tab.active { background: var(--gold); border-color: var(--gold); color: #1a1405; }
.admin-panel[hidden] { display: none; }
@media (max-width: 700px) {
  .admin-tabs { gap: 6px; margin-bottom: 22px; }
  .admin-tab { font-size: 0.8rem; padding: 9px 1px; }
}

/* Page tabs (shared, 2026-11-10): the same tab pattern as the admin
   panel, for content pages that split one board into views — first
   used by the Receiving board (Receiving Orders / Loaners Out /
   Exchange Cores). Same mechanics: server-rendered panels, [hidden]
   wins, ?tab= deep links land on the right tab. */
.page-tabs { display: flex; gap: 8px; margin: 4px 0 28px; }
.page-tab {
  flex: 1 1 0; min-width: 0; text-align: center;
  padding: 10px 4px; border: 1px solid #35507e; border-radius: 10px;
  background: var(--navy-card); color: var(--ink);
  font-weight: 600; font-size: 0.95rem; text-decoration: none;
}
.page-tab:hover { border-color: var(--gold); text-decoration: none; }
.page-tab.active { background: var(--gold); border-color: var(--gold); color: #1a1405; }
.page-panel[hidden] { display: none; }
@media (max-width: 700px) {
  .page-tabs { gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
  .page-tab { font-size: 0.8rem; padding: 9px 1px; flex: 1 1 30%; }
}

/* Header menu — desktop button row (Jim, 2026-11-11): the hamburger
   is mobile-only; on desktop the same menu items sit across the top
   of the header as buttons. Mobile (<900px) keeps the dropdown. */
@media (min-width: 900px) {
  .menu-btn { display: none; }
  .menu-dropdown,
  .menu-dropdown.open {
    display: flex;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }
  .menu-dropdown a {
    display: inline-block;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    white-space: nowrap;
  }
  .menu-dropdown a:hover { background: transparent; border-color: var(--gold); text-decoration: none; }
  .menu-dropdown form { margin: 0; display: inline-flex; }
  .menu-dropdown .btn { margin-top: 0; }
  .site-header .menu-dropdown .menu-reset-btn {
    display: inline-block;
    width: auto;
    text-align: center;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    white-space: nowrap;
  }
  .site-header .menu-dropdown .menu-reset-btn:hover { border-color: var(--gold); }
}
