:root {
  --bg: #f5f7fb;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --surface-soft: #f8fbff;
  --ink: #111827;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: rgba(148, 163, 184, 0.26);
  --line-strong: rgba(100, 116, 139, 0.30);
  --blue: #2563eb;
  --blue-soft: #eaf2ff;
  --cyan: #06b6d4;
  --cyan-soft: #e6fbff;
  --mint: #10b981;
  --mint-soft: #e9fff6;
  --amber: #f59e0b;
  --amber-soft: #fff7df;
  --rose: #f43f5e;
  --rose-soft: #fff0f4;
  --violet: #7c3aed;
  --violet-soft: #f2ecff;
  --radius: 8px;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.06);
  --focus: 0 0 0 4px rgba(37, 99, 235, 0.18);
  --sans: "Inter", "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Microsoft YaHei UI", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(6, 182, 212, 0.18), transparent 290px),
    radial-gradient(circle at 92% 0%, rgba(124, 58, 237, 0.16), transparent 330px),
    radial-gradient(circle at 70% 38%, rgba(16, 185, 129, 0.10), transparent 360px),
    linear-gradient(180deg, #fbfdff, #f2f6fb 46%, #eef3f9);
}

[hidden] {
  display: none !important;
}

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

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

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 38px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

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

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

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

h1 {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: 0;
}

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

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

main {
  display: grid;
  gap: 14px;
}

.overview-band {
  position: relative;
  display: flex;
  overflow: hidden;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.92), rgba(37, 99, 235, 0.86) 48%, rgba(6, 182, 212, 0.76)),
    #111827;
  color: #fff;
  box-shadow: 0 22px 54px rgba(37, 99, 235, 0.18);
}

.overview-band::after {
  position: absolute;
  inset: auto -5% -80px 28%;
  height: 150px;
  content: "";
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.0), rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.0));
  transform: rotate(-7deg);
}

.overview-band > * {
  position: relative;
  z-index: 1;
}

.overview-band .eyebrow,
.overview-band h2 {
  color: #fff;
}

.overview-band h2 {
  max-width: 760px;
  font-size: clamp(20px, 2.4vw, 30px);
}

.overview-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.overview-badges span {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #f8fbff;
  font-size: 13px;
  font-weight: 800;
  backdrop-filter: blur(8px);
}

.overview-badges svg {
  width: 16px;
  height: 16px;
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.button {
  padding: 0 15px;
}

.button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.button.primary {
  background: linear-gradient(135deg, var(--blue), var(--violet));
  color: #fff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.28);
}

.button.secondary {
  background: var(--blue-soft);
  border-color: rgba(37, 99, 235, 0.22);
  color: var(--blue);
}

.button.secondary:hover,
.button.ghost:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--ink-2);
}

.button.danger {
  background: var(--rose-soft);
  border-color: rgba(244, 63, 94, 0.22);
  color: var(--rose);
}

.button.full {
  width: 100%;
}

.button:active,
.icon-button:active {
  transform: translateY(1px) scale(0.99);
}

.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

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

.metric-card,
.panel,
.control-panel,
.login-card,
.editor-card {
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.metric-card {
  position: relative;
  display: grid;
  overflow: hidden;
  min-height: 138px;
  align-content: space-between;
  gap: 10px;
  padding: 16px;
}

.metric-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.metric-card:nth-child(2)::before {
  background: linear-gradient(90deg, var(--cyan), var(--mint));
}

.metric-card:nth-child(3)::before {
  background: linear-gradient(90deg, var(--amber), var(--rose));
}

.metric-card:nth-child(4)::before {
  background: linear-gradient(90deg, var(--mint), var(--cyan));
}

.metric-card:nth-child(5)::before {
  background: linear-gradient(90deg, var(--rose), var(--violet));
}

.metric-card:hover,
.panel:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.metric-icon {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-card:nth-child(2) .metric-icon {
  background: var(--cyan-soft);
  color: #0891b2;
}

.metric-card:nth-child(3) .metric-icon {
  background: var(--amber-soft);
  color: #b45309;
}

.metric-card:nth-child(4) .metric-icon {
  background: var(--mint-soft);
  color: #047857;
}

.metric-card:nth-child(5) .metric-icon {
  background: var(--rose-soft);
  color: var(--rose);
}

.metric-icon svg {
  width: 18px;
  height: 18px;
}

.metric-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(28px, 3.1vw, 38px);
  font-weight: 900;
  line-height: 1;
}

.metric-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
}

