:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --panel-soft: #fbfaf7;
  --ink: #1e2329;
  --muted: #667085;
  --line: #ded8ce;
  --line-strong: #c8c0b4;
  --brand: #126c62;
  --brand-dark: #0b4942;
  --accent: #b64f2a;
  --accent-soft: #fff0e9;
  --ok: #238551;
  --warn: #b7791f;
  --danger: #b42318;
  --blue: #2f5f98;
  --shadow: 0 18px 50px rgba(30, 35, 41, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

a.button {
  text-decoration: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
  background: #182724;
  color: #f8fbf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: #f8fbf8;
  color: var(--brand-dark);
  font-weight: 800;
}

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

.brand span {
  display: block;
  margin-top: 3px;
  color: rgba(248, 251, 248, 0.66);
  font-size: 12px;
}

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

.nav button {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(248, 251, 248, 0.76);
  text-align: left;
}

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

.nav .nav-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  text-align: center;
}

.tenant-card {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.tenant-card span,
.tenant-card small {
  color: rgba(248, 251, 248, 0.66);
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 22px 26px 36px;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.18;
}

h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

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

.service-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.service-status.online {
  border-color: #b7dcc8;
  background: #eef9f2;
  color: var(--ok);
}

.user-switcher {
  width: auto;
  min-width: 190px;
}

.disabled-link {
  opacity: 0.45;
  pointer-events: none;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button {
  gap: 7px;
  padding: 9px 14px;
  white-space: nowrap;
}

.button.primary {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(18, 108, 98, 0.2);
}

.button.secondary {
  border-color: #a8c7c1;
  background: #e9f4f2;
  color: var(--brand-dark);
}

.button.ghost {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.button.danger {
  background: var(--danger);
  color: #ffffff;
}

.button.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.content {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.compact-grid {
  gap: 8px;
}

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

.panel,
.metric,
.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

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

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.metric {
  min-height: 124px;
  padding: 16px;
}

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

.metric strong {
  display: block;
  margin: 9px 0 8px;
  font-size: 30px;
  line-height: 1;
}

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

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

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

.progress.warn > span {
  background: var(--warn);
}

.progress.danger > span {
  background: var(--danger);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

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

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

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.input,
.select {
  min-height: 38px;
  padding: 8px 10px;
}

.textarea {
  min-height: 270px;
  padding: 12px;
  resize: vertical;
  line-height: 1.62;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 108, 98, 0.12);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  background: #ffffff;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: #49525f;
  font-size: 12px;
}

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

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

.nowrap {
  white-space: nowrap;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #4a5564;
  font-size: 12px;
  font-weight: 700;
}

.chip.ok {
  border-color: #b7dcc8;
  background: #eef9f2;
  color: var(--ok);
}

.chip.warn {
  border-color: #efd4a8;
  background: #fff7e8;
  color: var(--warn);
}

.chip.danger {
  border-color: #f1b6b0;
  background: #fff1f0;
  color: var(--danger);
}

.chip.blue {
  border-color: #b7cae5;
  background: #edf4ff;
  color: var(--blue);
}

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

.item-card {
  padding: 13px;
}

.item-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.item-card p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.55;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}

.project-card .toolbar {
  margin-bottom: 0;
}

.mini-metric,
.mini-panel {
  display: grid;
  gap: 5px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

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

.mini-metric strong,
.mini-panel strong {
  line-height: 1.35;
}

.drop-zone {
  position: relative;
  display: grid;
  gap: 7px;
  min-height: 124px;
  margin-bottom: 14px;
  padding: 18px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  text-align: center;
}

.drop-zone strong {
  color: var(--ink);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.compact-drop {
  min-height: 88px;
}

.inline-field {
  min-width: 180px;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
}

.timeline-date {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.timeline-body {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child .timeline-body {
  border-bottom: 0;
  padding-bottom: 0;
}

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

.task-column {
  min-height: 360px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.task-column h3 {
  display: flex;
  justify-content: space-between;
  min-height: 26px;
  margin-bottom: 12px;
}

.task-card {
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.task-card strong {
  line-height: 1.35;
}

.task-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.quality-gate {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.quality-gate:last-child {
  border-bottom: 0;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.toggle input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
}

.delivery-summary {
  min-height: 230px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  white-space: pre-wrap;
  line-height: 1.62;
}

.empty {
  display: grid;
  min-height: 160px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #182724;
  color: #ffffff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

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

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

  .grid.cols-3,
  .grid.cols-2,
  .split {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}

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

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

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

  .main {
    padding: 18px 14px 30px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .task-board,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }
}

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

  .button {
    width: 100%;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}
