:root {
  color-scheme: light;
  --ink: #141414;
  --ink-soft: #262626;
  --muted: #707070;
  --faint: #adadad;
  --canvas: #fff;
  --canvas-soft: #f3f3f3;
  --field: #f0f0f0;
  --hairline: #e0e0e0;
  --hairline-soft: #f0f0f0;
  --accent: #0066ff;
  --success: #177245;
  --warning: #9a6700;
  --danger: #b42318;
  --sidebar: 248px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; line-height: 1.5; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }

.btn {
  min-height: 44px;
  border: 0;
  border-radius: 9999px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--ink-soft); }
.btn:focus-visible, .field:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--ink); border: 1px solid var(--hairline); }
.btn-outline:hover { background: var(--canvas-soft); }
.btn-soft { background: var(--canvas-soft); color: var(--ink); }
.btn-blue { background: var(--accent); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 13px; }

.field-wrap { display: grid; gap: 7px; }
.field-label { font-size: 12px; font-weight: 650; color: var(--ink-soft); }
.field {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  padding: 0 15px;
  background: var(--field);
  color: var(--ink);
}
.field::placeholder { color: var(--faint); }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #707070 50%), linear-gradient(135deg, #707070 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.field-help { color: var(--muted); font-size: 12px; }
.field-error, .form-error { color: var(--danger); font-size: 12px; }
.form-success { color: var(--success); font-size: 13px; }

