/* CivikIndia Design Tokens */
:root {
  --gov-saffron: #FF6200;
  --gov-saffron-light: #FFF0E6;
  --gov-green: #006B3C;
  --gov-green-mid: #008848;
  --gov-green-light: #E8F5EE;
  --gov-navy: #1A2B4A;
  --gov-navy-mid: #2E4371;
  --status-pending: #B45309;
  --status-pending-bg: #FFFBEB;
  --status-resolved: #15803D;
  --status-resolved-bg: #F0FDF4;
  --status-delayed: #B91C1C;
  --status-delayed-bg: #FEF2F2;
  --status-normal: #1D4ED8;
  --status-normal-bg: #EFF6FF;
  --priority-critical: #7C2D12;
  --priority-high: #B91C1C;
  --priority-normal: #1D4ED8;
  --priority-low: #374151;
  --neutral-900: #111827;
  --neutral-700: #374151;
  --neutral-500: #6B7280;
  --neutral-300: #D1D5DB;
  --neutral-100: #F3F4F6;
  --neutral-50: #F9FAFB;
  --white: #FFFFFF;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --font-primary: 'Noto Sans', system-ui, sans-serif;
  --font-devanagari: 'Noto Sans Devanagari', 'Noto Sans', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  color: var(--neutral-900);
  line-height: 1.6;
  background: var(--neutral-100);
}

.text-hindi,
[lang="hi"] {
  font-family: var(--font-devanagari);
  line-height: 1.8;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-bold);
  color: var(--neutral-900);
  line-height: 1.25;
}

.text-muted,
.text-secondary {
  color: var(--neutral-700) !important;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--gov-green);
  color: var(--white);
  padding: 8px 16px;
  z-index: 9999;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.025em;
  text-transform: uppercase;
  white-space: nowrap;
  width: auto !important;
  max-width: max-content;
  flex: 0 0 auto;
  line-height: 1.4;
}

.badge-pending,
.badge-review { background: var(--status-pending-bg); color: var(--status-pending); }
.badge-resolved,
.badge-action,
.badge-closed { background: var(--status-resolved-bg); color: var(--status-resolved); }
.badge-delayed,
.badge-reopened { background: var(--status-delayed-bg); color: var(--status-delayed); }
.badge-assigned { background: var(--status-normal-bg); color: var(--status-normal); }
.badge-priority-critical { background: #7C2D12; color: var(--white); }
.badge-priority-high { background: var(--status-delayed-bg); color: var(--priority-high); }
.badge-priority-normal { background: var(--status-normal-bg); color: var(--priority-normal); }
.badge-priority-low { background: var(--neutral-100); color: var(--neutral-700); }
.badge-role-admin { background: #4C1D95; color: var(--white); }
.badge-role-officer { background: #1E3A5F; color: var(--white); }

.mibsp-card {
  background: var(--white);
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.btn-gov-primary {
  background: var(--gov-green);
  color: var(--white);
  border: none;
  padding: 10px var(--space-6);
  border-radius: var(--radius-md);
  font-weight: var(--fw-semibold);
  font-size: var(--text-base);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-gov-primary:hover,
.btn-gov-primary:focus {
  background: var(--gov-green-mid);
  color: var(--white);
  transform: translateY(-1px);
}

.btn-gov-secondary {
  background: transparent;
  color: var(--gov-green);
  border: 2px solid var(--gov-green);
  padding: 10px var(--space-6);
  border-radius: var(--radius-md);
  font-weight: var(--fw-semibold);
}

.btn-gov-secondary:hover,
.btn-gov-secondary:focus {
  background: var(--gov-green-light);
  color: var(--gov-green);
}

.btn-gov-danger {
  background: transparent;
  color: var(--status-delayed);
  border: 1.5px solid var(--status-delayed);
  padding: 8px var(--space-4);
  border-radius: var(--radius-md);
  font-weight: var(--fw-medium);
}

.form-control,
.form-select {
  border: 1.5px solid var(--neutral-300);
  border-radius: var(--radius-md);
  padding: 10px var(--space-4);
  font-size: var(--text-base);
  color: var(--neutral-900);
  background: var(--white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--gov-green);
  box-shadow: 0 0 0 3px rgba(0, 107, 60, 0.12);
  outline: none;
}

.form-section {
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  background: var(--white);
}

.form-section-header {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gov-green);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--gov-green-light);
}

/* Escalation matrix + nested cards: Bootstrap can flatten borders; reinforce tokens */
.escalation-form-card .form-section .form-control,
.escalation-form-card .form-section .form-select {
  border: 1.5px solid var(--neutral-300) !important;
  background-color: var(--white) !important;
}

.escalation-form-card .form-section .form-control:focus,
.escalation-form-card .form-section .form-select:focus {
  border-color: var(--gov-green) !important;
  box-shadow: 0 0 0 3px rgba(0, 107, 60, 0.12) !important;
}

/* Staff login: neutral operational focus (avoid saffron “warning” read) */
.staff-login-page .form-control:focus,
.staff-login-page .form-select:focus {
  border-color: var(--gov-green) !important;
  box-shadow: 0 0 0 3px rgba(0, 107, 60, 0.12) !important;
  outline: none !important;
}

.staff-login-page .input-group:focus-within {
  box-shadow: 0 0 0 3px rgba(0, 107, 60, 0.12);
  border-radius: var(--radius-md);
}

.staff-login-page .input-group:focus-within .form-control,
.staff-login-page .input-group:focus-within .input-group-text {
  border-color: var(--gov-green) !important;
}

.gov-breadcrumb {
  background: var(--neutral-100);
  border-bottom: 1px solid var(--neutral-300);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--neutral-500);
}

.gov-breadcrumb a {
  color: var(--gov-green);
  text-decoration: none;
}

.gov-breadcrumb a:hover {
  text-decoration: underline;
}

.gov-breadcrumb .breadcrumb {
  margin-bottom: 0;
}

.gov-breadcrumb .breadcrumb-item.active,
.gov-breadcrumb .current {
  color: var(--neutral-900);
  font-weight: var(--fw-medium);
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  height: 100%;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gov-navy);
}

.kpi-card.total::before { background: var(--gov-navy); }
.kpi-card.pending::before { background: var(--status-pending); }
.kpi-card.resolved::before { background: var(--status-resolved); }
.kpi-card.officers::before,
.kpi-card.assigned::before { background: var(--gov-navy-mid); }
.kpi-card.delayed::before { background: var(--status-delayed); }

.kpi-value {
  font-size: var(--text-4xl);
  font-weight: var(--fw-bold);
  line-height: 1;
  color: var(--neutral-900);
}

.kpi-label {
  font-size: var(--text-sm);
  color: var(--neutral-500);
  margin-top: var(--space-1);
}

.kpi-sub {
  font-size: var(--text-xs);
  color: var(--neutral-500);
  margin-top: var(--space-3);
}

.stat-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  border: 1px solid;
}

