:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #6f788a;
  --line: #e5e9f0;
  --blue: #155eef;
  --blue-dark: #0d4fd3;
  --blue-soft: #edf4ff;
  --green: #168554;
  --green-soft: #eaf8f1;
  --orange: #c66914;
  --orange-soft: #fff4e8;
  --red: #cc3d4a;
  --red-soft: #fff0f1;
  --shadow: 0 12px 35px rgba(26, 39, 73, 0.07);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; color: var(--text); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, .button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(26px, 3vw, 34px); line-height: 1.2; letter-spacing: -.02em; }
h2 { font-size: 18px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: 236px; flex-direction: column; border-right: 1px solid var(--line); background: rgba(255,255,255,.96); padding: 26px 18px 18px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; color: #fff; background: var(--blue); font-size: 18px; font-weight: 800; box-shadow: 0 8px 20px rgba(21,94,239,.22); }
.brand strong, .brand small, .user-chip strong, .user-chip small { display: block; }
.brand strong { font-size: 15px; }
.brand small, .user-chip small { color: var(--muted); font-size: 12px; }
.primary-nav { display: grid; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 11px; border-radius: 10px; padding: 11px 12px; color: #566074; font-weight: 600; }
.nav-link:hover { background: var(--surface-soft); color: var(--text); }
.nav-link.active { color: var(--blue); background: var(--blue-soft); }
.nav-link span { width: 18px; text-align: center; }
.sidebar-footer { display: grid; gap: 14px; margin-top: auto; padding: 18px 8px 0; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-chip strong { overflow: hidden; text-overflow: ellipsis; }
.avatar { display: grid; flex: 0 0 auto; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: var(--blue); background: var(--blue-soft); font-weight: 800; }
.avatar.small { width: 30px; height: 30px; font-size: 12px; }
.text-button { border: 0; padding: 0; color: var(--muted); background: none; }
.text-button:hover { color: var(--red); }
.workspace-main { min-height: 100vh; margin-left: 236px; }
.page-content { width: min(1180px, 100%); margin: 0 auto; padding: 46px 42px 60px; }
.mobile-topbar, .nav-backdrop { display: none; }
.flash-stack { position: fixed; z-index: 60; top: 22px; right: 24px; display: grid; gap: 8px; }
.flash { min-width: 260px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; background: var(--surface); box-shadow: var(--shadow); }
.flash.error { color: var(--red); border-color: #ffd6da; }
.flash.success { color: var(--green); border-color: #ccecdf; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header p { margin-bottom: 4px; color: var(--muted); }
.page-actions { display: flex; gap: 10px; }
.button, button[type="submit"], input[type="submit"] { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; border: 1px solid var(--blue); border-radius: 9px; padding: 9px 17px; color: #fff; background: var(--blue); font-weight: 700; transition: .18s ease; }
.button:hover, button[type="submit"]:hover, input[type="submit"]:hover { background: var(--blue-dark); }
.button.secondary { color: var(--text); border-color: var(--line); background: var(--surface); }
.button.secondary:hover { border-color: #c9d1df; background: var(--surface-soft); }
.button.danger { color: var(--red); border-color: #ffd6da; background: var(--red-soft); }
.button.small, button.small { min-height: 34px; padding: 5px 11px; font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.intern-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--surface); }
.stat-card span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.stat-card strong { font-size: 27px; line-height: 1; }
.stat-card.orange strong { color: var(--orange); }
.stat-card.green strong { color: var(--green); }
.stat-card.red strong { color: var(--red); }
.content-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 2px rgba(26,39,73,.02); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-header h2, .panel-header p { margin-bottom: 0; }
.panel-header p { color: var(--muted); }
.panel-body { padding: 22px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pills a { border-radius: 8px; padding: 6px 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-pills a.active { color: var(--blue); background: var(--blue-soft); }

.filter-bar { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(150px, .8fr) minmax(220px, 1.4fr) auto; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.field { display: grid; gap: 7px; color: #4f596c; font-weight: 600; }
.field > span { font-size: 13px; }
input:not([type="submit"]), textarea, select { width: 100%; border: 1px solid #dce2eb; border-radius: 9px; padding: 10px 12px; color: var(--text); outline: none; background: #fff; }
input:focus, textarea:focus, select:focus { border-color: #8db4ff; box-shadow: 0 0 0 3px var(--blue-soft); }
textarea { min-height: 145px; resize: vertical; }
.form-card { width: min(680px, 100%); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; background: var(--surface); box-shadow: var(--shadow); }
.form-stack { display: grid; gap: 20px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.field-error { margin: 0; color: var(--red); font-size: 12px; font-weight: 500; }
.inline-create { display: flex; align-items: flex-end; gap: 8px; }
.inline-create input[type="text"] { width: 180px; }
.account-error { padding: 10px 22px 0; }
.sr-only { position: absolute; overflow: hidden; width: 1px; height: 1px; margin: -1px; clip: rect(0,0,0,0); white-space: nowrap; }

.task-list, .member-list, .account-list { display: grid; }
.task-row, .member-row, .account-row { display: grid; align-items: center; gap: 16px; padding: 17px 22px; border-bottom: 1px solid var(--line); }
.task-row:last-child, .member-row:last-child, .account-row:last-child { border-bottom: 0; }
.task-row { grid-template-columns: minmax(110px,.65fr) minmax(240px,1.7fr) 92px minmax(130px,.9fr) 112px 92px; }
.member-row { grid-template-columns: minmax(150px,1fr) minmax(210px,1.4fr) minmax(150px,.8fr) 110px; }
.account-row { grid-template-columns: minmax(150px,1fr) 90px minmax(170px,1fr) auto; }
.task-row:hover, .member-row:hover, .account-row:hover { background: #fbfcff; }
.row-title { font-weight: 700; }
.task-row-link { color: inherit; text-decoration: none; transition: background .18s ease, box-shadow .18s ease; }
.task-row-link:hover { background: #f7f9ff; box-shadow: inset 3px 0 0 var(--blue); }
.task-row-link:focus-visible { position: relative; z-index: 1; outline: 3px solid var(--blue-soft); outline-offset: -3px; }
.latest-update { margin-top: 7px; padding: 8px 10px; border-radius: 8px; background: #f6f8fc; }
.latest-update span { color: var(--muted); font-size: 11px; font-weight: 700; }
.latest-update p { display: -webkit-box; overflow: hidden; margin: 3px 0 0; color: var(--text); font-size: 13px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.view-detail { color: var(--blue); font-size: 13px; font-weight: 700; white-space: nowrap; }
.row-meta { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-actions form { margin: 0; }
.status { display: inline-flex; width: fit-content; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; }
.status[data-status="not_started"] { color: #687386; background: #eef1f5; }
.status[data-status="in_progress"] { color: var(--orange); background: var(--orange-soft); }
.status[data-status="blocked"] { color: var(--red); background: var(--red-soft); }
.status[data-status="completed"] { color: var(--green); background: var(--green-soft); }
.status[data-active="true"] { color: var(--green); background: var(--green-soft); }
.status[data-active="false"] { color: var(--red); background: var(--red-soft); }
.progress-wrap { display: flex; align-items: center; gap: 10px; }
progress { overflow: hidden; width: 100%; height: 7px; border: 0; border-radius: 99px; background: #edf0f4; }
progress::-webkit-progress-bar { background: #edf0f4; }
progress::-webkit-progress-value { border-radius: 99px; background: var(--blue); }
progress::-moz-progress-bar { border-radius: 99px; background: var(--blue); }
.progress-wrap span { min-width: 34px; color: var(--muted); font-size: 12px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-title h2 { margin: 0; }
.empty-state { padding: 64px 24px; text-align: center; color: var(--muted); }
.empty-state h2 { color: var(--text); }
.empty-state.compact { padding: 24px; }

.detail-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(290px,.75fr); gap: 20px; }
.detail-grid.single-focus { grid-template-columns: minmax(0, 760px); }
.detail-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--surface); }
.detail-card + .detail-card { margin-top: 18px; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; }
.detail-copy { white-space: pre-wrap; }
.timeline { position: relative; display: grid; gap: 20px; padding-left: 20px; }
.timeline::before { position: absolute; top: 8px; bottom: 8px; left: 4px; width: 1px; content: ""; background: var(--line); }
.timeline-item { position: relative; }
.timeline-item::before { position: absolute; top: 7px; left: -20px; width: 9px; height: 9px; border: 3px solid var(--blue-soft); border-radius: 50%; content: ""; background: var(--blue); }
.timeline-item time { display: block; color: var(--muted); font-size: 12px; }

.auth-body { min-height: 100vh; background: radial-gradient(circle at top left, #edf4ff 0, transparent 36%), var(--bg); }
.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 28px; }
.auth-card { width: min(420px, 100%); border: 1px solid var(--line); border-radius: 18px; padding: 36px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.auth-brand { display: grid; justify-items: center; margin-bottom: 28px; text-align: center; }
.auth-brand .brand-mark { margin-bottom: 14px; }
.auth-brand h1 { font-size: 25px; }
.auth-brand p, .auth-note { color: var(--muted); }
.auth-note { margin: 20px 0 0; text-align: center; font-size: 12px; }
.auth-card input[type="submit"] { width: 100%; margin-top: 6px; }
.auth-flashes { position: fixed; }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .task-row { grid-template-columns: minmax(110px,.7fr) minmax(210px,1.5fr) 90px minmax(120px,.8fr) 90px; }
  .task-row .due-date { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body.nav-open { overflow: hidden; }
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; }
  .nav-open .sidebar { transform: translateX(0); }
  .nav-backdrop { position: fixed; inset: 0; z-index: 20; border: 0; background: rgba(17,28,48,.3); }
  .nav-open .nav-backdrop { display: block; }
  .workspace-main { margin-left: 0; }
  .mobile-topbar { position: sticky; top: 0; z-index: 15; display: flex; height: 58px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 16px; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
  .mobile-nav-toggle { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0; color: var(--text); background: var(--surface); }
  .page-content { padding: 26px 16px 44px; }
  .page-header { align-items: flex-start; flex-direction: column; margin-bottom: 22px; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-card strong { font-size: 23px; }
  .filter-bar { grid-template-columns: 1fr; }
  .task-row, .member-row, .account-row { grid-template-columns: 1fr; gap: 10px; padding: 18px; }
  .view-detail { justify-self: start; }
  .row-actions { justify-content: flex-start; }
  .form-card { padding: 22px 18px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button, .form-actions input { width: 100%; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .inline-create { width: 100%; align-items: stretch; flex-direction: column; }
  .inline-create input[type="text"] { width: 100%; }
  .flash-stack { top: 68px; right: 14px; left: 14px; }
  .flash { min-width: 0; }
  .auth-card { padding: 28px 22px; }
}
