/* ==========================================================================
   Digital Security — Exact Design Matching Multi-purpose Admin Page Template
   Palette, typography, components, dark mode, widgets, and layout.
   ========================================================================== */

:root {
  --bg: #F2F6F5;
  --surface: #FFFFFF;
  --surface-2: #F3F7F6;
  --border: #E0E8E6;
  --text: #10211F;
  --muted: #5A6B68;
  --primary: #009982;
  --primary-hover: #00836F;
  --on-primary: #FFFFFF;
  --primary-soft: #E3F5F1;
  --primary-ink: #007A68;
  --ring: rgba(0, 153, 130, .16);
  --accent: #F26A0B;
  --ok-bg: #E5F4EB;
  --ok-fg: #1B7442;
  --warn-bg: #FDF0E1;
  --warn-fg: #9C5406;
  --bad-bg: #FCE8E8;
  --bad-fg: #B42323;
  --info-bg: #E8EFFA;
  --info-fg: #1F4E9A;
  --neutral-bg: #EEF0F4;
  --neutral-fg: #4A5466;
  --shadow: 0 1px 2px rgba(16, 33, 31, .05), 0 2px 6px rgba(16, 33, 31, .04);
  --shadow-lg: 0 16px 40px rgba(0, 30, 26, .16);
  --overlay: rgba(0, 30, 26, .45);

  /* Legacy & bootstrap compat aliases */
  --page-bg: var(--bg);
  --card-bg: var(--surface);
  --input-border: var(--border);
  --text-heading: var(--text);
  --input-placeholder: var(--muted);
  --input-label: var(--text);
  --checkbox-label: var(--text);
  --font-base: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --success: var(--ok-fg);
  --success-light: var(--ok-bg);
  --success-light-text: var(--ok-fg);
  --warning: var(--warn-fg);
  --warning-light: var(--warn-bg);
  --warning-light-text: var(--warn-fg);
  --danger: var(--bad-fg);
  --danger-light: var(--bad-bg);
  --danger-light-text: var(--bad-fg);
  --info: var(--info-fg);
  --info-light: var(--info-bg);
  --info-light-text: var(--info-fg);
  --secondary: var(--neutral-fg);
  --secondary-light: var(--neutral-bg);
  --secondary-light-text: var(--neutral-fg);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #08130F;
  --surface: #0F1D1A;
  --surface-2: #152825;
  --border: #24403A;
  --text: #E4EEEB;
  --muted: #94A8A3;
  --primary: #1FB59C;
  --primary-hover: #35C7AF;
  --on-primary: #04211C;
  --primary-soft: #113029;
  --primary-ink: #8FE0D0;
  --ring: rgba(31, 181, 156, .3);
  --ok-bg: #12301F;
  --ok-fg: #6FD39A;
  --warn-bg: #35240E;
  --warn-fg: #F2B266;
  --bad-bg: #3A1717;
  --bad-fg: #F28B8B;
  --info-bg: #162847;
  --info-fg: #93B8F0;
  --neutral-bg: #1C2638;
  --neutral-fg: #A7B1C2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .4);
  --overlay: rgba(0, 0, 0, .6);

  --page-bg: var(--bg);
  --card-bg: var(--surface);
  --input-border: var(--border);
  --text-heading: var(--text);

  color-scheme: dark;
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-base);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary-ink);
  text-decoration: none;
  transition: color .15s ease;
}

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

img {
  max-width: 100%;
}

/* Bootstrap / Utility Theme Adaptations */
.text-dark {
  color: var(--text) !important;
}
.text-muted {
  color: var(--muted) !important;
}
.bg-white {
  background-color: var(--surface) !important;
}
.bg-light, .bg-secondary {
  background-color: var(--surface-2) !important;
}
.border-gray-200, .border-gray-300 {
  border-color: var(--border) !important;
}
:root[data-theme="dark"] .text-dark {
  color: var(--text) !important;
}
:root[data-theme="dark"] .bg-white {
  background-color: var(--surface) !important;
}
:root[data-theme="dark"] .bg-light, :root[data-theme="dark"] .bg-secondary {
  background-color: var(--surface-2) !important;
}

