/* =========================================================
   Merged stylesheet — base app styles + admin dashboard.
   (formerly styles.css + admin.css)
   Base tokens are defined first so admin rules can consume them.
   ========================================================= */

/* =========================================================
   DOFE Complaint System — Centralized Stylesheet
   Tokens from design-system.md; primary = blue-600 (#1560bd)
   ========================================================= */

/* ---------- Raw tokens ---------- */
:root {
  /* Brand reds */
  --red-500: #ce0000;
  --red-600: #b30000;
  --red-400: #dc143c;

  /* Greens */
  --green-700: #1b5e20;
  --green-500: #388e3c;
  --green-400: #4caf50;

  /* Blues */
  --blue-600: #1560bd;
  --blue-500: #1e5fcc;
  --blue-700: #0f4a91;

  /* Earth tones */
  --gold-500: #c9a227;
  --gold-600: #b8902b;

  /* Neutrals */
  --white:    #ffffff;
  --gray-50:  #f7f7f8;
  --gray-100: #ececef;
  --gray-200: #dfe1e6;
  --gray-300: #c9ccd3;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #141518;
  --black:    #000000;
}

/* ---------- Semantic tokens (main theme = BLUE) ---------- */
:root {
  /* Brand — primary BLUE per user instruction */
  --color-primary:        var(--blue-600);
  --color-primary-hover:  var(--blue-700);
  --color-primary-soft:   #e8f0fa;
  --color-primary-ink:    var(--blue-700);

  --color-secondary:      var(--red-500);
  --color-secondary-hover: var(--red-600);
  --color-secondary-soft: #fde9e9;
  --color-secondary-ink:  var(--red-600);

  --color-accent:         var(--gold-500);
  --color-accent-hover:   var(--gold-600);
  --color-accent-soft:    #fbf3d8;
  --color-accent-ink:     #6b5210;

  --color-success:        var(--green-500);
  --color-success-soft:   #e3f1e4;
  --color-warning:        var(--gold-500);
  --color-danger:         var(--red-400);
  --color-danger-soft:    #fde9ed;

  /* Surfaces */
  --color-bg:             var(--white);
  --color-surface:        var(--white);
  --color-surface-alt:    var(--gray-50);
  --color-border:         var(--gray-200);
  --color-border-strong:  var(--gray-300);

  /* Text */
  --color-text:           var(--gray-900);
  --color-text-muted:     var(--gray-500);
  --color-text-soft:      var(--gray-500);
  --color-text-inverse:   var(--white);

  /* Structural — header is BLUE per user instruction */
  --color-header-bg:      var(--color-primary);
  --color-header-text:    var(--white);
  --color-footer-bg:      var(--gray-900);
  --color-footer-text:    var(--gray-100);

  /* Spacing */
  --space-1: 0.25rem; --space-2: 0.5rem;  --space-3: 0.75rem;
  --space-4: 1rem;    --space-6: 1.5rem;  --space-8: 2rem;
  --space-12: 3rem;   --space-16: 4rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.15);

  /* Typography */
  --font-sans: "Mukta", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-sm: 0.875rem; --text-base: 1rem; --text-lg: 1.125rem;
  --text-xl: 1.5rem;   --text-2xl: 2rem;  --text-3xl: 2.25rem;
  --leading: 1.6;

  /* Layout */
  --container: 1200px;
  --header-h: 64px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-base);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

p { margin: 0; }
a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover { color: var(--color-primary-hover); text-decoration: underline; }

button { font-family: inherit; }

