* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a, a:link, a:visited {
  color: inherit;
  text-decoration: none;
  transition: color 0.18s ease;
}

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

.cursor-pointer { cursor: pointer; }

h1, h2, h3, h4, h5, h6,
.navbar-brand, .btn, thead th {
  font-family: var(--font-display);
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
}

.sidebar-header {
  padding: 1.3rem 1.2rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-collapse-btn {
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.sidebar-collapse-btn:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: #ffffff !important;
  text-decoration: none;
}

.sidebar-brand b { color: var(--sidebar-active); }

.sidebar-section-label {
  padding: 1rem 1.2rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(156, 163, 175, 0.55);
  display: block;
}

.sidebar-nav {
  padding: 0.4rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-link,
.sidebar-link:link,
.sidebar-link:visited {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link i {
  width: 17px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.9;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #e5e7eb;
}

.sidebar-link.active {
  background: rgba(14, 165, 233, 0.15);
  color: #ffffff;
  font-weight: 600;
}

.sidebar-link.active i {
  color: var(--sidebar-active);
  opacity: 1;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 0.4rem 0.65rem;
}

.sidebar-bottom {
  padding: 0.75rem 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  cursor: default;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.71rem;
  color: var(--sidebar-text);
  text-transform: capitalize;
}

.sidebar-logout,
.sidebar-logout:link,
.sidebar-logout:visited {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  margin-top: 0.25rem;
}

.sidebar-logout:hover {
  background: rgba(220, 38, 38, 0.14);
  color: #fca5a5 !important;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 199;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

.app-topbar {
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 0.85rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.topbar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s;
  line-height: 1;
}

.topbar-toggle:hover { background: var(--surface-3); }

.topbar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.7rem 0.3rem 0.38rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-2);
  transition: border-color 0.15s, background 0.15s;
}

.topbar-user-btn:hover {
  border-color: var(--line-2);
  background: var(--surface-3);
}

.topbar-user-avatar {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-dropdown {
  min-width: 190px;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  margin-top: 0.5rem !important;
}

.topbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-xs);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-2);
  transition: background 0.15s;
  text-decoration: none;
}

.topbar-dropdown-item:hover {
  background: var(--surface-3);
  color: var(--text);
}

.topbar-dropdown-item.danger:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.topbar-logout-form {
  margin: 0;
}

.topbar-logout-btn {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.app-content {
  flex: 1;
  padding: 1.75rem 1.75rem 1.25rem;
}

.page-header { margin-bottom: 1.5rem; }

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-eyebrow {
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.2rem;
  display: block;
}

.page-title {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 800;
  color: var(--text);
  margin: 0 0 0.2rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.87rem;
  margin: 0;
}

.breadcrumb-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.breadcrumb-row a { color: var(--brand); }
.breadcrumb-row a:hover { text-decoration: underline; }
.breadcrumb-sep { opacity: 0.45; }

.card, .modal-content, .jumbotron {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-md) !important;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  animation: riseIn 0.35s ease both;
}

.card:hover { box-shadow: var(--shadow-sm); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.35rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 0 2px 2px 0;
}

.stat-card.pending::before  { background: var(--warn);   }
.stat-card.approved::before { background: var(--ok);     }
.stat-card.rejected::before { background: var(--danger); }

.stat-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.stat-icon.pending  { background: var(--warn-light);   color: var(--warn);   }
.stat-icon.approved { background: var(--ok-light);     color: var(--ok);     }
.stat-icon.rejected { background: var(--danger-light); color: var(--danger); }

.stat-body { flex: 1; min-width: 0; }

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.12rem;
  display: block;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 700;
  background: rgba(14, 165, 233, 0.12);
  color: var(--brand);
}

.table {
  overflow: hidden;
  margin-bottom: 0;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-md) !important;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.table thead th,
.table thead,
thead.table th {
  background: #18344f !important;
  color: #fff !important;
  border-color: #214261 !important;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.72rem 0.9rem;
  vertical-align: middle;
}

.table td, .table th {
  vertical-align: middle;
  border-color: var(--line) !important;
  padding: 0.62rem 0.9rem;
  font-size: 0.875rem;
}

.table tbody tr:first-child td { border-top: none; }

.table-hover tbody tr:hover {
  background-color: #f0f7ff !important;
}

