:root {
  --erp-blue-900: #0a2342;
  --erp-blue-700: #0f3f78;
  --erp-blue-600: #0b5cab;
  --erp-blue-500: #1678d0;
  --erp-sky-100: #eaf4ff;
  --erp-border: #d5dde6;
  --erp-bg: #f4f7fb;
  --erp-surface: #ffffff;
  --erp-text: #1f2d3d;
  --erp-muted: #66788a;
  --erp-success: #1b8f4b;
  --erp-warning: #ba7a00;
  --erp-danger: #c03a2b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow-sm: 0 2px 8px rgba(16, 45, 75, 0.08);
  --shadow-md: 0 8px 24px rgba(16, 45, 75, 0.12);
}

* {
  box-sizing: border-box;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Tahoma", "Arial", sans-serif;
  color: var(--erp-text);
  background: linear-gradient(180deg, #eef4fb 0%, var(--erp-bg) 55%);
}

.app-shell {
  display: grid;
  grid-template-columns: 272px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--erp-blue-900), #0c2f57);
  color: #dce8f6;
  padding: 14px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
}

.brand img {
  width: 42px;
  height: 42px;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

.brand h1 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 600;
}

.brand span {
  display: block;
  font-size: 11px;
  opacity: 0.8;
}

.nav-group {
  margin: 12px 0 16px;
}

.nav-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.8;
  margin: 10px 8px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: #e4eefb;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin: 2px 0;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.16);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--erp-border);
  backdrop-filter: blur(4px);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.left-actions,