.material-symbols-rounded {
  font-family: 'Material Symbols Rounded', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-family: var(--font-base);
  margin: 0 0 .5rem;
  letter-spacing: -.02em;
}

h1 { font-size: clamp(24px, 2.4vw, 30px); font-weight: 800; line-height: 1.2; }
h2 { font-size: clamp(20px, 2vw, 24px); font-weight: 800; line-height: 1.25; }
h3 { font-size: 20px; font-weight: 700; line-height: 1.3; }
h4 { font-size: 17px; font-weight: 700; line-height: 1.35; }
h5 { font-size: 15px; font-weight: 700; line-height: 1.4; }
h6 { font-size: 13px; font-weight: 700; line-height: 1.4; }

.text-muted { color: var(--muted) !important; }
.text-heading { color: var(--text) !important; }
.text-primary-ink { color: var(--primary-ink) !important; }
.text-accent { color: var(--accent) !important; }
.type-body { font-size: 14px; }
.type-small { font-size: 12px; color: var(--muted); }

/* Metronic compatibility typography classes */
.fs-1 { font-size: 1.5rem !important; }
.fs-2 { font-size: 1.35rem !important; }
.fs-3 { font-size: 1.2rem !important; }
.fs-4 { font-size: 1.15rem !important; }
.fs-5 { font-size: 1.05rem !important; }
.fs-6 { font-size: 0.95rem !important; }
.fs-7 { font-size: 0.85rem !important; }
.fs-8 { font-size: 0.78rem !important; }
.fs-9 { font-size: 0.72rem !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }
.fw-bolder { font-weight: 800 !important; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
  box-shadow: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.btn.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.btn.btn-primary:hover, .btn.btn-primary:active, .btn.btn-primary.active {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--on-primary);
}

.btn.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn.btn-secondary:hover, .btn.btn-secondary:active, .btn.btn-secondary.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn.btn-soft, .btn.btn-primary-soft, .btn.btn-primary-light, .btn.btn-light-primary {
  background: var(--primary-soft) !important;
  color: var(--primary-ink) !important;
  border-color: transparent !important;
}
.btn.btn-soft:hover, .btn.btn-primary-soft:hover, .btn.btn-primary-light:hover, .btn.btn-light-primary:hover {
  background: var(--primary-soft) !important;
  opacity: .88;
}

.btn.btn-accent {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}
.btn.btn-accent:hover {
  filter: brightness(0.95);
  color: #FFFFFF;
}

.btn.btn-danger {
  background: var(--bad-fg);
  color: #FFFFFF;
  border-color: var(--bad-fg);
}
.btn.btn-danger:hover {
  filter: brightness(0.92);
  color: #FFFFFF;
}

.btn.btn-light-danger {
  background: var(--bad-bg) !important;
  color: var(--bad-fg) !important;
  border-color: transparent !important;
}

.btn.btn-light-info {
  background: var(--info-bg) !important;
  color: var(--info-fg) !important;
  border-color: transparent !important;
}

.btn.btn-light-success {
  background: var(--ok-bg) !important;
  color: var(--ok-fg) !important;
  border-color: transparent !important;
}

.btn:disabled, .btn.disabled {
  background: var(--surface-2) !important;
  color: var(--muted) !important;
  border-color: var(--border) !important;
  cursor: not-allowed;
  opacity: .65;
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 6px;
}

.btn-lg {
  height: 46px;
  padding: 0 22px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
}
.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
}

/* ==========================================================================
   Form Controls (Text, Email, Password, Number, Textarea, Select)
   ========================================================================== */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  width: 100%;
}

.field-label, .form-label, label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-label.required::after, label.required::after {
  content: "*";
  color: var(--bad-fg);
  font-size: 14px;
}

.form-control, .input-field {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.form-control::placeholder, .input-field::placeholder {
  color: var(--muted);
  opacity: .8;
}

.form-control:focus, .input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
  background: var(--surface);
  color: var(--text);
}

