:root {
  --navy: #101a33;
  --navy-light: #1c2b4f;
  --blue: #2f5fe0;
  --blue-dark: #2347b3;
  --bg: #f3f5fa;
  --border: #dde2ec;
  --green: #1a9c5c;
  --amber: #b8860b;
  --red: #d13c3c;
  --gray: #6b7280;
  --shadow: 0 1px 3px rgba(16, 26, 51, 0.08), 0 1px 2px rgba(16, 26, 51, 0.06);
  --shadow-md: 0 4px 14px rgba(16, 26, 51, 0.10);
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  margin: 0;
  color: #182036;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }

/* ---- Top bar ---- */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar .brand { font-weight: 800; font-size: 1.25rem; letter-spacing: 0.06em; }
.topbar .brand span { color: #7ea1ff; }
.topbar nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.9rem; align-items: center; }
.topbar nav a { opacity: 0.88; transition: opacity .15s; }
.topbar nav a:hover { opacity: 1; }

/* ---- App shell: sidebar + main content (admin) ---- */
.app-shell { display: flex; align-items: flex-start; min-height: calc(100vh - 58px); }
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 58px);
  padding: 18px 0;
  position: sticky;
  top: 58px;
}
.sidebar-section {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray);
  font-weight: 700;
  padding: 16px 22px 6px;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 22px;
  color: #2a3350;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border-left: 3px solid transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.sidebar a:hover { background: #f2f5fd; }
.sidebar a.active { background: #eef2ff; border-left-color: var(--blue); color: var(--blue); }
.app-main { flex: 1; min-width: 0; }
@media (max-width: 780px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%; position: static; min-height: auto;
    display: flex; overflow-x: auto; padding: 8px 6px; gap: 2px;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .sidebar-section { display: none; }
  .sidebar a { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; padding: 9px 14px; }
  .sidebar a.active { border-left-color: transparent; border-bottom-color: var(--blue); }
}

.container { max-width: 1000px; margin: 0 auto; padding: 20px; }

/* ---- Splash / brand lockup (admin dashboard header) ---- */
.brand-splash { text-align: center; padding: 30px 16px 22px; }
.brand-splash .logo {
  font-size: 3.2rem; font-weight: 900; letter-spacing: 0.18em; color: var(--navy);
  margin: 0;
}
.brand-splash .logo span { color: var(--blue); }
.brand-splash .tagline { color: var(--gray); font-size: 1.1rem; margin-top: 6px; font-style: italic; }
.brand-splash hr { border: none; border-top: 2px solid var(--blue); width: 220px; margin: 14px auto; opacity: 0.5; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
h1, h2, h3 { margin-top: 0; }
h1 { font-size: 1.4rem; font-weight: 800; }
h2 { font-size: 1.08rem; font-weight: 700; }
label { display: block; font-size: 0.85rem; color: #333; margin: 10px 0 4px; font-weight: 600; }
input[type=text], input[type=password], input[type=file], input[type=number], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,95,224,0.14);
}
textarea { min-height: 70px; }
button, .btn {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 12px;
  transition: background .12s, transform .05s;
}
button:hover, .btn:hover { background: var(--blue-dark); }
button:active, .btn:active { transform: translateY(1px); }
.btn-secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.btn-secondary:hover { background: #eef2fb; }
.btn-sm { padding: 6px 10px; font-size: 0.82rem; margin-top: 0; }
.btn-green { background: var(--green); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { border: 1px solid var(--border); padding: 9px 10px; text-align: left; vertical-align: top; }
th { background: #f5f7fc; font-weight: 700; color: #2a3350; }
tr:hover td { background: #fafbfe; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.74rem; font-weight: 700; }
.badge-pending { background: #fde8e8; color: var(--red); }
.badge-assigned { background: #fef3c7; color: var(--amber); }
.badge-installed { background: #dcfce7; color: var(--green); }
.error { background: #fde8e8; color: #a4241e; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid #f5c2c2; }
.success { background: #dcfce7; color: #146c2e; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid #b9e8cb; }
.muted { color: var(--gray); font-size: 0.85rem; }
.shop-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fff; box-shadow: var(--shadow); }
.shop-card h3 { margin-bottom: 4px; }
.distance-tag { float: right; background: #eef2fb; color: var(--blue); padding: 3px 9px; border-radius: 12px; font-size: 0.8rem; font-weight: 700; }
.photo-thumb { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; margin: 4px; border: 1px solid var(--border); }

/* Lightbox: hover-zoom on thumbnails, click opens a modal (with download/close)
   instead of navigating to a new tab. */
.lightbox-trigger { cursor: zoom-in; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.lightbox-trigger:hover { transform: scale(1.08); box-shadow: var(--shadow-md); position: relative; z-index: 2; }

body.lightbox-open { overflow: hidden; }
.lightbox-overlay {
  display: none !important;
  position: fixed !important; inset: 0 !important; z-index: 99999 !important;
  background: rgba(10, 14, 28, 0.85);
  align-items: center; justify-content: center;
  padding: 24px; box-sizing: border-box;
  overflow: auto;
}
.lightbox-overlay.open { display: flex !important; }
.lightbox-overlay img {
  max-width: min(100%, 92vw); max-height: 82vh;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  background: #fff;
  object-fit: contain;
}
.lightbox-status { color: #fff; margin-top: 10px; font-size: 0.85rem; min-height: 18px; text-align: center; }
.lightbox-toolbar {
  position: absolute; top: 18px; right: 22px;
  display: flex; gap: 10px; flex-wrap: wrap; max-width: calc(100% - 44px); justify-content: flex-end;
}
.lightbox-toolbar a, .lightbox-toolbar button {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.95); color: #182036;
  border: none; border-radius: 8px;
  padding: 8px 14px; font-size: 0.85rem; font-weight: 700;
  cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow);
}
.lightbox-toolbar a:hover, .lightbox-toolbar button:hover { background: #fff; }
.lightbox-toolbar .lightbox-close { background: var(--red); color: #fff; }
.lightbox-toolbar .lightbox-close:hover { background: #b83030; }
.lightbox-toolbar .lightbox-secondary { background: rgba(255,255,255,0.95); color: #182036; }
.lightbox-toolbar .lightbox-secondary:hover { background: #fff; }
@media (max-width: 560px) {
  .lightbox-toolbar { top: 10px; right: 10px; }
  .lightbox-toolbar a, .lightbox-toolbar button { padding: 7px 10px; font-size: 0.78rem; }
}
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 90vh; padding: 16px; background: radial-gradient(circle at top, #16204a 0%, var(--navy) 60%); }
.login-box { max-width: 380px; width: 100%; box-shadow: var(--shadow-md); }
.login-box .logo { text-align: center; font-size: 2rem; font-weight: 900; letter-spacing: 0.15em; color: var(--navy); margin-bottom: 4px; }
.login-box .logo span { color: var(--blue); }
.tab-row { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-row a { flex: 1; text-align: center; padding: 10px; border-radius: 8px; background: #fff; border: 1px solid var(--border); text-decoration: none; color: #333; font-weight: 600; }
.tab-row a.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.checkbox-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.checkbox-row input { width: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
footer.small { text-align: center; color: var(--gray); font-size: 0.78rem; padding: 20px; }
