:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef4f8;
  --ink: #1e2732;
  --muted: #687586;
  --line: #dfe6ee;
  --brand: #0f70c8;
  --brand-strong: #075da9;
  --teal: #0f9c8f;
  --green: #1f9d55;
  --amber: #b26a00;
  --red: #c83832;
  --graphite: #2c3138;
  --shadow: 0 16px 36px rgba(31, 45, 61, 0.11);
  --radius: 8px;
  --sidebar: 268px;
  --topbar: 72px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

body.theme-dark {
  color-scheme: dark;
  --bg: #111820;
  --surface: #18222d;
  --surface-2: #202c38;
  --ink: #edf4fb;
  --muted: #a8b5c3;
  --line: #2f3d4c;
  --brand: #3194e6;
  --brand-strong: #69b8ff;
  --teal: #28c4b2;
  --green: #39bf73;
  --amber: #f0b34d;
  --red: #f06b63;
  --graphite: #0c1218;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  --sidebar: 84px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--graphite);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 20;
}

.app-shell.sidebar-collapsed .brand-block {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 14px 10px;
}

.app-shell.sidebar-collapsed .brand-block > div,
.app-shell.sidebar-collapsed .nav-group-label,
.app-shell.sidebar-collapsed .nav-item span,
.app-shell.sidebar-collapsed .nav-parent span,
.app-shell.sidebar-collapsed .nav-parent svg:last-child,
.app-shell.sidebar-collapsed .nav-children,
.app-shell.sidebar-collapsed .sidebar-footer {
  display: none;
}

.app-shell.sidebar-collapsed .nav {
  padding: 12px 10px;
}

.app-shell.sidebar-collapsed .nav-item,
.app-shell.sidebar-collapsed .nav-parent {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 10px;
}

.brand-block {
  min-height: var(--topbar);
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
  width: 50px;
  height: 46px;
  object-fit: contain;
  border: 2px solid rgba(255, 255, 255, 0.78);
  background: #fff;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.05;
}

.brand-slogan {
  display: block;
  margin-top: 3px;
  color: #bfd7ea;
  font-size: 11px;
  font-weight: 600;
  text-transform: lowercase;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.nav-group-label {
  color: #aeb9c5;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  margin: 18px 10px 7px;
}

.nav-item,
.nav-parent {
  width: 100%;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: #e7edf4;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: var(--radius);
  text-align: left;
  font-weight: 700;
}

.nav-item:hover,
.nav-parent:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active,
.nav-parent.active {
  background: #ffffff;
  color: var(--brand-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.17);
}

.nav-item svg,
.nav-parent svg {
  width: 18px;
  height: 18px;
}

.nav-item span,
.nav-parent span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-children {
  display: grid;
  gap: 4px;
  padding: 6px 0 4px 34px;
}

.nav-children .nav-item {
  min-height: 36px;
  font-size: 13px;
  grid-template-columns: 20px minmax(0, 1fr) 0;
  color: #d4dee9;
}

.sidebar-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #c3cfda;
  font-size: 12px;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: var(--topbar) minmax(0, 1fr) auto;
}

