* { box-sizing: border-box; }
:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #718096;
  --line: #e2e8f0;
  --blue: #2864e8;
  --blue-soft: #eef5ff;
  --green: #16b887;
  --orange: #f59e0b;
  --red: #ef4444;
  --shadow: 0 18px 45px rgba(23, 32, 51, .08);
}
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: flex; min-height: 100vh; }
body.login-mode .sidebar { display: none; }
body.login-mode .main { padding: 0; }
.sidebar {
  width: 248px;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: #fff;
  border-right: 1px solid var(--line);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 24px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #1d4ed8, #12a38f);
  color: #fff; font-size: 22px; font-weight: 900;
}
.brand strong { display: block; font-size: 18px; }
.brand span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.nav-item {
  width: 100%; height: 44px; margin-bottom: 6px; border: 0; border-radius: 8px;
  display: flex; align-items: center; gap: 11px; padding: 0 12px;
  background: transparent; color: #536173; text-align: left; font-weight: 800;
}
.nav-item i {
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 7px; background: #f1f5f9; color: #64748b; font-style: normal;
}
.nav-item.active { background: var(--blue-soft); color: var(--blue); }
.nav-item.active i { background: var(--blue); color: #fff; }
.logout-item { margin-top: 16px; color: #ef4444; }
.logout-item i { background: #fff1f2; color: #ef4444; }
.main { flex: 1; min-width: 0; padding: 28px 24px; }
.primary-btn, .ghost-btn, .danger-btn {
  height: 40px; border: 0; border-radius: 8px; padding: 0 15px; font-weight: 900;
}
.primary-btn { background: var(--blue); color: #fff; }
.ghost-btn { background: var(--blue-soft); color: var(--blue); }
.danger-btn { background: #fff1f2; color: var(--red); }
.hero {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; margin-bottom: 16px;
}
.hero-card, .panel, .metric-card, .table-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
}
.hero-card {
  padding: 24px; overflow: hidden; position: relative;
  background: linear-gradient(135deg, #1f5bd8, #2376e7 55%, #078679);
  color: #fff;
}
.hero-card::after {
  content: ""; position: absolute; width: 220px; height: 220px; right: -50px; top: -50px;
  border: 28px solid rgba(255,255,255,.14); border-radius: 50%;
}
.hero-card p { margin: 0 0 10px; color: rgba(255,255,255,.76); font-weight: 800; }
.hero-card h2 { margin: 0; font-size: 34px; }
.hero-stats { display: flex; gap: 10px; margin-top: 28px; }
.mini-stat {
  min-width: 112px; padding: 12px; border-radius: 8px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
}
.mini-stat strong { display: block; font-size: 24px; }
.mini-stat span { color: rgba(255,255,255,.78); font-size: 13px; font-weight: 800; }
.todo-panel { padding: 20px; }
.todo-panel h3, .panel h3 { margin: 0 0 14px; font-size: 18px; }
.todo { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid #eef2f7; }
.todo:first-of-type { border-top: 0; }
.todo strong { display: block; }
.todo span { color: var(--muted); font-size: 13px; }
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border-radius: 7px; background: #f1f5f9; color: #475569; font-size: 12px; font-weight: 900; }
.tag.green { background: #dcfce7; color: #15803d; }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.orange { background: #fff7ed; color: #c2410c; }
.tag.red { background: #fee2e2; color: #b91c1c; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.metric-card { padding: 18px; position: relative; overflow: hidden; }
.metric-card::before {
  content: ""; position: absolute; left: 0; top: 18px; width: 4px; height: 42px; border-radius: 999px;
  background: var(--blue);
}
.metric-card span { color: var(--muted); font-weight: 800; }
.metric-card strong { display: block; margin-top: 8px; font-size: 30px; }
.metric-card em { color: #94a3b8; font-style: normal; font-size: 13px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { padding: 20px; margin-bottom: 16px; }
.progress-row { margin: 16px 0; }
.progress-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 900; }
.bar { height: 9px; background: #e9edf3; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--green)); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { padding: 10px 12px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--line); font-weight: 900; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: #fff; color: #536173;
  height: 36px; padding: 0 12px; border-radius: 8px; font-weight: 900;
}
.tab.active { border-color: var(--blue); background: var(--blue); color: #fff; }
.filter-bar {
  margin: 12px 0 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.filter-bar input,
.filter-bar select {
  flex: 1;
  min-width: 260px;
  height: 40px;
  border: 1px solid #d8e0eb;
  border-radius: 8px;
  padding: 0 12px;
  outline: 0;
  background: #fff;
}
.table-card { overflow: hidden; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 14px 16px; border-bottom: 1px solid #eef2f7; text-align: left; font-size: 14px; }
th { color: #64748b; background: #f8fafc; font-size: 13px; }
td strong { display: block; margin-bottom: 4px; }
td small { color: var(--muted); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.link-btn {
  border: 0; background: transparent; color: var(--blue); font-weight: 900; padding: 0;
}
.avatar-cell {
  width: 42px;
  height: 42px;
  display: inline-flex;
  overflow: hidden;
  border-radius: 8px;
  background: #f1f5f9;
}
.avatar-cell img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.pagination-info {
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
}
.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pagination .ghost-btn:disabled {
  opacity: .45;
  cursor: default;
}
.feedback-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 260px;
}
.feedback-thumb {
  width: 72px;
  height: 72px;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.feedback-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.content-card { padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.content-card h3 { margin: 0 0 8px; }
.content-card p { margin: 0 0 14px; color: var(--muted); line-height: 1.6; }
.drawer-mask {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.24); z-index: 10;
}
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 440px; z-index: 11;
  background: #fff; box-shadow: -24px 0 60px rgba(15,23,42,.18);
  transform: translateX(105%); transition: transform .22s ease; padding: 24px;
  display: flex; flex-direction: column; overflow: hidden;
}
.drawer.open { transform: translateX(0); }
.drawer-mask.open { display: block; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.drawer-head p { margin: 0 0 6px; color: var(--muted); font-weight: 800; }
.drawer-head h2 { margin: 0; }
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 8px; background: #f1f5f9; font-size: 24px;
}
.form-grid {
  flex: 1; min-height: 0; overflow-y: auto; padding: 0 2px 96px 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: start;
}
.form-grid label { color: #475569; font-weight: 900; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; margin-top: 8px; border: 1px solid #d8e0eb; border-radius: 8px; padding: 10px 12px; outline: 0;
}
.form-grid textarea { min-height: 140px; resize: vertical; }
.wide { grid-column: 1 / -1; }
.form-help {
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #ecfdf5;
  color: #166534;
}
.form-help strong {
  display: block;
  margin-bottom: 6px;
}
.form-help span {
  display: block;
  line-height: 1.6;
  color: #15803d;
}
.file-preview {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.file-preview span {
  display: block;
  color: #475569;
  font-weight: 900;
}
.file-preview a {
  display: inline-block;
  margin-top: 8px;
  color: var(--blue);
  font-weight: 900;
  text-decoration: none;
}
.file-preview small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-break: anywhere;
}
.question-extra {
  display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc;
}
.question-extra h3 { margin: 0; font-size: 15px; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-field { display: block; }
.check-row {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 8px;
}
.check-row label {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; border: 1px solid #d8e0eb; border-radius: 8px; background: #fff; color: var(--text);
}
.check-row input {
  width: auto; margin: 0;
}
.drawer-actions {
  position: sticky; bottom: 0; grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px;
  margin: 8px -2px -96px; padding: 16px 0 0; background: linear-gradient(180deg, rgba(255,255,255,.82), #fff 45%);
}
.form-error { grid-column: 1 / -1; margin: 0; color: var(--red); font-weight: 800; line-height: 1.6; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  opacity: 0; pointer-events: none; z-index: 20;
  padding: 11px 16px; border-radius: 8px; background: #0f172a; color: #fff; font-weight: 800;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 20% 18%, rgba(40,100,232,.12), transparent 32%),
    radial-gradient(circle at 78% 24%, rgba(18,163,143,.14), transparent 30%),
    var(--bg);
}
.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.login-card .brand-logo { margin-bottom: 18px; }
.login-card p {
  margin: 0 0 6px;
  color: var(--muted);
  font-weight: 900;
}
.login-card h1 {
  margin: 0 0 24px;
  font-size: 30px;
}
.login-card label {
  display: block;
  margin-bottom: 14px;
  color: #475569;
  font-weight: 900;
}
.login-card input {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border: 1px solid #d8e0eb;
  border-radius: 8px;
  padding: 0 12px;
  outline: 0;
}
.login-card button { width: 100%; margin-top: 8px; }
.login-card button:disabled { opacity: .65; cursor: default; }
@media (max-width: 1100px) {
  .metric-grid, .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .hero, .split { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
}