/* ---------- App Shell ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--color-header-bg);
  color: var(--color-header-text);
  border-bottom: 1px solid var(--color-border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.app-header .brand-text strong,
.app-header .brand-text span {
  color: var(--color-header-text);
}

.app-header .brand-text span {
  opacity: 0.85;
}

.app-header .user-pill {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
  color: var(--color-header-text);
}

.app-header .user-pill .user-avatar {
  background: white;
  color: var(--color-primary);
}

.app-header .btn-ghost {
  color: var(--color-header-text);
}

.app-header .btn-ghost:hover {
  background: rgba(255,255,255,0.15);
  color: var(--color-header-text);
}

.app-header .brand-mark {
  background: white;
  border-color: rgba(255,255,255,0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 3px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 15px;
  color: var(--color-text);
}

.brand-text span {
  font-size: 12px;
  color: var(--color-text-muted);
}

.brand-text .brand-gov { font-size: 11px; }
.brand-text .brand-dept { font-size: 12px; font-weight: 600; color: var(--color-text); }
.brand-text .brand-sys { font-size: 14px; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 14px;
  color: var(--color-header-text);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--white);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.app-main {
  flex: 1;
  padding: 32px;
}

.app-footer {
  border-top: 1px solid var(--color-border);
  padding: 16px 32px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
  background: var(--color-surface);
}

/* ---------- Auth Pages (centered card) ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-aside {
  background: var(--color-primary);
  color: white;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.auth-aside::before { content: none; }

.auth-aside-content {
  position: relative;
  z-index: 1;
}

.auth-aside .brand-mark {
  width: 56px;
  height: 56px;
  background: white;
  border-color: rgba(255,255,255,0.4);
}

.auth-aside h1 {
  font-size: 32px;
  color: white;
  margin-top: 32px;
  letter-spacing: -0.5px;
}

.auth-aside .lede {
  margin-top: 16px;
  color: oklch(1 0 0 / 0.85);
  font-size: 16px;
  max-width: 38ch;
}

.auth-aside-foot {
  position: relative;
  z-index: 1;
  font-size: 13px;
  color: oklch(1 0 0 / 0.7);
}

.auth-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--color-bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card h2 {
  font-size: 26px;
  margin-bottom: 4px;
}

.auth-card .auth-sub {
  color: var(--color-text-muted);
  margin-bottom: 28px;
  font-size: 14px;
}

.auth-foot-link {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--color-text-muted);
}

@media (max-width: 880px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { padding: 32px; min-height: auto; }
  .auth-aside h1 { font-size: 24px; margin-top: 16px; }
  .auth-aside-foot { display: none; }
}

/* ---------- Form fundamentals ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  grid-column: span 12;
}

.field.col-6 { grid-column: span 6; }
.field.col-4 { grid-column: span 4; }
.field.col-3 { grid-column: span 3; }
.field.col-8 { grid-column: span 8; }

@media (max-width: 720px) {
  .field.col-6,
  .field.col-4,
  .field.col-3,
  .field.col-8 { grid-column: span 12; }
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.field .req {
  color: var(--color-danger);
  margin-left: 2px;
}

.field .hint {
  display: none;
}

.field .error-text {
  font-size: 12px;
  color: var(--color-danger);
  display: none;
}

.field.has-error .error-text { display: block; }

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--color-danger);
  background: var(--color-danger-soft);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

input[readonly] {
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.checkbox input,
.radio input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

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

.radio-group label {
  flex: 1;
  min-width: 140px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  background: var(--color-surface);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.radio-group label:hover {
  border-color: var(--color-primary);
}

.radio-group label.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary-ink);
}

.multi-select {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  min-height: 44px;
}

.multi-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.multi-chip:hover { border-color: var(--color-primary); }

.multi-chip.is-selected {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-accent-soft);
}

.multi-chip.is-selected::after {
  content: "✓";
  font-size: 12px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-text-inverse);
  text-decoration: none;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-surface-alt);
  color: var(--color-text);
  text-decoration: none;
}

.btn-danger {
  background: var(--color-surface);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
  text-decoration: none;
}

.btn-block { width: 100%; }

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Card / Panel ---------- */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
}

.panel-header h2 {
  font-size: 18px;
}

.panel-body { padding: 24px; }

/* ---------- Accordion ---------- */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.accordion-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion-section.is-open {
  border-color: var(--color-primary);
}

.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 20px 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  text-align: left;
}

.accordion-trigger:hover {
  background: var(--color-surface-alt);
}

.accordion-num {
  display: none;
}

.accordion-title {
  flex: 1;
  display: flex;
  align-items: center;
}

.accordion-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  transition: all 0.2s;
}

.accordion-section.is-open .accordion-toggle {
  background: var(--color-primary);
  color: white;
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  padding: 0 24px;
  border-top: 0 solid transparent;
  transition:
    max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    border-top-color 0.32s linear;
}

.accordion-section.is-open .accordion-body {
  padding: 24px;
  border-top: 1px solid var(--color-border);
}

.accordion-body > * + * { margin-top: 0; }

.section-help {
  background: var(--color-primary-soft);
  border-left: 3px solid var(--color-primary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 20px;
}

/* ---------- Repeater ---------- */
.repeater {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.repeater-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
  padding: 24px;
  position: relative;
}

.repeater-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.repeater-item-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text);
}

.repeater-add {
  align-self: flex-start;
  margin-top: 20px;
}

