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

:root {
  --blue-dark:   #1f3c88;
  --blue-mid:    #2a4fa8;
  --blue-light:  #e6f0ff;
  --gold:        #f5c842;
  --green:       #28a745;
  --green-light: #d4edda;
  --green-dark:  #155724;
  --red:         #dc3545;
  --red-light:   #f8d7da;
  --red-dark:    #721c24;
  --amber:       #ffc107;
  --amber-light: #fff3cd;
  --amber-dark:  #856404;
  --teal:        #17a2b8;
  --teal-light:  #d1ecf1;
  --teal-dark:   #0c5460;
  --gray-100:    #f4f6f9;
  --gray-200:    #e9ecef;
  --gray-300:    #dee2e6;
  --gray-500:    #adb5bd;
  --gray-700:    #495057;
  --gray-900:    #212529;
  --white:       #ffffff;
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.12);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.18);
  --transition:  .18s ease;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

.site-header {
  background: var(--blue-dark);
  color: var(--white);
  padding: 16px 24px;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1200px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-wrap {
  flex-shrink: 0;
}

.logo {
  width: 72px;
  height: 72px;
  display: block;
}

.header-text {
  flex: 1;
  text-align: center;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--white);
}

.header-sub {
  font-size: 12px;
  color: rgba(255,255,255,.75);
  margin: 2px 0;
}

.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
}

.toolbar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
}

.toolbar input[type="text"],
.toolbar select {
  padding: 9px 13px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--white);
  color: var(--gray-900);
  transition: border-color var(--transition), box-shadow var(--transition);
  min-width: 180px;
}

.toolbar input[type="text"] {
  flex: 1;
}

.toolbar input:focus,
.toolbar select:focus {
  outline: none;
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 3px rgba(31,60,136,.15);
}

.stats-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stat-chip {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.chip-all  { background: var(--blue-light); color: var(--blue-dark); }
.chip-ord  { background: #e6f0ff; color: #0c3484; }
.chip-res  { background: var(--green-light); color: var(--green-dark); }

.table-wrap {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--blue-dark);
  color: var(--white);
  padding: 12px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

thead th.col-actions {
  text-align: center;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: #f8faff;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ordinance {
  background: #dbeafe;
  color: #1e3a8a;
}

.badge-resolution {
  background: var(--green-light);
  color: var(--green-dark);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--blue-dark);
  color: var(--white);
}
.btn-primary:hover { background: var(--blue-mid); }

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}
.btn-secondary:hover { background: var(--gray-300); }

.btn-danger {
  background: var(--red);
  color: var(--white);
}
.btn-danger:hover { background: #c82333; }

.actions-cell {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.act-btn {
  border: none;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}

.act-btn:hover { opacity: .82; }
.act-btn:active { transform: scale(.95); }

.act-view   { background: var(--teal-light);  color: var(--teal-dark); }
.act-edit   { background: var(--amber-light); color: var(--amber-dark); }
.act-delete { background: var(--red-light);   color: var(--red-dark); }

/* ═══════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--gray-500);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.empty-state small {
  font-size: 13px;
}

.hidden { display: none !important; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.48);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.overlay.open {
  display: flex;
}

.modal {
  background: var(--white);
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideIn .2s ease;
}

.modal-sm {
  max-width: 420px;
}

.modal-view {
  max-width: 520px;
}

@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.modal-header {
  background: var(--blue-dark);
  color: var(--white);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-header-danger {
  background: var(--red);
}

.modal-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  opacity: .8;
  transition: opacity var(--transition);
}
.modal-close:hover { opacity: 1; }

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.req { color: var(--red); }

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--white);
  color: var(--gray-900);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 3px rgba(31,60,136,.15);
}

.form-group input.field-error,
.form-group select.field-error {
  border-color: var(--red);
}

.input-with-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-badge input {
  flex: 1;
}

.input-badge {
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.form-hint {
  display: block;
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
}

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 14px;
}

.alert-error {
  background: var(--red-light);
  color: var(--red-dark);
  border: 1px solid #f5c6cb;
}

.view-row {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-200);
  align-items: flex-start;
}

.view-row:last-child {
  border-bottom: none;
}

.view-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--gray-500);
  width: 130px;
  flex-shrink: 0;
  padding-top: 1px;
}

.view-value {
  font-size: 14px;
  color: var(--gray-900);
  font-weight: 500;
  flex: 1;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: var(--white);
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  z-index: 999;
  box-shadow: var(--shadow-md);
  transform: translateY(80px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  pointer-events: none;
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.toast-success { background: var(--green); }
.toast.toast-error   { background: var(--red); }
.toast.toast-info    { background: var(--teal); }

@media (max-width: 768px) {
  .header-inner { flex-direction: column; text-align: center; }
  .logo { width: 56px; height: 56px; }
  .header-title { font-size: 16px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 8px 10px; }
}

@media (max-width: 520px) {
  .toolbar { flex-direction: column; }
  .toolbar-left { width: 100%; }
  .toolbar input[type="text"],
  .toolbar select { width: 100%; min-width: unset; }
}
