/* ══════════════════════════════════════════════
   NCMCA Site — Shared Stylesheet
   ══════════════════════════════════════════════ */

/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:        #1b2d4f;
  --navy-light:  #243d6a;
  --navy-dark:   #111e33;
  --gold:        #c9952a;
  --gold-light:  #e8b84b;
  --cream:       #faf8f4;
  --gray:        #f0ede8;
  --border:      #e5e0d8;
  --text:        #1e1e1e;
  --muted:       #5a5a5a;
  --white:       #ffffff;
  --radius:      6px;
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.07);
  --shadow-md:   0 6px 24px rgba(0,0,0,0.10);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.14);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  color: var(--text);
  background: var(--white);
  line-height: 1.65;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container--wide { max-width: 1300px; margin: 0 auto; padding: 0 24px; }

/* ── Typography ── */
.section-label {
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  display: block;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 400;
  color: var(--navy);
  margin-bottom: 10px;
  line-height: 1.25;
}
.section-subtitle {
  font-family: Arial, sans-serif;
  font-size: 0.97rem;
  color: var(--muted);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 44px;
}
.page-hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 16px;
}
.page-hero-sub {
  font-family: Arial, sans-serif;
  font-size: 1.05rem;
  color: rgba(255,255,255,0.82);
  max-width: 560px;
  line-height: 1.7;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 13px 28px;
  border-radius: var(--radius);
  font-family: Arial, sans-serif;
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
  border: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-gold { background: var(--gold); color: var(--white); }
.btn-gold:hover { background: var(--gold-light); color: var(--white); }
.btn-outline-white { background: transparent; color: var(--white); border: 2px solid rgba(255,255,255,0.7); }
.btn-outline-white:hover { background: var(--white); color: var(--navy); border-color: var(--white); }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--navy-light); color: var(--white); }
.btn-outline-navy { background: transparent; color: var(--navy); border: 2px solid var(--navy); }
.btn-outline-navy:hover { background: var(--navy); color: var(--white); }
.btn-white { background: var(--white); color: var(--navy); }
.btn-white:hover { background: var(--cream); color: var(--navy); }
.btn-sm { padding: 9px 18px; font-size: 0.75rem; }

/* ── Top Bar ── */
.topbar {
  background: var(--navy-dark);
  color: rgba(255,255,255,0.65);
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  padding: 7px 0;
  border-bottom: 2px solid var(--gold);
}
.topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.topbar a { color: rgba(255,255,255,0.8); transition: color 0.15s; }
.topbar a:hover { color: var(--gold-light); }
.topbar-contact { display: flex; gap: 18px; flex-wrap: wrap; }
.topbar-actions { display: flex; gap: 10px; }
.topbar-actions a {
  background: var(--gold);
  color: var(--white) !important;
  padding: 3px 12px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 0.74rem;
  transition: background 0.15s;
}
.topbar-actions a:hover { background: var(--gold-light) !important; }

/* ── Navigation ── */
.nav {
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
  gap: 16px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.nav-logo img {
  height: 48px;
  width: auto;
}
.nav-logo-text strong {
  display: block;
  font-family: Arial, sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--navy);
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.nav-logo-text small {
  font-family: Arial, sans-serif;
  font-size: 0.66rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  flex-wrap: wrap;
}
.nav-links li a {
  font-family: Arial, sans-serif;
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--navy);
  padding: 7px 11px;
  border-radius: var(--radius);
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s;
  display: block;
}
.nav-links li a:hover,
.nav-links li a.active { background: var(--gray); color: var(--gold); }
.nav-links li.nav-cta a {
  background: var(--gold);
  color: var(--white);
  padding: 7px 16px;
}
.nav-links li.nav-cta a:hover { background: var(--gold-light); color: var(--white); }