/* ---------- Table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.data-table th {
  background: var(--color-surface-alt);
  font-weight: 700;
  font-size: 13px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.data-table tbody tr:hover {
  background: var(--color-surface-alt);
}

.claim-row td input {
  font-size: 13px;
  padding: 8px 10px;
}

.claim-total {
  background: var(--color-primary-soft) !important;
  font-weight: 700;
  color: var(--color-primary-ink);
}

/* Document table row cells */
#documentsTable td .error-text {
  font-size: 12px;
  color: var(--color-danger);
  display: none;
}
#documentsTable td.has-error .error-text { display: block; }
#documentsTable td.has-error select,
#documentsTable td.has-error input {
  border-color: var(--color-danger);
  background: var(--color-danger-soft);
}
#documentsTable td select,
#documentsTable td input[type="file"] {
  font-size: 13px;
  padding: 8px 10px;
  width: 100%;
}

/* ---------- Stat cards (Dashboard) ---------- */
.page-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title h1 {
  font-size: 28px;
  letter-spacing: -0.4px;
}

.page-title .page-sub {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 8px;
  line-height: 1;
}

.stat-card .stat-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--color-text-soft);
}

.cta-card {
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-md);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.cta-card h2 {
  color: white;
  font-size: 22px;
  margin-bottom: 6px;
}

.cta-card p {
  color: rgba(255,255,255,0.85);
  max-width: 56ch;
}

.cta-card .btn {
  background: white;
  color: var(--color-primary);
  border-color: white;
}

.cta-card .btn:hover {
  background: var(--gray-50);
  color: var(--color-primary-hover);
}

/* ---------- Checklist ---------- */
.checklist-wrap {
  max-width: 720px;
  margin: 0 auto;
}

.checklist-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 14px;
}

.checklist-question {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.checklist-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.checklist-question p {
  font-weight: 600;
  font-size: 15px;
}

.checklist-options {
  display: flex;
  gap: 10px;
  margin-left: 44px;
  flex-wrap: wrap;
}

.checklist-options label {
  flex: 1;
  min-width: 140px;
}

.progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--color-primary);
  width: 0;
  transition: width 0.3s ease;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success {
  background: var(--color-success-soft);
  color: oklch(0.32 0.10 150);
  border: 1px solid oklch(0.78 0.10 150);
}

.alert-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border: 1px solid oklch(0.78 0.14 25);
}

.alert-info {
  background: var(--color-primary-soft);
  color: var(--color-primary-ink);
  border: 1px solid oklch(0.82 0.06 230);
}

.alert-icon { font-weight: 700; }

/* ---------- Institutional complaint form compatibility ---------- */
.alert-box {
  display: none;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-box:not(:empty) {
  display: block;
}

.alert-error {
  background: var(--color-danger-soft);
  border: 1px solid oklch(0.78 0.14 25);
  color: var(--color-danger);
}

.form-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}

.form-section:first-of-type,
.form-section:hover {
  border-color: var(--color-primary);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 20px 24px;
  background: transparent;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.section-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.section-body {
  padding: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin-bottom: 16px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row.cols-2 > .form-group { grid-column: span 6; }
.form-row.cols-3 > .form-group { grid-column: span 4; }
.form-row.cols-4 > .form-group { grid-column: span 3; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.form-control,
.form-select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.entry-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
  margin-bottom: 16px;
  overflow: hidden;
}

.entry-block-header {
  background: var(--color-primary-soft);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-primary-ink);
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
}

.entry-body {
  padding: 24px;
}

.type-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--color-surface);
}

.type-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-toggle label {
  padding: 8px 14px;
  border-right: 1px solid var(--color-border-strong);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.type-toggle label:last-child {
  border-right: 0;
}

.type-toggle input:checked + label {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.address-subsection {
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 14px;
  background: var(--color-surface-alt);
}

.address-subsection-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary-ink);
  margin-bottom: 12px;
}

.nature-list,
.doc-rows-container {
  display: grid;
  gap: 10px;
}

.complaint-detail-textarea {
  min-height: 140px;
}

.info-text {
  background: var(--color-primary-soft);
  border: 1px solid oklch(0.82 0.06 230);
  border-radius: var(--radius-md);
  color: var(--color-primary-ink);
  font-size: 14px;
  padding: 12px 14px;
}

.add-entry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
}

.add-entry-btn:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

@media (max-width: 880px) {
  .form-row.cols-2 > .form-group,
  .form-row.cols-3 > .form-group,
  .form-row.cols-4 > .form-group {
    grid-column: span 12;
  }
}

