:root {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #253247;
  background: #f3f6fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --sidebar: #24364b;
  --sidebar-deep: #1d2c3d;
  --sidebar-active: #1a2736;
  --blue: #2f8df6;
  --line: #dce3ed;
  --soft-line: #eef2f7;
  --surface: #ffffff;
  --text: #253247;
  --muted: #778397;
  --green: #67c23a;
  --red: #f56c6c;
  --orange: #e6a23c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  background: #f3f6fb;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: #edf2f8;
}

.auth-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 24px;
  padding: 36px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(34, 55, 82, 0.14);
}

.auth-brand {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #24364b;
  border-radius: 6px;
  font-size: 28px;
  font-weight: 900;
}

.auth-kicker {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.auth-panel h1 {
  margin: 8px 0;
  font-size: 24px;
}

.auth-panel p,
.auth-panel small {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  font-size: 14px;
}

.auth-form input,
.auth-form button {
  height: 42px;
}

.auth-error {
  padding: 10px 12px;
  color: #b63b3b;
  background: #fff1f1;
  border: 1px solid #ffd2d2;
  border-radius: 4px;
  font-size: 13px;
}

.permission-fieldset {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.permission-fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.permission-fieldset input {
  width: 16px;
  height: 16px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select {
  height: 34px;
  border: 1px solid #ccd6e2;
  border-radius: 4px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input::placeholder {
  color: #b3bdca;
}

.backend-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 200px minmax(980px, 1fr);
}

.backend-sidebar {
  background: var(--sidebar);
  color: #f3f8ff;
  min-height: 100vh;
  box-shadow: 2px 0 10px rgba(20, 38, 60, 0.16);
}

.backend-logo {
  height: 58px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.module-menu {
  padding: 8px 0 20px;
}

.menu-group {
  margin: 0;
}

.menu-group-title,
.submenu-item {
  width: 100%;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.menu-group-title {
  min-height: 52px;
  display: grid;
  grid-template-columns: 28px 1fr 18px;
  align-items: center;
  padding: 0 16px;
  font-weight: 800;
  border-left: 4px solid transparent;
}

.menu-group-title:hover,
.menu-group-title.is-active,
.menu-group:has(.submenu-item.is-active) .menu-group-title {
  background: var(--sidebar-active);
}

.menu-group-title.is-active,
.menu-group:has(.submenu-item.is-active) .menu-group-title {
  border-left-color: #4a9eff;
}

.menu-group-title small {
  color: #9fb0c4;
}

.submenu {
  display: grid;
  background: var(--sidebar-deep);
}

.menu-group.is-collapsed .submenu {
  display: none;
}

.menu-group.is-direct .menu-group-title {
  grid-template-columns: 28px 1fr;
}

.submenu-item {
  min-height: 48px;
  padding: 0 18px 0 50px;
  color: #cbd7e5;
}

.submenu-item.is-active {
  color: #4aa0ff;
  background: #1a2533;
  border-left: 4px solid #2f8df6;
  padding-left: 46px;
}

.backend-main {
  min-width: 0;
}

.backend-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(25, 42, 64, 0.08);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #7a8797;
  font-size: 14px;
}

.breadcrumb strong {
  color: #3d4b61;
}

.fold-button,
.header-tools button,
.round-tools button,
.pagination button {
  border: 0;
  background: transparent;
  color: #5c6878;
}

.fold-button {
  font-size: 20px;
  padding: 0 8px 0 0;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-tools button {
  position: relative;
  font-size: 18px;
}

.header-tools button[data-global-action] {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  background: #fff;
  color: #526174;
  font-size: 13px;
  font-weight: 800;
}

.toast {
  max-width: 360px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #b3d8ff;
  border-radius: 4px;
  padding: 0 12px;
  color: #1d6fc8;
  background: #ecf5ff;
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-tools em {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f45b5b;
  color: white;
  font-size: 10px;
  font-style: normal;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #d8e1eb !important;
  color: #4e5e72 !important;
  font-size: 14px !important;
}

.module-page {
  padding: 8px;
}

.filter-card,
.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  margin-bottom: 12px;
}

.filter-card {
  padding: 12px 16px;
}

.table-empty {
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 28px;
}

.filter-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #2e3d52;
  font-weight: 800;
  font-size: 14px;
}

.filter-row input {
  width: 240px;
}

.blue-button,
.plain-button,
.blue-soft,
.green-soft,
.red-soft {
  min-height: 32px;
  border-radius: 4px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 800;
}

.blue-button {
  background: var(--blue);
  color: #fff;
}

.plain-button {
  background: #fff;
  border-color: var(--line);
  color: #5b6676;
}

.blue-soft {
  color: #409eff;
  background: #ecf5ff;
  border-color: #b3d8ff;
}

.green-soft {
  color: #67c23a;
  background: #f0f9eb;
  border-color: #c2e7b0;
}

.red-soft {
  color: #f56c6c;
  background: #fef0f0;
  border-color: #fbc4c4;
}

.toolbar {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.toolbar > div {
  display: flex;
  gap: 10px;
}

.selection-hint {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  color: #718095;
  background: #fbfcfe;
  font-size: 13px;
}

.selection-hint.is-active {
  color: #2d6fab;
  background: #eef7ff;
}

.selection-hint strong {
  color: #1f77d0;
}

.selection-hint button {
  min-height: 26px;
  border: 1px solid #b3d8ff;
  border-radius: 4px;
  padding: 0 10px;
  color: #2f8df6;
  background: #fff;
  font-weight: 800;
}

.round-tools button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
}

.table-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 0;
}

.table-title-line h1 {
  margin: 0;
  font-size: 16px;
  color: #27364a;
}

.table-title-line span {
  color: var(--muted);
  font-size: 13px;
}

.backend-table {
  display: grid;
  padding: 14px 20px 8px;
  overflow-x: auto;
}

.backend-tr {
  min-width: 1120px;
  display: grid;
  align-items: center;
  border-bottom: 1px solid var(--soft-line);
}

.backend-table.is-selectable .backend-tr {
  grid-template-columns: 44px repeat(var(--cols), minmax(104px, 1fr));
}

.backend-table.is-readonly .backend-tr {
  grid-template-columns: repeat(var(--cols), minmax(112px, 1fr));
}

.backend-tr > span {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 7px 8px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.entity-cell {
  display: grid;
  gap: 2px;
}

.entity-cell strong {
  color: #27364a;
  font-size: 13px;
}

.entity-cell small {
  color: var(--muted);
  font-size: 12px;
}

.backend-th {
  background: #f6f8fb;
  color: #2f3e54;
  font-weight: 900;
}

.backend-th > span {
  min-height: 40px;
}

.status-badge {
  min-width: 26px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 4px;
  font-style: normal;
  font-size: 12px;
}

.status-badge.success {
  color: #2f8f23;
  background: #eff9eb;
  border: 1px solid #d4efc7;
}

.status-badge.warning,
.status-badge.info {
  color: #ad711b;
  background: #fdf6ec;
  border: 1px solid #f5dab1;
}

.status-badge.danger {
  color: #d84a4a;
  background: #fef0f0;
  border: 1px solid #fbc4c4;
}

.link-action {
  border: 0;
  background: transparent;
  color: #409eff;
  padding: 0 6px 0 0;
}

.link-action.danger {
  color: #f56c6c;
}

.backend-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
}

.pagination {
  min-height: 58px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 0 20px 12px;
  color: #606b7a;
  font-size: 13px;
}

.pagination select {
  width: 120px;
}

.pagination button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
}

.pagination .page-current {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.pagination input {
  width: 56px;
  text-align: center;
}

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

.backend-kpi {
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 18px;
}

button.backend-kpi {
  cursor: pointer;
}

button.backend-kpi:hover {
  border-color: #9dccff;
  box-shadow: 0 8px 20px rgba(47, 141, 246, 0.12);
}

.backend-kpi span {
  color: #66768a;
  font-weight: 800;
}

.backend-kpi strong {
  display: block;
  font-size: 30px;
  margin: 8px 0;
}

.backend-kpi small {
  color: #8a96a7;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 28, 42, 0.38);
}

.modal {
  width: min(760px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 54px rgba(18, 35, 58, 0.28);
}

.modal-header {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
  color: #253247;
}

.modal-header button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #f2f5f9;
  color: #68778a;
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  padding: 20px;
}

.form-grid label {
  display: grid;
  gap: 8px;
  color: #33445b;
  font-size: 13px;
  font-weight: 800;
}

.form-grid input,
.form-grid select {
  width: 100%;
}

.form-grid input:disabled {
  color: #7f8da0;
  background: #f5f7fa;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.detail-list {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0;
  margin: 0;
  padding: 18px 20px;
}

.detail-list dt,
.detail-list dd {
  min-height: 40px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--soft-line);
  margin: 0;
  line-height: 1.5;
}

.detail-list dt {
  color: #6d7b8d;
  font-weight: 900;
}

.detail-list dd {
  color: #26364b;
  overflow-wrap: anywhere;
}

.ledger-list {
  margin: 0 20px 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.ledger-list h3 {
  margin: 0;
  padding: 10px 12px;
  color: #304158;
  background: #f6f8fb;
  font-size: 14px;
}

.ledger-list div {
  min-height: 38px;
  display: grid;
  grid-template-columns: 1fr 90px 90px;
  align-items: center;
  border-top: 1px solid var(--soft-line);
  padding: 0 12px;
  font-size: 13px;
}

.ledger-list strong {
  color: #253247;
}

.ledger-list em {
  color: #66768a;
  font-style: normal;
}

@media (max-width: 1180px) {
  body {
    min-width: 1000px;
  }

  .backend-shell {
    grid-template-columns: 188px minmax(812px, 1fr);
  }
}
