:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #dce5ef;
  --text: #142033;
  --muted: #607086;
  --primary: #1268b3;
  --primary-dark: #0d4f88;
  --accent: #0f8b6f;
  --danger: #b42318;
  --sidebar: #172033;
  --sidebar-2: #202b40;
  --sidebar-hover: #2a3852;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.app-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: 310px;
  background: var(--sidebar);
  color: #fff;
  overflow-y: auto;
  padding: 18px 14px;
  border-inline-end: 1px solid rgba(255, 255, 255, .08);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 4px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  font-size: 22px;
}

.brand strong { display: block; font-size: 20px; }
.brand span { display: block; color: #cbd5e1; font-size: 13px; }

.side-nav { margin-top: 14px; padding-bottom: 20px; }
.nav-section { margin-top: 8px; }

.nav-group-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: #aebbd0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-align: start;
}

.nav-group-toggle i { transition: transform .18s ease; font-size: 12px; }
.nav-group-toggle:not(.collapsed) i { transform: rotate(180deg); }

.side-nav .nav-link {
  color: #e8edf4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  margin-bottom: 3px;
  text-decoration: none;
  min-height: 42px;
  border: 1px solid transparent;
}

.side-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.side-nav .nav-link.active {
  background: #eef6ff;
  color: var(--primary-dark);
  border-color: rgba(18, 104, 179, .2);
  font-weight: 800;
}

.root-link { margin-bottom: 10px; background: var(--sidebar-2); }

.nav-item-icon,
.module-icon {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  color: inherit;
  flex: 0 0 30px;
}

.nav-link.active .nav-item-icon { background: rgba(18, 104, 179, .12); }

.app-main {
  margin-inline-start: 310px;
  min-height: 100vh;
  padding: 20px;
}

.topbar,
.module-toolbar,
.crud-panel,
.data-panel,
.report-actions,
.hero-panel,
.metric-card,
.dashboard-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 82px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 { margin: 0; font-size: 24px; font-weight: 900; }
.topbar p { margin: 3px 0 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }

.user-chip,
.counter-chip,
.page-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #edf7f4;
  color: #0b6b56;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
}

.content-shell { margin-top: 18px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.hero-panel {
  grid-column: span 4;
  padding: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.hero-panel h2 { font-size: 32px; font-weight: 900; margin: 6px 0; }
.hero-panel p { color: var(--muted); margin: 0; max-width: 820px; }
.eyebrow { color: var(--accent); font-weight: 900; font-size: 13px; }

.metric-card {
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  min-height: 120px;
  display: grid;
  gap: 10px;
}

.metric-card:hover { border-color: rgba(18, 104, 179, .35); color: var(--text); transform: translateY(-1px); }
.metric-card span { display: block; color: var(--muted); }
.metric-card strong { display: block; font-size: 30px; font-weight: 900; }
.metric-card i { color: var(--primary); font-size: 24px; }

.dashboard-panel {
  grid-column: span 2;
  padding: 18px;
}

.full-width-panel { grid-column: 1 / -1; }

.ops-hero { margin-bottom: 14px; }
.ops-hero-icon {
  font-size: 54px;
  color: var(--primary);
}

.ops-grid,
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.ops-card,
.matrix-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.ops-card {
  min-height: 150px;
  padding: 18px;
  display: grid;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
}

.ops-card:hover {
  color: var(--text);
  border-color: rgba(18, 104, 179, .45);
  transform: translateY(-1px);
}

.ops-card i {
  color: var(--primary);
  font-size: 28px;
}

.ops-card strong { font-size: 18px; font-weight: 900; }
.ops-card span { color: var(--muted); }
.ops-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-field {
  min-width: 260px;
  margin: 0;
}

.matrix-card {
  overflow: hidden;
}

.matrix-title {
  min-height: 52px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eef6ff;
  color: var(--primary-dark);
}

.permission-list {
  display: grid;
  gap: 2px;
  padding: 10px;
}

.permission-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px;
  border-radius: 8px;
  color: var(--text);
}

.permission-check:hover { background: var(--surface-soft); }
.permission-check span { display: grid; gap: 2px; }
.permission-check small { color: var(--muted); direction: ltr; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 12px;
  background: rgba(244, 247, 251, .92);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #edf7f4;
  color: #0b6b56;
  font-weight: 900;
}

.audit-json {
  min-width: 150px;
}

.audit-json summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary-dark);
  font-weight: 800;
  list-style: none;
  user-select: none;
}