#list_wrapper, .dataTables_wrapper {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-xs);
}

.dataTables_filter input,
.dataTables_length select {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-xs) !important;
  padding: 0.3rem 0.5rem !important;
  background: var(--surface) !important;
  font-size: 0.85rem !important;
}

.btn {
  font-family: var(--font-display);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, .16);
}

.btn:active { transform: translateY(0); }

.btn-primary,
.btn-dark,
.btn-dark.purple {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand)) !important;
  border-color: transparent !important;
  color: #fff !important;
}

.btn-outline-dark {
  border-color: var(--line) !important;
  color: var(--text-2) !important;
  background: var(--surface);
}

.btn-outline-dark:hover { background: var(--surface-3) !important; }

.form-label {
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0.28rem;
  letter-spacing: 0.01em;
  display: block;
}

.form-control,
.form-select,
.input-group-text,
textarea {
  border-radius: var(--radius-xs) !important;
  border: 1px solid var(--line) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  font-size: 0.875rem;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, .14) !important;
  outline: none;
}

.input-group-text {
  background: var(--surface-3) !important;
  color: var(--muted) !important;
  border-color: var(--line) !important;
}

.modal-header, .modal-footer { border-color: var(--line); }

#forgotPassword .modal-content { border-radius: var(--radius-lg) !important; }

.badge {
  border-radius: 999px;
  padding: 0.34rem 0.6rem;
  font-size: 0.74rem;
}

.action-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  color: var(--brand) !important;
  border: 1px solid var(--line);
  transition: background 0.15s, transform 0.15s;
}

.action-icon:hover {
  background: var(--brand-light);
  transform: translateY(-1px);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.data-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: var(--surface-2);
  flex-shrink: 0;
}

.panel-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.panel-body { flex: 1; }

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.empty-state i {
  font-size: 1.5rem;
  opacity: 0.3;
  display: block;
  margin-bottom: 0.5rem;
}

.form-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-xs);
}

.form-section-header {
  padding: 0.8rem 1.2rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.form-section-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin: 0;
}

.form-section-body { padding: 1.25rem; }

.runtime-template-subsection {
  margin-bottom: 1rem;
}

.runtime-template-subsection:last-child {
  margin-bottom: 0;
}

.runtime-template-subsection-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.runtime-template-flat {
  padding: 0.1rem 0;
}

.runtime-matrix-shell {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-md) - 4px);
  background: #fbfdff;
  overflow: hidden;
}

.runtime-matrix-scroll {
  margin: 0;
}

.runtime-matrix-table {
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.runtime-matrix-table thead th {
  background: #eff5fb;
  color: #35506b;
  border-color: #d9e6f2;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  padding: 0.9rem 0.85rem;
}

.runtime-matrix-table thead tr:first-child th {
  background: #e3eef8;
  color: #1f3b57;
}

.runtime-matrix-table tbody th,
.runtime-matrix-rowhead {
  background: #f8fbfe;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
  min-width: 110px;
  padding: 0.95rem 0.85rem;
  border-color: #e1eaf2;
}

.runtime-matrix-table tbody td,
.runtime-matrix-table tfoot th,
.runtime-matrix-table tfoot td {
  border-color: #e1eaf2;
  padding: 0.65rem 0.8rem;
  vertical-align: middle;
  background: #fff;
}

.runtime-matrix-table tbody tr:nth-child(even) td {
  background: #fcfdff;
}

.runtime-matrix-table .form-control,
.runtime-matrix-table .form-select {
  min-width: 140px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.runtime-matrix-table input[type="number"] {
  text-align: right;
}

.runtime-matrix-table tfoot th,
.runtime-matrix-table tfoot td {
  background: #f4f8fc;
  font-weight: 700;
}

@media (max-width: 767.98px) {
  .runtime-matrix-table thead th,
  .runtime-matrix-table tbody th,
  .runtime-matrix-table tbody td,
  .runtime-matrix-table tfoot th,
  .runtime-matrix-table tfoot td {
    padding: 0.65rem 0.55rem;
  }

  .runtime-matrix-table .form-control,
  .runtime-matrix-table .form-select {
    min-width: 120px;
  }
}

.form-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.form-split-col { padding: 1.25rem; }

.form-split-col + .form-split-col {
  border-left: 1px solid var(--line);
}

.sub-label {
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--line);
  display: block;
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.field-pair:last-child { margin-bottom: 0; }

.req { color: var(--danger); font-size: 0.75em; margin-left: 2px; }

.field-error {
  font-size: 0.77rem;
  color: var(--danger);
  margin-top: 0.22rem;
  display: block;
}

.submit-btn {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  border: none;
  padding: 0.65rem 2.25rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: var(--font-display);
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.submit-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, .32);
}

body.login-body {
  background:
    radial-gradient(ellipse at 5% 5%, rgba(14, 165, 233, .10) 0%, transparent 50%),
    radial-gradient(ellipse at 95% 95%, rgba(249, 115, 22, .08) 0%, transparent 50%),
    linear-gradient(155deg, #f0f7fc 0%, #e8f0f7 100%);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.login-topbar {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.login-brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.09em;
  color: var(--text);
  padding: 0.42rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-xs);
}

.login-brand-mark b { color: var(--brand); }

.login-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-light);
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(2, 132, 199, .2);
}