.topbar {
  position: sticky;
  top: 0;
  min-height: var(--topbar);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(245, 247, 251, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 15;
}

.mobile-menu,
.btn.mobile-menu {
  display: none;
}

.page-heading {
  min-width: 0;
}

.page-heading h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-pill {
  min-height: 40px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 260px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: #e5f2ff;
  color: var(--brand-strong);
  font-weight: 900;
  border-radius: 999px;
}

.user-name {
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  padding: 22px;
  min-width: 0;
  overflow-x: hidden;
}

.footer {
  padding: 14px 22px 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
}

.footer a {
  color: var(--brand-strong);
  font-weight: 700;
  text-decoration: none;
}

body.theme-dark .topbar {
  background: rgba(17, 24, 32, 0.94);
}

body.theme-dark .footer,
body.theme-dark .panel,
body.theme-dark .kpi-card,
body.theme-dark .login-panel,
body.theme-dark .modal-card,
body.theme-dark .quick-card,
body.theme-dark .list-item,
body.theme-dark .table-wrap,
body.theme-dark .document-preview,
body.theme-dark .status-tile,
body.theme-dark .summary-box,
body.theme-dark .user-pill {
  background: var(--surface);
  border-color: var(--line);
}

body.theme-dark .btn,
body.theme-dark .field input,
body.theme-dark .field select,
body.theme-dark .field textarea {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

body.theme-dark .btn:hover {
  background: #263545;
  border-color: #415369;
}

body.theme-dark th {
  background: #21303f;
  color: #c7d5e4;
}

body.theme-dark td {
  color: var(--ink);
}

body.theme-dark .empty-state,
body.theme-dark .license-panel {
  background: #151f2a;
  border-color: var(--line);
}

body.theme-dark .nav-item.active,
body.theme-dark .nav-parent.active {
  background: #e8f3ff;
  color: #075da9;
}

body.theme-dark .login-screen {
  background:
    linear-gradient(90deg, rgba(17, 24, 32, 0.96), rgba(17, 24, 32, 0.9)),
    url("assets/logo-as.jpeg") center/260px repeat;
}

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

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

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

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

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

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

.panel,
.kpi-card,
.login-panel,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(28, 39, 53, 0.06);
}

.panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.kpi-card {
  min-height: 112px;
  display: grid;
  gap: 10px;
  padding: 15px;
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #e6f2fd;
  color: var(--brand-strong);
}

.kpi-icon.teal {
  background: #ddf6f2;
  color: var(--teal);
}

.kpi-icon.green {
  background: #e7f7ed;
  color: var(--green);
}

.kpi-icon.amber {
  background: #fff2d9;
  color: var(--amber);
}

.kpi-icon.red {
  background: #fde8e7;
  color: var(--red);
}

.kpi-value {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.kpi-note {
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
}

.btn-row,
.filter-row,
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.btn {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  border-color: #b8c7d8;
  background: #f8fbff;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

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

.btn-primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn-green {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn-green:hover {
  background: #188447;
  border-color: #188447;
}

.btn-danger {
  background: #fff;
  border-color: #f0bfbd;
  color: var(--red);
}

.btn-danger:hover {
  background: #fff4f4;
}

.btn-ghost {
  background: transparent;
}

.btn-icon {
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.blue {
  background: #e6f2fd;
  color: var(--brand-strong);
  border-color: #cbe3f8;
}

.pill.green {
  background: #e8f7ed;
  color: #167740;
  border-color: #c7edd5;
}

.pill.amber {
  background: #fff2d9;
  color: #8c5400;
  border-color: #f4d89f;
}

.pill.red {
  background: #fde8e7;
  color: var(--red);
  border-color: #f3c6c3;
}

.pill.gray {
  background: #eef2f6;
  color: #4f5b67;
  border-color: #dae2ea;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1 1 210px;
}

.field label {
  color: #3b4653;
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cfd9e5;
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 9px 10px;
  outline: 0;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 112, 200, 0.14);
}

.field-help {
  color: var(--muted);
  font-size: 11px;
}

.field-inline {
  display: flex;
  align-items: end;
  gap: 8px;
}

.field-inline .field {
  flex: 1;
}

.form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-items: end;
}

.form-grid .field {
  flex: 1 1 210px;
  min-width: 180px;
}

.form-grid-compact .field {
  flex-basis: 240px;
}

.panel form > .grid-2,
.panel form > .grid-3 {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-items: end;
}

.panel form > .grid-2 .field,
.panel form > .grid-3 .field {
  flex: 1 1 205px;
  min-width: 180px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  background: #f3f7fa;
  color: #4d5c6d;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 900;
}

td {
  color: #25303c;
}

tr:last-child td {
  border-bottom: 0;
}

.td-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  min-width: 150px;
}

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

.strong {
  font-weight: 900;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #c9d5e2;
  border-radius: var(--radius);
  padding: 24px;
  background: #fbfdff;
}

.empty-state svg {
  width: 34px;
  height: 34px;
  margin: 0 auto 8px;
  color: #91a3b6;
}

.split {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: start;
}

.split > .panel:first-child,
.operation-form {
  flex: 1 1 500px;
  min-width: 360px;
}

.split > .panel:last-child,
.operation-list {
  flex: 1.35 1 620px;
  min-width: 0;
}

.operation-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
}

.admin-grid {
  align-items: start;
}

.license-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
  padding: 14px;
}

.license-copy {
  flex: 1 1 360px;
  min-width: 0;
}

.license-copy strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.license-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.license-meter {
  flex: 0 1 320px;
  height: 12px;
  border-radius: 999px;
  background: #dfe9f4;
  overflow: hidden;
}

.license-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--brand));
}

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

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.list-item-title {
  font-weight: 900;
}

.list-item-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.progress-stack {
  display: grid;
  gap: 8px;
}

.progress-row {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.progress-bar {
  height: 9px;
  border-radius: 999px;
  background: #e5ebf2;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  max-width: 360px;
  padding: 12px 14px;
  background: #142130;
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(14, 24, 38, 0.48);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 16px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(245, 247, 251, 0.94), rgba(245, 247, 251, 0.86)),
    url("assets/logo-as.jpeg") center/260px repeat;
}

.login-panel {
  width: min(430px, 100%);
  padding: 22px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.login-brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #fff;
}

.login-brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.login-brand p {
  margin: 2px 0 0;
  color: var(--muted);
}

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

.quick-card {
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  color: var(--ink);
  text-align: left;
}

.quick-card:hover {
  border-color: #b8c7d8;
  box-shadow: 0 10px 24px rgba(31, 45, 61, 0.08);
}