.audit-json summary::-webkit-details-marker { display: none; }

.audit-json pre {
  margin: 8px 0 0;
  max-width: 420px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  direction: ltr;
  text-align: left;
  font-size: 11px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.dashboard-panel h3,
.grid-header h3,
.report-actions h3,
.crud-title h3 {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 900;
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.module-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.module-title-block .module-icon {
  width: 52px;
  height: 52px;
  background: #eaf4ff;
  color: var(--primary);
  font-size: 24px;
}

.module-header h2 { margin: 4px 0 0; font-size: 25px; font-weight: 900; }
.module-header p { margin: 4px 0 0; color: var(--muted); }

.endpoint-chip {
  max-width: 44%;
  background: #f1f5f9;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  direction: ltr;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-toolbar {
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.search-form,
.toolbar-actions,
.app-alert,
.btn,
.pager-actions,
.page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.search-form { display: flex; flex: 1 1 auto; }
.input-icon { position: relative; width: min(460px, 100%); }
.input-icon i { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .form-control { padding-inline-start: 38px; }

.crud-panel { padding: 16px; margin-bottom: 14px; }
.report-actions {
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crud-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.crud-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field .form-control,
.field .form-select {
  color: var(--text);
  font-weight: 600;
  min-height: 40px;
}

.switch-row {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.crud-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.attachment-panel {
  border-inline-start: 4px solid var(--accent);
}

.attachment-form,
.attachment-delete {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 10px;
}

.documents-upload {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.inline-actions {
  grid-column: auto;
  justify-content: flex-start;
}

.attachment-delete {
  grid-template-columns: minmax(220px, 1fr) auto;
  margin-bottom: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.data-panel { overflow: hidden; }
.grid-header,
.grid-footer {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.grid-footer { border-top: 1px solid var(--border); border-bottom: 0; background: var(--surface-soft); }
.pager-summary, .page-size { color: var(--muted); font-weight: 800; }

.data-table { margin: 0; min-width: 900px; }
.data-table thead th {
  background: #243044;
  color: #fff;
  font-size: 13px;
  padding: 14px;
  white-space: nowrap;
}
.data-table tbody td { padding: 12px 14px; border-color: var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fbff; }
.actions-col { width: 210px; }

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.row-actions form { margin: 0; }

.empty-row {
  height: 86px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.empty-row i { color: var(--primary); margin-inline-end: 6px; }

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px;
  color: var(--muted);
}

.empty-state.compact { min-height: 180px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.empty-state h2 { color: var(--text); margin: 10px 0 6px; font-size: 23px; }
.empty-state p { max-width: 560px; margin: 0; }
.empty-icon { color: var(--primary); font-size: 42px; }

.barcode-cell {
  direction: ltr;
  font-family: "Consolas", "Courier New", monospace;
  letter-spacing: 1px;
  font-weight: 900;
}

.workflow-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr);
  gap: 16px;
  margin-bottom: 16px;
}

.workflow-stack {
  display: grid;
  gap: 16px;
}

.workflow-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.compact-workflow {
  align-self: start;
}

.workflow-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.workflow-title i {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #eef6ff;
  color: var(--primary);
  font-size: 22px;
}

.workflow-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.workflow-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ops-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

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

.form-grid label,
.line-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.span-2 {
  grid-column: span 2;
}

.line-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}

.line-head,
.line-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(110px, .5fr) minmax(110px, .5fr) minmax(160px, .9fr);
  gap: 8px;
  align-items: center;
  padding: 10px;
}

.line-head {
  background: #243044;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
}

.line-row {
  border-top: 1px solid var(--border);
  background: #fff;
}

.line-row:nth-child(even) {
  background: #f8fbff;
}

.inventory-lines {
  grid-template-columns: minmax(220px, 1.3fr) minmax(100px, .45fr) minmax(100px, .45fr) minmax(160px, .9fr);
}

.mini-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
  margin-bottom: 8px;
}

.professional-table thead th {
  background: #243044;
  color: #fff;
  border: 0;
  white-space: nowrap;
}

.professional-table td,
.professional-table th {
  padding: 12px;
  vertical-align: middle;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.kpi-strip div {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.kpi-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.kpi-strip strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 20px;
}

.compact-kpis {
  margin-top: 12px;
}

.bulk-area {
  min-height: 220px;
  direction: ltr;
  font-family: "Consolas", "Courier New", monospace;
}

.rank-list {
  display: grid;
  gap: 8px;
}

.rank-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.rank-list.warning div {
  background: #fff8ed;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #eef3f8;
}

.login-card {
  width: min(420px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-brand { margin-bottom: 24px; }
.hint { color: var(--muted); margin: 14px 0 0; text-align: center; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--accent); border-color: var(--accent); }
.btn-danger, .btn-outline-danger:hover { background: var(--danger); border-color: var(--danger); }

.context-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 14px;
  padding: 14px 16px;
  background: #fff8ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #7c2d12;
}

.context-note i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffedd5;
  color: #c2410c;
  flex: 0 0 34px;
}

.context-note strong,
.context-note span {
  display: block;
}

.context-note span {
  color: #9a3412;
  margin-top: 4px;
}

.smart-select-wrap {
  position: relative;
  width: 100%;
}

.smart-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.smart-select-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: start;
  font-weight: 700;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.smart-select-trigger:hover,
.smart-select-trigger:focus {
  border-color: rgba(18, 104, 179, .65);
  box-shadow: 0 0 0 4px rgba(18, 104, 179, .12);
  outline: 0;
}

.smart-select-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.smart-select-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.smart-select-modal.open {
  display: flex;
}

.smart-select-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(3px);
}

.smart-select-dialog {
  position: relative;
  width: min(760px, 96vw);
  max-height: min(720px, 90vh);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  background: #fff;
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
  padding: 16px;
  animation: smartSelectIn .14s ease-out;
}

.smart-select-head,
.smart-select-search {
  display: flex;
  align-items: center;
  gap: 10px;
}

.smart-select-head {
  justify-content: space-between;
}

.smart-select-head h3 {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 900;
}

.smart-select-search {
  position: relative;
}

.smart-select-search i {
  position: absolute;
  inset-inline-start: 14px;
  color: var(--muted);
}

.smart-select-search input {
  min-height: 46px;
  padding-inline-start: 42px;
}

.smart-select-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.smart-select-list {
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-inline-end: 4px;
}

.smart-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  text-align: start;
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}

.smart-select-option:hover,
.smart-select-option.selected {
  background: #eef6ff;
  border-color: rgba(18, 104, 179, .45);
  transform: translateY(-1px);
}

.smart-select-option span {
  font-weight: 900;
}

.smart-select-option small {
  color: var(--muted);
  direction: ltr;
}

.smart-select-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.permission-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-tile {
  min-height: 104px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.summary-tile i {
  grid-row: span 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 20px;
}

.summary-tile span {
  color: var(--muted);
  font-weight: 800;
}

.summary-tile strong {
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
}

.summary-tile.teal i { background: #dcfce7; color: #15803d; }
.summary-tile.blue i { background: #dbeafe; color: #1d4ed8; }
.summary-tile.amber i { background: #fef3c7; color: #b45309; }
.summary-tile.slate i { background: #e2e8f0; color: #334155; }

.permission-toolbar {
  align-items: end;
}

.permission-search-field {
  min-width: min(420px, 100%);
  flex: 1 1 360px;
}

.matrix-card {
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.matrix-card:hover {
  transform: translateY(-1px);
  border-color: rgba(18, 104, 179, .35);
}

.matrix-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.matrix-title i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef6ff;
  color: var(--primary);
}

.permission-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.permission-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}

.permission-check:hover {
  background: #f8fbff;
  border-color: rgba(18, 104, 179, .32);
}

.permission-check:has(input:checked) {
  background: #edf7f4;
  border-color: rgba(15, 139, 111, .38);
}

.permission-check span,
.permission-check strong,
.permission-check small {
  display: block;
}

.permission-check strong {
  color: var(--text);
}

.permission-check small {
  margin-top: 2px;
  color: var(--muted);
  direction: ltr;
  text-align: start;
}

.executive-dashboard {
  display: grid;
  gap: 14px;
}

.executive-hero {
  min-height: 240px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 20px;
  align-items: stretch;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(18, 104, 179, .10), rgba(15, 139, 111, .08)),
    #fff;
  box-shadow: var(--shadow);
}

.executive-hero h2 {
  max-width: 780px;
  margin: 8px 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.12;
  font-weight: 950;
  letter-spacing: 0;
}

.executive-hero p {
  max-width: 920px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.dashboard-date {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  min-height: 180px;
  border: 1px solid rgba(18, 104, 179, .18);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--primary);
}

.dashboard-date i {
  font-size: 42px;
}

.dashboard-date span {
  color: var(--muted);
  font-weight: 800;
}

.dashboard-date strong {
  direction: ltr;
  font-size: 24px;
  color: var(--text);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-tile {
  min-height: 118px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 4px 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.action-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(18, 104, 179, .35);
  box-shadow: 0 18px 34px rgba(15, 23, 42, .10);
}

.action-tile i {
  grid-row: span 2;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef6ff;
  color: var(--primary);
  font-size: 20px;
}

.action-tile strong {
  font-size: 16px;
  font-weight: 900;
}

.action-tile span {
  color: var(--muted);
  line-height: 1.65;
}

.module-icon-grid,
.professional-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.module-icon-card,
.professional-card {
  min-height: 136px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.module-icon-card:hover,
.professional-card:hover {
  transform: translateY(-2px);
  border-color: rgba(18, 104, 179, .35);
  box-shadow: 0 18px 34px rgba(15, 23, 42, .10);
}

.module-icon-card i,
.professional-card i {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef6ff;
  color: var(--primary);
  font-size: 22px;
}

.module-icon-card strong,
.professional-card strong {
  font-weight: 950;
}

.module-icon-card span,
.professional-card span {
  color: var(--muted);
  line-height: 1.65;
}

.professional-panel {
  grid-column: span 2;
}

.wide-panel {
  grid-column: span 2;
}

.section-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.section-stat-card {
  min-height: 148px;
  padding: 16px;
  display: grid;
  gap: 8px;
  align-content: space-between;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 18px 36px rgba(15, 23, 42, .07);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.section-stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(18, 104, 179, .35);
  box-shadow: 0 24px 46px rgba(15, 23, 42, .12);
}

.section-stat-card i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef6ff;
  color: var(--primary);
  font-size: 22px;
}

.section-stat-card span {
  color: var(--muted);
  font-weight: 800;
}

.section-stat-card strong {
  font-size: 26px;
  font-weight: 950;
  line-height: 1.15;
}

.section-stat-card small {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.6;
}

.section-stat-card.students i { background: #ecfdf5; color: #047857; }
.section-stat-card.academic i { background: #eef2ff; color: #4338ca; }
.section-stat-card.attendance i { background: #fff7ed; color: #c2410c; }
.section-stat-card.finance i { background: #f0fdf4; color: #15803d; }
.section-stat-card.accounting i { background: #f8fafc; color: #334155; }
.section-stat-card.exams i { background: #fefce8; color: #a16207; }
.section-stat-card.inventory i { background: #eff6ff; color: #1d4ed8; }
.section-stat-card.portal i { background: #fdf2f8; color: #be185d; }

.panel-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef6ff;
  color: var(--primary);
  font-weight: 850;
  white-space: nowrap;
}

.alerts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.ops-alert {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.ops-alert .alert-count {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef6ff;
  color: var(--primary);
  font-size: 20px;
  font-weight: 950;
}

.ops-alert strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 950;
}

.ops-alert small {
  color: var(--muted);
  line-height: 1.7;
}

.ops-alert.danger .alert-count { background: #fef2f2; color: #dc2626; }
.ops-alert.warning .alert-count { background: #fff7ed; color: #c2410c; }
.ops-alert.info .alert-count { background: #eef6ff; color: var(--primary); }

.empty-alert {
  grid-column: 1 / -1;
  min-height: 120px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8fbff;
  text-align: center;
}

.empty-alert i {
  color: #059669;
  font-size: 34px;
}

.empty-alert span {
  color: var(--muted);
}

.mini-stat-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.mini-stat-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.mini-stat-list span {
  color: var(--muted);
  font-weight: 800;
}

.mini-stat-list strong {
  color: var(--text);
  font-weight: 950;
  direction: ltr;
}

.status-card {
  min-height: 170px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.status-card i {
  font-size: 40px;
}

.status-card strong {
  font-size: 22px;
  font-weight: 950;
}

.status-card span {
  color: var(--muted);
  direction: ltr;
}

.status-card.ok i,
.status-card.ok strong {
  color: #047857;
}

.status-card.warn i,
.status-card.warn strong {
  color: #c2410c;
}

@keyframes smartSelectIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1100px) {
  .app-sidebar { width: 270px; }
  .app-main { margin-inline-start: 270px; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-grid,
  .action-grid,
  .module-icon-grid,
  .professional-grid,
  .section-stat-grid,
  .alerts-grid,
  .matrix-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .executive-hero { grid-template-columns: 1fr; }
  .workflow-shell { grid-template-columns: 1fr; }
  .permission-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-panel { grid-column: span 2; }
  .dashboard-panel { grid-column: span 2; }
  .crud-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-sidebar { position: static; width: auto; max-height: 360px; }
  .app-main { margin-inline-start: 0; padding: 12px; }
  .topbar,
  .module-toolbar,
  .hero-panel,
  .module-header,
  .grid-header,
  .grid-footer,
  .report-actions { display: block; height: auto; }
  .top-actions,
  .toolbar-actions,
  .pager-actions { margin-top: 10px; flex-wrap: wrap; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .ops-grid,
  .action-grid,
  .module-icon-grid,
  .professional-grid,
  .section-stat-grid,
  .alerts-grid,
  .matrix-grid { grid-template-columns: 1fr; }
  .executive-hero { padding: 16px; }
  .permission-summary { grid-template-columns: 1fr; }
  .workflow-shell,
  .form-grid,
  .line-head,
  .line-row,
  .inventory-lines,
  .mini-line,
  .kpi-strip { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .hero-panel,
  .dashboard-panel,
  .wide-panel { grid-column: span 1; }
  .panel-title-row { display: block; }
  .live-badge { margin-top: 10px; white-space: normal; }
  .search-form { margin-top: 10px; flex-wrap: wrap; }
  .input-icon, .endpoint-chip { width: 100%; max-width: 100%; }
  .crud-form { grid-template-columns: 1fr; }
  .crud-title { display: block; }
  .crud-title .btn { margin-top: 10px; }
}