.stat-chip.danger { background: var(--status-delayed-bg); color: var(--status-delayed); border-color: #FECACA; }
.stat-chip.success { background: var(--status-resolved-bg); color: var(--status-resolved); border-color: #BBF7D0; }
.stat-chip.warning { background: var(--status-pending-bg); color: var(--status-pending); border-color: #FDE68A; }
.stat-chip.neutral { background: var(--neutral-100); color: var(--neutral-700); border-color: var(--neutral-300); }

.mibsp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.mibsp-table thead {
  background: var(--gov-navy);
  color: var(--white);
}

.mibsp-table thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.mibsp-table tbody tr {
  border-bottom: 1px solid var(--neutral-100);
  transition: background var(--transition-fast);
}

.mibsp-table tbody tr:hover {
  background: var(--gov-green-light);
}

.mibsp-table tbody td {
  padding: var(--space-3) var(--space-4);
  vertical-align: middle;
}

.mibsp-table .sortable {
  cursor: pointer;
  user-select: none;
}

.mibsp-table .sortable:hover {
  background: var(--gov-navy-mid);
}

.tracking-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--neutral-100);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--gov-navy);
}

.btn-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-300);
  background: var(--white);
  color: var(--gov-green);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.btn-icon:hover {
  background: var(--gov-green-light);
  color: var(--gov-green);
}

.skeleton {
  background: linear-gradient(90deg, var(--neutral-100) 25%, var(--neutral-50) 50%, var(--neutral-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-md);
  height: 1em;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--neutral-500);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--fw-semibold);
  color: var(--neutral-700);
}

.empty-state-message {
  font-size: var(--text-base);
  margin: var(--space-2) 0 var(--space-6);
}

.timeline {
  display: grid;
  gap: var(--space-4);
}

.timeline-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--space-3);
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: calc(-1 * var(--space-4));
  width: 2px;
  background: var(--neutral-300);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gov-green);
  color: var(--white);
  font-size: var(--text-xs);
  z-index: 1;
}

.sla-bar {
  height: 10px;
  background: var(--neutral-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.sla-bar-fill {
  display: block;
  height: 100%;
  width: var(--sla-progress, 65%);
  background: linear-gradient(90deg, var(--gov-green), var(--status-pending));
}

@media (max-width: 640px) {
  .mibsp-table thead {
    display: none;
  }

  .mibsp-table tr {
    display: block;
    border: 1px solid var(--neutral-300);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: var(--white);
  }

  .mibsp-table tbody td {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--neutral-100);
  }

  .mibsp-table td::before {
    content: attr(data-label);
    font-weight: var(--fw-semibold);
    color: var(--neutral-500);
    font-size: var(--text-sm);
  }
}

/* Motion Design Easing & Duration Tokens */
:root {
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-stiff: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-reveal: cubic-bezier(0.215, 0.61, 0.355, 1);
  --transition-slow: 600ms var(--ease-reveal);
  --transition-entrance: 800ms var(--ease-reveal);
  --transition-spring-btn: 400ms var(--ease-spring);
}