.quick-card svg {
  width: 26px;
  height: 26px;
  color: var(--brand-strong);
}

.quick-card strong {
  display: block;
  font-size: 13px;
}

.quick-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.document-preview {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
}

.doc-header {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border-bottom: 2px solid #52738d;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.doc-header img {
  width: 86px;
  height: 64px;
  object-fit: contain;
  border: 1px solid #dce6ee;
}

.doc-header h2 {
  margin: 0;
  color: var(--brand-strong);
  font-size: 25px;
}

.doc-header p {
  margin: 2px 0;
  color: #29465b;
  font-weight: 700;
}

.doc-box {
  border: 2px solid #52738d;
  min-height: 72px;
  padding: 10px 12px;
  margin-top: 8px;
}

.doc-warning {
  margin-top: 8px;
  border: 2px solid #52738d;
  padding: 10px;
  text-align: center;
  font-weight: 900;
  color: #0f70c8;
}

.doc-warning .red {
  color: #bf1e17;
}

.status-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.status-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  min-height: 84px;
}

.status-tile strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.status-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.summary-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.summary-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-box strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.swatch-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 1180px) {
  .grid-4,
  .kpi-grid,
  .quick-actions,
  .report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .split {
    flex-direction: column;
  }

  .split > .panel:first-child,
  .split > .panel:last-child,
  .operation-form,
  .operation-list {
    width: 100%;
    min-width: 0;
  }

  .span-2,
  .span-3 {
    grid-column: auto;
  }
}

@media (max-width: 860px) {
  :root {
    --topbar: 64px;
  }

  .app-shell {
    display: block;
    padding-bottom: 72px;
  }

  .app-shell.sidebar-collapsed .brand-block {
    grid-template-columns: 50px minmax(0, 1fr);
    justify-items: stretch;
    padding: 14px 18px;
  }

  .app-shell.sidebar-collapsed .brand-block > div,
  .app-shell.sidebar-collapsed .nav-group-label,
  .app-shell.sidebar-collapsed .nav-item span,
  .app-shell.sidebar-collapsed .nav-parent span,
  .app-shell.sidebar-collapsed .nav-parent svg:last-child,
  .app-shell.sidebar-collapsed .sidebar-footer {
    display: block;
  }

  .app-shell.sidebar-collapsed .nav-children {
    display: grid;
  }

  .app-shell.sidebar-collapsed .nav-item,
  .app-shell.sidebar-collapsed .nav-parent {
    grid-template-columns: 24px minmax(0, 1fr) 18px;
    justify-items: stretch;
    padding: 9px 10px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .app-shell.menu-open .sidebar {
    transform: translateX(0);
  }

  .main {
    min-height: 100vh;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 10px 14px;
  }

  .mobile-menu,
  .btn.mobile-menu {
    display: inline-flex;
  }

  .page-heading h1 {
    font-size: 18px;
  }

  .page-heading p,
  .user-pill,
  .top-actions .desktop-only {
    display: none;
  }

  .content {
    padding: 14px;
  }

  .footer {
    padding: 12px 14px 18px;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .kpi-grid,
  .quick-actions,
  .report-summary,
  .status-board {
    grid-template-columns: 1fr;
  }

  .panel form > .grid-2,
  .panel form > .grid-3,
  .form-grid,
  .license-panel {
    display: grid;
    grid-template-columns: 1fr;
  }

  .form-grid .field,
  .panel form > .grid-2 .field,
  .panel form > .grid-3 .field {
    min-width: 0;
  }

  .panel {
    padding: 13px;
  }

  .panel-head {
    display: grid;
  }

  .btn {
    min-height: 40px;
  }

  .btn-row,
  .filter-row,
  .form-actions {
    align-items: stretch;
  }

  .filter-row .field,
  .filter-row .btn,
  .form-actions .btn {
    flex: 1 1 100%;
  }

  .list-item {
    grid-template-columns: 1fr;
  }

  .td-actions {
    min-width: 132px;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(31, 45, 61, 0.1);
    padding: 5px 4px max(5px, env(safe-area-inset-bottom));
  }

  .mobile-bottom-nav button {
    min-height: 54px;
    border: 0;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 800;
  }

  .mobile-bottom-nav svg {
    width: 20px;
    height: 20px;
  }

  .mobile-bottom-nav button.active {
    color: var(--brand-strong);
  }
}

@media (max-width: 460px) {
  body {
    font-size: 13px;
  }

  .content {
    padding: 10px;
  }

  .kpi-value {
    font-size: 24px;
  }

  .doc-header {
    grid-template-columns: 1fr;
  }

  .doc-header img {
    width: 76px;
    height: 58px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .footer,
  .mobile-bottom-nav,
  .no-print {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
  }

  .content {
    padding: 0;
  }

  .panel,
  .document-preview,
  .table-wrap {
    border: 0;
    box-shadow: none;
  }
}
