:root {
  --surface-1: #1a1a19;
  --page: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --border: rgba(255, 255, 255, 0.10);
  --gridline: #2c2c2a;
  --brand: #3987e5;
  --brand-dark: #184f95;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
  line-height: 1.5;
}

header.site {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  padding: 14px 20px;
  min-height: 36px;
}

header.site .brand { min-width: 0; display: flex; align-items: center; gap: 12px; }
header.site .brand-logo { height: 44px; width: 44px; border-radius: 50%; flex-shrink: 0; }
header.site h1 { margin: 0; font-size: 1.5rem; }

/* ── Standard title-bar icon buttons (Home / Back / Settings / Guide / Profile) ──────
   Matches cwaJPODdash/cwaJPODmitel/dashboard.fity.ca - reuse this exact icon set/markup
   everywhere instead of inventing new button styles per app. */
.title-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
}

.title-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 2px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.icon-btn:hover { background: rgba(0, 0, 0, 0.35); }
.icon-btn svg { width: 18px; height: 18px; fill: #ffffff; }

.dropdown-menu-custom {
  display: none;
  position: absolute;
  top: 44px;
  right: 0;
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  min-width: 240px;
  padding: 0.4rem;
  z-index: 30;
}

.dropdown-menu-custom.show { display: block; }

.dropdown-menu-custom .label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.4rem 0.7rem 0.2rem;
}

.dropdown-menu-custom .item {
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  font-size: 0.87rem;
  cursor: pointer;
}

.dropdown-menu-custom .item:hover { background: var(--page); }

.pin-error {
  color: #ff6b6b;
  font-size: 0.9rem;
  min-height: 1.2em;
  margin: 8px 0 0;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.panel h2 { margin-top: 0; font-size: 1.1rem; }

label { font-weight: 600; display: block; margin-bottom: 6px; }
select {
  width: 100%;
  padding: 8px;
  font-size: 14px;
  border: 1px solid var(--gridline);
  border-radius: 6px;
  background: var(--page);
  color: var(--text-primary);
}
.muted { color: var(--text-muted); font-size: 13px; margin: 8px 0 16px; }

.dropZone {
  border: 2px dashed var(--gridline);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dropZone.dragover {
  background: rgba(57, 135, 229, 0.12);
  border-color: var(--brand);
}

.statusBox {
  margin-top: 16px;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
}
.statusBox.success { background: rgba(52, 199, 89, 0.15); color: #6fe08a; }
.statusBox.error { background: rgba(255, 69, 58, 0.15); color: #ff8a80; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; }
a.downloadLink { color: var(--brand); text-decoration: none; font-weight: 600; }
a.downloadLink:hover { text-decoration: underline; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tag.success { background: rgba(52, 199, 89, 0.15); color: #6fe08a; }
.tag.error { background: rgba(255, 69, 58, 0.15); color: #ff8a80; }

/* ── Clear Upload Log confirm dialog ──────────────────────────────────────── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.dialog-box {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  padding: 24px;
  width: 340px;
  max-width: 90vw;
}

.dialog-box h2 { margin: 0 0 12px; font-size: 1.2rem; }

.dialog-box input {
  width: 100%;
  padding: 10px;
  font-size: 1.2rem;
  letter-spacing: 3px;
  text-align: center;
  border: 1px solid var(--gridline);
  border-radius: 8px;
  margin: 10px 0;
  font-family: inherit;
  background: var(--page);
  color: var(--text-primary);
}

.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.dialog-actions button {
  flex: 1;
  padding: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.btn-secondary { background: var(--gridline); color: var(--text-primary); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a3291b; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }

.verify-info {
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 12px;
  margin: 4px 0 14px;
}
.verify-info__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.verify-info__row:last-child { border-bottom: none; }
.verify-info__row span { color: var(--text-muted); }

/* ── Daily Visitors page ──────────────────────────────────────────────────── */
.text-input {
  width: 100%;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.text-input:focus { outline: none; border-color: var(--brand); }

.btn {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: var(--brand-dark);
  color: #fff;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.6; cursor: default; }

.form-error { margin-top: 10px; font-size: 0.78rem; color: #ff6b6b; }
.form-error:empty { display: none; }

.breadcrumb { font-size: 0.85rem; margin-bottom: 4px; }
.breadcrumb a { color: var(--brand); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.site-count { font-size: 0.85rem; color: var(--text-muted); margin: -2px 0 18px; }

.filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-1);
  margin-bottom: 16px;
}
.filter-panel .form-field { flex: 1 1 180px; min-width: 160px; }
.filter-panel__actions { display: flex; gap: 8px; flex: 0 0 auto; }

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-1);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.data-table th, .data-table td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--gridline);
  white-space: nowrap;
}
.data-table th {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 800;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--page); }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text-primary); }

/* ── Audit viewer page ────────────────────────────────────────────────────── */
.gridWrap { overflow-x: auto; }
.backLink { display: inline-block; margin-bottom: 16px; color: var(--brand); text-decoration: none; }
.backLink:hover { text-decoration: underline; }
.sectionLabel { font-size: 13px; color: var(--text-muted); margin: 0 0 10px; }
