:root {
   --app-bg: #f6f8fb;
   --app-surface: #ffffff;
   --app-surface-soft: #fafafa;
   --app-text: rgba(0, 0, 0, 0.88);
   --app-muted: rgba(0, 0, 0, 0.45);
   --app-line: #d9d9d9;
   --app-line-soft: #f0f0f0;
   --app-brand: #1677ff;
   --app-brand-strong: #0958d9;
   --app-brand-hover: #4096ff;
   --app-brand-light: #e6f4ff;
   --app-accent: #b45309;
   --app-sidebar-bg: #101828;
   --app-sidebar-bg-alt: #162033;
   --app-sidebar-text: #cbd5e1;
   --app-sidebar-muted: #8190a3;
   --app-success: #15803d;
   --app-warning: #b45309;
   --app-danger: #b91c1c;
   --shadow-soft: 0 6px 16px rgba(0, 0, 0, 0.08);
   --radius-sm: 6px;
   --radius-md: 8px;
   --control-height: 32px;
   --control-height-lg: 40px;
   --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

body.app-shell.theme-dark {
   --app-bg: #0f1720;
   --app-surface: #17212f;
   --app-surface-soft: #1f2b3b;
   --app-text: #e5edf5;
   --app-muted: #9aa9ba;
   --app-line: #2d3d50;
   --app-line-soft: #253448;
   --app-brand: #60a5fa;
   --app-brand-strong: #93c5fd;
   --app-accent: #f59e0b;
   --app-sidebar-bg: #0b1420;
   --app-sidebar-bg-alt: #112033;
   --app-sidebar-text: #d5dee9;
   --app-sidebar-muted: #8290a1;
   --shadow-soft: 0 14px 30px rgba(0, 0, 0, 0.28);
}

html,
body {
   min-height: 100%;
}

body {
   margin: 0;
   font-family: var(--font-family);
   font-size: 14px;
   line-height: 1.5715;
   color: var(--app-text);
   background: var(--app-bg);
   letter-spacing: 0;
   -webkit-font-smoothing: antialiased;
   text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
   letter-spacing: 0;
}

body.app-shell .wrapper,
.content-wrapper.app-content-wrapper {
   background: var(--app-bg);
}

a {
   color: var(--app-brand);
}

   a:hover {
      color: var(--app-brand-strong);
   }

.app-topbar {
   min-height: 56px;
   background: #ffffff !important;
   border-bottom: 1px solid var(--app-line);
   box-shadow: 0 3px 18px rgba(15, 23, 42, 0.05);
   padding-inline: 0.75rem;
}

body.app-shell.theme-dark .app-topbar {
   background: rgba(15, 23, 32, 0.96) !important;
}

.app-topbar .nav-link {
   color: var(--app-muted);
   border-radius: var(--radius-sm);
   font-size: 14px;
}

   .app-topbar .nav-link:hover {
      color: var(--app-brand-strong);
      background: rgba(37, 99, 235, 0.08);
   }

.app-icon-button {
   width: 32px;
   height: 32px;
   display: inline-flex !important;
   align-items: center;
   justify-content: center;
}

.app-theme-toggle {
   border: 0;
   padding: 0;
}

.app-topbar-context {
   min-height: 32px;
   display: inline-flex;
   flex-direction: column;
   justify-content: center;
   color: var(--app-text);
   line-height: 1.15;
}

.context-label {
   font-size: 14px;
   font-weight: 600;
}

.context-date {
   margin-top: 0.1rem;
   color: var(--app-muted);
   font-size: 12px;
}

.app-topbar .app-user-chip {
   display: inline-flex;
   align-items: center;
   gap: 0.45rem;
   max-width: 230px;
   min-height: 28px;
   padding: 0 0.65rem;
   color: var(--app-text);
   background: var(--app-surface-soft);
   border: 1px solid var(--app-line);
   border-radius: 999px;
   font-size: 13px;
   font-weight: 500;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
}

.app-topbar .logout-button {
   border: 0;
   color: var(--app-danger);
   font-weight: 600;
}

.app-toast-container {
   position: fixed;
   top: 1rem;
   right: 1rem;
   z-index: 1090;
   display: flex;
   flex-direction: column;
   gap: 0.5rem;
   pointer-events: none;
}

.app-notification {
   pointer-events: auto;
   width: min(360px, calc(100vw - 2rem));
   max-width: 360px;
   padding: 0.6rem 0.8rem 0.7rem;
   border-radius: var(--radius-md);
   box-shadow: var(--shadow-soft);
   color: #ffffff;
   opacity: 0;
   transform: translateY(-6px);
   transition: opacity 0.18s ease, transform 0.18s ease;
}

   .app-notification.show {
      opacity: 1;
      transform: translateY(0);
   }

.app-notification-success {
   background: #1f8f56;
   border: 1px solid #1f8f56;
}

.app-notification-error {
   background: #c0392b;
   border: 1px solid #c0392b;
}

.app-notification-header {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 0.5rem;
   margin-bottom: 0.2rem;
}

.app-notification-title {
   font-size: 1rem;
   line-height: 1.2;
}

.app-notification-body {
   font-size: 0.98rem;
   line-height: 1.4;
   word-break: break-word;
}

.app-notification-close {
   width: 24px;
   height: 24px;
   border: 0;
   border-radius: 4px;
   background: transparent;
   color: rgba(255, 255, 255, 0.9);
   font-size: 22px;
   line-height: 1;
   padding: 0;
}

   .app-notification-close:hover {
      background: rgba(255, 255, 255, 0.12);
   }

.app-toast-container .toast {
   display: none;
}

   .app-toast-container .toast.app-toast-success {
      color: #ffffff;
      background: #1f8f56;
      border-color: #1f8f56;
   }

   .app-toast-container .toast.app-toast-error {
      color: #ffffff;
      background: #c0392b;
      border-color: #c0392b;
   }

   .app-toast-container .toast .toast-header {
      min-height: 0;
      height: auto;
      line-height: 1.35;
      border-bottom: 1px solid rgba(255, 255, 255, 0.24);
   }

   .app-toast-container .toast .toast-body {
      min-height: 0 !important;
      height: auto !important;
      padding-top: 0;
      line-height: 1.4;
      white-space: normal;
      word-break: break-word;
   }

   .app-toast-container .toast .btn-close {
      opacity: 0.9;
   }

#confirmModal .modal-body {
   color: var(--app-text);
}