/* ---------- Form actions bar ---------- */
.form-actions {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
  box-shadow: var(--shadow-sm);
}

.form-actions-spacer { flex: 1; min-width: 8px; }

.btn-action {
  gap: 8px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
}

.btn-action svg { flex-shrink: 0; opacity: 0.9; }

.btn-action-primary {
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(21, 96, 189, 0.25);
}

.btn-action-primary svg { opacity: 1; }

@media (max-width: 720px) {
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .form-actions-spacer { display: none; }
  .btn-action { width: 100%; justify-content: center; }
}

.form-actions .left {
  margin-right: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Success page ---------- */
.success-wrap {
  max-width: 560px;
  margin: 80px auto;
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color-success-soft);
  color: var(--color-success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 20px;
}

.ref-box {
  display: inline-block;
  padding: 12px 24px;
  background: var(--color-primary-soft);
  color: var(--color-primary-ink);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  margin: 16px 0 24px;
  letter-spacing: 1px;
  border: 1px solid var(--color-border);
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.2 0.01 270 / 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.modal-backdrop.is-open { display: flex; }

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { color: var(--color-text-muted); margin-bottom: 20px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-text);
  color: var(--color-bg);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 2000;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Utility ---------- */
.text-muted { color: var(--color-text-muted); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-gap { gap: 12px; }
.section-divider {
  height: 1px;
  background: var(--color-border);
  margin: 16px 0;
}

.field-grid-title {
  grid-column: span 12;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-top: 4px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--color-border);
}

/* ---------- Highlighted Add Complaint CTA ---------- */
.cta-card-highlight {
  position: relative;
}

.cta-content { flex: 1; }

.cta-badge {
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.btn-cta {
  background: white;
  color: var(--color-primary);
  border: 1px solid white;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-cta:hover {
  background: var(--gray-50);
  color: var(--color-primary-hover);
  text-decoration: none;
}

.cta-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Dashboard menu (complaint types) ---------- */
.menu-section {
  margin-bottom: 28px;
}

.menu-heading {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.menu-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-decoration: none;
  color: var(--color-text);
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.menu-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--color-text);
}

.menu-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.menu-card h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.menu-card p {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.55;
  flex: 1;
}

.menu-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
}

.menu-card .menu-card-arrow {
  transition: transform 0.15s;
}

.menu-card:hover .menu-card-arrow {
  transform: translateX(4px);
}

.menu-card-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px 12px 14px;
  background: var(--color-primary);
  color: white;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  z-index: 100;
  transition: background 0.15s;
  box-shadow: var(--shadow-md);
}

.fab:hover {
  background: var(--color-primary-hover);
  text-decoration: none;
  color: white;
}

.fab-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: white;
  color: var(--color-primary);
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Complaint Date row (top of form) ---------- */
.complaint-date-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 20px;
  font-size: 14px;
  color: var(--color-text);
}

.complaint-date-row label {
  font-weight: 600;
  color: var(--color-text);
}

.complaint-date-row input[type="date"] {
  width: auto;
  min-width: 170px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
}

/* =========================================================
   Responsive — consistent behaviour across every page
   Breakpoints: 768px (tablet/phone) · 480px (small phone)
   ========================================================= */

/* Make every data table scroll horizontally instead of crushing */
.panel-body,
#complaintsList {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  /* Layout padding */
  .app-header { padding: 12px 16px; gap: 12px; }
  .app-main   { padding: 20px 16px; }
  .app-footer { padding: 14px 16px; }

  /* Header: hide system name + user name on mobile (clean, minimal) */
  .brand { gap: 10px; }
  .brand-mark { width: 36px; height: 36px; }
  .app-header .brand-text { display: none; }
  .header-actions { gap: 8px; }
  .user-pill { padding: 4px; gap: 0; }
  .user-pill > span { display: none; }

  /* Headings */
  .page-title { margin-bottom: 18px; }
  .page-title h1 { font-size: 22px; }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.4rem; }

  /* Accordion / panel density */
  .accordion-trigger { padding: 16px 18px; font-size: 15px; }
  .accordion-section.is-open .accordion-body,
  .accordion-body { padding-left: 18px; padding-right: 18px; }
  .accordion-section.is-open .accordion-body { padding-top: 18px; padding-bottom: 18px; }
  .panel-header { padding: 14px 16px; }
  .panel-body { padding: 16px; }

  /* Forms */
  .form-grid { gap: 14px; }
  .repeater-item { padding: 16px; }
  .repeater-item-head { margin-bottom: 16px; }
  .section-help { padding: 10px 14px; font-size: 12.5px; }

  /* Data tables: slightly tighter, keep readable while scrolling */
  .data-table th,
  .data-table td { padding: 8px 10px; }
  .data-table { font-size: 13px; }
  #complaintsList .data-table { min-width: 560px; }

  /* Complaint date row wraps */
  .complaint-date-row { flex-wrap: wrap; gap: 8px; }
  .complaint-date-row input[type="date"] { min-width: 150px; }

  /* FAB more compact */
  .fab { bottom: 18px; right: 16px; padding: 10px 16px 10px 12px; font-size: 13px; }
  .fab-plus { width: 22px; height: 22px; font-size: 16px; }

  /* CTA / menu cards */
  .cta-card { flex-direction: column; align-items: flex-start; padding: 22px; }
  .menu-card { padding: 20px; }

  /* Success page */
  .success-wrap { margin: 40px auto; padding: 32px 20px; }
  .success-icon { width: 64px; height: 64px; font-size: 32px; }
}

