:root {
  --bg: #ffffff;
  --bg-sidebar: #5B9BD5;
  --bg-card: #ffffff;
  --bg-input: #f5f6f8;
  --bg-hover: #f0f2f5;
  --text: #1a1a1a;
  --text-secondary: #4a5568;
  --text-muted: #8a94a6;
  --border: #e2e5ea;
  --accent: #2b6cb0;
  --accent-hover: #2c5282;
  --green: #4BA48B;
  --orange: #DB9048;
  --red: #C0392B;
  --green-light: rgba(15,166,127,0.12);
  --red-light: rgba(185,28,28,0.12);
  --orange-light: rgba(232,146,46,0.12);
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --radius: 4px;
  --radius-lg: 6px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Cascadia Code', Consolas, monospace;
  --header-height: 48px;
  --sidebar-width: 220px;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
}

/* HEADER */
.app-header {
  height: var(--header-height);
  background: #5B9BD5;
  border-bottom: 1px solid #4A8AC4;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.app-logo {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
  margin-right: 32px;
}

.app-nav {
  display: flex;
  gap: 2px;
  height: 100%;
}

.nav-tab {
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.nav-tab:hover { color: #ffffff; background: rgba(255,255,255,0.08); }
.nav-tab.active { color: #ffffff; border-bottom-color: #ffffff; }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* LAYOUT */
.app-body {
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.page { display: none; padding: 20px 24px; }
.page.active { display: block; }

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
}

.card-body { padding: 16px; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.btn:hover { background: var(--bg-hover); border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }

/* INPUTS */
.input, .select {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}

.input:focus, .select:focus { border-color: var(--accent); }
.select { cursor: pointer; appearance: auto; }

/* FILTER BAR */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar label {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 4px;
}

.search-input {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

/* GRID */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.store-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.store-card:hover { border-color: var(--accent); }

.store-card-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.store-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
}

.store-card-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 8px;
}

.status-submitted { background: var(--green-light); color: var(--green); }
.status-pending { background: rgba(138,148,166,0.12); color: var(--text-muted); }

/* FORM PAGE */
.form-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: calc(100vh - var(--header-height));
}

.form-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.form-sidebar-title {
  padding: 0 14px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}

.section-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.section-nav-item:hover { color: #ffffff; background: rgba(255,255,255,0.08); }
.section-nav-item.active { color: #ffffff; border-left-color: #ffffff; background: rgba(255,255,255,0.1); }
.section-nav-item .check { color: var(--green); font-size: 13px; }

.form-content {
  padding: 20px 28px;
  max-width: 800px;
}

.form-store-header {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.form-store-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.form-store-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.form-section { margin-bottom: 24px; }

.form-section-title {
  font-size: 12px;
  font-weight: 600;
  padding: 10px 0;
  margin-bottom: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}

.form-question {
  position: relative;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: opacity 0.2s;
}

.form-question.hidden { display: none; }

.form-question-label {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.5;
}

.form-question-label .q-index {
  color: var(--text-muted);
  margin-right: 4px;
  font-size: 11px;
}

.form-question-label .q-kpi {
  font-size: 10px;
  background: var(--bg-input);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--accent);
  margin-left: 4px;
  font-weight: 600;
}

.form-question-label .q-required {
  color: var(--red);
  margin-left: 3px;
}

.radio-group { display: flex; gap: 16px; }

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
}

.radio-option input { cursor: pointer; accent-color: var(--accent); }

.text-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  resize: vertical;
  min-height: 50px;
}

.text-input:focus { border-color: var(--accent); }

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}

.checkbox-option input { accent-color: var(--accent); cursor: pointer; }

.file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  font-size: 12px;
  color: var(--text-muted);
}

.file-upload:hover { border-color: var(--accent); }
.file-upload input { display: none; }
.file-upload .preview { margin-top: 6px; }
.file-upload .preview img { max-height: 70px; border-radius: 4px; }

.form-actions {
  display: flex;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  position: sticky;
  bottom: 0;
  background: #ffffff;
  z-index: 10;
}