.app-sidebar {
   background: linear-gradient(180deg, var(--app-sidebar-bg), var(--app-sidebar-bg-alt));
   border-right: 1px solid rgba(255, 255, 255, 0.08);
}

   .app-sidebar .brand-link {
      min-height: 56px;
      display: flex;
      align-items: center;
      gap: 0.7rem;
      padding: 0.8rem 1rem;
      color: #fff;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
   }

   .app-sidebar .brand-mark {
      width: 32px;
      height: 32px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      color: #ffffff;
      background: #2563eb;
   }

.brand-text-group {
   display: flex;
   min-width: 0;
   flex-direction: column;
   line-height: 1.15;
}

.brand-title {
   font-size: 14px;
   font-weight: 600;
}

.brand-subtitle {
   margin-top: 0.12rem;
   color: var(--app-sidebar-muted);
   font-size: 12px;
   font-weight: 500;
}

.sidebar {
   padding-top: 0.5rem;
}

.nav-sidebar .nav-header {
   margin: 0.7rem 0.85rem 0.25rem;
   padding: 0;
   color: var(--app-sidebar-muted);
   font-size: 11px;
   font-weight: 600;
   letter-spacing: 0.04em;
}

.sidebar .nav-link {
   min-height: 40px;
   margin: 0.08rem 0.55rem;
   padding: 0.56rem 0.75rem;
   color: var(--app-sidebar-text) !important;
   border-radius: var(--radius-sm);
   font-size: 14px;
   font-weight: 500;
   transition: background-color 0.16s ease, color 0.16s ease;
}

   .sidebar .nav-link .nav-icon {
      width: 1.25rem;
      color: #98a7b9;
   }

   .sidebar .nav-link:hover,
   .nav-sidebar .menu-open > .nav-link {
      background: rgba(255, 255, 255, 0.08);
      color: #fff !important;
   }

