/* Base */
.note { font-size: 0.95rem; }
.sidebar-brand { display: flex; align-items: center; gap: 0.6rem; }
.sidebar-brand img { width: 42px; height: 42px; border-radius: 8px; }

/* ── Professional nav-tabs ────────────────────────────────────────────────── */
.nav-tabs {
  border-bottom: 2px solid var(--app-border, #e5e7eb);
  gap: 2px;
}
.nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: .55rem .9rem;
  font-size: .85rem;
  font-weight: 500;
  color: var(--app-muted, #6b7280);
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: color .15s, border-color .15s;
}
.nav-tabs .nav-link:hover { color: var(--app-text, #111827); border-bottom-color: var(--app-border, #e5e7eb); }
.nav-tabs .nav-link.active {
  color: var(--app-primary, #3b82f6);
  border-bottom-color: var(--app-primary, #3b82f6);
  background: none;
  font-weight: 600;
}
.nav-tabs .nav-link .tab-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .1em .45em;
  border-radius: 10px;
  background: rgba(107,114,128,.15);
  color: inherit;
  line-height: 1.4;
}
.nav-tabs .nav-link.active .tab-badge { background: rgba(59,130,246,.15); }

/* Tab content spacing */
.tab-content-body { padding-top: 1.25rem; }

/* ── ERP table improvements ───────────────────────────────────────────────── */
.erp-table { font-size: .875rem; }
.erp-table thead { background: var(--app-card, #fff); }
.erp-table thead th { font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--app-muted,#6b7280); border-bottom: 2px solid var(--app-border,#e5e7eb); white-space: nowrap; position: relative; }
.erp-table tbody tr:hover { background: rgba(59,130,246,.04); cursor: pointer; }
.erp-table tbody tr.selected-row { background: rgba(59,130,246,.10); }
.erp-table td { vertical-align: middle; }
/* Sticky headers inside scrollable containers */
.table-responsive .erp-table thead th { position: sticky; top: 0; z-index: 2; background: #f8f9fa; }
.table-responsive .erp-table thead { box-shadow: 0 1px 0 var(--app-border, #e5e7eb); }
.erp-table.erp-grid-enhanced col { transition: width .06s linear; }
.erp-grid-header-cell { position: relative; }
.erp-grid-sortable { cursor: pointer; user-select: none; padding-right: 1.45rem; }
.erp-grid-sortable::after {
  content: "\2195";
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .72rem;
  color: rgba(107,114,128,.7);
  opacity: .8;
}
.erp-grid-sortable[data-sort-dir="asc"]::after {
  content: "\25B2";
  color: var(--app-primary, #3b82f6);
}
.erp-grid-sortable[data-sort-dir="desc"]::after {
  content: "\25BC";
  color: var(--app-primary, #3b82f6);
}
.erp-grid-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  z-index: 4;
}
.erp-grid-resizer::before {
  content: "";
  position: absolute;
  top: 18%;
  bottom: 18%;
  right: 3px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background-color .12s ease-in-out;
}
.erp-grid-header-cell:hover .erp-grid-resizer::before,
.erp-grid-resizer:hover::before,
.erp-table.is-resizing .erp-grid-resizer::before {
  background: rgba(59,130,246,.45);
}
body.erp-grid-resizing {
  cursor: col-resize !important;
  user-select: none;
}

/* ── UiFormSection icon ───────────────────────────────────────────────────── */
.ui-form-section-title .section-icon { margin-right: .4rem; opacity: .7; }

/* ── Modal header improvements ───────────────────────────────────────────── */
.erp-modal-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--app-border, #e5e7eb);
  background: var(--app-card, #fff);
}
.erp-modal-header .modal-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}
.erp-modal-title { font-size: .95rem; font-weight: 600; margin: 0; }

/* Sidebar section label */
.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(219, 234, 254, 0.55);
  padding: 0.25rem 0.75rem;
  margin-top: 0.25rem;
}

/* Sidebar nav icon width fix */
.app-sidebar .nav-icon {
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
}

/* Topbar dropdown */
.app-topbar .dropdown-menu {
  min-width: 200px;
  border-radius: 10px;
  border: 1px solid var(--app-border);
  background: var(--app-card);
}
.app-topbar .dropdown-item {
  font-size: 0.875rem;
  color: var(--app-text);
}
.app-topbar .dropdown-item:hover {
  background: rgba(13, 110, 253, 0.06);
}

/* App shell + responsive drawer */
.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(1200px 480px at 20% -10%, rgba(59, 130, 246, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.03), rgba(15, 23, 42, 0.01));
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 292px;
  max-width: 86vw;
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--app-border);
  transform: translateX(-110%);
  transition: transform 0.2s ease-in-out;
  z-index: 1040;
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.45);
}

.app-shell.sidebar-open .app-sidebar,
.app-sidebar.open {
  transform: translateX(0);
}

.app-sidebar .nav,
.app-sidebar ul {
  list-style: none;
  padding-left: 0;
}

.app-sidebar .nav-link {
  white-space: normal;
}

.app-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  z-index: 1030;
}

/* Sidebar navigation styling */
.app-sidebar a,
.app-sidebar .nav-link {
  color: var(--sidebar-text);
}

.app-sidebar .text-muted {
  color: rgba(219, 234, 254, 0.72) !important;
}

.app-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  margin: 0.15rem 0.5rem;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  text-decoration: none;
}

.app-sidebar .nav-link.active,
.app-sidebar .nav-link[aria-current="page"] {
  background: rgba(59, 130, 246, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: #fff;
}


.app-shell.sidebar-open .app-sidebar-backdrop,
.app-sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.app-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  margin-left: 0;
  transition: margin-left 0.2s ease-in-out;
}

.app-topbar {
  flex-shrink: 0;
  z-index: 1020;
  background: var(--app-card, #fff);
  border-bottom: 1px solid var(--app-border, #e5e7eb);
  padding: 0.55rem 1rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.app-scroll-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.app-scroll-area > .p-3 {
  flex: 1;
}

.app-footer {
  flex-shrink: 0;
  padding: .5rem 1rem;
  background: var(--app-card, #fff);
  border-top: 1px solid var(--app-border, #e5e7eb);
  margin-top: 0 !important;
}

.app-menu-toggle {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-user-name {
  display: inline-block;
  max-width: min(38vw, 340px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-page-host {
  min-height: 100vh;
  padding: 0.75rem 0;
}

@media (min-width: 992px) {
  .app-shell.sidebar-open .app-main {
    margin-left: 292px;
  }

  .app-sidebar-backdrop {
    display: none;
  }
}

/* Form alignment helpers */
.erp-form-grid .form-label {
  display: block;
  min-height: 1.35rem;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.erp-kv-table {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
}

.erp-kv-table .k {
  font-weight: 600;
  color: var(--bs-secondary-color);
}

.erp-kv-table .v {
  word-break: break-word;
}

/* ERPModalFrm (draggable/resizable) */
.erp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 2vw;
  z-index: 1050;
}

.erp-modal {
  position: relative;
  width: min(980px, 96vw);
  height: min(78vh, 900px);
  background: var(--bs-body-bg);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.erp-modal-header {
  cursor: move;
  user-select: none;
  background: var(--bs-tertiary-bg);
  border-bottom: 1px solid var(--bs-border-color);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.erp-modal-body {
  height: calc(100% - 110px);
  overflow: auto;
  padding: 1rem;
}

.erp-modal-footer {
  height: 58px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  background: var(--bs-body-bg);
}

.erp-resize-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  right: 6px;
  bottom: 6px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.2) 50%);
  border-radius: 4px;
}

.erp-form-nav .form-label {
  font-weight: 600;
}

.erp-form-nav .form-control,
.erp-form-nav .form-select,
.erp-form-nav textarea.form-control {
  border-color: var(--bs-border-color);
  background: var(--bs-body-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.erp-form-nav .form-control:focus,
.erp-form-nav .form-select:focus,
.erp-form-nav textarea.form-control:focus {
  border-color: var(--bs-primary);
  background: color-mix(in srgb, var(--bs-primary) 4%, var(--bs-body-bg));
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--bs-primary) 18%, transparent);
}

/* Endless pager sentinel */
.erp-sentinel {
  height: 1px;
}

/* Audit table (endless-page friendly) */
.audit-table-wrap {
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.audit-table-wrap table {
  margin-bottom: 0;
}

.audit-table-wrap thead th {
  position: sticky;
  top: 0;
  background: var(--bs-body-bg);
  z-index: 2;
}

.audit-json {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.audit-json-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.dashboard-page { max-width: 1400px; }

.welcome-banner {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}

.welcome-icon-box {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg,#3b82f6,#6366f1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.welcome-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  min-width: min(100%, 420px);
}

.welcome-meta-pill {
  background: linear-gradient(180deg, rgba(59,130,246,.06), transparent 65%), var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}

.welcome-meta-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  color: var(--app-muted);
  margin-bottom: 0.2rem;
}

.welcome-meta-value {
  color: var(--app-text);
  font-size: 0.92rem;
}

.welcome-meta-value.is-ok { color: #15803d; }
.welcome-meta-value.is-warn { color: #b45309; }

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--app-muted);
}

.dashboard-surface,
.dashboard-info-panel {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}

.dashboard-surface-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.dashboard-surface-subtitle {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--app-muted);
}

.dashboard-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(59,130,246,.14);
  background: rgba(59,130,246,.08);
  color: var(--app-text);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.dashboard-chip.is-warn {
  background: rgba(234,179,8,.12);
  border-color: rgba(234,179,8,.24);
  color: #a16207;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.dashboard-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 146px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 72%), var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  padding: 0.9rem;
  color: var(--app-text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.dashboard-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
  border-color: rgba(59,130,246,.26);
}

.dashboard-kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--app-text);
  line-height: 1.1;
}

.dashboard-kpi-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--app-text);
}

.dashboard-kpi-sub {
  font-size: 0.74rem;
  color: var(--app-muted);
  line-height: 1.4;
}

.dashboard-info-stack {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--app-border);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dashboard-info-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--app-muted);
}

.dashboard-info-row strong { color: var(--app-text); }

.dashboard-inline-note {
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(234,179,8,.12);
  color: #a16207;
  font-size: 0.76rem;
}

/* Quick-action cards */
.quick-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  padding: 1rem;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  height: 100%;
}
.quick-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  border-color: rgba(59,130,246,.35);
}
.quick-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.quick-card-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--app-text);
  line-height: 1.3;
}
.quick-card-sub {
  font-size: 0.75rem;
  color: var(--app-muted);
}
.quick-card-manageable {
  position: relative;
  padding-top: 1.25rem;
}
.quick-card-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.quick-card-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(239,68,68,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: #b91c1c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, transform .15s, background .15s;
}
.quick-card-manageable:hover .quick-card-close,
.quick-card-close:focus-visible {
  opacity: 1;
}
.quick-card-close:hover {
  background: #fff1f2;
  transform: scale(1.04);
}

.dashboard-section-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.quick-access-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1rem;
}

.quick-access-editor-pane {
  border: 1px solid var(--app-border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(59,130,246,.03), transparent 24%), var(--app-card);
  padding: 0.9rem;
  min-width: 0;
}

.quick-access-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.quick-access-selected-list,
.quick-access-tree {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.quick-access-edit-item,
.quick-access-tree-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  background: var(--app-card);
}

.quick-access-edit-item {
  cursor: grab;
}

.quick-access-edit-item:active {
  cursor: grabbing;
}

.quick-access-edit-main {
  min-width: 0;
}

.quick-access-edit-main .fw-semibold,
.quick-access-tree-item .fw-semibold {
  line-height: 1.25;
}

.quick-access-drag-handle {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--app-muted);
  background: rgba(107,114,128,.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-access-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-access-edit-empty,
.quick-access-collapsed-state {
  border: 1px dashed rgba(59,130,246,.26);
  border-radius: 12px;
  padding: 1.2rem;
  background: rgba(59,130,246,.04);
  color: var(--app-muted);
  text-align: center;
}

.quick-access-edit-empty i,
.quick-access-collapsed-state i {
  color: var(--brand-accent);
}

.quick-access-dropzone {
  border: 1px dashed rgba(59,130,246,.35);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(59,130,246,.05);
  color: var(--app-muted);
  text-align: center;
  font-size: 0.82rem;
}

.quick-access-tree-group {
  border-top: 1px solid var(--app-border);
  padding-top: 0.7rem;
}

.quick-access-tree-group:first-child {
  border-top: none;
  padding-top: 0;
}

.quick-access-tree-group-title {
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--app-text);
  margin-bottom: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.55px;
}

.quick-access-tree-section + .quick-access-tree-section {
  margin-top: 0.75rem;
}

.quick-access-tree-section-title,
.module-section-title {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.55px;
  margin-bottom: 0.45rem;
}

.quick-access-tree-item.is-selected {
  background: rgba(107,114,128,.06);
  border-color: rgba(107,114,128,.16);
}

.module-section + .module-section {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--app-border);
}

