:root {
  color-scheme: light;
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --surface-strong: #eef3f7;
  --sidebar: #202833;
  --sidebar-2: #2a3442;
  --text: #17212f;
  --muted: #647184;
  --muted-2: #8a95a5;
  --line: #d7dde5;
  --line-soft: #e8edf2;
  --green: #16825c;
  --blue: #2367b1;
  --amber: #a86912;
  --red: #b93832;
  --violet: #6a5fb8;
  --teal: #0f766e;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 26px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.06);
  --radius: 8px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 220px),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid #1f5fa5;
  background: linear-gradient(180deg, #2b73bd, #1f5fa5);
  color: #fff;
  border-radius: var(--radius-sm);
  min-height: 34px;
  padding: 7px 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

button:hover {
  border-color: #1b528d;
  box-shadow: 0 3px 10px rgba(31, 95, 165, 0.18);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(35, 103, 177, 0.18);
  outline-offset: 2px;
}

.ghost {
  background: #fff;
  color: #253044;
  border-color: var(--line);
  box-shadow: none;
}

.ghost:hover {
  background: var(--surface-soft);
  border-color: #bdc7d4;
  box-shadow: var(--shadow-soft);
}

.ghost.danger {
  border-color: #efc1bd;
  color: var(--red);
}

.ghost.danger:hover {
  background: #fff0ef;
  border-color: #df8b84;
}

.icon-btn {
  width: 34px;
  padding: 0;
  background: #fff;
  color: #253044;
  border-color: var(--line);
  font-size: 22px;
  line-height: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 12px;
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #dce5ef;
}

.sidebar nav {
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
}

.brand {
  min-height: 72px;
  padding: 8px 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand strong {
  display: block;
  font-size: 19px;
  letter-spacing: 0;
  color: #fff;
}

.brand span {
  display: block;
  margin-top: 6px;
  color: #aeb9c8;
  font-size: 12px;
}

.mobile-menu-toggle,
.mobile-menu-actions {
  display: none;
}

.subtitle,
.eyebrow,
.muted,
td small {
  color: var(--muted);
}

nav {
  display: grid;
  gap: 4px;
}

.nav-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 38px;
  gap: 10px;
  background: transparent;
  color: #cbd5e1;
  border-color: transparent;
  text-align: left;
  box-shadow: none;
  padding: 8px 10px;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.nav-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-btn small {
  color: #8ea0b6;
  font-size: 11px;
  font-weight: 700;
}

.nav-btn.active {
  background: #ffffff;
  border-color: #ffffff;
  color: #1f3f66;
}

.nav-btn.active small {
  color: var(--blue);
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 10px;
  background: var(--sidebar-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.sidebar-foot span {
  color: #aeb9c8;
}

.sidebar-foot strong {
  color: #fff;
}

.app {
  min-width: 0;
  padding: 22px 24px 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 2px 0 4px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 800;
  color: #111827;
}

h2 {
  font-size: 16px;
  line-height: 1.35;
  font-weight: 800;
  color: #1f2937;
}

h3 {
  font-size: 14px;
  line-height: 1.35;
  font-weight: 800;
}

.eyebrow {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--teal);
}

.subtitle {
  margin-top: 6px;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.auth-required {
  display: block;
  min-height: 100vh;
}

.auth-required .sidebar,
.auth-required .app {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(32, 40, 51, 0.94), rgba(31, 95, 165, 0.86)),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.login-card label {
  display: grid;
  gap: 7px;
  color: #435166;
  font-size: 12px;
  font-weight: 800;
}

.login-card input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.login-card small {
  color: var(--muted);
  line-height: 1.6;
}

.login-error {
  padding: 10px 12px;
  border: 1px solid #efc1bd;
  border-radius: var(--radius-sm);
  background: #fff0ef;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  max-width: 260px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #435166;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.panel,
.kpi,
.mini-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.kpi {
  position: relative;
  padding: 15px 16px;
  min-height: 106px;
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--blue);
}

.kpi:nth-child(2)::before {
  background: var(--teal);
}

.kpi:nth-child(3)::before {
  background: var(--green);
}

.kpi:nth-child(4)::before {
  background: var(--amber);
}

.kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.12;
  color: #101828;
}

.kpi small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  padding: 15px;
  margin-bottom: 12px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

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

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

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

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

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 840px;
  background: #fff;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #435166;
  background: #f2f5f8;
  font-weight: 800;
  white-space: nowrap;
}

td {
  color: #202b3a;
}

tbody tr:nth-child(even) td {
  background: #fbfcfd;
}

tbody tr:hover td {
  background: #f4f8fb;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #3b4656;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.green {
  color: var(--green);
  background: #edf8f3;
  border-color: #b9dfcf;
}

.status.blue {
  color: var(--blue);
  background: #edf5ff;
  border-color: #bdd5f0;
}

.status.amber {
  color: var(--amber);
  background: #fff7e8;
  border-color: #efd49e;
}

.status.red {
  color: var(--red);
  background: #fff0ef;
  border-color: #efc1bd;
}

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

.toolbar input,
.toolbar select {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #253044;
}

.toolbar input::placeholder {
  color: var(--muted-2);
}

.mini-card {
  padding: 13px 14px;
  min-height: 104px;
}

.mini-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.mini-card strong {
  display: block;
  margin-top: 7px;
  font-size: 20px;
  line-height: 1.2;
  color: #101828;
}

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

.process-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: start;
  min-height: 88px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.process-step > strong,
.process-line > strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: #e8f2ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.process-step p,
.process-line p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.process-step.pending > strong {
  background: #fff4df;
  color: var(--amber);
}

.process-list {
  display: grid;
  gap: 10px;
}

.process-line {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.nas-source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.nas-source-tabs button {
  display: inline-grid;
  gap: 2px;
  justify-items: start;
}

.nas-source-tabs small {
  color: inherit;
  opacity: 0.72;
  font-size: 11px;
}

.nas-source-toolbar {
  margin-bottom: 12px;
  justify-content: space-between;
}

.nas-tree {
  display: grid;
  gap: 8px;
}

.nas-tree-node {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.nas-tree-node summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  list-style-position: inside;
}

.nas-tree-node summary strong,
.nas-tree-node summary small {
  display: block;
}

.nas-select {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nas-select input {
  margin: 0;
}

.nas-tree-node summary small,
.nas-tree-meta {
  color: var(--muted);
  font-size: 12px;
}

.nas-tree-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
  align-items: center;
}

.nas-tree-meta {
  padding: 0 12px 10px 28px;
}

.nas-tree-children {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px 24px;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: min(720px, calc(100vw - 48px));
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #253044;
}

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

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #253044;
  font-size: 12px;
  font-weight: 700;
}

.check-item input {
  width: auto;
  min-height: 0;
  margin: 0;
}

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
  padding: 18px;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
}

.chart-list {
  display: grid;
  gap: 10px;
}

.chart-row {
  display: grid;
  grid-template-columns: 120px 1fr 88px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

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

.bar i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.amount-positive {
  color: var(--green) !important;
  font-weight: 800;
}

.amount-negative {
  color: var(--red) !important;
  font-weight: 800;
}

.ledger-groups,
.ledger-months {
  display: grid;
  gap: 10px;
}

.ledger-group,
.ledger-month {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.ledger-month {
  margin: 10px;
  background: var(--surface-soft);
}

.ledger-group > summary,
.ledger-month > summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
}

.ledger-group > summary {
  background: #f2f5f8;
}

.ledger-month > summary {
  background: #f8fafc;
}

.ledger-group > summary:hover,
.ledger-month > summary:hover {
  background: #edf3f8;
}

.ledger-group > summary::-webkit-details-marker,
.ledger-month > summary::-webkit-details-marker {
  display: none;
}

.ledger-group > summary strong,
.ledger-month > summary strong {
  color: #1f2937;
}

.ledger-group > summary span,
.ledger-month > summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.empty {
  color: var(--muted);
  padding: 14px 16px;
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}

.nested-panel {
  margin-top: 12px;
  margin-bottom: 12px;
  box-shadow: none;
}

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

.workflow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.workflow-step > strong {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: #3b4656;
  font-size: 12px;
}

.workflow-step.green > strong {
  background: var(--green);
}

.workflow-step.blue > strong {
  background: var(--blue);
}

.workflow-step.amber > strong {
  background: var(--amber);
}

.workflow-step.red > strong {
  background: var(--red);
}

.workflow-step p {
  margin: 5px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.workflow-step button {
  min-height: 30px;
  padding: 5px 9px;
}

.gantt {
  display: grid;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.gantt-scale,
.gantt-row {
  display: grid;
  grid-template-columns: 190px minmax(620px, 1fr);
  gap: 12px;
  align-items: center;
}

.gantt-scale {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.gantt-scale::before {
  content: "任务";
}

.gantt-scale span {
  display: inline-block;
  min-width: 50px;
}

.gantt-scale > span,
.gantt-track {
  position: relative;
}

.gantt-scale {
  grid-template-columns: 190px minmax(620px, 1fr);
}

.gantt-scale span {
  margin-right: 18px;
}

.gantt-label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.gantt-label strong {
  overflow: hidden;
  color: #1f2937;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-label span {
  color: var(--muted);
  font-size: 11px;
}

.gantt-track {
  height: 32px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(90deg, #f8fafc 0, #f8fafc 49px, #eef2f6 50px),
    #f8fafc;
}

.gantt-bar {
  position: absolute;
  top: 5px;
  height: 20px;
  min-height: 20px;
  overflow: hidden;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: none;
  font-size: 11px;
  line-height: 20px;
}

.gantt-bar.green {
  background: var(--green);
}

.gantt-bar.amber {
  background: var(--amber);
}

.gantt-bar.red {
  background: var(--red);
}

.gantt-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(255, 255, 255, 0.28);
}

.gantt-bar span {
  position: relative;
  z-index: 1;
}

@media (max-width: 1120px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

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

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

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

  .span-7,
  .span-5,
  .span-6 {
    grid-column: span 12;
  }
}

@media (max-width: 680px) {
  html {
    scroll-padding-top: 128px;
    -webkit-text-size-adjust: 100%;
  }

  body {
    font-size: 15px;
    background: var(--bg);
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    max-height: 100vh;
    overflow-y: auto;
    gap: 12px;
    padding: 12px 12px 10px;
    border-right: 0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  }

  .brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: auto;
    padding: 2px 2px 2px;
    flex-wrap: wrap;
  }

  .brand strong {
    font-size: 20px;
    line-height: 1.15;
  }

  .brand span {
    flex-basis: 100%;
    margin-top: 2px;
    text-align: left;
    font-size: 12px;
    line-height: 1.2;
  }

  .mobile-menu-toggle {
    display: inline-grid;
    place-items: center;
    width: 42px;
    min-height: 38px;
    padding: 0;
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 24px;
    box-shadow: none;
  }

  .sidebar nav {
    display: none;
    grid-template-columns: 1fr;
    gap: 8px;
    overflow: visible;
    padding: 8px 0 0;
  }

  .sidebar.nav-open nav,
  .sidebar.nav-open .mobile-menu-actions {
    display: grid;
  }

  .nav-btn {
    width: 100%;
    min-height: 42px;
    justify-content: space-between;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
  }

  .nav-btn small {
    display: none;
  }

  .nav-btn span {
    max-width: none;
  }

  .sidebar-foot {
    display: none;
  }

  .mobile-menu-actions {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .mobile-menu-actions .user-chip {
    width: 100%;
    max-width: none;
    justify-content: center;
  }

  .app {
    padding: 14px 10px 24px;
  }

  .topbar {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
  }

  .top-actions {
    display: none;
  }

  .top-actions button,
  .toolbar button,
  menu button,
  .login-card button {
    min-height: 44px;
  }

  .top-actions .user-chip {
    grid-column: 1 / -1;
    max-width: none;
    width: 100%;
    min-height: 38px;
    justify-content: center;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 18px;
  }

  h3 {
    font-size: 15px;
  }

  .subtitle,
  .panel-head p,
  .mini-card p,
  .process-step p,
  .process-line p {
    font-size: 13px;
  }

  .kpi-grid,
  .module-grid,
  .process-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .panel,
  .kpi,
  .mini-card {
    border-radius: var(--radius-sm);
  }

  .kpi {
    min-height: auto;
    padding: 16px;
  }

  .kpi strong {
    font-size: 26px;
  }

  .panel {
    padding: 14px;
    margin-bottom: 12px;
  }

  .panel-head {
    display: block;
    margin-bottom: 10px;
    padding-bottom: 9px;
  }

  .panel-head .toolbar {
    margin-top: 10px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .toolbar input,
  .toolbar select,
  .toolbar button {
    width: 100%;
    min-width: 0;
  }

  .layout {
    gap: 10px;
  }

  .workflow-steps {
    grid-template-columns: 1fr;
  }

  .workflow-step {
    min-height: auto;
  }

  .gantt-scale,
  .gantt-row {
    grid-template-columns: 124px minmax(420px, 1fr);
    gap: 8px;
  }

  .gantt-scale {
    grid-template-columns: 124px minmax(420px, 1fr);
  }

  .gantt-label strong {
    white-space: normal;
  }

  .span-7,
  .span-5,
  .span-6 {
    grid-column: 1 / -1;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table {
    display: block;
    min-width: 0;
    background: transparent;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    display: grid;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: var(--shadow-soft);
  }

  td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-height: 42px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 14px;
    word-break: break-word;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
    white-space: normal;
    font-size: 12px;
  }

  tbody tr:nth-child(even) td,
  tbody tr:hover td {
    background: #fff;
  }

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

  td button {
    margin: 0 6px 6px 0;
    min-height: 36px;
    padding: 7px 10px;
  }

  .status {
    width: fit-content;
    max-width: 100%;
  }

  .ledger-month {
    margin: 8px;
  }

  .ledger-group > summary,
  .ledger-month > summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 12px;
  }

  .chart-row {
    grid-template-columns: 92px 1fr 72px;
  }

  .login-screen {
    padding: 14px;
  }

  .login-card {
    padding: 20px;
  }

  dialog {
    width: calc(100vw - 18px);
    max-width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
    padding: 14px;
  }

  .dialog-head {
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .form-grid {
    min-width: 0;
    gap: 10px;
  }

  menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .top-actions {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .brand {
    align-items: start;
  }

  .brand span {
    max-width: 128px;
  }

  td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  td::before {
    font-size: 11px;
  }

  .chart-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

html.mobile-ui {
  scroll-padding-top: 128px;
  -webkit-text-size-adjust: 100%;
}

html.mobile-ui body {
  display: block;
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  font-size: 15px;
}

html.mobile-ui .sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: auto;
  max-height: 100vh;
  overflow-y: auto;
  gap: 12px;
  padding: 12px 12px 10px;
  border-right: 0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

html.mobile-ui .brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: auto;
  padding: 2px 2px;
  flex-wrap: wrap;
}

html.mobile-ui .brand strong {
  font-size: 20px;
  line-height: 1.15;
}

html.mobile-ui .brand span {
  flex-basis: 100%;
  margin-top: 2px;
  text-align: left;
  font-size: 12px;
  line-height: 1.2;
}

html.mobile-ui .mobile-menu-toggle {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-height: 38px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  box-shadow: none;
}

html.mobile-ui .sidebar nav {
  display: none;
  grid-template-columns: none;
  gap: 8px;
  overflow: visible;
  padding: 8px 0 0;
}

html.mobile-ui .sidebar.nav-open nav,
html.mobile-ui .sidebar.nav-open .mobile-menu-actions {
  display: grid;
}

html.mobile-ui .mobile-menu-actions {
  grid-template-columns: 1fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

html.mobile-ui .mobile-menu-actions .user-chip {
  width: 100%;
  max-width: none;
  justify-content: center;
}

html.mobile-ui .nav-btn {
  width: 100%;
  min-width: auto;
  min-height: 42px;
  justify-content: space-between;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

html.mobile-ui .nav-btn span {
  max-width: none;
}

html.mobile-ui .nav-btn small,
html.mobile-ui .sidebar-foot {
  display: none;
}

html.mobile-ui .app {
  min-width: 0;
  padding: 14px 10px 24px;
}

html.mobile-ui .topbar {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

html.mobile-ui .top-actions {
  display: none;
}

html.mobile-ui .top-actions .user-chip {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  min-height: 38px;
  justify-content: center;
}

html.mobile-ui .top-actions button,
html.mobile-ui .toolbar button,
html.mobile-ui menu button,
html.mobile-ui .login-card button {
  min-height: 44px;
}

html.mobile-ui h1 {
  font-size: 22px;
}

html.mobile-ui h2 {
  font-size: 18px;
}

html.mobile-ui h3 {
  font-size: 15px;
}

html.mobile-ui .subtitle,
html.mobile-ui .panel-head p,
html.mobile-ui .mini-card p,
html.mobile-ui .process-step p,
html.mobile-ui .process-line p {
  font-size: 13px;
}

html.mobile-ui .layout,
html.mobile-ui .kpi-grid,
html.mobile-ui .module-grid,
html.mobile-ui .process-grid,
html.mobile-ui .form-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

html.mobile-ui .workflow-steps {
  grid-template-columns: 1fr;
}

html.mobile-ui .workflow-step {
  min-height: auto;
}

html.mobile-ui .gantt-scale,
html.mobile-ui .gantt-row {
  grid-template-columns: 124px minmax(420px, 1fr);
  gap: 8px;
}

html.mobile-ui .gantt-scale {
  grid-template-columns: 124px minmax(420px, 1fr);
}

html.mobile-ui .gantt-label strong {
  white-space: normal;
}

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

html.mobile-ui .span-7,
html.mobile-ui .span-5,
html.mobile-ui .span-6 {
  grid-column: 1 / -1;
}

html.mobile-ui .panel {
  padding: 14px;
  margin-bottom: 12px;
}

html.mobile-ui .kpi {
  min-height: auto;
  padding: 16px;
}

html.mobile-ui .kpi strong {
  font-size: 26px;
}

html.mobile-ui .panel-head {
  display: block;
  margin-bottom: 10px;
  padding-bottom: 9px;
}

html.mobile-ui .panel-head .toolbar {
  margin-top: 10px;
}

html.mobile-ui .toolbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
}

html.mobile-ui .toolbar input,
html.mobile-ui .toolbar select,
html.mobile-ui .toolbar button {
  width: 100%;
  min-width: 0;
}

html.mobile-ui .table-wrap {
  overflow: visible;
  border: 0;
  background: transparent;
}

html.mobile-ui table {
  display: block;
  min-width: 0;
  background: transparent;
}

html.mobile-ui thead {
  display: none;
}

html.mobile-ui tbody {
  display: grid;
  gap: 10px;
}

html.mobile-ui tr {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

html.mobile-ui td {
  display: grid;
  grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 42px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
  word-break: break-word;
}

html.mobile-ui td::before {
  content: attr(data-label);
  color: var(--muted);
  font-weight: 800;
  white-space: normal;
  font-size: 12px;
}

html.mobile-ui tbody tr:nth-child(even) td,
html.mobile-ui tbody tr:hover td {
  background: #fff;
}

html.mobile-ui td:last-child {
  border-bottom: 0;
}

html.mobile-ui td button {
  margin: 0 6px 6px 0;
  min-height: 36px;
  padding: 7px 10px;
}

html.mobile-ui .ledger-month {
  margin: 8px;
}

html.mobile-ui .ledger-group > summary,
html.mobile-ui .ledger-month > summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 10px 12px;
}

html.mobile-ui dialog {
  width: calc(100vw - 18px);
  max-width: calc(100vw - 18px);
  max-height: calc(100vh - 18px);
  padding: 14px;
}

html.mobile-ui .form-grid {
  min-width: 0;
}

html.mobile-ui menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
