:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --sidebar: #182433;
  --sidebar-muted: #91a1b4;
  --text: #17202c;
  --muted: #667085;
  --border: #d9e1e8;
  --accent: #1769e0;
  --accent-strong: #0f54b7;
  --green: #0b8f6a;
  --amber: #b46a00;
  --red: #c43d3d;
  --shadow: 0 14px 40px rgba(22, 36, 50, 0.08);
  --radius: 8px;
  --sidebar-width: 248px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.svg-sprite {
  display: none;
}

.toast {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 40;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-left-color: var(--red);
}

.toast.success {
  border-left-color: var(--green);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px;
  background:
    linear-gradient(120deg, rgba(23, 105, 224, 0.08), transparent 38%),
    linear-gradient(160deg, transparent 55%, rgba(11, 143, 106, 0.08)),
    var(--bg);
}

.login-panel {
  width: 460px;
  display: grid;
  gap: 22px;
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #13202e;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  font-size: 13px;
}

.login-panel h1,
.topbar h1,
.panel h2,
.sidebar-brand h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-panel h1 {
  font-size: 26px;
  line-height: 1.25;
}

.login-panel p,
.panel-head p,
.sidebar-brand p,
.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

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

.form-grid.single {
  grid-template-columns: 1fr;
}

.form-grid label {
  display: grid;
  gap: 7px;
}

.form-grid label > span {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cfd8e2;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input {
  height: 40px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  min-height: 116px;
  padding: 10px 11px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.primary-btn,
.ghost-btn,
.link-btn,
.icon-btn,
.mini-btn {
  border: 0;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0;
}

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

.primary-btn:hover {
  background: var(--accent-strong);
}

.ghost-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: #344054;
}

.ghost-btn:hover {
  border-color: #b8c5d2;
  background: #f8fafc;
}

.ghost-btn.danger {
  color: var(--red);
}

.link-btn {
  min-height: 32px;
  padding: 0 8px;
  background: transparent;
  color: var(--accent);
}

.icon-btn {
  width: 40px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: #344054;
}

.mini-btn {
  min-width: 34px;
  padding: 0 9px;
  border: 1px solid #c9daf2;
  background: #e8f0fb;
  color: var(--accent);
}

.mini-btn:hover {
  background: #dbe9fa;
}

.icon-btn svg,
.btn-icon,
.side-nav svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex: 0 0 auto;
}

.inline-control {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 8px;
}

.batch-control {
  grid-template-columns: minmax(82px, 1fr) repeat(8, auto);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f9fbfd;
}

.switch-row.compact {
  min-height: 40px;
  padding: 0 10px;
  background: var(--surface);
}

.switch-row strong {
  display: block;
  font-size: 13px;
}

.switch-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c8d2dd;
  transition: background 0.15s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: var(--sidebar);
  color: #fff;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.sidebar-brand h2 {
  font-size: 16px;
}

.sidebar-brand p {
  color: var(--sidebar-muted);
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 12px;
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.workspace {
  min-width: 0;
  padding: 22px 26px 40px;
}

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

.topbar h1 {
  font-size: 24px;
  line-height: 1.25;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

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

.metric-card,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(22, 36, 50, 0.04);
}

.metric-card {
  padding: 18px;
  min-height: 128px;
}

.metric-card span,
.metric-card em {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.metric-card strong {
  display: block;
  margin: 14px 0 10px;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.metric-card.accent strong {
  color: var(--green);
}

.panel {
  padding: 18px;
}

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

.panel-head h2 {
  font-size: 17px;
}

.panel-head.split {
  align-items: center;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 18px;
}

.cabinets-layout {
  grid-template-columns: 390px minmax(0, 1fr);
}

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

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

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

th {
  background: #f7f9fb;
  color: #475467;
  font-weight: 700;
}

td {
  color: #273444;
}

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

.compact-table table {
  min-width: 520px;
}

.empty-cell {
  height: 76px;
  color: var(--muted);
  text-align: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #edf4ff;
  color: var(--accent);
}

.tag.green {
  background: #e8f6f1;
  color: var(--green);
}

.tag.amber {
  background: #fff3df;
  color: var(--amber);
}

.tag.red {
  background: #fff0f0;
  color: var(--red);
}

.search-input {
  width: 230px;
}

.filter-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.capacity-list {
  display: grid;
  gap: 12px;
}

.capacity-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.capacity-item strong {
  display: block;
  font-size: 14px;
}

.capacity-item span,
.capacity-item small {
  color: var(--muted);
  font-size: 12px;
}

.capacity-count {
  color: var(--green);
  font-size: 20px;
  font-weight: 800;
}

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

.board-card {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfcfe;
  color: var(--text);
  text-align: left;
}

.board-card:hover,
.board-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.1);
}

.board-card strong {
  font-size: 14px;
}

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

.board-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

@media (max-width: 1260px) {
  body {
    min-width: 1040px;
  }

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

  .two-column {
    grid-template-columns: 1fr;
  }
}
