.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.setting-panel { min-width: 0; }
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #e3e8f3;
  --text: #1f2a44;
  --muted: #6b7890;
  --primary: #1d5fd3;
  --primary-deep: #143f92;
  --primary-soft: #eaf2ff;
  --success: #26a269;
  --success-soft: #eaf8ef;
  --warn: #e08a00;
  --warn-soft: #fff4e1;
  --danger: #e05050;
  --danger-soft: #fcecec;
  --shadow: 0 8px 24px rgba(31, 42, 68, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

body {
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

#app {
  min-height: 100vh;
}

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

.sidebar {
  background: linear-gradient(180deg, #143b7d 0%, #0d254f 100%);
  color: #dbe7ff;
  padding: 14px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.13);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  line-height: 1.15;
  color: #fff;
}

.brand p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav svg,
.toolbar-btn svg,
.btn svg,
.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.footer-company {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.35;
}

.workspace {
  min-width: 0;
  padding: 10px;
}

.topbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 10px;
  z-index: 4;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

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

.page-title h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  white-space: nowrap;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #dbe7ff;
  color: #2f4ea8;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.page {
  margin-top: 10px;
  display: grid;
  gap: 12px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 4px 0;
}

.page-head h1,
.page-head h2 {
  margin: 0;
  font-size: 22px;
}

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

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

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  min-width: 0;
}

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

.kpi .value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
}

.kpi .suffix {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.kpi .foot {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.kpi.primary {
  background: linear-gradient(180deg, #edf4ff 0%, #ffffff 100%);
}

.kpi.success {
  background: linear-gradient(180deg, #effaf3 0%, #ffffff 100%);
}

.kpi.warn {
  background: linear-gradient(180deg, #fff7eb 0%, #ffffff 100%);
}

.kpi.danger {
  background: linear-gradient(180deg, #fdf0f0 0%, #ffffff 100%);
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  min-width: 0;
}

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

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

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

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

.flow-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 10px;
  background: #fbfcff;
}

.flow-item .step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
}

.flow-item .title {
  margin-top: 8px;
  font-weight: 700;
}

.flow-item .desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.stack {
  display: grid;
  gap: 10px;
}

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

.progress-row .row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.progress {
  height: 10px;
  background: #edf1f8;
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.progress > span.green {
  background: #20a55c;
}

.progress > span.orange {
  background: #f4a11a;
}

.progress > span.purple {
  background: #7a55d6;
}

.progress > span.cyan {
  background: #2c9ff5;
}

.progress > span.red {
  background: #e25555;
}

.chart-wrap {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.donut {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(
    #7c58e6 0 22%,
    #f0b02c 22% 39%,
    #29a15e 39% 57%,
    #2c8cf4 57% 78%,
    #ea6a6a 78% 100%
  );
  position: relative;
  margin: 0 auto;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 28px;
  background: #fff;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line);
}

.legend {
  display: grid;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.dashboard-process {
  min-height: 218px;
}

.dashboard-bottom .panel {
  min-height: 268px;
}

.dashboard-detail-table {
  min-width: 0;
}

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

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

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

.table-wrap {
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  background: #fff;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f8faff;
  color: #57637f;
  font-weight: 700;
}

tbody tr:hover {
  background: #fafcff;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.active,
.status.approved,
.status.normal {
  background: var(--success-soft);
  color: var(--success);
}

.status.pending,
.status.intern {
  background: var(--warn-soft);
  color: var(--warn);
}

.status.rejected,
.status.inactive,
.status.leave {
  background: var(--danger-soft);
  color: var(--danger);
}

.status.locked {
  background: #edf1ff;
  color: #4258b8;
}

.btn-row,
.toolbar,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn,
.toolbar-btn,
.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

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

.btn.success {
  background: #26a269;
  color: #fff;
  border-color: #26a269;
}

.btn.danger {
  background: #e55c5c;
  color: #fff;
  border-color: #e55c5c;
}

.btn.ghost,
.toolbar-btn.ghost {
  background: transparent;
}

.btn.small,
.toolbar-btn.small,
.icon-btn.small {
  padding: 6px 9px;
  font-size: 12px;
}

.btn:hover,
.toolbar-btn:hover,
.icon-btn:hover {
  border-color: #c7d2ea;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  color: var(--ink);
}
.check-item input { width: auto; }
.field-wide { grid-column: 1 / -1; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

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

.field label {
  color: var(--muted);
  font-size: 12px;
}

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

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

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

.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
}

.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 12px;
}

.detail-box {
  display: grid;
  gap: 10px;
}

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

.mini-card {
  border: 1px solid var(--line);
  background: #fbfcff;
  border-radius: 8px;
  padding: 10px;
}

.mini-card .k {
  font-size: 12px;
  color: var(--muted);
}

.mini-card .v {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 700;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top left, #edf4ff 0, #f5f7fb 42%, #eef2f8 100%);
  padding: 24px;
}

.login-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-hero {
  padding: 38px;
  background: linear-gradient(180deg, #1c4fae 0%, #12306f 100%);
  color: #fff;
  display: grid;
  gap: 16px;
}

.login-system-chip {
  width: 100%;
  max-width: 548px;
  min-height: 70px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 28px;
}

.login-system-chip span {
  font-size: 14px;
  line-height: 1.25;
  opacity: 0.92;
}

.login-system-chip strong {
  font-size: 18px;
  line-height: 1.25;
}

.login-hero h1 {
  margin: 0;
  font-size: 30px;
}

.login-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.75;
}

.login-features {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.login-feature {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.login-form {
  padding: 38px;
  display: grid;
  align-content: center;
  gap: 16px;
}

.login-form h2 {
  margin: 0;
  font-size: 22px;
}

.login-grid {
  display: grid;
  gap: 10px;
}

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

.quick-accounts button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 10px 12px;
  text-align: left;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  background: #1f2a44;
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-width: 220px;
}

.dialog-mask {
  position: fixed;
  inset: 0;
  background: rgba(9, 20, 38, 0.36);
  display: grid;
  place-items: center;
  z-index: 18;
  padding: 18px;
}

.dialog {
  width: min(760px, 100%);
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px;
}

.dialog.detail-dialog {
  width: min(1180px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
}
.detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 14px;
  color: var(--muted);
}
.detail-meta strong {
  color: var(--ink);
  font-size: 16px;
}
.detail-table {
  max-height: min(62vh, 620px);
  overflow: auto;
}
.detail-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.dialog h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

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

.mobile-toggle {
  display: none;
}

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

  .grid-2,
  .split,
  .login-card {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    z-index: 12;
  }

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

  .workspace {
    padding: 8px;
  }

  .topbar {
    top: 8px;
  }

  .mobile-toggle {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  .page-head,
  .topbar,
  .panel-head,
  .toolbar,
  .filters {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid-kpi,
  .flow,
  .form-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 900px;
  }
}

@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

@media (min-width: 721px) {
  .dashboard-process .chart-wrap {
    grid-template-columns: 180px minmax(0, 1fr);
  }
}
