:root {
  --bg: #f4efe7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #fffdf9;
  --border: rgba(82, 55, 35, 0.12);
  --text: #24170f;
  --muted: #736155;
  --accent: #bf5a36;
  --accent-deep: #8f3f22;
  --accent-soft: #f6d8c8;
  --navy: #17324d;
  --shadow: 0 24px 60px rgba(39, 20, 8, 0.12);
  --radius: 24px;
  --radius-sm: 18px;
  --font: "Poppins", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 214, 189, 0.9), transparent 28%),
    radial-gradient(circle at bottom right, rgba(23, 50, 77, 0.2), transparent 32%),
    linear-gradient(135deg, #f7f1ea 0%, #f0e6da 100%);
}

a { color: inherit; text-decoration: none; }

.muted { color: var(--muted); }

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #7b1e00;
  background: #ffe5dc;
}

.flash.success {
  color: #146c43;
  background: #eaf7f0;
}

.flash.error {
  color: #8f1f1f;
  background: #ffe6e6;
}

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 14px 16px;
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-weight: 600;
  line-height: 1.45;
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast-hide {
  opacity: 0;
  transform: translateY(10px);
}

.toast-pending {
  border-color: rgba(23, 50, 77, 0.18);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 246, 255, 0.98));
  color: var(--navy);
}

.toast-success {
  border-color: rgba(20, 108, 67, 0.18);
  background: linear-gradient(135deg, rgba(234, 247, 240, 0.98), rgba(255, 255, 255, 0.98));
  color: #146c43;
}

.toast-error {
  border-color: rgba(143, 31, 31, 0.18);
  background: linear-gradient(135deg, rgba(255, 230, 230, 0.98), rgba(255, 255, 255, 0.98));
  color: #8f1f1f;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(1140px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: rgba(255, 253, 249, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.auth-copy,
.login-panel,
.sidebar,
.hero-card,
.stat-card,
.glass-panel,
.topbar,
.profile-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
}

.auth-copy {
  padding: 42px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(23, 50, 77, 0.98), rgba(31, 80, 106, 0.9));
  color: #fffdf9;
}

.auth-copy h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4.2rem);
  line-height: 1.05;
}

.auth-copy .muted {
  color: rgba(255, 253, 249, 0.82);
  margin-top: 18px;
  max-width: 520px;
}

.feature-grid {
  margin-top: 36px;
  display: grid;
  gap: 16px;
}

.feature-grid article {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
}

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

.feature-grid span {
  margin-top: 8px;
  color: rgba(255, 253, 249, 0.82);
}

.login-panel {
  padding: 34px;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-heading h2,
.panel-heading h4 {
  margin: 0;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field span,
label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

.field input,
.input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(36, 23, 15, 0.1);
  border-radius: 16px;
  font: inherit;
  background: rgba(255, 255, 255, 0.92);
}

.field input:focus,
.input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid rgba(191, 90, 54, 0.22);
  border-color: var(--accent);
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.remember-me input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.login-logo {
  display: block;
  width: min(360px, 35%);
  height: auto;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.12));
}			 
.btn,
.primary-btn,
.logout-link,
.theme-toggle,
.sidebar-collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn,
.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 16px 30px rgba(191, 90, 54, 0.24);
}

.btn.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid rgba(36, 23, 15, 0.1);
  box-shadow: none;
}

.btn:hover,
.primary-btn:hover,
.logout-link:hover,
.theme-toggle:hover {
  transform: translateY(-1px);
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
  gap: 18px;
  //padding: 18px;
  margin-right: 18px;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 92px minmax(0, 1fr);
}

.sidebar {
  padding: 22px;
  //border-radius: 30px;
  position: sticky;
  top: 18px;
  //height: calc(100vh - 36px);
  overflow-y: auto;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-block.compact {
  justify-content: center;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--navy), #2a6980);
}

.brand-block h1 {
  margin: 0;
  font-size: 1.35rem;
}

.brand-copy .muted {
  margin-top: 4px;
}

.sidebar-collapse-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  margin-left: auto;
  margin-bottom: 18px;
  border-radius: 14px;
  background: rgba(23, 50, 77, 0.08);
  color: var(--navy);
  display: grid;
  place-items: center;
  box-shadow: none;
}

.sidebar-toggle-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.sidebar-toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell.sidebar-collapsed .sidebar {
  padding-inline: 14px;
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .menu-label,
.app-shell.sidebar-collapsed .submenu-link span:not(.submenu-dot),
.app-shell.sidebar-collapsed .sidebar-footer .profile-pill,
.app-shell.sidebar-collapsed .logout-link {
  display: none;
}

.app-shell.sidebar-collapsed .brand-block {
  justify-content: center;
  margin-bottom: 20px;
}

.app-shell.sidebar-collapsed .sidebar-collapse-toggle {
  width: 44px;
  height: 44px;
}

.app-shell.sidebar-collapsed .menu-link {
  justify-content: center;
  padding-inline: 10px;
}

.app-shell.sidebar-collapsed .menu-icon {
  margin-right: 0;
}

.app-shell.sidebar-collapsed .menu-caret {
  display: none;
}

.app-shell.sidebar-collapsed .submenu-group {
  padding-left: 0;
}

.sidebar-footer {
  margin-top: auto;
}

.menu-search-wrap { margin-bottom: 18px; }
.menu-search-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}
.menu-search,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  outline: none;
}

.menu {
  display: grid;
  gap: 14px;
}

.menu-group {
  display: grid;
  gap: 8px;
}

.menu-hidden { display: none; }