/* Module grid cards */
.module-card {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  overflow: hidden;
}
.module-card-header {
  display: flex;
  align-items: center;
  padding: 0.65rem 1rem;
  background: var(--app-card);
  border-bottom: 2px solid var(--app-border);
  border-left: 4px solid currentColor;
  font-size: 0.875rem;
}
.module-card-body { padding: 0.75rem 1rem; }
.module-link-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}
.module-link-grid a {
  font-size: 0.82rem;
  color: var(--app-text);
  text-decoration: none;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  transition: background .12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-link-grid a:hover {
  background: rgba(59,130,246,.07);
  color: var(--brand-accent);
}

@media (max-width: 991.98px) {
  .welcome-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 575.98px) {
  .welcome-meta-grid,
  .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }

  .quick-access-edit-item,
  .quick-access-tree-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .quick-access-drag-handle {
    display: none;
  }
}

/* ── PageHeader ──────────────────────────────────────────────────────────── */
.page-header {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--app-border);
}
.page-header-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.page-header-title { line-height: 1.25; }
.breadcrumb-sm { font-size: 0.78rem; }
.breadcrumb-sm .breadcrumb-item + .breadcrumb-item::before { font-size: 0.7rem; }

/* ── Toast notifications ──────────────────────────────────────────────────── */
.toast-host {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
  pointer-events: none;
}
.toast-item {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  pointer-events: auto;
  animation: toastIn .2s ease-out;
}
@keyframes toastIn {
  from { opacity:0; transform: translateY(16px); }
  to   { opacity:1; transform: translateY(0); }
}
.toast-item .toast-body { padding: .6rem .85rem; font-size:.875rem; }
.toast-success { border-left: 4px solid #22c55e; }
.toast-error   { border-left: 4px solid #ef4444; }
.toast-warning { border-left: 4px solid #f59e0b; }
.toast-info    { border-left: 4px solid #3b82f6; }

/* ── UiFormLayout ─────────────────────────────────────────────────────────── */
.ui-form-layout .card-header { background: var(--app-card); border-bottom: 1px solid var(--app-border); }
.ui-form-section { margin-bottom: 1.5rem; }
.ui-form-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--app-muted);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--app-border);
  margin-bottom: 0.85rem;
}

/* ── UiEmptyState ─────────────────────────────────────────────────────────── */
.ui-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}
.ui-empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 1rem;
}
.ui-empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--app-text);
  margin-bottom: 0.35rem;
}
.ui-empty-state-msg {
  font-size: 0.85rem;
  color: var(--app-muted);
  max-width: 360px;
}