.form-control:disabled, .form-control[readonly], .input-field:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
  border-color: var(--border);
}

.form-control.is-invalid, .is-invalid .form-control {
  border-color: var(--bad-fg);
}
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(180, 35, 35, .18);
}

textarea.form-control, textarea.input-field {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

.form-select, select.form-control {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235A6577'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") right 8px center/20px no-repeat;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.form-select:focus, select.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}

.form-select:disabled {
  background-color: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
}

/* Input icon wrapper */
.input-icon-wrap {
  position: relative;
  width: 100%;
}

.input-icon-wrap > .material-symbols-rounded:first-child,
.input-icon-wrap > i:first-child {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
}

.input-icon-wrap .form-control {
  padding-left: 42px;
}

.input-icon-btn, .input-icon-wrap .input-icon-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.input-icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.input-icon-wrap:has(.input-icon-btn) .form-control {
  padding-right: 44px;
}

/* ==========================================================================
   Checkboxes & Radio Buttons
   ========================================================================== */
.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  margin-bottom: 8px;
  padding-left: 0;
  cursor: pointer;
}

.form-check-input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: none;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-grid;
  place-content: center;
  transition: all .15s ease;
}

.form-check-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.form-check-input[type="checkbox"] {
  border-radius: 5px;
}

.form-check-input[type="checkbox"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.5L6.5 11.5L12.5 4.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

.form-check-input[type="radio"] {
  border-radius: 50%;
}

.form-check-input[type="radio"]:checked {
  border-color: var(--primary);
  background: var(--surface) radial-gradient(circle, var(--primary) 0 4.5px, transparent 5px) center/16px no-repeat;
}

.form-check-label {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}

/* Card radio selector */
.card-radio-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.card-radio-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* Switch toggle */
.form-check.form-switch .form-check-input {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  background-color: var(--border);
  background-image: none;
  position: relative;
  transition: background-color .2s ease;
}
.form-check.form-switch .form-check-input::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .2s ease;
}
.form-check.form-switch .form-check-input:checked {
  background-color: var(--primary);
}
.form-check.form-switch .form-check-input:checked::before {
  transform: translateX(20px);
}

/* ==========================================================================
   Cards & Layout Components
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--text);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.card-body {
  padding: 20px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}

.page-header p {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* ==========================================================================
   Table Component
   ========================================================================== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 0;
}

.table thead tr, .table thead tr.bg-secondary, .table thead tr.text-dark {
  background: var(--surface-2) !important;
  color: var(--muted) !important;
}

.table thead th, .table thead th.text-dark, .table thead th.fw-bold {
  padding: 10px 20px;
  height: 44px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2) !important;
  color: var(--muted) !important;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  vertical-align: middle;
}

.table tbody tr {
  border-top: 1px solid var(--border);
  transition: background .15s ease;
}

.table tbody tr:hover, .table-hover tbody tr:hover {
  background: var(--surface-2);
}

.table tbody td {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  border-bottom: none;
  background: transparent;
  color: var(--text);
  vertical-align: middle;
}

/* Table Toolbar (search & filter bar) */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.table-toolbar-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 240px;
}

.table-toolbar-filters .form-control,
.table-toolbar-filters .form-select {
  height: 40px;
}

.table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Keep search fields and the search button on a single row on desktop. */
@media (min-width: 992px) {
  .table-toolbar {
    flex-wrap: nowrap;
  }

  .table-toolbar-filters {
    flex-wrap: nowrap;
    flex: 1 1 0;
    min-width: 0;
  }

  .table-toolbar-filters > * {
    flex: 1 1 0;
    min-width: 0;
    max-width: 280px;
  }

  .table-toolbar-filters .select2-container {
    width: 100% !important;
  }

  .table-toolbar-actions {
    flex: 0 0 auto;
  }
}

/* Row action buttons */
.row-actions {
  display: inline-flex;
  gap: 4px;
  white-space: nowrap;
}

.row-action-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
  padding: 0;
}