.login-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem 2rem;
}

.login-shell {
  width: 100%;
  max-width: 860px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.login-panel {
  background:
    radial-gradient(circle at 12% 12%, rgba(255,255,255,.16), transparent 42%),
    radial-gradient(circle at 88% 90%, rgba(249, 115, 22, .22), transparent 40%),
    linear-gradient(145deg, #0b3352 0%, #0c5779 50%, #0b7da3 100%);
  padding: 2.75rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
}

.login-panel-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 0.75rem;
  display: block;
}

.login-panel-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.8rem;
  letter-spacing: -0.01em;
}

.login-panel-text {
  font-size: 0.88rem;
  opacity: 0.82;
  line-height: 1.65;
  margin-bottom: 1.75rem;
  max-width: 280px;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.login-feature-item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .24);
  width: fit-content;
}

.login-card-wrap {
  background: var(--surface);
  padding: 2.5rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 3px solid var(--line);
  object-fit: cover;
  display: block;
  margin: 0 auto 1.2rem;
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 1.6rem;
}

.login-card-wrap .form-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.73rem;
  margin-top: 0.5rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.reset-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 58px);
  padding: 2rem 1rem;
}

.reset-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.25rem 2rem;
  animation: riseIn 0.35s ease both;
}

.reset-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin: 0 auto 1.25rem;
}

.reset-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.reset-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.6rem;
}

.app-footer {
  padding: 0.8rem 1.75rem;
  border-top: none;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.footer-brand {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-2);
  font-size: 0.85rem;
}

.footer-brand b { color: var(--brand); }

.footer-legal {
  font-size: 0.78rem;
  color: var(--muted);
}

.footer-credit {
  font-size: 0.73rem;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.login-footer {
  padding: 1rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--line);
}

.login-footer-text {
  font-size: 0.78rem;
  color: var(--subtle);
}

@media (max-width: 1023.98px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 200;
  }

  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

  .sidebar-overlay.visible { display: block; }

  .topbar-toggle { display: flex; }

  .app-main { width: 100%; }

  .stats-row { grid-template-columns: 1fr; gap: 0.75rem; }

  .form-split { grid-template-columns: 1fr; }

  .form-split-col + .form-split-col {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .field-pair { grid-template-columns: 1fr; }

  .login-shell { grid-template-columns: 1fr; max-width: 440px; }

  .login-panel { display: none; }

  .login-card-wrap { padding: 2rem 1.75rem; }

  .app-content { padding: 1.25rem 1rem; }
}

@media (max-width: 575.98px) {
  .app-content { padding: 1rem; }

  .login-topbar { padding: 0.75rem 1rem; }

  .login-card-wrap { padding: 1.5rem 1.25rem; }

  .app-footer {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.75rem 1rem;
  }
}

.sidebar.collapsed {
  width: 62px;
}
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-link-text,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-user-info {
  display: none;
}
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.sidebar-brand-short { display: none; }