@media (max-width: 480px) {
  /* Hide the secondary English brand line to save room */
  .app-header .brand-text span { display: none; }

  .app-main { padding: 16px 12px; }
  .page-title h1 { font-size: 20px; }
  .page-title .page-sub { font-size: 13px; }

  /* Auth pages */
  .auth-aside { padding: 24px 20px; }
  .auth-pane { padding: 28px 18px; }
  .auth-card h2 { font-size: 22px; }

  /* Stack action buttons full width */
  .page-title > div:last-child .btn { width: 100%; }

  /* Radio cards stack */
  .radio-group label { min-width: 100%; }

  /* Tighter accordion toggle */
  .accordion-trigger { padding: 14px 14px; font-size: 14px; }
  .accordion-toggle { width: 24px; height: 24px; font-size: 16px; }
}

/* =========================================================
   ADMIN DASHBOARD STYLES (merged from admin.css)
   ========================================================= */

/* =========================================================
   Admin Dashboard — layout & components
   Reuses tokens/buttons/inputs/modal from styles.css
   Aesthetic: flat, white surfaces, subtle borders, sentence case
   ========================================================= */

:root {
  --admin-sidebar-w: 224px;
  --admin-bg: #f6f7f9;
  --neutral-soft: #eef0f3;
  --neutral-ink: #475467;
  --info-soft: #e8f0fa;
  --info-ink: #1560bd;
  --warn-soft: #fdf3d8;
  --warn-ink: #8a6d10;
  --success-soft: #e3f1e4;
  --success-ink: #2f7a34;
  --danger-soft: #fde7ea;
  --danger-ink: #c0203a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.admin {
  font-family: var(--font-sans);
  background: var(--admin-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.admin-shell { display: flex; min-height: 100vh; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: var(--admin-sidebar-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--color-border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 60;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border);
}
.sidebar-brand img { width: 34px; height: 34px; object-fit: contain; }
.sidebar-brand .sb-gov { font-size: 10px; color: var(--color-text-muted); line-height: 1.3; }
.sidebar-brand .sb-title { font-size: 13px; font-weight: 700; line-height: 1.25; }
.sidebar-brand .sb-sub { font-size: 10.5px; color: var(--color-text-muted); }

.sidebar-nav { padding: 10px 10px 24px; flex: 1; }
.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-muted);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--neutral-ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--neutral-soft); color: var(--color-text); }
.nav-item .nav-ico { width: 18px; height: 18px; flex-shrink: 0; color: currentColor; }
.nav-item .nav-text { flex: 1; }
.nav-item .nav-badge {
  min-width: 22px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--neutral-soft);
  color: var(--neutral-ink);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-item.is-active {
  background: var(--info-soft);
  color: var(--info-ink);
  font-weight: 600;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -10px; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--color-primary);
}
.nav-item.is-active .nav-badge {
  background: var(--color-primary);
  color: #fff;
}

/* submenu (Official / Normal users) */
.nav-parent-wrap { display: flex; flex-direction: column; }
.nav-parent .nav-chevron { margin-left: auto; width: 14px; height: 14px; transition: transform 0.15s; }
.nav-parent.is-expanded .nav-chevron { transform: rotate(90deg); }
.nav-sub { display: none; flex-direction: column; gap: 2px; margin: 2px 0 4px; }
.nav-sub.is-expanded { display: flex; }
.nav-item.is-child { padding-left: 40px; font-size: 13px; font-weight: 500; }