.row-action-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.row-action-btn.row-action-view:hover {
  background: var(--info-bg);
  color: var(--info-fg);
}

.row-action-btn.row-action-edit:hover {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.row-action-btn.row-action-delete:hover {
  background: var(--bad-bg);
  color: var(--bad-fg);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.badge-primary, .badge-primary { background: var(--primary-soft); color: var(--primary-ink); }
.badge.badge-success, .badge-success, .badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge.badge-warning, .badge-warning, .badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.badge-danger, .badge-danger, .badge-bad { background: var(--bad-bg); color: var(--bad-fg); }
.badge.badge-info, .badge-info { background: var(--info-bg); color: var(--info-fg); }
.badge.badge-secondary, .badge-secondary, .badge-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }

/* ==========================================================================
   Pagination
   ========================================================================== */
.app-pagination-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.app-pagination-info {
  font-size: 13px;
  color: var(--muted);
}

.app-pagination-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.app-page-btn {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all .15s ease;
  user-select: none;
}

.app-page-btn:hover:not(.disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.app-page-nav-btn {
  padding: 0 10px;
}

.app-page-num-btn {
  min-width: 34px;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

.app-page-num-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.app-page-btn.disabled, .app-page-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

.app-page-gap {
  min-width: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  background: var(--overlay);
  backdrop-filter: blur(2px);
}

.modal-dialog {
  margin: 1.75rem auto;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(8, 20, 40, .3);
  overflow: hidden;
  font-family: inherit;
  color: var(--text);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.modal-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.modal-header-text {
  flex: 1;
  min-width: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.25;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.modal-header .btn-close, .modal-header [data-bs-dismiss="modal"] {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  opacity: 1;
  box-shadow: none;
  transition: background .15s ease, color .15s ease;
}

.modal-header .btn-close:hover, .modal-header [data-bs-dismiss="modal"]:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal-body {
  padding: 20px;
  background: var(--surface);
  color: var(--text);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 16px 16px;
}

/* ==========================================================================
   Toaster Notifications
   ========================================================================== */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(8, 20, 40, .18);
  animation: toastIn .22s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity .2s ease, transform .2s ease;
}

.toast-item.toast-fade-out {
  opacity: 0;
  transform: translateY(10px);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.toast-item.toast-success .toast-icon { color: var(--ok-fg); }
.toast-item.toast-error .toast-icon, .toast-item.toast-danger .toast-icon { color: var(--bad-fg); }
.toast-item.toast-warning .toast-icon { color: var(--warn-fg); }
.toast-item.toast-info .toast-icon { color: var(--info-fg); }

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.toast-msg {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

.toast-close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 6px;
}
.toast-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ==========================================================================
   DatePicker (Flatpickr Theme)
   ========================================================================== */
.flatpickr-calendar {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 32px rgba(8, 20, 40, .18) !important;
  font-family: var(--font-base) !important;
  width: 280px !important;
  padding: 10px !important;
  color: var(--text) !important;
}

.flatpickr-calendar::before, .flatpickr-calendar::after {
  display: none !important;
}

.flatpickr-months {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 8px !important;
}

.flatpickr-months .flatpickr-month {
  color: var(--text) !important;
  fill: var(--text) !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  height: 32px !important;
}

.flatpickr-current-month {
  font-size: 14px !important;
  font-weight: 700 !important;
  padding: 4px 0 !important;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  width: 32px !important;
  height: 32px !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--text) !important;
  fill: var(--text) !important;
  padding: 0 !important;
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}

.flatpickr-weekdays {
  margin-bottom: 4px !important;
}

span.flatpickr-weekday {
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: .04em !important;
}

.dayContainer {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  gap: 2px !important;
}

.flatpickr-day {
  height: 34px !important;
  line-height: 34px !important;
  max-width: 100% !important;
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-variant-numeric: tabular-nums !important;
}

.flatpickr-day:hover {
  background: var(--surface-2) !important;
  border-color: transparent !important;
}

.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
  background: var(--primary) !important;
  color: var(--on-primary) !important;
  border-color: var(--primary) !important;
  font-weight: 600 !important;
}

.flatpickr-day.today {
  border-color: var(--primary) !important;
}

.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay {
  color: var(--muted) !important;
  opacity: .4 !important;
}

/* ==========================================================================
   Select2 (Searchable Select Theme)
   ========================================================================== */
.select2-container--default .select2-selection--single {
  height: 40px !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  background: var(--surface) !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 12px !important;
  box-shadow: none !important;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--ring) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text) !important;
  font-size: 14px !important;
  font-family: inherit !important;
  padding-left: 0 !important;
  line-height: 38px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 38px !important;
  right: 8px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--muted) transparent transparent transparent !important;
}

