:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #1d2939;
  --muted: #667085;
  --line: #d8e0ea;
  --brand: #1677ff;
  --brand-dark: #0f5fd2;
  --accent: #0f766e;
  --danger: #dc2626;
  --warning: #b45309;
  --success: #15803d;
  --shadow: 0 8px 24px rgba(29, 41, 57, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.is-hidden {
  display: none !important;
}

.boot-shell,
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.boot-panel,
.login-panel {
  width: min(480px, 100%);
  background: #fff;
  border: 1px solid rgba(216, 224, 234, 0.95);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 28px;
}

.boot-panel {
  width: min(320px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.boot-silent {
  background: var(--bg);
}

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

.brand-block,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  flex: 0 0 auto;
}

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

.brand-block p,
.sidebar-brand span,
.panel-head span,
.user-card small {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 14px;
}

.checkbox-label {
  align-content: end;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.inline-check input {
  width: auto;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.login-form button,
.form-actions button:first-child,
.topbar-actions > button,
.filter-row button,
.review-btn,
.user-card button {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.login-form button:hover,
.form-actions button:first-child:hover,
.topbar-actions > button:hover,
.filter-row button:hover,
.review-btn:hover,
.user-card button:hover {
  background: var(--brand-dark);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.demo-accounts {
  display: grid;
  gap: 6px;
  margin-top: 22px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

.demo-accounts strong {
  color: var(--text);
}

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

.sidebar {
  min-height: 100vh;
  padding: 20px;
  background: #fff;
  color: var(--text);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sidebar-brand .brand-mark {
  background: var(--brand);
}

.sidebar-brand strong {
  display: block;
  font-size: 18px;
}

.sidebar-brand span {
  color: var(--muted);
}

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

.nav-item {
  width: 100%;
  min-height: 42px;
  text-align: left;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: #344054;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.is-active {
  background: #eef5ff;
  color: var(--brand);
}

.nav-sublist {
  display: grid;
  gap: 6px;
  margin: -2px 0 4px;
  padding-left: 14px;
  border-left: 1px solid #dbeafe;
}

.nav-subitem {
  width: 100%;
  min-height: 36px;
  text-align: left;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: #667085;
  font-size: 14px;
}

.nav-subitem:hover,
.nav-subitem.is-active {
  background: #eef5ff;
  color: var(--brand);
}

.user-card {
  margin-top: auto;
  display: grid;
  gap: 7px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.user-card span {
  color: var(--brand);
  font-size: 13px;
}

.user-card button {
  margin-top: 8px;
  background: #e8f2ff;
  color: var(--brand);
}

.workspace {
  min-width: 0;
  padding: 22px 24px 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.topbar-right {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: 0;
}

.topbar h2 {
  margin: 0;
  font-size: 26px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.topbar-actions,
.filter-row,
.form-actions,
.calc-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-actions input {
  width: 150px;
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.theme-switcher span {
  color: var(--muted);
}

.theme-switcher select {
  width: auto;
  min-width: 94px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  padding: 4px 22px 4px 6px;
  box-shadow: none;
}

.theme-switcher select:hover,
.theme-switcher select:focus {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: none;
}

.range-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.topbar-actions .range-btn {
  min-height: 32px;
  border-radius: 5px;
  padding: 0 10px;
  background: transparent;
  color: #475467;
  font-weight: 700;
}

.topbar-actions .range-btn:hover,
.topbar-actions .range-btn.is-active {
  background: #e8f2ff;
  color: var(--brand);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(29, 41, 57, 0.04);
}

.metric-card {
  min-height: 92px;
  padding: 14px 16px;
  display: grid;
  align-content: center;
  gap: 7px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  font-size: 22px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  margin-top: 16px;
}

.business-summary-panel {
  margin-top: 16px;
}

.dashboard-visual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.visual-panel {
  min-height: 0;
}

.visual-panel-main {
  grid-column: 1 / -1;
}

.daily-visual {
  min-height: 174px;
}

.chart-empty {
  min-height: 138px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 700;
}

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

.daily-ring-card {
  position: relative;
  min-height: 158px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: center;
}

.daily-ring {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.daily-ring > div {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.daily-ring strong {
  font-size: 16px;
}

.daily-ring-card span,
.daily-ring-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.daily-ring-card span {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.has-tip {
  position: relative;
}

.has-tip::after,
.has-tip::before {
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.has-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 30;
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
}

.has-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  z-index: 31;
  border: 6px solid transparent;
  border-top-color: #111827;
}

.has-tip:hover::after,
.has-tip:hover::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  display: inline-block;
}

.legend-dot.sales {
  color: #1677ff;
}

.legend-dot.spend {
  color: #f59e0b;
}

.legend-dot.profit {
  color: #16a34a;
}

.legend-dot.sales {
  background: #1677ff;
}

.legend-dot.spend {
  background: #f59e0b;
}

.legend-dot.profit {
  background: #16a34a;
}

.daily-bar-wrap {
  position: relative;
  min-height: 226px;
}

.daily-bar-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 206px;
}

.daily-axis {
  stroke: var(--line);
  stroke-width: 1;
}

.daily-axis-label,
.daily-x-label {
  fill: var(--muted);
  font-size: 13px;
}

.daily-x-label {
  text-anchor: middle;
}

.daily-bar {
  shape-rendering: geometricPrecision;
}

.daily-bar.sales {
  fill: #1677ff;
}

.daily-bar.spend {
  fill: #f59e0b;
}

.daily-bar.profit {
  fill: #16a34a;
}

.daily-bar.profit.is-loss {
  fill: #dc2626;
}

.daily-hover-grid {
  position: absolute;
  left: 64px;
  right: 24px;
  top: 0;
  bottom: 34px;
  z-index: 5;
  display: grid;
}

.daily-hover-cell {
  min-width: 0;
}

.daily-hover-cell::after {
  top: 12px;
  bottom: auto;
}

.daily-hover-cell::before {
  top: 0;
  bottom: auto;
  border-top-color: transparent;
  border-bottom-color: #111827;
}

.ring-wrap {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.cost-ring {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.ring-center {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: var(--surface);
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--line);
}

.ring-center span,
.ring-legend-item em,
.compare-card span,
.operator-card span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.ring-center strong {
  font-size: 16px;
}

.ring-legend {
  display: grid;
  gap: 7px;
}

.ring-legend-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  gap: 7px;
  align-items: center;
  font-size: 13px;
}

.ring-legend-item i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.ring-legend-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-visual,
.operator-visual {
  display: grid;
  gap: 8px;
}

.compare-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.mini-ring {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.mini-ring span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.compare-card-main,
.operator-card-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.compare-card-main strong,
.operator-card-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-card-main em,
.operator-card em {
  font-style: normal;
  font-weight: 800;
}

.operator-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.operator-rank {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f2ff;
  color: var(--brand);
  font-weight: 800;
}

.panel {
  padding: 16px 18px;
}

.panel + .panel {
  margin-top: 16px;
}

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

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

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

.panel-actions button {
  min-height: 36px;
  border-radius: 6px;
  padding: 0 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.panel-actions button:hover {
  background: var(--brand-dark);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.resource-list {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.resource-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.resource-toolbar input {
  width: min(360px, 100%);
  height: 36px;
}

.resource-toolbar span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.resource-list .compact-table {
  max-height: 292px;
  overflow: auto;
}

.resource-list.compact-resource .compact-table {
  max-height: 210px;
}

.compact-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
  font-size: 13px;
}

.table-wrap.wide {
  max-height: calc(100vh - 260px);
}

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

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

th {
  color: #344054;
  background: #f3f6fa;
  font-weight: 700;
}

td {
  color: #344054;
}

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

.amount-profit {
  color: var(--success);
  font-weight: 700;
}

.amount-loss {
  color: var(--danger);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.badge-profit,
.badge-approved {
  background: #dcfce7;
  color: var(--success);
}

.badge-loss,
.badge-rejected {
  background: #fee2e2;
  color: var(--danger);
}

.badge-break_even,
.badge-draft {
  background: #f1f5f9;
  color: #475569;
}

.badge-submitted {
  background: #fef3c7;
  color: var(--warning);
}

.filter-row {
  margin-bottom: 14px;
}

.filter-row select {
  width: 170px;
}

.subnav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.subnav-row.compact {
  display: inline-flex;
  margin-bottom: 14px;
  background: var(--surface-2);
}

.subnav-btn {
  min-height: 36px;
  border-radius: 6px;
  padding: 0 14px;
  background: transparent;
  color: #475467;
  font-weight: 700;
}

.subnav-btn:hover,
.subnav-btn.is-active {
  background: #e8f2ff;
  color: var(--brand);
}

.subnav-btn.is-active {
  box-shadow: inset 0 0 0 1px rgba(22, 119, 255, 0.22);
}

.subnav-btn:hover {
  color: var(--brand);
}

.subnav-btn.is-active:hover {
  background: #e8f2ff;
  color: var(--brand);
}

.edit-user-picker {
  max-width: 360px;
  margin-bottom: 14px;
}

.review-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.reject-btn {
  background: #fff;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.reject-btn:hover {
  background: #fee2e2;
}

.report-form {
  max-width: 1180px;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.management-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.project-form {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.department-form {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.inline-editor {
  margin: 12px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.inline-editor-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.inline-editor-head strong {
  font-size: 16px;
}

.inline-editor-head span {
  color: var(--muted);
  font-size: 13px;
}

.mode-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.user-form-actions {
  display: grid;
  gap: 8px;
  align-content: end;
}

.user-form-actions button,
.delete-user-btn,
.edit-user-btn {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 700;
}

.user-form-actions button:not(.secondary-btn) {
  background: var(--brand);
  color: #fff;
}

.user-form-actions button:not(.secondary-btn):hover {
  background: var(--brand-dark);
}

#reportFormMsg,
#userFormMsg,
#platformFormMsg,
#projectFormMsg,
#productFormMsg,
#rentalCostFormMsg,
#rentalVendorFormMsg,
#departmentFormMsg {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

#reportFormMsg.is-success,
#userFormMsg.is-success,
#platformFormMsg.is-success,
#projectFormMsg.is-success,
#productFormMsg.is-success,
#rentalCostFormMsg.is-success,
#rentalVendorFormMsg.is-success,
#departmentFormMsg.is-success {
  color: var(--success);
  font-weight: 700;
}

#reportFormMsg.is-error,
#userFormMsg.is-error,
#platformFormMsg.is-error,
#projectFormMsg.is-error,
#productFormMsg.is-error,
#rentalCostFormMsg.is-error,
#rentalVendorFormMsg.is-error,
#departmentFormMsg.is-error {
  color: var(--danger);
  font-weight: 700;
}

.secondary-btn,
.edit-user-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
}

.edit-user-btn {
  margin-right: 6px;
}

.secondary-btn:hover,
.edit-user-btn:hover {
  background: var(--surface-2);
}

.delete-user-btn,
.delete-resource-btn {
  min-height: 32px;
  border: 1px solid #fecaca;
  background: #fff;
  color: var(--danger);
  font-size: 13px;
}

.delete-user-btn:hover,
.delete-resource-btn:hover {
  background: #fee2e2;
}

.user-table table {
  min-width: 1320px;
}

.resource-list .user-table table {
  min-width: 760px;
}

.resource-list .user-table.compact-table table {
  min-width: 720px;
}

.resource-list.compact-resource .user-table.compact-table table {
  min-width: 480px;
}

.department-table table {
  min-width: 760px;
}

.is-editing-row td {
  background: #f0f7ff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
}

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

.calc-preview {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: #475467;
}

.calc-preview strong {
  color: var(--text);
}

.submit-status {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
}

.submit-status.is-info,
.submit-status.is-success,
.submit-status.is-error {
  display: block;
}

.submit-status.is-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--success);
  font-weight: 700;
}

.submit-status.is-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
  font-weight: 700;
}

.payroll-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.payroll-export-tools {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.payroll-export-tools label {
  min-width: 260px;
}

.payroll-export-tools button {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.payroll-export-tools button:hover {
  background: var(--brand-dark);
}

.payroll-summary span {
  display: grid;
  gap: 6px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

.payroll-summary strong {
  color: var(--text);
  font-size: 18px;
}

.payroll-table table {
  min-width: 1420px;
}

.payroll-cost-panel {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.compact-head {
  margin-bottom: 12px;
}

.nested-management {
  margin: 0 0 14px;
  padding: 12px 0 2px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.nested-management .panel-head {
  margin-bottom: 10px;
}

.nested-management .management-form {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px);
}

.product-form,
.rental-cost-form {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}

.rental-cost-table table {
  min-width: 760px;
}

.form-actions {
  margin-top: 16px;
}

.form-actions button:nth-child(2) {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
  border: 1px solid var(--line);
  color: #344054;
}

#reportFormMsg {
  color: var(--muted);
  font-size: 14px;
}

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

.permission-grid article {
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-2);
}

.permission-grid strong {
  display: block;
  margin-bottom: 8px;
}

.permission-grid p,
.deploy-notes p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.deploy-notes {
  display: grid;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 20;
}

body.theme-classic {
  --bg: #f5f7fb;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --line: #d9e0ea;
}

body.theme-classic .sidebar {
  background: #182230;
  color: #fff;
  border-right: 0;
}

body.theme-classic .sidebar-brand .brand-mark {
  background: #14b8a6;
}

body.theme-classic .sidebar-brand span {
  color: #cbd5e1;
}

body.theme-classic .nav-item {
  color: #cbd5e1;
}

body.theme-classic .nav-item:hover,
body.theme-classic .nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

body.theme-classic .nav-sublist {
  border-left-color: rgba(203, 213, 225, 0.24);
}

body.theme-classic .nav-subitem {
  color: #cbd5e1;
}

body.theme-classic .nav-subitem:hover,
body.theme-classic .nav-subitem.is-active {
  background: rgba(20, 184, 166, 0.18);
  color: #99f6e4;
}

body.theme-classic .user-card {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

body.theme-classic .user-card span {
  color: #99f6e4;
}

body.theme-classic .user-card button {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

body.theme-clean {
  --bg: #f3f6fb;
  --brand: #1677ff;
  --brand-dark: #0f5fd2;
}

body.theme-compact {
  --bg: #f6f7f9;
  --brand: #344054;
  --brand-dark: #1d2939;
  --line: #d0d5dd;
}

body.theme-compact .workspace {
  padding: 16px 18px 22px;
}

body.theme-compact .panel,
body.theme-compact .metric-card {
  box-shadow: none;
}

body.theme-compact th,
body.theme-compact td {
  padding: 8px 9px;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

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

  .dashboard-visual-grid {
    grid-template-columns: 1fr;
  }

  .visual-panel-main {
    grid-row: auto;
  }

  .form-grid,
  .user-form,
  .management-form,
  .project-form,
  .nested-management .management-form,
  .department-form,
  .payroll-summary,
  .permission-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

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

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

  .workspace {
    padding: 16px;
  }

  .topbar {
    display: grid;
  }

  .topbar-right,
  .topbar-actions,
  .theme-switcher {
    width: 100%;
  }

  .topbar-right {
    justify-items: stretch;
  }

  .theme-switcher {
    justify-content: flex-end;
  }

  .range-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .topbar-actions .range-btn {
    width: auto;
    padding: 0 4px;
  }

  .topbar-actions input,
  .topbar-actions > button,
  .filter-row select,
  .filter-row button {
    width: 100%;
  }

  .dashboard-visual-grid {
    grid-template-columns: 1fr;
  }

  .visual-panel {
    min-height: auto;
  }

  .chart-legend {
    gap: 8px;
  }

  .daily-ring-grid,
  .ring-wrap {
    grid-template-columns: 1fr;
  }

  .cost-ring {
    margin: 0 auto;
  }

  .metric-grid,
  .form-grid,
  .user-form,
  .management-form,
  .project-form,
  .nested-management .management-form,
  .department-form,
  .payroll-summary,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .resource-toolbar {
    display: grid;
  }

  .resource-toolbar input {
    width: 100%;
  }
}