/* ── Page Hero Banner ── */
.page-hero {
  position: relative;
  background: var(--navy);
  color: var(--white);
  padding: 72px 0 64px;
  overflow: hidden;
}
.page-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.22;
}
.page-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--navy) 40%, rgba(27,45,79,0.7));
}
.page-hero .container { position: relative; z-index: 1; }
.page-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, calc(100% - 48px));
  height: 3px;
  background: var(--gold);
}
.breadcrumb {
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--gold-light); }
.breadcrumb span { margin: 0 6px; }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card-img { width: 100%; height: 220px; object-fit: cover; }
.card-body { padding: 24px; }
.card-tag {
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
  display: block;
}
.card h3 { font-size: 1.1rem; color: var(--navy); margin-bottom: 10px; font-weight: 400; }
.card p { font-family: Arial, sans-serif; font-size: 0.88rem; color: var(--muted); line-height: 1.6; }

/* ── Photo Grid (Gallery) ── */
.photo-grid {
  display: grid;
  gap: 8px;
}
.photo-grid-2 { grid-template-columns: repeat(2, 1fr); }
.photo-grid-3 { grid-template-columns: repeat(3, 1fr); }
.photo-grid-4 { grid-template-columns: repeat(4, 1fr); }
.photo-item {
  overflow: hidden;
  border-radius: var(--radius);
  position: relative;
  background: var(--navy-dark);
  cursor: pointer;
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, opacity 0.3s;
  display: block;
}
.photo-item:hover img { transform: scale(1.04); opacity: 0.88; }
.photo-item-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 16px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  color: var(--white);
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.3s;
}
.photo-item:hover .photo-item-caption { opacity: 1; }

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: fixed;
  top: 18px; right: 24px;
  font-size: 2rem;
  color: var(--white);
  cursor: pointer;
  background: none; border: none;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-caption {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-family: Arial, sans-serif;
  font-size: 0.88rem;
  text-align: center;
}

/* ── Stat Bar ── */
.stat-bar {
  background: var(--navy);
  color: var(--white);
}
.stat-bar .container {
  display: flex;
  gap: 0;
}
.stat-item {
  flex: 1;
  text-align: center;
  padding: 28px 20px;
  border-right: 1px solid rgba(255,255,255,0.1);
}
.stat-item:last-child { border-right: none; }
.stat-num {
  font-size: 2.2rem;
  color: var(--gold-light);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-label {
  font-family: Arial, sans-serif;
  font-size: 0.74rem;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ── Cert Level Cards ── */
.cert-level {
  background: var(--white);
  border-radius: var(--radius);
  border-left: 4px solid var(--gold);
  padding: 26px 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.cert-level-tag {
  font-family: Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}
.cert-level h4 { font-size: 1.1rem; color: var(--navy); font-weight: 400; margin-bottom: 8px; }
.cert-level p { font-family: Arial, sans-serif; font-size: 0.88rem; color: var(--muted); line-height: 1.6; }

/* ── Event Cards ── */
.event-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--white);
}
.event-card:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); }
.event-date { text-align: center; flex-shrink: 0; width: 54px; }
.event-month {
  font-family: Arial, sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--navy);
  color: var(--white);
  padding: 3px 0;
  border-radius: 3px 3px 0 0;
}
.event-day {
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--navy);
  line-height: 1;
  border: 1px solid var(--border);
  border-top: none;
  padding: 6px 0;
  border-radius: 0 0 3px 3px;
}
.event-info h4 { font-size: 0.95rem; color: var(--navy); font-weight: 400; margin-bottom: 4px; line-height: 1.35; }
.event-info .event-meta { font-family: Arial, sans-serif; font-size: 0.78rem; color: var(--muted); }
.event-type {
  display: inline-block;
  margin-top: 7px;
  font-family: Arial, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 2px 9px;
  border-radius: 50px;
}