.sidebar.collapsed .sidebar-brand {
  font-size: 0.95rem;
}
.sidebar.collapsed .sidebar-brand b {
  display: none;
}
.sidebar.collapsed .sidebar-brand-short {
  display: inline;
}
.sidebar.collapsed .sidebar-link,
.sidebar.collapsed .sidebar-link:link,
.sidebar.collapsed .sidebar-link:visited {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.sidebar.collapsed .sidebar-link i {
  width: auto;
  font-size: 1rem;
}
.sidebar.collapsed .sidebar-logout,
.sidebar.collapsed .sidebar-logout:link,
.sidebar.collapsed .sidebar-logout:visited {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.sidebar.collapsed .sidebar-user {
  justify-content: center;
}
.sidebar.collapsed #sidebarCollapseIcon {
  transform: rotate(180deg);
}
.sidebar.collapsed .sidebar-collapse-btn {
  margin: 0 auto;
}

.view-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--subtle);
  margin-bottom: .25rem;
}
.view-value {
  font-size: .92rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.sidebar-search-wrap {
  padding: .55rem .65rem .3rem;
}
.sidebar-search-form {
  position: relative;
  display: flex;
  align-items: center;
}
.sidebar-search-icon {
  position: absolute;
  left: .65rem;
  color: rgba(156,163,175,.6);
  font-size: .75rem;
  pointer-events: none;
}
.sidebar-search-input {
  width: 100%;
  padding: .42rem .75rem .42rem 2rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.09);
  background: rgba(255,255,255,.06);
  color: #e5e7eb;
  font-size: .8rem;
  outline: none;
  transition: border-color .15s, background .15s;
}
.sidebar-search-input::placeholder { color: rgba(156,163,175,.55); }
.sidebar-search-input:focus {
  border-color: var(--sidebar-active);
  background: rgba(255,255,255,.1);
}
.sidebar.collapsed .sidebar-search-wrap { display: none; }

.rf-form { margin-bottom: 1.25rem; }

.rf-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.rf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  gap: .75rem;
  flex-wrap: wrap;
}

.rf-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
}

.rf-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: .78rem;
}

.rf-header-right {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.rf-clear {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .76rem;
  color: var(--subtle);
  text-decoration: none;
  padding: .28rem .65rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: color .15s, border-color .15s;
}
.rf-clear:hover { color: var(--danger); border-color: var(--danger); }

.rf-apply {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .32rem .85rem;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  border: none;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.rf-apply:hover { background: var(--brand-dark); }

.rf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 0;
  padding: .85rem 1.1rem;
  row-gap: .75rem;
  column-gap: .75rem;
}

.rf-field { display: flex; flex-direction: column; gap: .28rem; }

.rf-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--subtle);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.rf-label .fa { font-size: .68rem; opacity: .8; }

.rf-wrap { position: relative; }

.rf-input,
.rf-select {
  width: 100%;
  padding: .4rem .75rem;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: .82rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.rf-input:focus,
.rf-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(2,132,199,.1);
}

.rf-chev {
  position: absolute;
  right: .65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--subtle);
  font-size: .65rem;
  pointer-events: none;
}

.rf-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .6rem 1.1rem .75rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.rf-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: var(--brand-light);
  border: 1px solid rgba(2,132,199,.2);
  font-size: .73rem;
  color: var(--brand);
}
.rf-tag-key { font-weight: 700; opacity: .75; }

.pg-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem .75rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: .6rem;
  background: var(--surface);
  border-radius: 0 0 14px 14px;
}
.pg-info {
  font-size: .78rem;
  font-weight: 500;
  color: var(--subtle);
  letter-spacing: .01em;
}
.pg-info strong {
  color: var(--text);
  font-weight: 700;
}
.pg-nav {
  display: flex;
  align-items: center;
  gap: .2rem;
}
.pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 .6rem;
  border-radius: 10px;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .12s;
  user-select: none;
}
.pg-btn:hover:not(.pg-disabled):not(.pg-active) {
  background: var(--brand-light);
  color: var(--brand);
  border-color: rgba(2,132,199,.3);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(2,132,199,.12);
}
.pg-btn.pg-active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 3px 10px rgba(2,132,199,.35);
  pointer-events: none;
  transform: translateY(-1px);
}
.pg-btn.pg-disabled {
  opacity: .3;
  pointer-events: none;
  cursor: default;
}
.pg-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 34px;
  font-size: .85rem;
  color: var(--subtle);
  letter-spacing: .05em;
}
