:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --text: #20283e;
  --muted: #768097;
  --border: #e6eaf2;
  --accent: #343fa8;
  --accent-hover: #29348f;
  --accent-soft: #edf0ff;
  --accent-subtle: #f5f6ff;
  --accent-border: #b7c0eb;
  --success: #2f8f68;
  --warning: #b57a24;
  --danger: #b84b4b;
  --shadow: 0 5px 22px rgba(33, 44, 82, .035);
  --radius: 13px;
}

* { box-sizing: border-box; }

html,
body { margin: 0; min-height: 100%; }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea { font: inherit; }

button { cursor: pointer; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(165deg, #2d2d2d, #272b3e);
  color: white;
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 36px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  font-weight: 800;
}

.brand strong { display: block; font-size: 15px; }

.brand small { display: block; margin-top: 2px; color: #aab0ba; }

.nav { display: grid; gap: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  border: 0;
  background: transparent;
  color: #b9bec7;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,.08);
  color: white;
}

.nav-item.active { background: var(--accent); box-shadow: 0 4px 14px #10173530; }
.main { min-width: 0; padding: 24px; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

.topbar h1 { margin: 0; font-size: 27px; letter-spacing: -.7px; }

.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.btn,
.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 11px;
}

.btn { padding: 10px 14px; }

.btn:hover { border-color: #c8ccd3; }

.btn.ghost { background: transparent; }

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn.danger {
  border-color: #efd0d0;
  background: #fff4f4;
  color: var(--danger);
}

.btn:disabled { cursor: wait; opacity: .65; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
}

.mobile-only { display: none; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}

.span-2 { grid-column: span 2; }

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.panel h2 { margin: 0; font-size: 15px; letter-spacing: -.2px; }

.panel p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

select {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 9px 34px 9px 11px;
  border-radius: 10px;
  color: var(--text);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  user-select: none;
}

.data-table tbody tr:hover { background: #fafbfc; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.row-actions { display: flex; gap: 6px; white-space: nowrap; }

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.form-field { display: grid; gap: 7px; position: relative; }

.form-field > span { font-size: 12px; font-weight: 750; }

.form-field input,
.form-field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}





@media (max-width: 1100px) {
.topbar { align-items: flex-start; }

}

@media (max-width: 860px) {
.app-shell { grid-template-columns: 1fr; }

.sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    width: 240px;
    transition: .25s;
  }

.sidebar.open { transform: translateX(0); }

.mobile-only { display: inline-grid; }

.main { padding: 20px; }

.topbar { flex-direction: column; }

.span-2 { grid-column: span 1; }
}

@media (max-width: 580px) {
.main { padding: 14px; }

.panel { border-radius: 14px; padding: 16px; }


}

[hidden] { display: none !important; }
a { color: var(--accent); }
.nav-item, .btn, .link-btn { text-decoration: none; }
.btn { display: inline-block; }

.module-view { min-width: 0; }
.load-error { margin-bottom: 18px; }
.notice { padding: 12px 15px; border-radius: 10px; margin-bottom: 18px; background: var(--accent-soft); color: var(--accent); }
.notice.error { background: #fff4f4; color: var(--danger); border: 1px solid #efd0d0; }
.notice.success { background: #edf8f1; color: var(--success); }

.ui-icon { width: 21px; height: 21px; display: block; flex-shrink: 0; }
.brand-mark .ui-icon { width: 27px; height: 27px; }
.header-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; font-weight: 600; min-height: 39px; }
.btn .ui-icon { width: 17px; height: 17px; }
.breadcrumb { display: flex; gap: 8px; align-items: center; color: var(--muted); margin-bottom: 12px; font-size: 11px; }
.breadcrumb a { text-decoration: none; color: var(--muted); }
.breadcrumb .ui-icon { width: 12px; height: 12px; }
.breadcrumb span { color: var(--text); font-weight: 600; }
.sidebar-footer { margin-top: auto; padding: 24px 7px 0; display: flex; gap: 10px; align-items: center; border-top: 1px solid #ffffff12; }
.sidebar-footer strong { display: block; font-size: 10px; line-height: 1.5; color: #e5e8f4; }
.sidebar-footer small { display: block; font-size: 10px; color: #aab0ba; margin-top: 4px; }
.sidebar-user { min-width: 0; overflow-wrap: anywhere; }
.sidebar-logout { margin-top: 9px; padding: 0; color: #d4d8f0; background: transparent; border: 0; font: inherit; font-size: 11px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.sidebar-logout:hover { color: white; }
.municipal-mark { width: 31px; height: 31px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center; font-size: 9px; background: var(--accent); font-weight: 750; }
@media (max-width: 860px) {
  .topbar { flex-direction: row; align-items: flex-start; gap: 14px; }
  .breadcrumb { display: none; }
  .header-actions { justify-content: flex-end; }
  .mobile-only { margin-bottom: 12px; }
}
@media (max-width: 580px) {
  .main { padding: 16px 12px; }
  .topbar { flex-wrap: wrap; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .topbar h1 { font-size: 25px; }
}
