:root {
  --bg: #eef3f2;
  --surface: #ffffff;
  --surface-2: #f7faf9;
  --text: #17212b;
  --muted: #61707d;
  --border: #d8e1df;
  --primary: #176b87;
  --primary-strong: #0f5066;
  --accent: #2f8f6b;
  --warning: #a56b00;
  --danger: #b42318;
  --success: #167a4a;
  --shadow: 0 16px 40px rgba(24, 43, 51, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 107, 135, 0.35);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  transform: translateY(-160%);
  background: var(--text);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
}

.skip-link:focus {
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(23, 107, 135, 0.12), transparent 38%),
    linear-gradient(315deg, rgba(47, 143, 107, 0.14), transparent 34%),
    var(--bg);
}

.login-panel {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px;
}

.brand-mark,
.side-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
}

.brand-mark svg,
.side-logo svg,
.icon-btn svg,
.nav-item svg,
.mini-action svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.login-panel h1 {
  margin: 20px 0 8px;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
}

.login-panel p {
  margin: 0 0 26px;
  color: var(--muted);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 600;
}

label span {
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

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

.shell {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: 264px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 20px 14px;
  background: #102730;
  color: #f3fbfb;
}

.side-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px 20px;
}

.side-brand strong,
.side-brand span {
  display: block;
}

.side-brand span {
  color: #a9c3c8;
  font-size: 12px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  padding: 10px 12px;
  background: transparent;
  color: #cfe0e2;
  text-align: left;
}

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

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
  padding: 16px 28px;
  background: rgba(238, 243, 242, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.topbar h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-box strong,
.user-box span {
  display: block;
  text-align: right;
}

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

.content {
  padding: 24px 28px 44px;
}

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

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

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

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(25, 45, 52, 0.06);
}

.panel.pad {
  padding: 18px;
}

.metric {
  padding: 18px;
}

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

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

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 12px;
}

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

.section-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.btn,
.icon-btn,
.mini-action {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 13px;
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 650;
}

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

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

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

.btn:disabled,
.icon-btn:disabled,
.mini-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.icon-btn {
  width: 44px;
  padding: 0;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  background: var(--surface-2);
  color: #41505b;
  font-size: 12px;
  text-transform: none;
}

tr:hover td {
  background: #fbfdfc;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 3px 10px;
  background: #e9f4f7;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status.warn {
  background: #fff4df;
  color: var(--warning);
}

.status.danger {
  background: #feeceb;
  color: var(--danger);
}

.status.done {
  background: #e9f7ef;
  color: var(--success);
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.tab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.tab.active {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 1px 4px rgba(20, 30, 45, 0.08);
}

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

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

.detail-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 16px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 650;
}

.detail-list dd {
  margin: 0;
}

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

.timeline-item {
  border-left: 3px solid var(--primary);
  padding: 4px 0 4px 12px;
}

.timeline-item strong {
  display: block;
}

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

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 20, 26, 0.42);
}

.modal {
  width: min(920px, 100%);
  max-height: min(86dvh, 840px);
  overflow: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.modal header h3 {
  margin: 0;
}

.modal-body {
  padding: 18px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  min-width: 260px;
  max-width: 420px;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  padding: 13px 15px;
  background: #102730;
  color: #fff;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

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

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

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

  .grid.cols-4,
  .grid.cols-2,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