.metric-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}

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

.control-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
}

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

.field span {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

input,
select {
  padding: 0 12px;
}

textarea {
  min-height: 92px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.55;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(37, 99, 235, 0.42);
  background: #fff;
}

input::placeholder,
textarea::placeholder {
  color: #9aa8bb;
}

.chart-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.05fr 1.05fr;
  gap: 12px;
}

.split-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 12px;
}

.panel {
  min-width: 0;
  padding: 16px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.chart-box {
  position: relative;
  height: 258px;
}

.list-stack,
.timeline {
  display: grid;
  gap: 9px;
}

.risk-item,
.timeline-item {
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
  padding: 12px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.risk-item {
  border-left: 4px solid var(--rose);
}

.timeline-item {
  border-left: 4px solid var(--cyan);
}

.risk-item:hover,
.timeline-item:hover {
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: var(--shadow-soft);
  transform: translateX(2px);
}

.risk-item strong,
.timeline-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.risk-meta {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.risk-item p,
.timeline-item p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  white-space: normal;
}

.tag {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.tag.done {
  border-color: rgba(16, 185, 129, 0.24);
  background: var(--mint-soft);
  color: #047857;
}

.tag.working {
  border-color: rgba(245, 158, 11, 0.28);
  background: var(--amber-soft);
  color: #a35b05;
}

.tag.pending,
.tag.risk {
  border-color: rgba(244, 63, 94, 0.24);
  background: var(--rose-soft);
  color: #be123c;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
}

th,
td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(248, 251, 255, 0.94);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  backdrop-filter: blur(12px);
}

td {
  color: #273244;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

tbody tr:hover {
  background: rgba(234, 242, 255, 0.46);
}

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

.auth-panel {
  display: grid;
  min-height: calc(100vh - 150px);
  place-items: center;
}

.login-card {
  position: relative;
  overflow: hidden;
  width: min(430px, 100%);
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, var(--cyan), var(--blue), var(--violet), var(--rose));
}

.login-card h2 {
  margin-bottom: 18px;
  font-size: 23px;
}

.form-error {
  min-height: 22px;
  margin: 2px 0 0;
  color: #be123c;
  font-size: 14px;
  font-weight: 800;
}

.admin-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto auto;
  gap: 10px;
}

.admin-table-wrap {
  max-height: 70vh;
}

.admin-table {
  min-width: 1240px;
  table-layout: fixed;
}

.admin-table th:nth-child(1),
.admin-table td:nth-child(1) {
  width: 130px;
}

.admin-table th:nth-child(2),
.admin-table td:nth-child(2) {
  width: 138px;
}

.admin-table th:nth-child(3),
.admin-table td:nth-child(3) {
  width: 260px;
}

.admin-table th:nth-child(4),
.admin-table td:nth-child(4) {
  width: 82px;
}

.admin-table th:nth-child(5),
.admin-table td:nth-child(5) {
  width: 92px;
}

.admin-table th:nth-child(6),
.admin-table td:nth-child(6) {
  width: 116px;
}

.admin-table th:nth-child(7),
.admin-table td:nth-child(7),
.admin-table th:nth-child(8),
.admin-table td:nth-child(8) {
  width: 86px;
}

.admin-table th:nth-child(9),
.admin-table td:nth-child(9) {
  width: 280px;
}

.admin-table th:nth-child(10),
.admin-table td:nth-child(10) {
  width: 108px;
}

.admin-table td {
  word-break: break-word;
}

.cell-clamp {
  display: -webkit-box;
  overflow: hidden;
  max-height: 61px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--muted);
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.32);
  color: var(--blue);
  box-shadow: var(--shadow-soft);
}

.icon-button.delete:hover {
  border-color: rgba(244, 63, 94, 0.30);
  color: var(--rose);
}

.editor-dialog {
  width: min(1040px, calc(100% - 24px));
  max-height: 90vh;
  border: 0;
  padding: 0;
  background: transparent;
}

.editor-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(8px);
}

.editor-card {
  padding: 20px;
  box-shadow: var(--shadow);
}

.editor-head,
.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-head {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin: 16px 0;
  max-height: 60vh;
  overflow: auto;
  padding-right: 4px;
}

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

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

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 12px;
  }

  .topbar,
  .overview-band,
  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .overview-badges {
    justify-content: stretch;
  }

  .metric-grid,
  .control-panel,
  .admin-tools,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .chart-box {
    height: 230px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
