
:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --info:          #0891b2;
  --secondary:     #6b7280;

  --dark:          #1e293b;
  --sidebar-bg:    #0f172a;
  --sidebar-text:  #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-active:#2563eb;

  --white:         #ffffff;
  --gray-50:       #f8fafc;
  --gray-100:      #f1f5f9;
  --gray-200:      #e2e8f0;
  --gray-300:      #cbd5e1;
  --gray-400:      #94a3b8;
  --gray-500:      #64748b;
  --gray-600:      #475569;
  --gray-700:      #334155;
  --gray-800:      #1e293b;
  --gray-900:      #0f172a;

  --border-radius: 8px;
  --border-radius-lg: 12px;
  --shadow-sm:     0 1px 2px rgba(0,0,0,.05);
  --shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --transition:    0.2s ease;
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ─── App Layout ─── */
.layout-app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  transition: transform var(--transition);
  z-index: 200;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; color: #fff;
}
.sidebar-logo-text { font-size: 1.1rem; font-weight: 700; color: #fff; }
.sidebar-logo-sub  { font-size: .7rem; color: var(--gray-400); }

.sidebar-user {
  padding: 1rem 1.5rem;
  display: flex; align-items: center; gap: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-avatar {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-name  { font-size: .875rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role  { font-size: .7rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .05em; }

.sidebar-nav { flex: 1; padding: .75rem 0; }

.nav-section { padding: .5rem 1.5rem .25rem; font-size: .65rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .08em; margin-top: .5rem; }

.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1.5rem;
  color: var(--sidebar-text);
  font-size: .875rem; font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(37,99,235,.15); color: #fff; }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--primary); border-radius: 0 2px 2px 0;
}
.nav-item-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; padding: .1rem .4rem; border-radius: 999px; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* ─── Main Content Area ─── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ─── */
.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.breadcrumb  { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--gray-500); }
.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb-sep { color: var(--gray-300); }
.breadcrumb-current { color: var(--gray-800); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: .75rem; }

.topbar-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  position: relative;
  transition: background var(--transition);
}
.topbar-btn:hover { background: var(--gray-50); }
.topbar-count {
  position: absolute; top: -4px; right: -4px;
  width: 18px; height: 18px; background: var(--danger);
  color: #fff; font-size: .6rem; font-weight: 700;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}

.topbar-user {
  display: flex; align-items: center; gap: .5rem;
  font-size: .875rem; font-weight: 500;
}
.topbar-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: #fff;
}

/* Notification Dropdown */
.dropdown-notif {
  position: relative;
}
.dropdown-notif-panel {
  display: none;
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 320px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
}
.dropdown-notif-panel.open { display: block; }
.dropdown-notif-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: .8rem; font-weight: 700; color: var(--gray-700);
  text-transform: uppercase; letter-spacing: .05em;
}
.notif-item {
  display: flex; gap: .75rem; padding: .75rem 1rem;
  border-bottom: 1px solid var(--gray-50);
  transition: background var(--transition);
  cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: var(--primary-light); }
.notif-icon { font-size: 1.1rem; }
.notif-text { flex: 1; font-size: .8125rem; line-height: 1.4; }
.notif-title { font-weight: 600; color: var(--gray-800); }
.notif-time  { color: var(--gray-400); font-size: .75rem; margin-top: .125rem; }
.notif-empty { padding: 1.5rem; text-align: center; color: var(--gray-400); font-size: .875rem; }

/* ─── Page Content ─── */
.page-content {
  padding: 1.5rem;
  flex: 1;
}

/* ─── Page Header ─── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem;
}
.page-title { font-size: 1.375rem; font-weight: 700; color: var(--gray-900); }

/* ─── Flash Messages ─── */
.flash { padding: .875rem 1.25rem; border-radius: var(--border-radius); margin-bottom: 1rem; font-size: .875rem; font-weight: 500; }
.flash-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.flash-error   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.flash-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.flash-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* ─── Card ─── */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card + .card { margin-top: 1.25rem; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--gray-800); }
.card-body  { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--gray-100); background: var(--gray-50); }
.p-0 { padding: 0 !important; }