/* ── CTA Banner ── */
.cta-band {
  background: var(--gold);
  padding: 56px 0;
}
.cta-band .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.cta-band h2 { font-size: clamp(1.4rem, 2.5vw, 1.9rem); color: var(--navy); font-weight: 400; margin-bottom: 8px; }
.cta-band p { font-family: Arial, sans-serif; font-size: 0.95rem; color: rgba(27,45,79,0.75); max-width: 500px; line-height: 1.65; }
.cta-band-actions { display: flex; gap: 12px; flex-wrap: wrap; flex-shrink: 0; }

/* ── Footer ── */
.footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,0.65);
  padding: 60px 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 50px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-brand p {
  font-family: Arial, sans-serif;
  font-size: 0.85rem;
  line-height: 1.65;
  margin-bottom: 18px;
  margin-top: 16px;
}
.footer-contact { font-family: Arial, sans-serif; font-size: 0.83rem; line-height: 1.9; }
.footer-contact a { color: var(--gold-light); }
.footer-logo { height: 52px; width: auto; }
.footer-col h5 {
  font-family: Arial, sans-serif;
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 18px;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a {
  font-family: Arial, sans-serif;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.55);
  transition: color 0.15s;
}
.footer-col ul li a:hover { color: var(--gold-light); }
.footer-bottom {
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-bottom p { font-family: Arial, sans-serif; font-size: 0.77rem; color: rgba(255,255,255,0.3); }

/* ── Responsive ── */
@media (max-width: 960px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .topbar .container { flex-direction: column; align-items: flex-start; gap: 8px; }
  .topbar-actions { flex-wrap: wrap; }
  .nav-links { display: none; }
  .photo-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .photo-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .stat-bar .container { flex-wrap: wrap; }
  .stat-item { min-width: 50%; border-bottom: 1px solid rgba(255,255,255,0.1); }
  .cta-band .container { flex-direction: column; }
}

/* ══════════════════════════════════════════════
   Flash Messages
   ══════════════════════════════════════════════ */
.flash-messages { max-width: 900px; margin: 18px auto 0; padding: 0 24px; }
.flash { padding: 14px 20px; border-radius: 6px; margin-bottom: 10px; font-family: Arial, sans-serif; font-size: 0.92rem; }
.flash-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.flash-error   { background: #fbe9e7; color: #c62828; border: 1px solid #ef9a9a; }
.flash-info    { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }

/* ══════════════════════════════════════════════
   Admin / Manage — Tables & Lists
   ══════════════════════════════════════════════ */
.admin-page    { padding: 48px 0 72px; background: var(--white); }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }

.admin-table { width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 0.9rem; }
.admin-table th { text-align: left; padding: 10px 14px; background: var(--navy); color: var(--white); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.admin-table th a { color: var(--white); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.admin-table th a:hover { color: var(--gold-light); }
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--navy); vertical-align: middle; }
.admin-table tbody tr { transition: background 0.15s; }
.admin-table tr:hover td { background: var(--cream); }
.admin-table tbody tr.sortable-ghost  td { background: #e8f0fe; opacity: 0.7; }
.admin-table tbody tr.sortable-chosen td { background: var(--cream); box-shadow: 0 2px 12px rgba(0,0,0,0.1); }

.sort-arrow        { font-size: 0.7rem; opacity: 0.6; }
.sort-arrow.active { opacity: 1; color: var(--gold-light); }

.drag-handle        { cursor: grab;    color: #bbb; padding-right: 6px; user-select: none; font-size: 1.1rem; }
.drag-handle:active { cursor: grabbing; }

.admin-actions {
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}
.admin-actions > a,
.admin-actions > form {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0;
}
.admin-actions > * + * {
  margin-left: 8px;
}
.admin-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
  text-decoration: none;
  font-family: Arial, sans-serif;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.admin-icon-btn:hover {
  background: var(--gold);
  color: var(--white);
  border-color: var(--gold);
}
.admin-icon-btn-danger {
  color: #c62828;
  border-color: #ef9a9a;
}
.admin-icon-btn-danger:hover {
  background: #c62828;
  color: var(--white);
  border-color: #c62828;
}

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.filter-bar input,
.filter-bar select { font-family: Arial, sans-serif; font-size: 0.85rem; padding: 7px 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--white); }
.filter-bar input { width: 220px; }
.filter-bar input:focus,
.filter-bar select:focus { border-color: var(--gold); outline: none; }
.filter-bar .btn-sm    { font-family: Arial, sans-serif; font-size: 0.82rem; padding: 7px 14px; }
.filter-bar .btn-clear { font-family: Arial, sans-serif; font-size: 0.82rem; padding: 7px 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; background: var(--white); text-decoration: none; }
.filter-bar .btn-clear:hover { color: #c62828; border-color: #ef9a9a; }

.filter-bar--persons {
  align-items: center;
  gap: 12px;
}
.filter-bar--persons .filter-field {
  flex: 0 1 auto;
  min-width: 180px;
}
.filter-bar--persons .filter-field input {
  width: 100%;
  min-height: 36px;
  box-sizing: border-box;
}
.filter-bar--persons .filter-field--search {
  flex-basis: 240px;
  max-width: 240px;
}
.filter-bar--persons .filter-field--company {
  flex-basis: 210px;
  max-width: 210px;
}
.filter-bar--persons .contacts-search {
  margin-bottom: 0;
  padding: 7px 12px;
  font-size: 0.85rem;
  border-radius: 4px;
}
.filter-bar--persons .filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.filter-bar--persons .btn-sm,
.filter-bar--persons .btn-clear {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
@media (max-width: 760px) {
  .filter-bar--persons .filter-field {
    flex-basis: 100%;
    max-width: 100%;
  }
  .filter-bar--persons .filter-actions {
    width: 100%;
  }
}

.pagination { display: flex; align-items: center; gap: 4px; margin-top: 24px; flex-wrap: wrap; }
.pagination a,
.pagination span { font-family: Arial, sans-serif; font-size: 0.82rem; padding: 6px 11px; border: 1px solid var(--border); border-radius: 4px; color: var(--navy); text-decoration: none; }
.pagination a:hover { background: var(--gold); color: var(--white); border-color: var(--gold); }
.pagination span.current  { background: var(--navy); color: var(--white); border-color: var(--navy); }
.pagination span.disabled { color: var(--muted); }
.result-count { font-family: Arial, sans-serif; font-size: 0.85rem; color: var(--muted); margin-top: 14px; }

.badge-active   { display: inline-block; font-size: 0.72rem; padding: 2px 8px; border-radius: 10px; background: #e8f5e9; color: #2e7d32; }
.badge-inactive { display: inline-block; font-size: 0.72rem; padding: 2px 8px; border-radius: 10px; background: #fbe9e7; color: #c62828; }
.badge-lapsed { display: inline-block; font-size: 0.72rem; padding: 2px 8px; border-radius: 10px; background: #fff4e5; color: #a15b00; }
.badge-never-member { display: inline-block; font-size: 0.72rem; padding: 2px 8px; border-radius: 10px; background: #eceff1; color: #455a64; }
.badge-yes { display: inline-block; background: #1b5e20; color: #fff; font-size: 0.72rem; font-family: Arial, sans-serif; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.badge-no  { display: inline-block; background: var(--border); color: var(--muted); font-size: 0.72rem; font-family: Arial, sans-serif; font-weight: 700; padding: 2px 8px; border-radius: 10px; }

#save-order-btn         { display: none; }
#save-order-btn.visible { display: inline-flex; align-items: center; gap: 6px; }

/* ── Manage Dashboard Cards ── */
.admin-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-top: 32px; }
.admin-card  { background: var(--cream); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 28px; transition: box-shadow 0.2s, border-color 0.2s; }
.admin-card:hover { box-shadow: var(--shadow-lg); border-color: var(--gold); }
.admin-card h3  { font-size: 1.15rem; color: var(--navy); margin-bottom: 6px; }
.admin-card p   { font-family: Arial, sans-serif; font-size: 0.88rem; color: var(--muted); line-height: 1.6; margin-bottom: 18px; }
.admin-card .btn { font-size: 0.82rem; }
@media (min-width: 1250px) { .admin-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .admin-cards { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════
   Admin / Manage — Forms
   ══════════════════════════════════════════════ */
.admin-form {
  max-width: 760px;
  background: var(--cream);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 40px 44px;
}

/* ── Row grid ── */
.form-row        { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 0; }
.form-row.triple { grid-template-columns: 1fr 1fr 1fr; }

/* ── Individual field ── */
.form-group {
  min-width: 0;          /* prevent grid blowout */
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
}
.form-group.full  { grid-column: 1 / -1; }
.form-group label {
  font-family: Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--navy);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;           /* fill the column, never overflow */
  box-sizing: border-box;
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,149,42,0.15);
  outline: none;
}
gmp-place-autocomplete,
.office-address-autocomplete {
  width: 100%;
  display: block;
  color-scheme: light;
  --gmpx-color-surface: #ffffff;
  --gmpx-color-on-surface: var(--navy);
  --gmpx-color-outline: var(--border);
  --gmpx-color-primary: var(--gold);
  --gmpx-font-family-base: Arial, sans-serif;
}
.admin-form input.is-invalid,
.admin-form select.is-invalid,
.admin-form textarea.is-invalid {
  border-color: #c62828;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}
.admin-form input.is-valid,
.admin-form select.is-valid,
.admin-form textarea.is-valid {
  border-color: #2e7d32;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}
.form-group textarea         { resize: vertical; min-height: 88px; }
.form-group select[multiple] { min-height: 110px; }

/* ── Checkboxes ── */
.checkbox-row                        { display: flex; align-items: center; gap: 10px; font-family: Arial, sans-serif; font-size: 0.9rem; color: var(--navy); margin-bottom: 16px; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; flex-shrink: 0; }
.checkbox-row label                  { margin: 0; text-transform: none; letter-spacing: 0; font-weight: 400; }

.checkbox-group                            { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.checkbox-label                            { display: flex; align-items: center; gap: 6px; font-family: Arial, sans-serif; font-size: 0.88rem; color: var(--navy); font-weight: 400; text-transform: none; letter-spacing: 0; cursor: pointer; }
.checkbox-label input[type="checkbox"]     { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Form footer buttons ── */
.form-buttons             { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; align-items: center; }
.form-buttons-top         { margin-top: 0; margin-bottom: 28px; justify-content: flex-end; }
.form-buttons .btn-cancel { font-family: Arial, sans-serif; font-size: 0.85rem; padding: 10px 22px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); background: var(--white); cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.form-buttons .btn-cancel:hover { border-color: var(--navy); color: var(--navy); }

.required { color: #c33; }
.hint     { font-family: Arial, sans-serif; font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

.phone-rows { display: grid; gap: 10px; margin-bottom: 10px; }
.phone-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 90px auto;
  gap: 10px;
  align-items: center;
}
.phone-row select,
.phone-row input {
  width: 100%;
  box-sizing: border-box;
}
.phone-row .admin-icon-btn {
  justify-self: end;
}
.btn-phone-remove {
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  padding: 9px 12px;
  border: 1px solid #ef9a9a;
  border-radius: 4px;
  background: var(--white);
  color: #c62828;
  cursor: pointer;
  white-space: nowrap;
}
.btn-phone-remove:hover { background: #c62828; color: var(--white); border-color: #c62828; }

.contact-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}
.contact-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 22px;
}
.contact-badge,
.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  line-height: 1;
  background: #eef3ff;
  border: 1px solid #c7d8ff;
  color: var(--navy);
}
.contact-badge-remove {
  border: none;
  background: transparent;
  color: #304879;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.form-section-divider {
  border: none;
  border-top: 1px solid var(--border, #ddd);
  margin: 24px 0;
}

.contacts-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

/* ── Contact Picker Modal ── */
.contacts-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.contacts-modal[hidden] { display: none; }

.contacts-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.contacts-modal-dialog {
  position: relative;
  z-index: 1;
  background: var(--white);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.contacts-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.contacts-modal-head h3 {
  font-family: Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

.contacts-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  padding: 0 4px;
}
.contacts-modal-close:hover { color: var(--navy); }

.contacts-modal-body {
  display: flex;
  flex-direction: column;
  padding: 16px 22px 20px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.company-save-modal-dialog {
  max-width: 420px;
}
.company-save-modal-body {
  gap: 16px;
}
.company-save-modal-body p {
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
  color: var(--navy);
}
.company-save-modal-actions {
  display: flex;
  justify-content: flex-end;
}

.contacts-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.contacts-search:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(27,45,79,0.12);
}

.contacts-picker-table-wrap {
  overflow-y: auto;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.contacts-picker-table {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial, sans-serif;
  font-size: 0.86rem;
}

.contacts-picker-table thead th {
  position: sticky;
  top: 0;
  background: var(--gray);
  padding: 8px 12px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.contacts-picker-table tbody tr {
  border-bottom: 1px solid var(--border);
}
.contacts-picker-table tbody tr:last-child { border-bottom: none; }
.contacts-picker-table tbody tr:hover { background: var(--gray); }

.contacts-picker-table td {
  padding: 9px 12px;
  color: var(--text);
  vertical-align: middle;
}

.btn-contact-add {
  padding: 4px 12px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: Arial, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-contact-add:hover { background: var(--navy-light); }
.btn-contact-add:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: default;
}
.contacts-table-head,
.contacts-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(170px, 1.1fr) minmax(150px, 0.9fr) 82px;
  gap: 12px;
  align-items: center;
}
.contacts-table-head {
  padding: 0 14px 8px;
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.contacts-rows {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}
.contacts-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--navy);
  font-family: Arial, sans-serif;
  background: rgba(245,247,250,0.92);
}
.contacts-summary-cell {
  min-width: 0;
  font-size: 0.84rem;
  line-height: 1.3;
}
.contacts-summary-name {
  font-weight: 700;
}
.contacts-card-actions {
  display: inline-flex;
  align-items: center;
  justify-self: end;
}
.contacts-empty-row {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: Arial, sans-serif;
  font-size: 0.84rem;
  color: var(--muted);
  background: var(--white);
}

.office-table-head,
.office-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(150px, 0.9fr) minmax(170px, 1fr) 82px;
  gap: 12px;
  align-items: center;
}
.office-table-head {
  padding: 0 14px 8px;
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.office-rows { display: grid; gap: 10px; margin-bottom: 12px; }
.office-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.7);
  overflow: hidden;
}
.office-card-header {
  padding: 12px 14px;
  color: var(--navy);
  font-family: Arial, sans-serif;
  background: rgba(245,247,250,0.92);
}
.office-summary-cell {
  min-width: 0;
  font-size: 0.84rem;
  line-height: 1.3;
}
.office-summary-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.office-name-input {
  min-width: 0;
  margin: 0;
}
.office-primary-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  color: var(--navy);
  text-transform: none;
  letter-spacing: 0;
}
.office-primary-inline { white-space: nowrap; margin: 0; justify-self: start; }
.office-primary-copy { font-size: 0.78rem; }
.office-primary-label input[type="radio"] {
  width: 15px;
  height: 15px;
  accent-color: var(--gold);
}
.office-primary-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff5df;
  border: 1px solid #e7c979;
  color: #725200;
  font-family: Arial, sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.office-primary-badge.hidden { display: none; }
.office-primary-edit-row {
  margin-bottom: 10px;
}
.office-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}
.office-card-body[hidden] { display: none; }
.office-card-body {
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--white);
}
.office-card-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.office-save-status {
  min-height: 1em;
  color: #2e7d32;
  font-size: 0.82rem;
}
.office-save-status.is-error {
  color: #c62828;
}
.office-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.office-grid-phone { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 110px; }
.office-grid-address { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.office-grid-location { grid-template-columns: minmax(0, 1.2fr) 90px 120px; margin-bottom: 0; }
.btn-office-icon {
  font-family: Arial, sans-serif;
  font-size: 1rem;
  line-height: 1;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  cursor: pointer;
  border: 1px solid #b8c5dc;
  color: var(--navy);
}
.btn-office-icon:hover { background: #e8effb; }
.btn-office-remove {
  border: 1px solid #ef9a9a;
  color: #c62828;
}
.btn-office-remove:hover { background: #c62828; color: var(--white); border-color: #c62828; }
.office-summary {
  padding: 8px 0;
  font-family: Arial, sans-serif;
  font-size: 0.84rem;
  line-height: 1.45;
}
.office-summary + .office-summary { border-top: 1px solid var(--border); }
.office-name-list { display: flex; flex-wrap: wrap; gap: 8px; }
.office-name-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-family: Arial, sans-serif;
  font-size: 0.77rem;
  line-height: 1;
  background: #f3f6fb;
  border: 1px solid #d5dfeb;
  color: var(--navy);
}
.office-name-chip.primary {
  background: #fff5df;
  border-color: #e7c979;
  color: #725200;
}
.office-primary-mini-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ffe8b0;
  border: 1px solid #e2bf66;
  color: #725200;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.chapter-chip {
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f7;
  border: 1px solid #d7dde8;
  color: #2d466f;
  font-family: Arial, sans-serif;
  font-size: 0.74rem;
}
.checkbox-row-top {
  margin-bottom: 18px;
  justify-content: flex-end;
}

@media (min-width: 1300px) {
  .admin-form { max-width: 920px; }
}

/* ── Form responsive breakpoints ── */
@media (max-width: 740px) {
  .admin-form { padding: 28px 24px; }
}
@media (max-width: 580px) {
  .form-row,
  .form-row.triple { grid-template-columns: 1fr; }
  .form-group.full { grid-column: auto; }
  .contact-picker { grid-template-columns: 1fr; }
  .office-table-head { display: none; }
  .phone-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .office-card-header {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
  .office-summary-cell:nth-child(2),
  .office-summary-cell:nth-child(3) {
    grid-column: 1 / -1;
  }
  .office-primary-inline {
    grid-column: 1 / 2;
  }
  .office-grid,
  .office-grid-phone,
  .office-grid-address,
  .office-grid-location {
    grid-template-columns: 1fr;
  }
  .office-card-actions {
    justify-self: start;
    grid-column: 2 / 3;
    grid-row: 1 / span 2;
  }
  .office-card-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .checkbox-row-top {
    justify-content: flex-start;
  }
}
@media (max-width: 400px) {
  .admin-form { padding: 20px 16px; }
}

/* ── Company Comment Thread ── */
.comment-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.comment-item {
  background: var(--gray);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.comment-date {
  font-family: Arial, sans-serif;
  font-size: 0.75rem;
  color: var(--muted);
}

.btn-comment-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1;
  padding: 0 2px;
}
.btn-comment-delete:hover { color: #c0392b; }

.comment-delete-form { margin: 0; }

.comment-body {
  font-size: 0.92rem;
  white-space: pre-wrap;
  color: var(--text);
}

.comment-empty {
  font-family: Arial, sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.comment-add-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: Arial, sans-serif;
  font-size: 0.9rem;
  resize: vertical;
}
.comment-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(27,45,79,0.12);
}