.select2-dropdown {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: 0 16px 40px rgba(8, 20, 40, .22) !important;
  font-family: var(--font-base) !important;
  color: var(--text) !important;
  overflow: hidden !important;
  z-index: 1060 !important;
}

.select2-search--dropdown {
  padding: 8px !important;
  border-bottom: 1px solid var(--border) !important;
}

.select2-search--dropdown .select2-search__field {
  height: 34px !important;
  padding: 0 10px !important;
  border: 1px solid var(--border) !important;
  border-radius: 7px !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  font-size: 14px !important;
  outline: none !important;
}
.select2-search--dropdown .select2-search__field:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--ring) !important;
}

.select2-results__option {
  padding: 8px 10px !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  margin: 2px 4px !important;
  color: var(--text) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--primary) !important;
  color: var(--on-primary) !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background: var(--primary-soft) !important;
  color: var(--primary-ink) !important;
  font-weight: 600 !important;
}

/* ==========================================================================
   Dropify (File Upload Theme)
   ========================================================================== */
.dropify-wrapper {
  border: 2px dashed var(--border) !important;
  border-radius: 14px !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  font-family: inherit !important;
  transition: border-color .15s ease, background .15s ease;
}

.dropify-wrapper:hover {
  border-color: var(--primary) !important;
  background: var(--primary-soft) !important;
}

.dropify-wrapper .dropify-message p {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  margin: 8px 0 0 !important;
}

.dropify-wrapper .dropify-preview {
  background: var(--surface) !important;
}

.dropify-wrapper .dropify-clear {
  border: none !important;
  border-radius: 8px !important;
  background: var(--bad-fg) !important;
  color: #FFFFFF !important;
  font-weight: 600 !important;
  padding: 6px 12px !important;
}

/* ==========================================================================
   SweetAlert2 Theme
   ========================================================================== */
.swal2-popup {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 64px rgba(8, 20, 40, .3) !important;
  font-family: var(--font-base) !important;
  color: var(--text) !important;
  padding: 24px !important;
}

.swal2-title {
  color: var(--text) !important;
  font-size: 18px !important;
  font-weight: 700 !important;
}

.swal2-html-container {
  color: var(--muted) !important;
  font-size: 14px !important;
}

.swal2-actions {
  gap: 10px !important;
  margin-top: 20px !important;
}

.swal2-actions .swal2-confirm {
  background-color: var(--primary) !important;
  color: var(--on-primary) !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  height: 40px !important;
  padding: 0 18px !important;
  box-shadow: none !important;
}
.swal2-actions .swal2-confirm:hover {
  background-color: var(--primary-hover) !important;
}

.swal2-actions .swal2-deny, .swal2-actions .swal2-cancel {
  background-color: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  height: 40px !important;
  padding: 0 16px !important;
  box-shadow: none !important;
}
.swal2-actions .swal2-deny:hover, .swal2-actions .swal2-cancel:hover {
  background-color: var(--surface-2) !important;
}

/* ==========================================================================
   App Shell (Sidebar, Topbar, Main)
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

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

/* Sidebar */
.app-sidebar {
  width: 264px;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 40;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform .22s ease;
}