.card { background: #fff; border: 1px solid var(--hairline-soft); border-radius: 24px; padding: 24px; }
.card-soft { background: var(--canvas-soft); border-color: transparent; }
.card-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.card-title { margin: 0; font-size: 20px; line-height: 1.3; }
.card-subtitle { margin: 6px 0 0; color: var(--muted); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border-radius: 9999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pending { background: #f4f4f4; color: #626262; }
.status-running { background: #fff6dd; color: var(--warning); }
.status-done { background: #eaf7f0; color: var(--success); }
.status-failed { background: #fff0ee; color: var(--danger); }
.status-neutral { background: var(--canvas-soft); color: var(--muted); }

.app-footer { min-height: 52px; display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--faint); font-size: 12px; }
.app-footer a { color: var(--muted); text-underline-offset: 3px; }
.footer-dot { color: var(--hairline); }

.auth-page { min-height: 100vh; display: grid; grid-template-rows: 1fr auto; }
.auth-shell { min-height: calc(100vh - 52px); display: grid; grid-template-columns: minmax(460px, 42%) 1fr; }
.auth-panel { padding: 48px clamp(32px, 5vw, 88px); display: flex; flex-direction: column; justify-content: center; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 30%; display: grid; place-items: center; color: #fff; background: var(--ink); font-size: 15px; }
.auth-copy { margin: 72px 0 30px; }
.auth-copy h1 { margin: 0; max-width: 520px; font-size: clamp(36px, 4vw, 58px); line-height: 1.03; letter-spacing: -.04em; }
.auth-copy p { max-width: 480px; margin: 18px 0 0; color: var(--muted); font-size: 16px; }
.auth-card { max-width: 460px; padding: 0; border: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 22px; border-radius: 9999px; background: var(--canvas-soft); }
.segment { min-height: 40px; border: 0; border-radius: 9999px; background: transparent; cursor: pointer; font-weight: 650; color: var(--muted); }
.segment.is-active { background: #fff; color: var(--ink); }
.auth-form { display: grid; gap: 16px; }
.auth-submit { width: 100%; margin-top: 6px; }
.auth-visual { margin: 18px 18px 18px 0; border-radius: 32px; background: var(--canvas-soft); padding: clamp(32px, 5vw, 72px); display: flex; align-items: center; overflow: hidden; }
.visual-board { width: 100%; max-width: 760px; margin: auto; display: grid; gap: 16px; }
.visual-top { display: flex; justify-content: space-between; align-items: center; }
.visual-chip { display: inline-flex; padding: 8px 13px; border-radius: 9999px; background: #fff; color: var(--muted); font-size: 12px; }
.visual-chart { height: 220px; border-radius: 24px; background: #fff; padding: 24px; display: flex; align-items: end; gap: 10px; }
.visual-bar { flex: 1; min-width: 12px; border-radius: 9999px 9999px 4px 4px; background: #d7d7d7; }
.visual-bar.is-accent { background: var(--accent); }
.visual-list { background: #fff; border-radius: 24px; overflow: hidden; }
.visual-row { height: 54px; display: grid; grid-template-columns: 1.5fr .7fr .5fr; gap: 16px; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--hairline-soft); color: var(--muted); font-size: 12px; }
.visual-row:last-child { border-bottom: 0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--hairline-soft); padding: 22px 16px; display: flex; flex-direction: column; background: #fff; z-index: 20; }
.sidebar .brand { padding: 0 8px; }
.sidebar-nav { display: grid; gap: 5px; margin-top: 36px; }
.nav-item { width: 100%; min-height: 44px; border: 0; border-radius: 9999px; padding: 0 14px; display: flex; align-items: center; gap: 11px; background: transparent; color: var(--muted); cursor: pointer; text-align: left; }
.nav-item:hover { background: var(--canvas-soft); color: var(--ink); }
.nav-item.is-active { background: var(--canvas-soft); color: var(--ink); font-weight: 650; }
.nav-icon { width: 18px; height: 18px; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 12px; }
.user-card { padding: 12px; border-radius: 16px; background: var(--canvas-soft); overflow: hidden; }
.user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.main { min-width: 0; padding: 28px clamp(22px, 3vw, 48px); background: #fff; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 32px; }
.page-title { margin: 0; font-size: 30px; line-height: 1.16; letter-spacing: -.025em; }
.page-kicker { margin: 6px 0 0; color: var(--muted); }
.view { display: grid; gap: 24px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-span-2 { grid-column: 1 / -1; }
.upload-zone { border: 1px dashed #cfcfcf; border-radius: 16px; padding: 22px; text-align: center; background: #fff; }
.upload-zone input { width: 100%; }

.table-wrap { overflow: auto; border: 1px solid var(--hairline-soft); border-radius: 16px; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data-table th, .data-table td { padding: 12px; border-bottom: 1px solid var(--hairline-soft); text-align: left; vertical-align: middle; white-space: nowrap; }
.data-table th { background: var(--canvas-soft); color: var(--muted); font-size: 12px; font-weight: 650; position: sticky; top: 0; z-index: 2; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fafafa; }
.task-name { font-weight: 650; color: var(--ink); }
.task-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.progress { min-width: 150px; }
.progress-track { height: 6px; border-radius: 9999px; background: var(--canvas-soft); overflow: hidden; }
.progress-bar { height: 100%; border-radius: inherit; background: var(--accent); }
.progress-copy { display: flex; justify-content: space-between; margin-top: 5px; color: var(--muted); font-size: 11px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 16px; }

.report-shell { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr auto; }
.report-topbar { padding: 18px 24px; border-bottom: 1px solid var(--hairline-soft); display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.report-tools { padding: 14px 24px; border-bottom: 1px solid var(--hairline-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.report-tools .field { min-height: 40px; width: auto; min-width: 220px; border-radius: 9999px; }
.report-frame { width: 100%; min-height: 720px; border: 0; background: #fff; }
.report-loading { padding: 80px 24px; text-align: center; color: var(--muted); }
.report-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-chip { padding: 7px 11px; border-radius: 9999px; background: var(--canvas-soft); color: var(--muted); font-size: 12px; }
.detail-drawer { position: fixed; right: 20px; bottom: 20px; width: min(460px, calc(100vw - 40px)); max-height: 72vh; overflow: auto; padding: 22px; border: 1px solid var(--hairline); border-radius: 24px; background: #fff; z-index: 50; }
.detail-drawer h2 { margin: 0 0 14px; font-size: 20px; }
.detail-block { margin-top: 14px; }
.detail-label { color: var(--muted); font-size: 12px; }
.detail-value { margin-top: 4px; white-space: pre-wrap; }

@media (max-width: 1100px) {
  :root { --sidebar: 216px; }
  .main { padding-inline: 22px; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-panel { padding: 32px 22px; }
  .auth-copy { margin-top: 54px; }
  .auth-visual { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--hairline-soft); }
  .sidebar-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 18px; overflow: auto; }
  .nav-item { justify-content: center; padding: 0 10px; white-space: nowrap; }
  .nav-icon { display: none; }
  .sidebar-bottom { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-span-2 { grid-column: auto; }
  .topbar { align-items: flex-start; }
}
@media (max-width: 600px) {
  .sidebar-nav { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 22px 14px; }
  .page-title { font-size: 25px; }
  .card { padding: 18px; border-radius: 18px; }
  .report-topbar, .report-tools { padding-inline: 14px; }
  .report-tools .field { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