/* ── Badge-soft color variants ────────────────────────────────────────────── */
.badge-soft-primary   { background: rgba(59,130,246,.12);  color: #1d4ed8; }
.badge-soft-success   { background: rgba(34,197,94,.12);   color: #15803d; }
.badge-soft-danger    { background: rgba(239,68,68,.12);   color: #b91c1c; }
.badge-soft-warning   { background: rgba(234,179,8,.12);   color: #a16207; }
.badge-soft-info      { background: rgba(6,182,212,.12);   color: #0e7490; }
.badge-soft-secondary { background: rgba(107,114,128,.12); color: #374151; }
.badge-soft-dark      { background: rgba(31,41,55,.12);    color: #111827; }
.badge-soft { border-radius: 6px; padding: .25em .55em; font-size: .78em; font-weight: 600; }

/* ── Collapsible sidebar nav groups ──────────────────────────────────────── */
.sidebar-group-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.35rem 0.75rem;
  background: none;
  border: none;
  color: rgba(219,234,254,0.75);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  gap: 0.4rem;
  transition: color .15s;
}
.sidebar-group-toggle:hover { color: #fff; }
.sidebar-group-toggle .sg-arrow {
  margin-left: auto;
  font-size: 0.7rem;
  transition: transform .2s;
}
.sidebar-group-toggle.collapsed .sg-arrow { transform: rotate(-90deg); }
.sidebar-group-items { overflow: hidden; transition: max-height .25s ease; }
.sidebar-group-items.collapsed { max-height: 0 !important; }
.sidebar-subgroup-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.55rem 0.75rem 0.25rem;
  background: none;
  border: none;
  color: rgba(191,219,254,0.72);
  cursor: pointer;
  transition: color .15s;
}
.sidebar-subgroup-toggle:hover { color: #fff; }
.sidebar-subgroup-toggle .sidebar-subsection-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.55px;
  text-transform: uppercase;
  color: inherit;
}
.sidebar-subgroup-toggle .subgroup-arrow {
  margin-left: auto;
  font-size: 0.65rem;
  transition: transform .2s;
}
.sidebar-subgroup-toggle.collapsed .subgroup-arrow { transform: rotate(-90deg); }
.sidebar-subgroup-items { overflow: hidden; transition: max-height .25s ease; }
.sidebar-subgroup-items.collapsed { max-height: 0 !important; }

/* ── Sidebar collapsed (icon-only) mode ──────────────────────────────────── */
.app-sidebar.sidebar-collapsed { width: 56px !important; }
.app-sidebar.sidebar-collapsed .sidebar-brand-text,
.app-sidebar.sidebar-collapsed .nav-link-text,
.app-sidebar.sidebar-collapsed .sidebar-section-label,
.app-sidebar.sidebar-collapsed .sidebar-group-toggle .sg-label,
.app-sidebar.sidebar-collapsed .sidebar-group-toggle .sg-arrow { display: none; }
.app-sidebar.sidebar-collapsed .sidebar-subgroup-toggle { display: none; }
.app-sidebar.sidebar-collapsed .sidebar-subgroup-items,
.app-sidebar.sidebar-collapsed .sidebar-subgroup-items.collapsed { max-height: none !important; }
.app-sidebar.sidebar-collapsed .nav-link { justify-content: center; padding-inline: 0; }
.app-sidebar.sidebar-collapsed .nav-icon { margin: 0 !important; font-size: 1rem; }
.app-sidebar.sidebar-collapsed + .app-content { margin-left: 56px; transition: margin-left .25s; }
.sidebar-collapse-btn {
  background: none;
  border: none;
  color: rgba(219,234,254,.6);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.sidebar-collapse-btn:hover { color: #fff; background: rgba(255,255,255,.08); }

/* ── Back-to-top button ───────────────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1050;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--app-primary, #3b82f6);
  color: #fff;
  border: none;
  font-size: 1rem;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  transition: opacity .2s;
}
#back-to-top.visible { display: flex; }
#back-to-top:hover { opacity: .85; }

/* ── GenericLookupField input polish ─────────────────────────────────────── */
.input-group .form-control[readonly] { background: var(--app-card, #fff); cursor: default; }
.input-group .form-control[readonly]:focus { box-shadow: none; border-color: var(--app-border, #e5e7eb); }

/* ── Filter card compact style ───────────────────────────────────────────── */
.filter-card { background: var(--app-card, #fff); border: 1px solid var(--app-border, #e5e7eb); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }

/* ── Row count badge ─────────────────────────────────────────────────────── */
.row-count-badge { font-size: .78rem; color: var(--app-muted, #6b7280); padding: .35rem 0 0; }
.row-count-badge strong { color: var(--app-text, #111827); }

/* ── Student Card — iki sütun mimarisi (sc-* bileşenleri) ────────────────── */

/* Ana iki sütun kapsayıcı */
.sc-layout {
  display: flex;
  gap: 0;
  min-height: 520px;
  max-height: 72vh;
  overflow: hidden;
}

/* ── Sol Kart ── */
.sc-left-card {
  width: 220px;
  min-width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--app-border, #e5e7eb);
  padding: 1rem .875rem 1rem;
  overflow-y: auto;
  background: var(--app-bg, #f8fafc);
  display: flex;
  flex-direction: column;
}

.sc-avatar-wrap { display: flex; justify-content: center; }

.sc-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(59,130,246,.15);
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -.5px;
}

.sc-name    { font-size: .95rem; font-weight: 700; line-height: 1.25; color: var(--app-text, #111827); text-align: center; }
.sc-meta    { font-size: .75rem; color: var(--app-muted, #6b7280); text-align: center; }
.sc-subtitle { font-size: .75rem; color: var(--app-muted, #6b7280); text-align: center; line-height: 1.4; }
.sc-subtitle a { color: var(--app-muted, #6b7280); text-decoration: none; }
.sc-subtitle a:hover { color: var(--app-primary, #3b82f6); }

.sc-divider { border: 0; border-top: 1px solid var(--app-border, #e5e7eb); margin: .625rem 0; }

/* Dikey sekme navigasyonu */
.sc-tab-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sc-tab-btn {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  width: 100%;
  padding: .4rem .625rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: .8rem;
  color: var(--app-muted, #6b7280);
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}
.sc-tab-btn i { width: 14px; flex-shrink: 0; font-size: .78rem; margin-top: .1rem; }
.sc-tab-btn span { word-break: break-word; }
.sc-tab-btn:hover  { background: rgba(59,130,246,.07); color: var(--app-primary, #3b82f6); }
.sc-tab-btn.active { background: rgba(59,130,246,.12); color: #1d4ed8; font-weight: 600; }

/* ── Sağ Panel ── */
.sc-right-panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: .875rem 1rem;
}

/* Özet sekmesi — aksiyon çubuğu */
.sc-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  padding: .4rem .625rem;
  background: var(--app-bg, #f8fafc);
  border: 1px solid var(--app-border, #e5e7eb);
  border-radius: 7px;
  margin-bottom: .75rem;
}

/* Bağlam chip — word wrap enabled */
.sc-context-chip {
  font-size: .78rem;
  color: var(--app-muted, #6b7280);
  word-break: break-word;
  line-height: 1.4;
}

/* Sol kart daralt/genişlet butonu */
.sc-collapse-btn {
  display: flex;
  align-self: flex-end;
  margin-bottom: .25rem;
  width: 22px;
  height: 22px;
  border: 1px solid var(--app-border, #e5e7eb);
  border-radius: 50%;
  background: var(--app-card, #fff);
  color: var(--app-muted, #6b7280);
  font-size: .65rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.sc-collapse-btn:hover { background: var(--app-border, #e5e7eb); color: var(--app-text, #111827); }

/* Collapsed sol kart */
.sc-layout.sc-left-collapsed .sc-left-card {
  width: 36px;
  min-width: 36px;
  padding: .5rem .25rem;
  align-items: center;
  overflow: hidden;
}
.sc-layout.sc-left-collapsed .sc-left-card .sc-avatar-wrap,
.sc-layout.sc-left-collapsed .sc-left-card .sc-name,
.sc-layout.sc-left-collapsed .sc-left-card .sc-meta,
.sc-layout.sc-left-collapsed .sc-left-card .sc-subtitle,
.sc-layout.sc-left-collapsed .sc-left-card .d-flex.flex-wrap,
.sc-layout.sc-left-collapsed .sc-left-card .sc-divider {
  display: none !important;
}
.sc-layout.sc-left-collapsed .sc-tab-nav {
  gap: 4px;
}
.sc-layout.sc-left-collapsed .sc-tab-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
  align-items: center;
}
.sc-layout.sc-left-collapsed .sc-tab-btn span {
  display: none;
}
.sc-layout.sc-left-collapsed .sc-tab-btn i {
  margin: 0;
  width: auto;
}

/* Özet akademik detay grid */
.sc-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem 1rem;
}
.sc-detail-cell { }
.sc-detail-label { font-size: .72rem; color: var(--app-muted, #6b7280); margin-bottom: .15rem; text-transform: uppercase; letter-spacing: .3px; }
.sc-detail-value { font-size: .88rem; color: var(--app-text, #111827); font-weight: 500; }
.sc-detail-value a { color: var(--app-primary, #3b82f6); text-decoration: none; }
.sc-detail-value a:hover { text-decoration: underline; }

/* Finansal sekmeler — filtre + Net Durum yan yana */
.sc-financial-top {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: .75rem;
}

/* Filtre paneli */
.sc-filter-panel {
  flex: 1;
  min-width: 0;
  background: var(--app-bg, #f8fafc);
  border: 1px solid var(--app-border, #e5e7eb);
  border-radius: 8px;
  padding: .75rem;
}
.sc-field-label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--app-muted, #6b7280);
  margin-bottom: .25rem;
}

/* Uygulanan filtre özeti */
.sc-active-filter {
  font-size: .75rem;
  color: var(--app-primary, #3b82f6);
  background: rgba(59,130,246,.07);
  border-radius: 5px;
  padding: .25rem .5rem;
}

/* Net Durum kartı */
.sc-net-durum {
  width: 190px;
  flex-shrink: 0;
  background: var(--app-card, #fff);
  border: 1px solid var(--app-border, #e5e7eb);
  border-radius: 10px;
  padding: .875rem;
  text-align: center;
}
.sc-nd-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--app-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: .35rem;
}
.sc-nd-value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.5px;
  margin-bottom: .5rem;
}
.sc-nd-rows {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  border-top: 1px solid var(--app-border, #e5e7eb);
  padding-top: .4rem;
}
.sc-nd-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .35rem;
  font-size: .78rem;
}
.sc-nd-row > span:first-child { color: var(--app-muted, #6b7280); }

/* Ekstre tablosu */
.sc-ledger-table { font-size: .82rem; }
.sc-ledger-table thead th { font-size: .75rem; font-weight: 600; white-space: nowrap; }
.sc-totals-row td {
  border-top: 2px solid var(--app-border, #e5e7eb);
  padding-top: .5rem;
  background: var(--app-bg, #f8fafc);
  font-size: .8rem;
}

@media (max-width: 720px) {
  .sc-layout       { flex-direction: column; max-height: none; }
  .sc-left-card    { width: 100%; border-right: none; border-bottom: 1px solid var(--app-border, #e5e7eb); }
  .sc-tab-nav      { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sc-tab-btn      { width: auto; }
  .sc-financial-top { flex-direction: column; }
  .sc-net-durum    { width: 100%; }
  .sc-detail-grid  { grid-template-columns: repeat(2, 1fr); }
}