.app-sidebar-header {
  height: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.app-sidebar-logo-crop {
  width: 20px;
  height: 40px;
  overflow: hidden;
  flex-shrink: 0;
  clip-path: polygon(0 0, 100% 0, 100% 87%, 35% 87%, 35% 100%, 0 100%);
}

.app-sidebar-logo-img {
  display: block;
  width: 58px;
  margin-left: -11.6px;
  margin-top: -2.8px;
}

.app-sidebar-custom-logo {
  max-height: 38px;
  max-width: 38px;
  object-fit: contain;
  border-radius: 8px;
}

.app-sidebar-brand-text {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}

.app-sidebar-brand-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--primary-ink);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar-brand-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.app-sidebar-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-sidebar-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.app-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-group-label {
  padding: 4px 12px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-link {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  width: 100%;
  transition: background .15s ease, color .15s ease;
}

.sidebar-link i, .sidebar-link .material-symbols-rounded {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.sidebar-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.sidebar-link.active i, .sidebar-link.active .material-symbols-rounded {
  color: var(--on-primary);
}

.sidebar-link-text {
  flex: 1;
  min-width: 0;
}

.sidebar-link-arrow {
  font-size: 20px !important;
  margin-left: auto;
  transition: transform .2s ease;
}
.sidebar-link-toggle.collapsed .sidebar-link-arrow {
  transform: rotate(-90deg);
}

.sidebar-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 21px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  margin-top: 2px;
  margin-bottom: 2px;
}

.sidebar-subnav .sidebar-link {
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  gap: 10px;
  font-size: 14px;
}

.sidebar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background .15s ease;
}

.sidebar-subnav .sidebar-link.active {
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-weight: 600;
}
.sidebar-subnav .sidebar-link.active .sidebar-dot {
  background: var(--accent);
}

.app-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

/* Mobile Sidebar Drawer */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transform: translateX(-100%);
    box-shadow: 0 16px 40px rgba(8, 20, 40, .28);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
}

.app-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 1035;
}
.app-sidebar-backdrop.show {
  display: block;
}

/* Topbar */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 clamp(16px, 3vw, 32px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.app-sidebar-toggle:hover {
  background: var(--surface-2);
}
@media (max-width: 991.98px) {
  .app-sidebar-toggle {
    display: flex;
  }
}

.app-topbar-date {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menubar-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s ease, color .15s ease;
}
.menubar-icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.theme-dark-show { display: none !important; }
:root[data-theme="dark"] .theme-dark-show { display: inline-block !important; }
:root[data-theme="dark"] .theme-light-show { display: none !important; }

/* Topbar User Profile */
.topbar-user-btn {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 4px;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  transition: background .15s ease;
}
.topbar-user-btn:hover {
  background: var(--surface-2);
}

.menubar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.topbar-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}
@media (max-width: 575.98px) {
  .topbar-user-info {
    display: none;
  }
}

.topbar-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.topbar-user-role {
  font-size: 12px;
  color: var(--muted);
  text-transform: capitalize;
}

.topbar-user-chevron {
  font-size: 20px;
  color: var(--muted);
}

/* User Dropdown */
.topbar-user-dropdown {
  width: 248px;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 40px rgba(0, 30, 26, .16) !important;
  padding: 6px !important;
  margin-top: 8px !important;
}

.topbar-dropdown-user-header {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.topbar-dropdown-user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.topbar-dropdown-user-email {
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}

.topbar-dropdown-item {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease;
}
.topbar-dropdown-item:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.topbar-dropdown-logout {
  color: var(--bad-fg) !important;
}
.topbar-dropdown-logout:hover {
  background: var(--bad-bg) !important;
}

/* Switch inside user dropdown */
.theme-switch-track {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border);
  position: relative;
  transition: background .2s ease;
  flex-shrink: 0;
}
.theme-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .2s ease;
}
:root[data-theme="dark"] .theme-switch-track {
  background: var(--primary);
}
:root[data-theme="dark"] .theme-switch-knob {
  transform: translateX(16px);
}

/* Notifications Dropdown */
.notification-badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  border: 2px solid var(--surface);
  box-sizing: content-box;
}