/* ─── Stats Grid ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 1rem;
  overflow: hidden;
}
.stat-icon { font-size: 2rem; flex-shrink: 0; line-height: 1; }
.stat-body { min-width: 0; flex: 1; }
.stat-label { font-size: .75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: clamp(1.1rem, 3.5vw, 1.75rem); font-weight: 700; color: var(--gray-900); line-height: 1.1; word-break: break-word; overflow-wrap: break-word; }
.stat-sub   { font-size: .75rem; color: var(--gray-400); margin-top: .375rem; }
.stat-card.primary,   .stat-card-blue   { border-left: 4px solid var(--primary); }
.stat-card.success,   .stat-card-green  { border-left: 4px solid var(--success); }
.stat-card.warning,   .stat-card-yellow { border-left: 4px solid var(--warning); }
.stat-card.danger,    .stat-card-red    { border-left: 4px solid var(--danger); }
.stat-card-orange { border-left: 4px solid #ea580c; }

/* ─── List Item (used in recent contracts etc.) ─── */
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1.25rem; gap: .75rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: .875rem;
}
.list-item:last-child { border-bottom: none; }
.list-item > div { min-width: 0; }
.list-item .text-sm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Table ─── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .75rem 1rem; text-align: left; }
.table th { font-size: .75rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .06em; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.table td { border-bottom: 1px solid var(--gray-100); vertical-align: middle; font-size: .875rem; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: var(--gray-50); }
.row-unread { background: #eff6ff !important; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: .375rem;
  padding: .5rem 1rem;
  font-size: .875rem; font-weight: 600;
  border-radius: var(--border-radius);
  border: 2px solid transparent;
  cursor: pointer; transition: all var(--transition);
  line-height: 1.4; white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: .9; }

.btn-primary  { background: var(--primary);   color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success  { background: var(--success);   color: #fff; border-color: var(--success); }
.btn-danger   { background: var(--danger);    color: #fff; border-color: var(--danger); }
.btn-warning  { background: var(--warning);   color: #fff; border-color: var(--warning); }
.btn-info     { background: var(--info);      color: #fff; border-color: var(--info); }
.btn-secondary{ background: var(--secondary); color: #fff; border-color: var(--secondary); }

.btn-outline {
  background: transparent; color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-outline:hover { background: var(--gray-100); border-color: var(--gray-400); color: var(--gray-800); }

.btn-xs { padding: .25rem .625rem; font-size: .75rem; }
.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ─── Badges ─── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem;
  font-size: .7rem; font-weight: 700;
  border-radius: 999px; line-height: 1;
}
.badge-primary   { background: #dbeafe; color: #1d4ed8; }
.badge-success   { background: #dcfce7; color: #15803d; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-danger    { background: #fee2e2; color: #b91c1c; }
.badge-info      { background: #cffafe; color: #0e7490; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* ─── Forms ─── */
.form-group   { margin-bottom: 1.125rem; }
.form-label   { display: block; font-size: .8125rem; font-weight: 600; color: var(--gray-700); margin-bottom: .375rem; }
.form-label.required::after { content: ' *'; color: var(--danger); }

.form-control {
  display: block; width: 100%;
  padding: .5625rem .875rem;
  font-size: .9rem; line-height: 1.5;
  color: var(--gray-800);
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--border-radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none; appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-control:disabled { background: var(--gray-100); cursor: not-allowed; color: var(--gray-500); }

select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .5rem center; background-size: 1.25rem; padding-right: 2rem; }

textarea.form-control { resize: vertical; min-height: 100px; }

.form-hint { font-size: .75rem; color: var(--gray-500); margin-top: .25rem; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: .25rem; }

.input-row { display: flex; gap: .5rem; }

/* ─── Filter Card ─── */
.filter-card .card-body { padding: .875rem 1.25rem; }
.filter-form .filter-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filter-row .form-control { flex: 1; min-width: 140px; }

/* ─── Grid / Row / Cols ─── */
.row { display: flex; flex-wrap: wrap; margin: 0 -.625rem; }
[class^="col-"] { padding: 0 .625rem; }
.col-12   { width: 100%; }
.col-md-3 { width: 25%; }
.col-md-4 { width: 33.333%; }
.col-md-5 { width: 41.666%; }
.col-md-6 { width: 50%; }
.col-md-7 { width: 58.333%; }
.col-md-8 { width: 66.666%; }
.col-md-9 { width: 75%; }

/* ─── Detail Grid ─── */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.detail-item { }
.detail-label { display: block; font-size: .7rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .25rem; }

/* ─── Description Box ─── */
.description-box { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--border-radius); padding: 1rem; font-size: .875rem; line-height: 1.7; white-space: pre-wrap; }
.description-box-info { background: var(--primary-light); border-color: #bfdbfe; }

/* ─── Action buttons group ─── */
.action-btns { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ─── Tabs ─── */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); gap: 0; }
.tab {
  padding: .625rem 1.25rem;
  font-size: .875rem; font-weight: 600;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  display: flex; align-items: center; gap: .5rem; text-decoration: none;
}
.tab:hover { color: var(--primary); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Pagination ─── */
.pagination-wrapper {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--gray-100);
  flex-wrap: wrap; gap: .75rem;
}
.pagination-info { font-size: .8125rem; color: var(--gray-500); }
.pagination { display: flex; gap: .25rem; }
.page-item {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  font-size: .8125rem; font-weight: 600;
  border-radius: var(--border-radius);
  border: 1.5px solid var(--gray-200);
  color: var(--gray-700); cursor: pointer;
  transition: all var(--transition); text-decoration: none;
}
.page-item:hover { background: var(--gray-50); text-decoration: none; }
.page-item.active { background: var(--primary); border-color: var(--primary); color: #fff; cursor: default; }
.page-item.disabled { color: var(--gray-300); cursor: default; }

/* ─── Modal ─── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(480px, 95vw); max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--gray-400); line-height: 1; }
.modal-close:hover { color: var(--gray-700); }
.modal-body   { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-100); display: flex; gap: .75rem; justify-content: flex-end; background: var(--gray-50); }

/* ─── Empty State ─── */
.empty-state {
  padding: 3.5rem 1.5rem;
  text-align: center; color: var(--gray-400);
}
.empty-icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state p { margin-bottom: 1.25rem; font-size: .9rem; }

/* ─── Quick Actions ─── */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center;
  padding: 1.25rem .75rem;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  color: var(--gray-700); text-decoration: none;
  transition: all var(--transition); text-align: center;
}
.quick-action-btn:hover {
  background: var(--primary-light); border-color: var(--primary);
  color: var(--primary); text-decoration: none;
}
.quick-action-icon { font-size: 1.5rem; margin-bottom: .375rem; }
.quick-action-label { font-size: .8rem; font-weight: 600; }

/* ─── Boleto Card ─── */
.boleto-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  max-width: 800px;
}
.boleto-header-strip {
  background: var(--primary); color: #fff;
  padding: .875rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.boleto-header-title { font-size: 1rem; font-weight: 700; }
.boleto-body { padding: 1.5rem; }
.boleto-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.boleto-field-label { font-size: .7rem; font-weight: 700; color: var(--gray-400); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .2rem; }
.boleto-field-value { font-size: .9375rem; font-weight: 600; color: var(--gray-800); }
.boleto-amount { font-size: 2rem; font-weight: 800; color: var(--gray-900); }
.boleto-barcode {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--border-radius); padding: 1rem 1.25rem;
  text-align: center; letter-spacing: .2em;
  font-family: 'Courier New', monospace; font-size: .8rem;
  color: var(--gray-700); word-break: break-all;
  margin-top: 1rem;
}
.boleto-status-paid { background: #f0fdf4; border-color: #86efac; }
.boleto-status-overdue { background: #fef2f2; border-color: #fca5a5; }

/* ─── Notices ─── */
.notices-list { display: flex; flex-direction: column; gap: 1rem; }
.notice-card .notice-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-100);
  gap: 1rem;
}
.notice-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); margin-bottom: .25rem; }
.notice-meta  { font-size: .75rem; color: var(--gray-400); display: flex; align-items: center; gap: .375rem; flex-wrap: wrap; }
.notice-body  { padding: 1rem 1.25rem; font-size: .875rem; line-height: 1.7; color: var(--gray-700); white-space: pre-wrap; }

/* ─── Messages ─── */
.message-meta  { font-size: .875rem; }
.message-body  { font-size: .9rem; line-height: 1.8; color: var(--gray-700); white-space: pre-wrap; }

/* ─── Profile Avatar ─── */
.profile-avatar {
  width: 72px; height: 72px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700; color: #fff;
  margin: 0 auto;
}

/* ─── Auth Layout ─── */
.layout-auth {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}
.auth-wrapper {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 1rem;
}
.auth-card {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: min(420px, 95vw);
  padding: 2.5rem;
}
.auth-brand {
  display: flex; align-items: center; gap: .625rem;
  justify-content: center; margin-bottom: 1.75rem;
  color: #2563eb;
}
.auth-brand svg { width: 2rem; height: 2rem; }
.auth-brand span { font-size: 1.5rem; font-weight: 800; color: #1e3a5f; }
.auth-title    { font-size: 1.375rem; font-weight: 700; color: #111827; margin: 0 0 .25rem; text-align: center; }
.auth-subtitle { font-size: .875rem; color: #6b7280; margin: 0 0 1.75rem; text-align: center; }
.auth-form     { display: flex; flex-direction: column; gap: 1rem; }
.auth-demo {
  margin-top: 1.5rem; padding: .875rem 1rem;
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: .5rem; font-size: .78rem; color: #374151; line-height: 1.6;
}
.auth-demo strong { color: #1d4ed8; }
.auth-demo code   { background: #dbeafe; color: #1e40af; padding: .1em .35em; border-radius: .25rem; }
/* compat aliases */
.auth-box   { background: #ffffff; border-radius: 1rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: min(420px,95vw); padding: 2.5rem; }
.auth-logo  { text-align: center; margin-bottom: 2rem; }
.auth-sub   { font-size: .875rem; color: #6b7280; margin: 0 0 1.75rem; text-align: center; }
.password-input-wrapper { position: relative; }
.password-input-wrapper .form-control { padding-right: 3rem; }
.password-toggle {
  position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1rem; color: #9ca3af;
}
.demo-credentials { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: .5rem; padding: .875rem 1rem; margin-top: 1.5rem; }
.demo-credentials h4 { font-size: .75rem; font-weight: 700; color: #2563eb; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .5rem; }
.demo-item { font-size: .75rem; color: #4b5563; display: flex; justify-content: space-between; padding: .125rem 0; }

/* ─── Utility Classes ─── */
.d-none   { display: none !important; }
.d-flex   { display: flex !important; }
.d-block  { display: block !important; }
.d-grid   { display: grid !important; }
.gap-2    { gap: .5rem; }
.gap-3    { gap: .75rem; }
.gap-4    { gap: 1rem; }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.ml-2 { margin-left: .5rem; }
.mr-2 { margin-right: .5rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm     { font-size: .8125rem; }
.text-xs     { font-size: .75rem; }
.text-muted  { color: var(--gray-400); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning{ color: var(--warning); }
.text-primary{ color: var(--primary); }
.font-medium { font-weight: 600; }
.font-bold   { font-weight: 700; }
.border-top  { border-top: 1px solid var(--gray-200); }
.w-100       { width: 100%; }

/* ─── Topbar Menu Button (hamburger) ─── */
.topbar-menu-btn {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none; border: none; cursor: pointer; padding: .25rem;
  border-radius: var(--border-radius);
}
.topbar-menu-btn span {
  display: block; width: 22px; height: 2px;
  background: var(--gray-700); border-radius: 2px;
  transition: all var(--transition);
}
.topbar-menu-btn:hover { background: var(--gray-100); }

/* ─── User avatar small (topbar) ─── */
.user-avatar-sm {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* ─── Notification / dropdown ─── */
.topbar-action    { position: relative; }
.dropdown-panel {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  width: 300px; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg); z-index: 300; overflow: hidden;
}
.dropdown-panel.open { display: block; }
.dropdown-header { padding: .75rem 1rem; border-bottom: 1px solid var(--gray-100); font-size: .8rem; font-weight: 700; color: var(--gray-700); }
.dropdown-empty  { padding: 1.5rem; text-align: center; color: var(--gray-400); font-size: .85rem; }
.badge-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; background: var(--danger); border-radius: 50%;
}

/* ─── Alert (flash) ─── */
.alert { padding: .875rem 1.25rem; border-radius: var(--border-radius); margin-bottom: 1rem; font-size: .875rem; font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-danger   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-warning  { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info     { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.alert-close    { background: none; border: none; cursor: pointer; font-size: 1.2rem; line-height: 1; color: inherit; opacity: .6; }
.alert-close:hover { opacity: 1; }

/* ─── Page footer ─── */
.page-footer {
  padding: 1rem 1.5rem;
  font-size: .78rem; color: var(--gray-400);
  border-top: 1px solid var(--gray-200);
  text-align: center;
}

/* ─── Sidebar Toggle (inside sidebar, desktop hidden) ─── */
.sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 1.25rem; padding: .25rem; color: var(--gray-400);
  line-height: 1;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  /* Show hamburger in topbar */
  .topbar-menu-btn { display: flex; }

  /* Sidebar slides off-canvas */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }

  /* Main content takes full width */
  .main-wrapper { margin-left: 0; }

  /* Overlay behind sidebar */
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 199;
  }
  .sidebar-overlay.open { display: block; }

  /* Stats: 2 columns on tablet */
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* Stat card: smaller icon, tighter padding */
  .stat-card { padding: 1rem; gap: .75rem; }
  .stat-icon { font-size: 1.5rem; }

  /* Grid collapses */
  .col-md-3, .col-md-4, .col-md-5,
  .col-md-6, .col-md-7, .col-md-8,
  .col-md-9 { width: 100%; }

  /* Detail grid: 2 cols */
  .detail-grid { grid-template-columns: 1fr 1fr; }

  /* Less padding on mobile */
  .page-content { padding: 1rem; }

  /* Tables scroll horizontally */
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { white-space: nowrap; }

  /* Hide secondary table columns on mobile to avoid overflow */
  .table .col-hide-mobile { display: none; }

  /* Quick actions: 3 cols */
  .quick-actions { grid-template-columns: repeat(3, 1fr); }

  /* Page header stacks */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .page-title { font-size: 1.1rem; }

  /* Filter row stacks */
  .filter-row { flex-direction: column; }
  .filter-row .form-control { min-width: unset; }

  /* Topbar: tighter */
  .topbar { padding: 0 1rem; }
  .breadcrumb { display: none; }

  /* Notification panel full-width */
  .dropdown-panel { width: 280px; right: -1rem; }

  /* Auth card tighter */
  .auth-card, .auth-box { padding: 1.75rem 1.25rem; }

  /* Boleto header stacks */
  .boleto-header-strip { flex-direction: column; align-items: flex-start; gap: .25rem; }

  /* Pagination wraps */
  .pagination-wrapper { justify-content: center; }

  /* Tabs scroll */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }

  /* Action buttons wrap nicely */
  .action-btns { flex-wrap: wrap; }

  /* Modals full-screen on phone */
  .modal { width: 95vw; margin: 1rem; }
}

@media (max-width: 480px) {
  /* Stats: 1 column */
  .stats-grid { grid-template-columns: 1fr; }

  /* Quick actions: 2 cols */
  .quick-actions { grid-template-columns: repeat(2, 1fr); }

  /* Detail grid: 1 col */
  .detail-grid { grid-template-columns: 1fr; }

  /* Row cols full */
  [class^="col-"] { width: 100%; }

  /* Font adjustments */
  .stat-value { font-size: 1.4rem; }
  .page-title { font-size: 1rem; }

  /* Buttons smaller */
  .btn { font-size: .8125rem; padding: .4375rem .875rem; }

  /* Auth */
  .auth-card, .auth-box { padding: 1.5rem 1rem; }

  /* Boleto meta stacks */
  .boleto-meta { grid-template-columns: 1fr 1fr; }

  /* Hide user name in topbar, show only avatar */
  .d-none-xs { display: none !important; }

  /* Topbar icons smaller gap */
  .topbar-right { gap: .375rem; }
}

/* ─── Print ─── */
@media print {
  .sidebar, .topbar, .btn, .page-header .btn,
  .filter-card, .modal-overlay { display: none !important; }
  .main-wrapper { margin-left: 0; }
  .boleto-card { border: 2px solid #000; }
}