.sidebar > nav > .nav-sidebar > .nav-item > .nav-link.active,
.nav-sidebar > .nav-item > .nav-link.active {
   color: #fff !important;
   background: rgba(37, 99, 235, 0.92);
   box-shadow: inset 3px 0 0 #bfdbfe;
}

.sidebar .nav-treeview .nav-link.active {
   color: #91caff !important;
   background: rgba(22, 119, 255, 0.14);
   box-shadow: inset 3px 0 0 #1677ff;
}

.sidebar .nav-link.active .nav-icon,
.sidebar .nav-link:hover .nav-icon {
   color: #fff;
}

.sidebar .nav-treeview .nav-link.active .nav-icon {
   color: #91caff;
}

.nav-treeview .nav-link {
   padding-left: 1rem;
   font-size: 13px;
}

.app-page-container {
   max-width: none;
   padding-bottom: 2rem;
}

.page-title-block {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 1rem;
   margin-bottom: 1.1rem;
   padding: 1rem 1.15rem;
   border: 1px solid var(--app-line);
   border-radius: var(--radius-md);
   background: var(--app-surface);
   box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.page-kicker {
   margin: 0 0 0.2rem;
   color: var(--app-muted);
   font-size: 12px;
   font-weight: 600;
   letter-spacing: 0.04em;
   text-transform: uppercase;
}

.page-title {
   margin: 0;
   color: var(--app-text);
   font-size: 22px;
   font-weight: 600;
   letter-spacing: 0;
}

.page-subtitle {
   max-width: 560px;
   margin: 0;
   color: var(--app-muted);
   font-size: 14px;
   text-align: right;
}

.card,
.small-box,
.info-box,
.modal-content,
.app-data-card,
.app-form-card,
.app-filter-panel {
   border: 1px solid var(--app-line);
   border-radius: var(--radius-md);
   background: var(--app-surface);
   box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card {
   color: var(--app-text);
}

   .card .card-header,
   .app-data-card .card-header {
      min-height: 48px;
      display: flex;
      align-items: center;
      background: var(--app-surface);
      border-bottom: 1px solid var(--app-line);
      color: var(--app-text);
      font-size: 14px;
      font-weight: 600;
   }

.app-toolbar {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 1rem;
   margin-bottom: 0.9rem;
   padding: 1rem 1.15rem;
   border: 1px solid var(--app-line);
   border-radius: var(--radius-md);
   background: var(--app-surface);
   box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.app-toolbar-title {
   margin: 0;
   color: var(--app-text);
   font-size: 16px;
   font-weight: 600;
}

.app-toolbar-actions {
   display: flex;
   flex-wrap: wrap;
   justify-content: flex-end;
   gap: 0.5rem;
}

.app-filter-panel,
.app-form-card {
   padding: 1rem;
   margin-bottom: 0.9rem;
}

.app-data-card {
   overflow: hidden;
}

   .app-data-card .table,
   .app-form-card .table {
      margin-bottom: 0;
   }

.table {
   margin-bottom: 0;
   color: var(--app-text);
   border-color: var(--app-line);
   vertical-align: middle;
   font-size: 14px;
}

   .table > :not(caption) > * > * {
      padding: 0.68rem 0.85rem;
      border-color: var(--app-line-soft);
   }

   .table thead th {
      background: var(--app-surface-soft);
      color: #111111;
      border-bottom: 1px solid var(--app-line-soft);
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 0;
      text-transform: none;
      white-space: nowrap;
   }

.table-hover tbody tr:hover {
   background: rgba(37, 99, 235, 0.045);
}

.table tbody tr,
.table.dataTable tbody tr.odd,
.table.dataTable tbody tr.even {
   background: transparent;
}

.table > :not(caption) > * > * {
   border: 1px solid var(--app-line-soft);
}

.table thead th {
   border-color: var(--app-line-soft);
}

.table thead th:first-child,
.table tbody td:first-child {
   width: 48px;
   min-width: 48px;
   max-width: 48px;
   text-align: center;
   white-space: nowrap;
}

table.dataTable thead th:first-child,
table.dataTable thead td:first-child {
   pointer-events: none;
   cursor: default !important;
}

table.dataTable thead th:first-child.sorting,
table.dataTable thead th:first-child.sorting_asc,
table.dataTable thead th:first-child.sorting_desc,
table.dataTable thead td:first-child.sorting,
table.dataTable thead td:first-child.sorting_asc,
table.dataTable thead td:first-child.sorting_desc {
   background-image: none !important;
}

.table-bordered {
   border-left: 0;
   border-right: 0;
}

.table-actions {
   width: 1%;
   white-space: nowrap;
}

.form-label {
   margin-bottom: 0.35rem;
   color: var(--app-text);
   font-size: 14px;
   font-weight: 500;
}

.form-control,
.form-select {
   height: var(--control-height);
   min-height: var(--control-height);
   padding: 4px 11px;
   border-color: var(--app-line);
   border-radius: var(--radius-sm);
   background-color: var(--app-surface);
   color: var(--app-text);
   font-size: 14px;
   line-height: 1.5715;
   box-shadow: none !important;
   transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.form-select {
   padding-top: 4px;
   padding-bottom: 4px;
   line-height: calc(var(--control-height) - 10px);
}

.form-control::placeholder {
   color: rgba(0, 0, 0, 0.25);
}

.form-control-sm,
.form-select-sm {
   height: 24px;
   min-height: 24px;
   padding: 0 7px;
   border-radius: 4px;
   font-size: 14px;
}

.form-control-lg,
.form-select-lg {
   height: var(--control-height-lg);
   min-height: var(--control-height-lg);
   padding: 6.5px 11px;
   font-size: 16px;
}

.form-control:focus,
.form-select:focus {
   border-color: var(--app-brand-hover);
   box-shadow: 0 0 0 2px rgba(5, 145, 255, 0.1) !important;
}

.form-control:hover,
.form-select:hover {
   border-color: var(--app-brand-hover);
}

.input-group-text {
   min-height: var(--control-height);
   border-color: var(--app-line);
   border-radius: var(--radius-sm);
   background: #fafafa;
   color: var(--app-muted);
   font-size: 14px;
}

.btn {
   min-height: var(--control-height);
   display: inline-flex;
   align-items: center;
   justify-content: center;
   gap: 0.35rem;
   padding: 4px 15px;
   border-radius: var(--radius-sm);
   font-size: 14px;
   line-height: 1.5715;
   font-weight: 400;
   box-shadow: none;
   transition: color 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

   .btn:active {
      transform: translateY(1px);
   }

   .btn i {
      font-size: 13px;
   }

.btn-lg {
   min-height: var(--control-height-lg);
   padding: 6.5px 15px;
   font-size: 16px;
}

.btn-sm {
   min-height: 24px;
   padding: 0 7px;
   border-radius: 4px;
   font-size: 14px;
}

.btn-primary {
   border-color: var(--app-brand);
   background: var(--app-brand);
   box-shadow: 0 2px 0 rgba(5, 145, 255, 0.1);
}

   .btn-primary:hover,
   .btn-primary:focus {
      border-color: var(--app-brand-hover);
      background: var(--app-brand-hover);
   }

.btn-outline-primary {
   color: var(--app-brand);
   border-color: var(--app-brand);
}

   .btn-outline-primary:hover,
   .btn-outline-primary:focus {
      color: #fff;
      border-color: var(--app-brand-hover);
      background: var(--app-brand-hover);
   }

.btn-outline-secondary {
   color: var(--app-text);
   border-color: var(--app-line);
   background: var(--app-surface);
}

   .btn-outline-secondary:hover,
   .btn-outline-secondary:focus {
      color: var(--app-brand-hover);
      border-color: var(--app-brand-hover);
      background: var(--app-surface);
   }

.btn-link {
   min-height: auto;
   padding: 0;
   border: 0;
   border-radius: var(--radius-sm);
}

.btn-outline-danger {
   color: var(--app-danger);
   border-color: rgba(185, 28, 28, 0.36);
}

   .btn-outline-danger:hover {
      border-color: var(--app-danger);
      background: var(--app-danger);
   }

.alert {
   border: 1px solid transparent;
   border-radius: var(--radius-md);
   box-shadow: none;
}

.alert-info {
   color: #1e3a8a;
   border-color: #bfdbfe;
   background: #eff6ff;
}

.alert-danger {
   color: #7f1d1d;
   border-color: #fecaca;
   background: #fef2f2;
}

.app-stats-grid {
   display: grid;
   grid-template-columns: repeat(12, minmax(0, 1fr));
   gap: 0.85rem;
}

   .app-stats-grid > * {
      grid-column: span 12;
   }

.stat-card {
   position: relative;
   min-height: 138px;
   overflow: hidden;
   border: 0;
   border-radius: var(--radius-md);
   transition: transform 0.16s ease, box-shadow 0.16s ease;
}

a:hover .stat-card {
   transform: translateY(-2px);
   box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

.stat-card .card-body {
   display: flex;
   min-height: 138px;
   flex-direction: column;
   justify-content: space-between;
   text-align: left !important;
}

.stat-card .display-6 {
   font-size: 2rem;
}

.stat-icon {
   width: 42px;
   height: 42px;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   border-radius: 8px;
   background: rgba(255, 255, 255, 0.18);
}

.card.bg-primary {
   background: #0f766e !important;
}

.card.bg-success {
   background: #15803d !important;
}

.card.bg-info {
   background: #0369a1 !important;
}

.card.bg-warning {
   background: #f59e0b !important;
}

.chip-status {
   display: inline-flex;
   align-items: center;
   min-height: 22px;
   border-radius: 4px;
   padding: 0 7px;
   font-size: 12px;
   font-weight: 500;
   white-space: nowrap;
}

   .chip-status.success {
      color: #166534;
      background: #dcfce7;
   }

   .chip-status.warning {
      color: #92400e;
      background: #fef3c7;
   }

   .chip-status.info {
      color: #075985;
      background: #e0f2fe;
   }

   .chip-status.secondary {
      color: #475569;
      background: #e2e8f0;
   }

.chart-panel {
   min-height: 360px;
}

   .chart-panel .card-body {
      min-height: 300px;
   }

.report-chart-grid {
   display: grid;
   grid-template-columns: minmax(360px, 0.85fr) minmax(520px, 1.15fr);
   gap: 0.85rem;
}

.report-panel .card-body {
   padding: 1rem;
}

.report-donut-layout {
   display: grid;
   grid-template-columns: 220px minmax(0, 1fr);
   gap: 1rem;
   align-items: center;
   min-height: 260px;
}

.report-donut-chart {
   position: relative;
   width: 220px;
   height: 220px;
}

.report-bar-chart {
   position: relative;
   height: 260px;
}

.report-summary-list {
   display: grid;
   gap: 0.55rem;
}

.report-summary-item {
   display: grid;
   grid-template-columns: 10px minmax(0, 1fr) auto auto;
   gap: 0.55rem;
   align-items: center;
   min-height: 36px;
   padding: 0.45rem 0.55rem;
   border: 1px solid var(--app-line);
   border-radius: var(--radius-sm);
   background: var(--app-surface-soft);
}

.report-summary-dot {
   width: 10px;
   height: 10px;
   border-radius: 999px;
}

.report-summary-name {
   min-width: 0;
   overflow: hidden;
   color: var(--app-text);
   font-weight: 600;
   text-overflow: ellipsis;
   white-space: nowrap;
}

.report-policy-card .table {
   margin-bottom: 0;
}

   .report-policy-card .table td,
   .report-policy-card .table th {
      padding-block: 0.65rem;
   }

.quick-action-grid {
   display: grid;
   grid-template-columns: repeat(4, minmax(0, 1fr));
   gap: 0.75rem;
}

.quick-action {
   min-height: 86px;
   display: flex;
   align-items: center;
   gap: 0.75rem;
   padding: 0.9rem;
   color: var(--app-text);
   border: 1px solid var(--app-line);
   border-radius: var(--radius-md);
   background: var(--app-surface);
   text-decoration: none;
}

   .quick-action:hover {
      color: var(--app-text);
      border-color: rgba(37, 99, 235, 0.4);
      background: rgba(37, 99, 235, 0.045);
   }

   .quick-action i {
      width: 38px;
      height: 38px;
      display: inline-flex;
      flex: 0 0 auto;
      align-items: center;
      justify-content: center;
      color: var(--app-brand-strong);
      border-radius: 8px;
      background: rgba(37, 99, 235, 0.1);
   }

.management-surface {
   display: grid;
   grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
   gap: 1rem;
   align-items: start;
}

.management-side {
   position: sticky;
   top: 74px;
}

.section-title {
   margin: 0 0 0.35rem;
   color: var(--app-text);
   font-size: 16px;
   font-weight: 600;
}

.section-description {
   margin: 0;
   color: var(--app-muted);
   font-size: 14px;
}

.inline-create-form {
   display: grid;
   gap: 0.75rem;
}

.data-card-header {
   min-height: 56px;
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 1rem;
   padding: 0.85rem 1rem;
   border-bottom: 1px solid var(--app-line-soft);
   background: var(--app-surface);
}

.data-card-title {
   margin: 0;
   font-size: 16px;
   font-weight: 600;
}

.data-card-meta {
   color: var(--app-muted);
   font-size: 13px;
   font-weight: 400;
}

.code-chip {
   display: inline-flex;
   align-items: center;
   min-height: 22px;
   padding: 0 7px;
   border: 1px solid #d9d9d9;
   border-radius: 4px;
   color: rgba(0, 0, 0, 0.65);
   background: #fafafa;
   font-size: 12px;
   font-weight: 500;
}

.narrow-surface {
   max-width: 720px;
}

.account-settings-grid {
   display: grid;
   grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
   gap: 1rem;
   align-items: start;
}

.account-summary-card .card-body {
   padding: 1.25rem;
}

.account-avatar {
   width: 52px;
   height: 52px;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   margin-bottom: 0.9rem;
   color: #ffffff;
   border-radius: 12px;
   background: var(--app-brand);
   font-size: 20px;
}

.account-name {
   margin: 0;
   color: var(--app-text);
   font-size: 18px;
   font-weight: 600;
}

.account-email {
   margin-top: 0.2rem;
   color: var(--app-muted);
   word-break: break-word;
}

.account-meta-list {
   display: grid;
   gap: 0.6rem;
   margin-top: 1rem;
}

   .account-meta-list div {
      padding: 0.65rem 0.75rem;
      border: 1px solid var(--app-line);
      border-radius: var(--radius-sm);
      background: var(--app-surface-soft);
   }

   .account-meta-list span,
   .account-meta-list strong {
      display: block;
   }

   .account-meta-list span {
      color: var(--app-muted);
      font-size: 12px;
   }

   .account-meta-list strong {
      margin-top: 0.15rem;
      color: var(--app-text);
      font-weight: 600;
      word-break: break-word;
   }

.residence-registration-grid {
   display: grid;
   grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
   gap: 1rem;
   align-items: start;
}

.resident-preview {
   min-height: 220px;
   padding: 1rem;
   border: 1px solid var(--app-line);
   border-radius: var(--radius-md);
   background: var(--app-surface-soft);
}

.resident-preview-empty {
   display: grid;
   min-height: 188px;
   place-items: center;
   color: var(--app-muted);
   text-align: center;
}

.resident-preview-title {
   display: flex;
   flex-wrap: wrap;
   align-items: baseline;
   gap: 0.5rem;
   margin-bottom: 0.85rem;
}

   .resident-preview-title span {
      color: var(--app-text);
      font-size: 18px;
      font-weight: 600;
   }

   .resident-preview-title small {
      color: var(--app-muted);
      font-weight: 500;
   }

.resident-info-grid {
   display: grid;
   grid-template-columns: repeat(2, minmax(0, 1fr));
   gap: 0.65rem;
}

   .resident-info-grid div {
      min-width: 0;
      padding: 0.6rem 0.7rem;
      border: 1px solid var(--app-line);
      border-radius: var(--radius-sm);
      background: var(--app-surface);
   }

   .resident-info-grid span,
   .resident-info-grid strong {
      display: block;
   }

   .resident-info-grid span {
      color: var(--app-muted);
      font-size: 12px;
   }

   .resident-info-grid strong {
      margin-top: 0.15rem;
      overflow-wrap: anywhere;
      color: var(--app-text);
      font-weight: 600;
   }

.workflow-strip {
   display: grid;
   grid-template-columns: repeat(3, minmax(0, 1fr));
   gap: 0.75rem;
}

.workflow-step {
   display: flex;
   align-items: flex-start;
   gap: 0.75rem;
   padding: 0.9rem;
   border: 1px solid var(--app-line);
   border-radius: var(--radius-md);
   background: var(--app-surface);
}

   .workflow-step > span {
      width: 28px;
      height: 28px;
      display: inline-flex;
      flex: 0 0 auto;
      align-items: center;
      justify-content: center;
      color: #ffffff;
      border-radius: 999px;
      background: var(--app-brand);
      font-weight: 600;
   }

   .workflow-step strong,
   .workflow-step small {
      display: block;
   }

   .workflow-step strong {
      color: var(--app-text);
      font-weight: 600;
   }

   .workflow-step small {
      margin-top: 0.15rem;
      color: var(--app-muted);
   }

.empty-workflow-state {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 1rem;
   padding: 1rem;
}

   .empty-workflow-state strong,
   .empty-workflow-state span {
      display: block;
   }

   .empty-workflow-state span {
      margin-top: 0.15rem;
      color: var(--app-muted);
   }

.center-surface {
   margin-inline: auto;
}

.quick-action strong,
.quick-action span {
   display: block;
}

.quick-action span {
   margin-top: 0.15rem;
   color: var(--app-muted);
   font-size: 13px;
}

.dataTables_wrapper {
   padding: 0.85rem 1rem;
   font-size: 14px;
}

   .dataTables_wrapper .row:first-child {
      align-items: center;
      margin-bottom: 0.5rem;
   }

   .dataTables_wrapper .dataTables_filter input,
   .dataTables_wrapper .dataTables_length select {
      min-height: var(--control-height);
      padding: 4px 11px;
      border: 1px solid var(--app-line);
      border-radius: var(--radius-sm);
      background: var(--app-surface);
      color: var(--app-text);
      font-size: 14px;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
   }

      .dataTables_wrapper .dataTables_filter input:hover,
      .dataTables_wrapper .dataTables_length select:hover,
      .dataTables_wrapper .dataTables_filter input:focus,
      .dataTables_wrapper .dataTables_length select:focus {
         border-color: var(--app-brand-hover);
         box-shadow: 0 0 0 2px rgba(5, 145, 255, 0.1);
      }

   .dataTables_wrapper .page-item.active .page-link {
      border-color: var(--app-brand);
      background: var(--app-brand);
   }

   .dataTables_wrapper .page-link {
      color: var(--app-brand);
      border-color: var(--app-line);
      background: var(--app-surface);
      min-width: 32px;
      min-height: 32px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 4px 10px;
      font-size: 14px;
   }

.app-footer {
   color: var(--app-muted);
   border-top: 1px solid var(--app-line);
   background: var(--app-surface);
   font-size: 0.82rem;
}

.auth-page {
   min-height: 100vh;
   margin: 0;
   display: grid;
   place-items: center;
   padding: 1rem;
   font-family: var(--font-family);
   background: linear-gradient(135deg, #101828, #0958d9);
}

   .auth-page .login-box,
   .auth-page .register-box {
      width: min(460px, 100%);
   }

   .auth-page .login-logo {
      margin-bottom: 1rem;
      color: #ecfeff;
      text-align: center;
      font-size: 24px;
      font-weight: 600;
   }

   .auth-page .card,
   .auth-page .login-card-body,
   .auth-page .register-card-body {
      border-radius: var(--radius-md);
   }

   .auth-page .card {
      border: 1px solid rgba(255, 255, 255, 0.22);
      box-shadow: 0 24px 52px rgba(0, 0, 0, 0.32);
   }

   .auth-page .login-card-body,
   .auth-page .register-card-body {
      padding: 1.4rem;
   }

   .auth-page .login-box-msg {
      color: var(--app-muted);
      font-weight: 600;
   }

.reveal-up {
   animation: revealUp 0.32s ease both;
}

@keyframes revealUp {
   from {
      opacity: 0;
      transform: translateY(8px);
   }

   to {
      opacity: 1;
      transform: translateY(0);
   }
}

body.app-shell.theme-dark .text-muted {
   color: var(--app-muted) !important;
}

body.app-shell.theme-dark .form-control::placeholder {
   color: rgba(229, 237, 245, 0.32);
}

body.app-shell.theme-dark .input-group-text {
   background: var(--app-surface-soft);
   border-color: var(--app-line);
}

body.app-shell.theme-dark .code-chip {
   color: #d5dee9;
   border-color: var(--app-line);
   background: var(--app-surface-soft);
}

body.app-shell.theme-dark .alert-info {
   color: #bae6fd;
   border-color: #0e7490;
   background: rgba(14, 116, 144, 0.22);
}

body.app-shell.theme-dark .alert-danger {
   color: #fecaca;
   border-color: #991b1b;
   background: rgba(127, 29, 29, 0.2);
}

body.app-shell.theme-dark .chip-status.success {
   color: #bbf7d0;
   background: rgba(22, 101, 52, 0.34);
}

body.app-shell.theme-dark .chip-status.warning {
   color: #fde68a;
   background: rgba(146, 64, 14, 0.34);
}

body.app-shell.theme-dark .chip-status.info {
   color: #bae6fd;
   background: rgba(7, 89, 133, 0.34);
}

@media (min-width: 768px) {
   .app-stats-grid > * {
      grid-column: span 4;
   }

      .app-stats-grid > *:nth-child(4) {
         grid-column: span 3;
      }
}

@media (min-width: 1200px) {
   .app-stats-grid > * {
      grid-column: span 3;
   }
}

@media (max-width: 991.98px) {
   .main-sidebar {
      box-shadow: 12px 0 30px rgba(0, 0, 0, 0.26);
   }

   .page-title-block,
   .app-toolbar {
      align-items: stretch;
      flex-direction: column;
   }

   .page-subtitle {
      max-width: none;
      text-align: left;
   }

   .app-toolbar-actions {
      justify-content: flex-start;
   }

   .quick-action-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
   }

   .management-surface {
      grid-template-columns: 1fr;
   }

   .management-side {
      position: static;
   }

   .report-chart-grid {
      grid-template-columns: 1fr;
   }

   .account-settings-grid {
      grid-template-columns: 1fr;
   }

   .residence-registration-grid {
      grid-template-columns: 1fr;
   }

   .workflow-strip {
      grid-template-columns: 1fr;
   }
}

@media (max-width: 575.98px) {
   .content {
      padding-inline: 0.75rem !important;
   }

   .page-title {
      font-size: 1.22rem;
   }

   .app-topbar .app-user-chip {
      max-width: 132px;
   }

   .app-toolbar-actions,
   .app-toolbar-actions .btn,
   .app-filter-panel .btn,
   .quick-action-grid {
      width: 100%;
   }

   .quick-action-grid {
      grid-template-columns: 1fr;
   }

   .app-filter-panel .col-auto {
      width: 100%;
   }

   .table > :not(caption) > * > * {
      padding: 0.65rem;
   }

   .report-donut-layout {
      grid-template-columns: 1fr;
      justify-items: center;
   }

   .report-donut-chart {
      width: 190px;
      height: 190px;
   }

   .report-bar-chart {
      height: 230px;
   }

   .report-summary-list {
      width: 100%;
   }

   .resident-info-grid {
      grid-template-columns: 1fr;
   }

   .empty-workflow-state {
      align-items: stretch;
      flex-direction: column;
   }
}

.main-sidebar, .main-sidebar::before {
   width: 260px !important;
}