/* ═══════════════════════════════════ */
/* DASHBOARD                          */
/* ═══════════════════════════════════ */

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.dash-date-filters {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.dash-title {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-title .bose-logo {
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0.05em;
}

/* Dashboard layout — vertical tabs sidebar + content */
.dash-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  min-height: calc(100vh - var(--header-height) - 100px);
}

.dash-tabs {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 2px solid var(--border);
  background: #f7f8fa;
  padding: 8px 0;
}

.dash-tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  border-left: 3px solid transparent;
  background: none;
  white-space: nowrap;
  font-family: var(--font);
  transition: all 0.15s;
  text-align: left;
}

.dash-tab:hover { color: var(--text); background: var(--bg-hover); }
.dash-tab.active {
  color: var(--text);
  font-weight: 600;
  border-left-color: var(--accent);
  background: #fff;
}

/* Dashboard filters row */
.dash-filters {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.dash-filter-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dash-filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Stat boxes — matching Figma layout */
.stat-boxes {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}

.stat-box {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.stat-box-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.stat-box-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.stat-item {
  text-align: center;
}

.stat-item .stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-item .stat-value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-item .stat-sub {
  font-size: 11px;
  margin-top: 4px;
}

.stat-item .stat-sub .c-green { color: var(--green); font-weight: 600; }
.stat-item .stat-sub .c-red { color: var(--red); font-weight: 600; }

/* Stat cards (legacy) */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.stat-card .stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-value.green { color: var(--green); }
.stat-card .stat-value.orange { color: var(--orange); }
.stat-card .stat-value.red { color: var(--red); }

/* Score section headers */
.score-section-title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  padding: 16px 0 12px;
  margin-top: 8px;
}

/* Horizontal bar charts — matching Figma style */
.score-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.score-chart-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.score-chart-panel-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
  text-decoration: underline;
}

.hbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.hbar-label {
  width: 100px;
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.hbar-track {
  flex: 1;
  height: 18px;
  background: #f0f0f0;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  position: relative;
}

.hbar-fill {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.hbar-fill.compliant { background: var(--green); }
.hbar-fill.non-compliant { background: var(--orange); }
.hbar-fill.zero { background: var(--red); }

.hbar-threshold {
  position: absolute;
  right: 20%;
  top: 0;
  bottom: 0;
  width: 1px;
  border-right: 1px dashed rgba(0,0,0,0.3);
}

.chart-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.threshold-label {
  text-align: right;
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

/* KPI Summary bar — single sorted list */
.kpi-summary-bars {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 24px;
}

.kpi-summary-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.kpi-summary-bar-label {
  width: 180px;
  font-size: 12px;
  text-align: right;
  flex-shrink: 0;
}

.kpi-summary-bar-track {
  flex: 1;
  height: 26px;
  background: #f0f0f0;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
}

.kpi-summary-bar-fill {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

/* Per-KPI reseller chart cards */
.kpi-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.kpi-chart-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.kpi-chart-card-header {
  background: #5B9BD5;
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}

.kpi-chart-card-body {
  padding: 10px 12px;
  max-height: 280px;
  overflow-y: auto;
}

.kpi-hbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.kpi-hbar-label {
  width: 120px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.kpi-hbar-track {
  flex: 1;
  height: 18px;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
}

.kpi-hbar-fill {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
}

/* RESELLER TABLE */
.reseller-table {
  width: 100%;
  border-collapse: collapse;
}

.reseller-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: #f7f8fa;
}

.reseller-table td {
  padding: 8px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.reseller-table tr { cursor: pointer; transition: background 0.15s; }
.reseller-table tr:hover { background: var(--bg-hover); }

.compliance-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.compliance-badge.pass { background: var(--green-light); color: var(--green); }
.compliance-badge.fail { background: var(--red-light); color: var(--red); }
.compliance-badge.partial { background: var(--orange-light); color: var(--orange); }

/* RESELLER DETAIL */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  margin-bottom: 12px;
  background: none;
  border: none;
  font-family: var(--font);
}

.detail-back:hover { text-decoration: underline; }

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.detail-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.kpi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.kpi-chip {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-chip.pass { background: var(--green-light); color: var(--green); border: 1px solid rgba(15,166,127,0.3); }
.kpi-chip.fail { background: var(--red-light); color: var(--red); border: 1px solid rgba(185,28,28,0.3); }

.sub-kpi-table {
  width: 100%;
  border-collapse: collapse;
}

.sub-kpi-table th {
  text-align: left;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.sub-kpi-table td {
  padding: 6px 10px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.sub-kpi-table td.answer {
  max-width: 300px;
  word-break: break-word;
}

/* DATA EXPORT TABLE */
.data-export-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-export-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-export-table th {
  position: sticky;
  top: 0;
  background: #f7f8fa;
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: normal;
  min-width: 120px;
  max-width: 260px;
  word-wrap: break-word;
}

.data-export-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-export-table tr:hover td { background: var(--bg-hover); }
.data-export-table td.answer-yes { color: var(--green); font-weight: 500; }
.data-export-table td.answer-no { color: var(--red); font-weight: 500; }

/* KPI multi-select checkbox dropdown */
.kpi-multiselect {
  position: relative;
  display: inline-block;
}

.kpi-multiselect-btn {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 140px;
  justify-content: space-between;
}

.kpi-multiselect-btn:hover { border-color: var(--accent); }

.kpi-multiselect-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 50;
  max-height: 300px;
  overflow-y: auto;
  min-width: 220px;
  padding: 4px 0;
}

.kpi-multiselect-dropdown.open { display: block; }

.kpi-multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
}

.kpi-multiselect-item:hover { background: var(--bg-hover); }
.kpi-multiselect-item input { accent-color: var(--accent); cursor: pointer; }

/* FORM BUILDER (Edit Mode) */
.form-builder-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.form-builder-toolbar .tool-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

.form-builder-toolbar .tool-btn:hover { border-color: var(--accent); color: var(--accent); }

.form-question-actions {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  gap: 3px;
}

.form-question:hover .form-question-actions { display: flex; }

.form-question-actions button {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}

.form-question-actions button:hover { color: var(--red); border-color: var(--red); }
.form-question-actions button.edit-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Yes/No buttons */
.yesno-btn-group {
  display: flex;
  gap: 0;
}

.yesno-btn {
  padding: 6px 28px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
  color: var(--text);
}

.yesno-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.yesno-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }
.yesno-btn.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.yesno-btn:hover:not(.selected) { background: var(--bg-hover); }

.clear-response {
  font-size: 11px;
  color: var(--red);
  cursor: pointer;
  text-align: right;
  margin-top: 4px;
  background: none;
  border: none;
  font-family: var(--font);
}

.clear-response:hover { text-decoration: underline; }

/* Edit modal */
.edit-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.edit-modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 500px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.edit-modal h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

.edit-modal .field-row {
  margin-bottom: 12px;
}

.edit-modal .field-row label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.edit-modal .field-row input,
.edit-modal .field-row select,
.edit-modal .field-row textarea {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  outline: none;
}

.edit-modal .field-row input:focus,
.edit-modal .field-row select:focus { border-color: var(--accent); }

.edit-modal .modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* GALLERY */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.gallery-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}

.gallery-item:hover { border-color: var(--accent); }

.gallery-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.gallery-item-info {
  padding: 6px 8px;
  font-size: 10px;
  color: var(--text-muted);
}

/* LIGHTBOX */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 6px;
}

/* TOAST */
.toast-container {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  animation: slideIn 0.3s ease;
  color: var(--text);
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }

@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* LOADING */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
}

/* Scrollable chart panels */
.score-scroll-panel {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.score-scroll-panel .hbar-row { margin-bottom: 3px; }
.score-scroll-panel .hbar-track { height: 16px; }
.score-scroll-panel .hbar-fill { font-size: 10px; }
.score-scroll-panel .hbar-label { width: 140px; font-size: 11px; }

/* Dashboard content area */
.dash-content-area {
  padding: 0 20px;
  overflow-y: auto;
}

/* Multi-select filter dropdown (stays open) */
.filter-multiselect {
  position: relative;
  display: inline-block;
}

.filter-multiselect-btn {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 140px;
  justify-content: space-between;
}

.filter-multiselect-btn:hover { border-color: var(--accent); }

.filter-multiselect-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
  min-width: 220px;
  padding: 4px 0;
}

.filter-multiselect-dropdown.open { display: block; }

.filter-multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
}