.right-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.icon-btn,
.btn {
  border: 1px solid var(--erp-border);
  background: #fff;
  color: var(--erp-text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12px;
  min-height: 36px;
  cursor: pointer;
}

.btn-primary {
  background: var(--erp-blue-500);
  color: #fff;
  border-color: var(--erp-blue-500);
}

.btn-primary:hover {
  background: var(--erp-blue-600);
}

.workspace {
  padding: 16px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.page-head h2 {
  margin: 0;
  font-size: 20px;
}

.page-head p {
  margin: 2px 0 0;
  color: var(--erp-muted);
  font-size: 13px;
}

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

.card {
  background: var(--erp-surface);
  border: 1px solid var(--erp-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.kpi-card {
  padding: 12px;
}

.kpi-card .title {
  color: var(--erp-muted);
  font-size: 12px;
}

.kpi-card .value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
}

.trend {
  margin-top: 8px;
  font-size: 12px;
}

.trend.up {
  color: var(--erp-success);
}

.trend.down {
  color: var(--erp-danger);
}

.trend.warn {
  color: var(--erp-warning);
}

.trend.err {
  color: var(--erp-danger);
  font-weight: 600;
}

.layout-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--erp-border);
}

.panel-head h3 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.page-nav {
  margin-bottom: 12px;
}

.page-nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.breadcrumb {
  font-size: 12px;
  color: var(--erp-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.breadcrumb strong {
  color: var(--erp-text);
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.control,
select,
input[type="text"],
input[type="date"],
input[type="number"] {
  border: 1px solid var(--erp-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  min-height: 36px;
  background: #fff;
  max-width: 100%;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--erp-border);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 820px;
}

th,
td {
  border-bottom: 1px solid var(--erp-border);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--erp-sky-100);
  color: #274b72;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.status {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
}

.status.ok {
  background: #e6f6ec;
  color: var(--erp-success);
}

.status.warn {
  background: #fff5df;
  color: var(--erp-warning);
}

.status.err {
  background: #fdeceb;
  color: var(--erp-danger);
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline li {
  border-left: 2px solid var(--erp-border);
  margin-left: 6px;
  padding: 0 0 12px 12px;
  position: relative;
}

.timeline li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--erp-blue-500);
  position: absolute;
  left: -5px;
  top: 4px;
}

.timeline .title {
  font-size: 12px;
  font-weight: 600;
}

.timeline .meta {
  font-size: 11px;
  color: var(--erp-muted);
}

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

.form-card {
  padding: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.form-field label {
  display: block;
  font-size: 11px;
  color: var(--erp-muted);
  margin-bottom: 4px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--erp-border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  background: #fff;
  font-size: 12px;
}

.tab.active {
  border-color: var(--erp-blue-500);
  color: var(--erp-blue-600);
  background: #f1f7ff;
  font-weight: 600;
}

.chart {
  height: 210px;
  border: 1px dashed var(--erp-border);
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(
      0deg,
      #f7fbff,
      #f7fbff 22px,
      #edf4fb 22px,
      #edf4fb 44px
    ),
    linear-gradient(180deg, #ffffff, #f9fcff);
  display: grid;
  place-items: center;
  color: #5e7690;
  font-size: 12px;
}

.chart-bars {
  position: relative;
  overflow: hidden;
  padding: 10px 10px 6px;
  display: block;
}

.chart-grid {
  position: absolute;
  inset: 10px 10px 24px;
  background: repeating-linear-gradient(
    to top,
    transparent,
    transparent 31px,
    rgba(12, 63, 120, 0.08) 31px,
    rgba(12, 63, 120, 0.08) 32px
  );
  pointer-events: none;
}

.bars {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.bar-col {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 6px;
}

.bar-col small {
  color: var(--erp-muted);
  text-align: center;
}

.bar {
  height: 0;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #57a8ec, #1678d0);
  box-shadow: 0 6px 12px rgba(22, 120, 208, 0.28);
  position: relative;
  transition: height 900ms cubic-bezier(0.23, 1, 0.32, 1);
}

.bar span {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #32597f;
  font-weight: 600;
}

.chart-donut {
  display: grid;
  place-items: center;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.donut {
  --pct: 68;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background: conic-gradient(
    #1b8f4b calc(var(--pct) * 0.45%),
    #ba7a00 calc(var(--pct) * 0.45%) calc(var(--pct) * 0.78%),
    #c03a2b calc(var(--pct) * 0.78%) calc(var(--pct) * 1%),
    #d7e1ee calc(var(--pct) * 1%) 100%
  );
  transform: rotate(-90deg) scale(0.84);
  opacity: 0;
  transition: transform 650ms ease, opacity 650ms ease;
}

.donut.ready {
  transform: rotate(-90deg) scale(1);
  opacity: 1;
}

.donut-core {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #fff;
  position: relative;
  top: 28px;
  left: 28px;
  display: grid;
  place-items: center;
  transform: rotate(90deg);
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--erp-border);
}

.donut-core strong {
  font-size: 22px;
  line-height: 1;
}

.donut-core span {
  font-size: 11px;
  color: var(--erp-muted);
}

.chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 12px;
}

.chart-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-ok {
  background: var(--erp-success);
}

.dot-warn {
  background: var(--erp-warning);
}

.dot-err {
  background: var(--erp-danger);
}

.chart-line {
  position: relative;
  padding: 14px 14px 8px;
  display: grid;
  gap: 10px;
  align-content: center;
}

.chart-line svg {
  width: 100%;
  height: 180px;
  border: 1px dashed var(--erp-border);
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(
      to top,
      #f8fcff,
      #f8fcff 29px,
      #edf4fb 29px,
      #edf4fb 30px
    ),
    linear-gradient(180deg, #ffffff, #f8fcff);
  overflow: visible;
}

.line-target,
.line-stroke {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.line-target {
  stroke: #8ca8c5;
  stroke-dasharray: 8 8;
  opacity: 0.9;
}

.line-stroke {
  stroke: #1678d0;
}

.line-point {
  fill: #fff;
  stroke: #1678d0;
  stroke-width: 3;
  transform-origin: center;
  transform: scale(0);
  opacity: 0;
  transition: transform 260ms ease, opacity 260ms ease;
}

.line-point.ready {
  transform: scale(1);
  opacity: 1;
}

.line-labels {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  font-size: 11px;
  color: var(--erp-muted);
  text-align: center;
}

.dot-line {
  background: #1678d0;
}

.dot-target {
  background: #8ca8c5;
}

@media (prefers-reduced-motion: reduce) {
  .bar,
  .donut,
  .line-point {
    transition: none;
  }
}

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

.module-link {
  display: block;
  text-decoration: none;
  color: var(--erp-text);
  border: 1px solid var(--erp-border);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12px;
}

.module-link:hover {
  border-color: var(--erp-blue-500);
  background: #f3f8ff;
}

.mobile-only {
  display: none;
}

.scan-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scan-control .control {
  min-width: 220px;
}

.scanner-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 26, 44, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 14px;
}

.scanner-modal.open {
  display: flex;
}

.scanner-modal-card {
  width: min(680px, 100%);
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--erp-border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.scanner-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--erp-border);
}

.scanner-modal-head h3 {
  margin: 0;
  font-size: 14px;
}

.scanner-modal-body {
  padding: 12px;
}

.scanner-preview {
  width: 100%;
  max-height: 320px;
  background: #0e243a;
  border-radius: var(--radius-sm);
  border: 1px solid #26435f;
  object-fit: cover;
}

.scanner-hint {
  margin: 10px 0;
  font-size: 12px;
  color: var(--erp-muted);
}

.tcode-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(7, 21, 35, 0.62);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.tcode-modal.open {
  display: flex;
}

.tcode-card {
  width: min(780px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--erp-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.tcode-head {
  padding: 12px;
  border-bottom: 1px solid var(--erp-border);
  display: grid;
  gap: 8px;
}

.tcode-head h3 {
  margin: 0;
  font-size: 15px;
}

.tcode-list {
  padding: 10px;
  display: grid;
  gap: 6px;
}

.tcode-item {
  border: 1px solid var(--erp-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  align-items: center;
}

.tcode-item.active,
.tcode-item:hover {
  border-color: var(--erp-blue-500);
  background: #f3f8ff;
}

.tcode-code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: #0b4e8f;
  font-weight: 700;
}

.tcode-desc {
  font-size: 12px;
}

.tcode-desc small {
  color: var(--erp-muted);
}

.code-gen-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.code-preview {
  border: 1px dashed var(--erp-border);
  border-radius: var(--radius-sm);
  background: #fff;
  min-height: 130px;
  display: grid;
  place-items: center;
  padding: 8px;
}

.code-preview img {
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
}

.code-preview .muted {
  font-size: 12px;
  color: var(--erp-muted);
}

.app-preloader {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 82% 8%, rgba(38, 128, 214, 0.22), transparent 44%),
    radial-gradient(circle at 4% 92%, rgba(10, 45, 80, 0.2), transparent 42%),
    linear-gradient(180deg, #0d315a, #082642);
  transition: opacity 260ms ease, visibility 260ms ease;
}

.app-preloader.hide {
  opacity: 0;
  visibility: hidden;
}

.app-preloader-card {
  width: min(320px, calc(100vw - 30px));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 34px rgba(4, 20, 37, 0.35);
  backdrop-filter: blur(3px);
  padding: 24px 20px;
  text-align: center;
  color: #e8f1fc;
}

.app-preloader-logo {
  width: 70px;
  height: 70px;
  margin: 0 auto 14px;
  animation: preload-spin 1.25s linear infinite;
}

.app-preloader-title {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.06em;
}

.app-preloader-sub {
  margin: 6px 0 0;
  font-size: 12px;
  color: #c7ddf5;
}

.app-preloader-bar {
  margin: 14px auto 0;
  width: 100%;
  max-width: 220px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.app-preloader-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f0bc28, #ffd66b);
  animation: preload-progress 1.1s ease-in-out infinite alternate;
}

@keyframes preload-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes preload-progress {
  from {
    width: 24%;
  }
  to {
    width: 86%;
  }
}

/* Rich UX layer: Enterprise-inspired controls, filter bars, and table ergonomics */
body {
  background:
    radial-gradient(circle at 88% -10%, rgba(22, 120, 208, 0.2), transparent 40%),
    radial-gradient(circle at -8% 30%, rgba(11, 92, 171, 0.14), transparent 42%),
    linear-gradient(180deg, #edf4fb 0%, var(--erp-bg) 58%);
}

.sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.nav-link {
  transition: background-color 140ms ease, transform 140ms ease;
}

.nav-link:hover,
.nav-link.active {
  transform: translateX(2px);
}

.topbar {
  box-shadow: 0 8px 18px rgba(18, 55, 89, 0.08);
}

.card {
  transition: box-shadow 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.card:hover {
  border-color: #c5d5e8;
  box-shadow: 0 10px 24px rgba(10, 46, 80, 0.12);
}

.panel-head {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.icon-btn,
.btn {
  border-color: #c8d6e7;
  border-bottom-color: #b9c9dd;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 150ms ease;
}

.icon-btn:hover,
.btn:hover {
  border-color: #8fb4d9;
  background: #f5f9ff;
}

.btn-primary {
  background: linear-gradient(180deg, #1f87de 0%, #0d69bc 100%);
  border-color: #0d69bc;
  box-shadow: 0 4px 10px rgba(13, 105, 188, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #2a90e4 0%, #0f70c7 100%);
  border-color: #0f70c7;
}

.btn:active,
.icon-btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.tab:focus-visible,
.module-link:focus-visible,
.nav-link:focus-visible,
.chip:focus-visible,
.control:focus-visible,
select:focus-visible,
input[type="text"]:focus-visible,
input[type="date"]:focus-visible,
input[type="number"]:focus-visible {
  outline: 0;
  border-color: #2a86d8;
  box-shadow: 0 0 0 3px rgba(42, 134, 216, 0.22);
}

.control,
select,
input[type="text"],
input[type="date"],
input[type="number"] {
  border-color: #c9d8e8;
  background: linear-gradient(180deg, #fff, #fbfdff);
  box-shadow: inset 0 1px 1px rgba(9, 44, 78, 0.05);
}

.control:hover,
select:hover,
input[type="text"]:hover,
input[type="date"]:hover,
input[type="number"]:hover {
  border-color: #9fc0de;
}

.toolbar {
  gap: 10px;
}

.rich-filterbar {
  width: 100%;
  border: 1px solid #d4e0ed;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: 10px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid #bfcee0;
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  color: #36516d;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.chip:hover {
  border-color: #91b2d2;
  color: #183d64;
}

.chip.active {
  border-color: #0f70c7;
  background: #e9f3ff;
  color: #0c4f8c;
}

.kpi-card {
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  inset: auto -30% -45% auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22, 120, 208, 0.2), transparent 66%);
  pointer-events: none;
}

.tabs {
  border: 1px solid #d3e0ee;
  border-radius: 10px;
  padding: 5px;
  background: #f6faff;
  width: fit-content;
}

.tab {
  cursor: pointer;
  font-weight: 600;
  transition: all 140ms ease;
}

.table-wrap {
  border-color: #ccd9e7;
  box-shadow: inset 0 1px 0 #fff;
}

th {
  background: linear-gradient(180deg, #eef6ff, #e2eefb);
  border-bottom: 1px solid #c7d6e6;
}

tbody tr {
  transition: background-color 130ms ease;
}

tbody tr:hover {
  background: #f5faff;
}

tbody tr.is-selected {
  background: #eaf4ff;
  box-shadow: inset 3px 0 0 #0f70c7;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

@media (min-width: 901px) {
  table th:first-child,
  table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: inherit;
  }

  table th:first-child {
    z-index: 2;
  }
}

@media (max-width: 1180px) {
  .topbar {
    align-items: flex-start;
  }
  .left-actions,
  .right-actions {
    width: 100%;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .layout-2 {
    grid-template-columns: 1fr;
  }
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .code-gen-grid {
    grid-template-columns: 1fr;
  }
  .rich-filterbar {
    padding: 8px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 50;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-only {
    display: inline-flex;
  }
  .workspace {
    padding: 12px;
  }
  .topbar {
    padding: 10px 12px;
  }
  .icon-btn,
  .btn {
    min-height: 38px;
  }
  .left-actions .control,
  .right-actions .control {
    width: 100%;
  }
  table {
    min-width: 700px;
  }
  .form-row,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .module-grid {
    grid-template-columns: 1fr;
  }
  .page-nav-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .tcode-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 10px;
  }
  .page-head h2 {
    font-size: 18px;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .panel-head,
  .panel-body,
  .form-card {
    padding: 10px;
  }
  .scan-control {
    width: 100%;
  }
  .scan-control .control {
    min-width: 0;
    width: 100%;
  }
  .toolbar .control,
  .toolbar select,
  .toolbar input[type="text"],
  .toolbar input[type="date"],
  .toolbar input[type="number"] {
    width: 100%;
  }
  .chip-group {
    width: 100%;
  }
  .code-preview {
    min-height: 110px;
  }
  table {
    min-width: 620px;
  }
  .table-wrap.cardified {
    border: 0;
    overflow: visible;
    background: transparent;
  }
  .table-wrap.cardified table {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
  }
  .table-wrap.cardified thead {
    display: none;
  }
  .table-wrap.cardified tbody,
  .table-wrap.cardified tr,
  .table-wrap.cardified td {
    display: block;
    width: 100%;
  }
  .table-wrap.cardified tr {
    border: 1px solid var(--erp-border);
    border-radius: var(--radius-sm);
    background: #fff;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }
  .table-wrap.cardified td {
    border-bottom: 1px solid #edf2f7;
    white-space: normal;
    text-align: right;
    padding: 10px 10px 10px 46%;
    position: relative;
    min-height: 38px;
  }
  .table-wrap.cardified td:last-child {
    border-bottom: 0;
  }
  .table-wrap.cardified td::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    top: 10px;
    width: 42%;
    text-align: left;
    color: var(--erp-muted);
    font-weight: 600;
    white-space: normal;
  }
  .table-wrap.cardified td .btn,
  .table-wrap.cardified td button {
    margin-left: auto;
  }
}

@media (max-width: 420px) {
  .brand h1 {
    font-size: 13px;
  }
  .brand span {
    font-size: 10px;
  }
  .icon-btn,
  .btn,
  .chip,
  .control,
  select,
  input[type="text"],
  input[type="date"],
  input[type="number"] {
    font-size: 11px;
  }
  .sidebar {
    width: 240px;
  }
}