/* ---------------- Main ---------------- */
.admin-main {
  flex: 1;
  margin-left: var(--admin-sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar h1 { font-size: 18px; font-weight: 700; margin: 0; }
.topbar .topbar-sub { font-size: 12px; color: var(--color-text-muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.role-switch { display: flex; align-items: center; gap: 8px; }
.role-switch label { font-size: 12px; color: var(--color-text-muted); }
.role-switch select {
  width: auto;
  padding: 7px 28px 7px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
}
.topbar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--info-soft);
  color: var(--info-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

.menu-toggle {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border: 1px solid var(--color-border);
  background: #fff; border-radius: var(--radius-md);
  cursor: pointer;
}

.view { padding: 24px; }
.view-section { margin-bottom: 26px; }
.section-title {
  font-size: 14px; font-weight: 700;
  margin: 0 0 14px;
}
.section-title .muted { font-weight: 500; color: var(--color-text-muted); font-size: 12px; }

/* ---------------- Cards ---------------- */
.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.metric {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.metric .m-label { font-size: 12px; color: var(--color-text-muted); font-weight: 500; }
.metric .m-value { font-size: 28px; font-weight: 700; margin-top: 6px; line-height: 1; }
.metric .m-meta { font-size: 12px; color: var(--color-text-muted); margin-top: 8px; }
.metric.is-alert {
  background: var(--danger-soft);
  border-color: #f3c2cc;
}
.metric.is-alert .m-value, .metric.is-alert .m-label { color: var(--danger-ink); }
.metric .m-ico {
  float: right;
  width: 30px; height: 30px;
  border-radius: var(--radius-md);
  background: var(--neutral-soft);
  color: var(--neutral-ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.metric.is-alert .m-ico { background: #f6cdd5; color: var(--danger-ink); }

/* analytics layout */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.analytics-grid .col-span-2 { grid-column: 1 / -1; }

/* ---------------- Charts (CSS) ---------------- */
.barchart { display: flex; flex-direction: column; gap: 10px; }
.barrow { display: grid; grid-template-columns: 160px 1fr 42px; align-items: center; gap: 10px; }
.barrow .bar-label { font-size: 12.5px; color: var(--neutral-ink); }
.bar-track { display: block; height: 12px; background: var(--neutral-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--color-primary); border-radius: 999px; transition: width 0.5s ease; }
.bar-fill.alt { background: #5a93dd; }
.barrow .bar-val { font-size: 12.5px; font-weight: 700; text-align: right; }

.columnchart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
  padding-top: 10px;
}
.col-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.col-bar {
  width: 70%;
  max-width: 46px;
  background: var(--info-soft);
  border: 1px solid #cfe0f4;
  border-radius: 6px 6px 0 0;
  position: relative;
  transition: height 0.5s ease;
}
.col-bar::after {
  content: attr(data-v);
  position: absolute; top: -18px; left: 0; right: 0;
  text-align: center; font-size: 11px; font-weight: 700; color: var(--neutral-ink);
}
.col-label { font-size: 11px; color: var(--color-text-muted); }

/* ---------------- Status pipeline ---------------- */
.pipeline {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: #fff;
  overflow: hidden;
}
.pipe-step {
  flex: 1;
  min-width: 120px;
  padding: 14px 16px;
  border-right: 1px solid var(--color-border);
  position: relative;
}
.pipe-step:last-child { border-right: none; }
.pipe-step .ps-count { font-size: 22px; font-weight: 700; }
.pipe-step .ps-label { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.pipe-step .ps-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ---------------- Pills & SLA ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.pill.neutral { background: var(--neutral-soft); color: var(--neutral-ink); }
.pill.info { background: var(--info-soft); color: var(--info-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.success { background: var(--success-soft); color: var(--success-ink); }
.pill.danger { background: var(--danger-soft); color: var(--danger-ink); }

.sla { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.sla .sla-dot { width: 8px; height: 8px; border-radius: 50%; }
.sla.ontime { color: var(--success-ink); }
.sla.ontime .sla-dot { background: var(--success-ink); }
.sla.due { color: var(--warn-ink); }
.sla.due .sla-dot { background: var(--warn-ink); }
.sla.overdue { color: var(--danger-ink); }
.sla.overdue .sla-dot { background: var(--danger-ink); }
.sla.na { color: var(--color-text-muted); }
.sla.na .sla-dot { background: var(--color-border-strong); }

.type-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700;
  border: 1px solid var(--color-border-strong);
}
.type-tag.ujuri { background: var(--info-soft); color: var(--info-ink); border-color: #cfe0f4; }
.type-tag.muddha { background: #f3eafc; color: #6b3fa0; border-color: #e0cdf3; }

/* ---------------- Toolbar ---------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}
.toolbar .search input { padding-left: 34px; }
.toolbar .search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--color-text-muted);
}
.toolbar select { width: auto; min-width: 130px; padding: 9px 30px 9px 12px; font-size: 13px; }
.toolbar .spacer { flex: 1; }

/* segmented control */
.segmented {
  display: inline-flex;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.segmented button,
.segmented a {
  border: none;
  background: #fff;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--neutral-ink);
  cursor: pointer;
  border-right: 1px solid var(--color-border-strong);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.segmented button:last-child,
.segmented a:last-child { border-right: none; }
.segmented button.is-active,
.segmented a.is-active { background: var(--color-primary); color: #fff; }

/* ---------------- Table ---------------- */
.table-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.atable { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.atable th, .atable td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.atable thead th {
  background: #fafbfc;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-text-muted);
}
.atable tbody tr:hover { background: #fafbfc; }
.atable td.num, .atable th.num { text-align: right; }
.atable .id-cell { font-family: var(--font-mono); font-weight: 600; font-size: 12px; }
.atable input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--color-primary); cursor: pointer; }

.row-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--neutral-ink);
  transition: all 0.12s;
}
.icon-btn:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--info-soft); }
.icon-btn svg { width: 15px; height: 15px; }

/* bulk bar */
.bulkbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--info-soft);
  border-bottom: 1px solid #cfe0f4;
  font-size: 13px;
}
.bulkbar.show { display: flex; }

/* pagination */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  flex-wrap: wrap;
}
.pager .p-info { font-size: 12.5px; color: var(--color-text-muted); }
.pager .p-controls { display: flex; gap: 6px; align-items: center; }
.page-btn {
  min-width: 32px; height: 32px;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: var(--radius-md);
  cursor: pointer;
  font: inherit; font-size: 13px;
  color: var(--neutral-ink);
}
.page-btn:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
.page-btn.is-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
  font-size: 13px;
}

/* ---------------- Triage list ---------------- */
.triage { display: flex; flex-direction: column; }
.triage-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--color-border);
}
.triage-item:last-child { border-bottom: none; }
.triage-item .ti-id { font-family: var(--font-mono); font-size: 12px; font-weight: 600; width: 92px; flex-shrink: 0; }
.triage-item .ti-main { flex: 1; min-width: 0; }
.triage-item .ti-name { font-weight: 600; }
.triage-item .ti-sub { font-size: 12px; color: var(--color-text-muted); }
.triage-item .ti-late { color: var(--danger-ink); font-weight: 700; font-size: 12.5px; white-space: nowrap; }

/* ---------------- Settings grid ---------------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.tile {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.tile:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.tile .tile-ico {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: var(--info-soft); color: var(--info-ink);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.tile .tile-name { font-weight: 700; font-size: 14px; }
.tile .tile-desc { font-size: 12.5px; color: var(--color-text-muted); margin-top: 4px; }

/* reports */
.report-list { display: flex; flex-direction: column; }
.report-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; border-bottom: 1px solid var(--color-border);
}
.report-row:last-child { border-bottom: none; }
.report-row .rr-ico {
  width: 34px; height: 34px; border-radius: var(--radius-md);
  background: var(--neutral-soft); color: var(--neutral-ink);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.report-row .rr-main { flex: 1; }
.report-row .rr-name { font-weight: 600; }
.report-row .rr-desc { font-size: 12px; color: var(--color-text-muted); }

/* ---------------- Dialog (admin) ---------------- */
.dlg-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 21, 24, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 1000;
}
.dlg {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.dlg.wide { max-width: 760px; }
.dlg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.dlg-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.dlg-close {
  width: 30px; height: 30px; border: none; background: transparent;
  font-size: 22px; line-height: 1; color: var(--color-text-muted); cursor: pointer;
  border-radius: var(--radius-md);
}
.dlg-close:hover { background: var(--neutral-soft); color: var(--color-text); }
.dlg-body { padding: 20px; overflow-y: auto; }
.dlg-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--color-border);
}

/* detail rows */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.detail-grid .full { grid-column: 1 / -1; }
.detail-item .di-label { font-size: 11.5px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.detail-item .di-value { font-weight: 600; margin-top: 2px; }

/* stepper (import) */
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 20px; }
.step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--color-text-muted); font-weight: 600;
}
.step .step-num {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--color-border-strong);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.step.is-active { color: var(--color-primary); }
.step.is-active .step-num { border-color: var(--color-primary); background: var(--info-soft); color: var(--color-primary); }
.step.is-done .step-num { border-color: var(--color-primary); background: var(--color-primary); color: #fff; }
.step-line { flex: 1; height: 1.5px; background: var(--color-border-strong); margin: 0 10px; min-width: 18px; }
.step-line.is-done { background: var(--color-primary); }

.dropzone {
  border: 1.5px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  color: var(--color-text-muted);
  cursor: pointer;
}
.dropzone:hover { border-color: var(--color-primary); background: var(--admin-bg); }
.dropzone strong { color: var(--color-text); }

.map-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.map-row .map-field { font-size: 13px; font-weight: 600; }
.map-row .map-field .req { color: var(--color-danger); }

.info-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--info-soft);
  border: 1px solid #cfe0f4;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--info-ink);
  margin-bottom: 14px;
}
.info-banner .ib-ico { flex-shrink: 0; }
.info-banner .ib-time { color: var(--neutral-ink); font-weight: 600; }

/* form fields inside dialogs reuse .field/.form-grid from styles.css */
.dlg .form-grid { gap: 14px; }

/* page header within views */
.view-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.view-head .vh-title { font-size: 16px; font-weight: 700; }
.view-head .vh-sub { font-size: 12.5px; color: var(--color-text-muted); }

/* sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 55;
}

/* full-screen form overlay (new-complaint surface) */
.form-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.form-overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  font-weight: 700;
  flex-shrink: 0;
}
.form-overlay iframe {
  flex: 1;
  width: 100%;
  border: none;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1024px) {
  .analytics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.22s ease; }
  .admin-shell.nav-open .sidebar { transform: translateX(0); }
  .admin-shell.nav-open .sidebar-overlay { display: block; }
  .admin-main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .view { padding: 16px; }
  .role-switch label { display: none; }
}
@media (max-width: 520px) {
  .map-row { grid-template-columns: 1fr; gap: 4px; margin-bottom: 14px; }
  .topbar h1 { font-size: 16px; }
  .toolbar .search { max-width: none; }
}