.notification-dropdown {
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 40px rgba(0, 30, 26, .16) !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.notification-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.notification-dropdown-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.notification-mark-read {
  border: none;
  background: transparent;
  color: var(--primary-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.notification-mark-read:hover {
  text-decoration: underline;
}

.notification-dropdown-body {
  max-height: 360px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background .15s ease;
}
.notification-item:hover {
  background: var(--surface-2);
}

.notification-item-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.notification-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notification-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.notification-item-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.notification-item-time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.notification-item-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.notification-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.notification-empty .material-symbols-rounded {
  font-size: 32px;
}

.notification-dropdown-footer {
  padding: 10px 16px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.notification-view-all {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-ink);
}

/* Breadcrumb Component */
.app-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 6px;
}

.app-breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-breadcrumb-sep {
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
}

.app-breadcrumb-link {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.app-breadcrumb-link:hover {
  color: var(--primary-ink);
  text-decoration: underline;
}

.app-breadcrumb-home {
  font-size: 16px;
  line-height: 1;
}

.app-breadcrumb-current {
  color: var(--text);
  font-weight: 600;
}

/* Page content wrapper */
.page {
  flex: 1;
  padding: clamp(16px, 3vw, 32px);
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   Auth Screen (Login / Register / Reset Password)
   ========================================================================== */
.auth-shell {
  min-height: 100vh;
  display: flex;
  background: var(--surface);
}

.auth-brand {
  flex: 1.1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 48px 56px;
  background: #FFFFFF url('/images/auth_bg_pattern.png') center/cover no-repeat;
  border-right: 1px solid var(--border);
}
:root[data-theme="dark"] .auth-brand {
  background: var(--surface);
  border-right-color: var(--border);
}

.auth-brand-logo-wrap {
  width: 142px;
  height: 212px;
  overflow: hidden;
  flex-shrink: 0;
}

.auth-brand-logo-img {
  display: block;
  width: 236px;
  margin-top: -9px;
}

.auth-brand-copy {
  max-width: 460px;
}

.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #E3F5F1;
  color: #009982;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
:root[data-theme="dark"] .auth-brand-badge {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.auth-brand-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #F26A0B;
}

.auth-brand-title {
  margin: 18px 0 12px;
  font-size: 40px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #009982;
  text-wrap: balance;
}
:root[data-theme="dark"] .auth-brand-title {
  color: var(--text);
}

.auth-brand-desc {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: #4A5466;
  text-wrap: pretty;
}
:root[data-theme="dark"] .auth-brand-desc {
  color: var(--muted);
}

.auth-brand-footer {
  font-size: 13px;
  color: var(--muted);
}

.auth-form-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--surface);
}

.auth-form-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
}

.auth-mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-mobile-logo-wrap {
  width: 20px;
  height: 40px;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% 87%, 35% 87%, 35% 100%, 0 100%);
}

.auth-mobile-logo-img {
  display: block;
  width: 58px;
  margin-left: -11.6px;
  margin-top: -2.8px;
}

.auth-mobile-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--primary-ink);
  letter-spacing: -.01em;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s ease, background .15s ease;
}
.theme-toggle-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.auth-form-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
}

.auth-form-content {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 20px;
}

.auth-title {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  text-align: left;
}

.auth-subtitle {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  text-align: left;
}

.auth-field-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 6px;
  width: 100%;
}

.auth-field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.auth-field-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}

.auth-input-wrap {
  position: relative;
  width: 100%;
}

.auth-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  pointer-events: none;
}

.auth-input {
  width: 100%;
  height: 44px;
  padding: 0 12px 0 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.auth-input.auth-input-pw {
  padding-right: 44px;
}

.auth-pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.auth-pw-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

.auth-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.auth-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.auth-submit-btn {
  height: 46px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s ease;
}
.auth-submit-btn:hover {
  background: var(--primary-hover);
}

.auth-field-error {
  font-size: 12px;
  color: var(--bad-fg);
}

/* ==========================================================================
   Dashboard Stat Cards
   ========================================================================== */
.stat-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-card-note {
  font-size: 13px;
  color: var(--muted);
}