.filter-multiselect-item:hover { background: var(--bg-hover); }
.filter-multiselect-item input { accent-color: var(--accent); cursor: pointer; }
.filter-multiselect-item.select-all { font-weight: 600; border-bottom: 1px solid var(--border); }

/* Form Results table */
.form-results-table {
  width: 100%;
  border-collapse: collapse;
}

.form-results-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: #f7f8fa;
  white-space: nowrap;
}

.form-results-table td {
  padding: 8px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.form-results-table tr:hover td { background: var(--bg-hover); }

.view-result-btn {
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  background: none;
  border: none;
  font-family: var(--font);
  padding: 0;
}

.view-result-btn:hover { text-decoration: underline; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .form-layout { grid-template-columns: 1fr; }
  .form-sidebar { display: none; }
  .store-grid { grid-template-columns: 1fr; }
  .kpi-chart-grid { grid-template-columns: 1fr; }
  .score-charts-row { grid-template-columns: 1fr; }
  .stat-boxes { flex-direction: column; }
  .dash-header { flex-direction: column; gap: 12px; }
  .dash-layout { grid-template-columns: 1fr; }
  .dash-tabs { flex-direction: row; border-right: none; border-bottom: 2px solid var(--border); overflow-x: auto; }
  .dash-tab { border-left: none; border-bottom: 3px solid transparent; }
  .dash-tab.active { border-bottom-color: var(--accent); border-left-color: transparent; }
}

/* ADMIN GEAR BUTTON */
.admin-gear-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
  line-height: 1;
}

.admin-gear-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

/* ACTION DROPDOWN (Form Results) */
.action-dropdown {
  display: inline-flex;
  position: relative;
}

.action-dropdown-trigger {
  border-radius: var(--radius) 0 0 var(--radius) !important;
  border-right: none !important;
}

.action-dropdown-arrow {
  border-radius: 0 var(--radius) var(--radius) 0 !important;
  padding: 4px 6px !important;
  min-width: 24px;
  font-size: 10px !important;
}

.action-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 60;
  min-width: 130px;
  padding: 4px 0;
  margin-top: 2px;
}

.action-dropdown-menu.open { display: block; }

.action-dropdown-item {
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}

.action-dropdown-item:hover { background: var(--bg-hover); }
.action-dropdown-item.action-dropdown-danger { color: var(--red); }
.action-dropdown-item.action-dropdown-danger:hover { background: var(--red-light); }

/* MODAL BODY SCROLL */
.modal-body-content {
  max-height: 65vh;
  overflow-y: auto;
}

/* ADMIN EDITABLE TABLE */
.admin-editable-table td.admin-cell {
  cursor: cell;
  padding: 4px 8px;
  min-width: 60px;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  border: 1px solid transparent;
  transition: border-color 0.15s;
}
.admin-editable-table td.admin-cell:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.04);
}
.admin-cell-input {
  width: 100%;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  padding: 2px 4px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

/* Online Audit Table Details */
.audit-table-header { display: flex; justify-content: space-between; align-items: flex-start; margin: 24px 0 8px; gap: 12px; }
.audit-table-title { font-size: 15px; font-weight: 700; background: #333; color: #fff; padding: 8px 16px; flex: 1; }
.audit-detail-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.audit-detail-table th, .audit-detail-table td { border: 1px solid #ccc; padding: 4px 6px; text-align: center; white-space: nowrap; }
.audit-detail-table th.adt-parent-header { background: #f5f5f5; font-weight: 700; font-size: 11px; border-bottom: 2px solid #999; }
.audit-detail-table th.adt-sub-header { background: #fafafa; font-weight: 600; font-size: 10px; }
.audit-detail-table td { font-size: 11px; color: #333; }
.audit-detail-table tbody tr:hover { background: #f9f9f9; }
.adt-sticky { position: sticky; left: 0; background: #fff; z-index: 1; text-align: left; font-weight: 500; min-width: 120px; }
.audit-detail-table thead th.adt-sticky { z-index: 3; background: #f5f5f5; }
.editable-form-name, .editable-section-name { cursor: pointer; }
.editable-form-name:hover, .editable-section-name:hover { text-decoration: underline dotted; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c4c9d2; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a8b8; }