/* ---- Admin Badges ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-success { background: var(--color-success-soft, #d1fae5); color: var(--color-success, #065f46); border: 1px solid color-mix(in srgb, var(--color-success, #065f46) 30%, transparent); }
.badge-warning { background: var(--color-accent-soft, #fef3c7); color: var(--color-accent-ink, #92400e); border: 1px solid color-mix(in srgb, var(--color-accent, #d97706) 35%, transparent); }
.badge-danger  { background: #fce7ef; color: var(--danger-ink, #be123c); border: 1px solid color-mix(in srgb, var(--danger-ink, #be123c) 30%, transparent); }
.badge-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid color-mix(in srgb, #1d4ed8 30%, transparent); }
.badge-secondary { background: var(--neutral-soft, #f3f4f6); color: var(--color-text-muted, #6b7280); border: 1px solid var(--border-color, #e5e7eb); }

/* ---- Admin toolbar / search bar ---- */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-toolbar .search-input {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
  padding: 8px 12px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  font-size: 14px;
  background: var(--color-bg, #fff);
  color: var(--color-text, #111827);
  outline: none;
}
.admin-toolbar .search-input:focus { border-color: var(--color-primary, #1560bd); }
.admin-toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  font-size: 14px;
  background: var(--color-bg, #fff);
  color: var(--color-text, #111827);
}

/* ---- Admin form layout ---- */
.admin-form { max-width: 620px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--color-text, #111827); }
.form-group .form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  font-size: 14px;
  background: var(--color-bg, #fff);
  color: var(--color-text, #111827);
  outline: none;
  transition: border-color 0.15s;
}
.form-group .form-control:focus { border-color: var(--color-primary, #1560bd); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary, #1560bd) 15%, transparent); }
.form-group .form-error { color: var(--danger-ink, #be123c); font-size: 12px; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 24px; }

/* ---- Detail grid (grievance show) ---- */
.detail-section { margin-bottom: 24px; }
.detail-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color, #e5e7eb); }
.detail-row { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin-bottom: 10px; font-size: 14px; }
.detail-label { color: var(--color-text-muted); font-weight: 500; }
.detail-value { color: var(--color-text); font-weight: 600; }