.menu-link,
.submenu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 16px;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.menu-link {
  width: 100%;
  border: 0;
  font: inherit;
  text-align: left;
  background: transparent;
  justify-content: space-between;
}

.menu-label {
  flex: 1;
  min-width: 0;
}

.menu-link:hover,
.submenu-link:hover,
.menu-link.active,
.submenu-link.active {
  color: var(--text);
  background: rgba(191, 90, 54, 0.1);
  transform: translateX(1px);
}

.menu-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(23, 50, 77, 0.08);
}

.menu-caret {
  margin-left: auto;
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.2s ease;
  transform: rotate(0deg);
}

.menu-caret.open {
  transform: rotate(90deg);
}

.submenu-group {
  margin-top: 8px;
  padding-left: 14px;
  display: none;
  gap: 6px;
}

.menu-group.expanded .submenu-group { display: grid; }

.content-shell { min-width: 0; }

.topbar {
  padding: 16px 20px;
  //border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar h2 { margin: 0; }

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-pill {
  padding: 12px 16px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-pill span {
  color: var(--muted);
  font-size: 0.86rem;
}

.logout-link {
  background: var(--navy);
  color: #fff;
}

.dashboard {
  padding: 22px 4px 8px;
}

.card,
.login-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  padding: 24px;
  margin-bottom: 18px;
}

.hero-card {
  border-radius: 30px;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(255, 241, 232, 0.96));
}

.hero-card h3 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.15;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 14px;
}

.hero-metrics div {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--navy), #315b73);
  color: #fff;
}

.stats-grid,
.panel-grid {
  margin-top: 20px;
  display: grid;
  gap: 18px;
}

.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel-grid { grid-template-columns: 1.3fr 0.9fr; }

.stat-card,
.glass-panel {
  padding: 22px;
  border-radius: 24px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  gap: 16px;
}

.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

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

.table-scroll {
  overflow-x: auto;
  margin-top: 14px;
  scroll-margin-top: 18px;
}

.grid-report-wrap {
  overflow: auto;
  margin-top: 14px;
  max-width: 100%;
  max-height: 68vh;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
}

.grid-report {
  display: grid;
  align-items: stretch;
  min-width: max-content;
}

.grid-report-head,
.grid-report-cell {
  position: relative;
  padding: 12px 14px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  white-space: nowrap;
}

.grid-report-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
}

.grid-report-head.sorted {
  background: #fff4ec;
}

.pivot-corner,
.pivot-group-head,
.pivot-summary-head,
.pivot-subhead {
  justify-content: center;
  background: #76933c;
  color: #fff;
  border-color: #1f1f1f;
}

.pivot-corner,
.pivot-summary-head {
  font-size: 0.96rem;
}

.pivot-group-head {
  font-size: 1rem;
}

.pivot-subhead {
  background: #8ea95a;
  font-size: 0.92rem;
}

.pivot-subhead-corner,
.pivot-subhead-empty {
  cursor: default;
}

.pivot-subhead-empty .sort-indicator,
.pivot-subhead-corner .sort-indicator {
  display: none;
}

.grid-sticky-cell {
  font-weight: 700;
  background: #fffdf8;
}

.grid-report-row {
  display: contents;
}

.grid-report-cell {
  min-height: 48px;
}

.grid-group-label,
.grid-total-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  background: #f7f3ee;
}

.grid-group-label {
  position: sticky;
  left: 0;
  z-index: 1;
}

.grid-total-label {
  background: #f0e7db;
}

.grid-child-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 36px;
  color: var(--muted);
  background: #fffefc;
}

.grid-group-row .grid-report-cell.numeric,
.grid-total-row .grid-report-cell.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.collapse-pill {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(23, 50, 77, 0.1);
  color: var(--navy);
  font-weight: 800;
  flex: 0 0 auto;
}

.child-indent {
  width: 14px;
  flex: 0 0 auto;
}

.sort-indicator {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
}

.resize-handle:hover {
  background: rgba(191, 90, 54, 0.15);
}

.pagination-toolbar,
.pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-controls.compact {
  justify-content: flex-end;
}

.pagination-btn {
  padding: 10px 14px;
  border-radius: 999px;
  min-height: 40px;
}

.pagination-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.pagination-size {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  white-space: nowrap;
}

.pagination-size span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.pagination-size .input {
  width: auto;
  min-width: 92px;
}

th, td {
  padding: 14px 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.toggle-row { margin: 16px 0; }

.switch-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}

.switch-field label {
  font-weight: 600;
  color: var(--text);
}

.toggle-switch {
  appearance: none;
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  border-radius: 999px;
  min-height: 38px;
  padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: fit-content;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.toggle-switch:hover {
  border-color: rgba(220, 38, 38, 0.55);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.toggle-switch__track {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fecaca;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  transform: translateX(0);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.toggle-switch__text {
  padding-right: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

.toggle-switch.is-on {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.35);
  color: #1d4ed8;
  justify-content: flex-end;
}

.toggle-switch.is-on .toggle-switch__track {
  background: var(--navy);
  transform: translateX(0);
}

.toggle-switch:not(.is-on) .toggle-switch__track {
  background: #dc2626;
}

.toggle-switch:not(.is-on):hover {
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.14);
}

.toggle-switch:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

@media (max-width: 1024px) {
  .auth-card,
  .hero-card,
  .cols-3,
  .cols-5,
  .stats-grid,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .auth-copy,
  .login-card {
    padding: 28px;
    margin: 18px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: auto;
    height: auto;
    position: relative;
  }

  .pagination-toolbar,
  .pagination-footer {
    align-items: flex-start;
  }

  .pagination-controls.compact {
    justify-content: flex-start;
  }
}
