:root {
  color-scheme: light;
  --ink: #1f2825;
  --muted: #66736d;
  --line: #dce3df;
  --surface: #ffffff;
  --ground: #f3f5f4;
  --rail: #eaf0ed;
  --teal: #147b69;
  --teal-soft: #e2f2ed;
  --orange: #a45b22;
  --orange-soft: #fbefe2;
  --red: #9e3b38;
  --red-soft: #f8e9e7;
  --blue: #3a6175;
  --blue-soft: #e9f0f3;
  --radius: 6px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ground);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--ground); font-size: 14px; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
::selection { background: #c2e1d8; color: #12251f; }
:focus-visible { outline: 3px solid #42a48e; outline-offset: 2px; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(360px, 500px); align-items: stretch; }
.auth-aside { background: #163c34; color: #f2f7f4; padding: 48px clamp(28px, 7vw, 96px); display: flex; flex-direction: column; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 16px; }
.brand-mark { width: 28px; height: 28px; border: 2px solid currentColor; position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: currentColor; }
.brand-mark::before { left: 5px; top: 5px; width: 14px; height: 2px; box-shadow: 0 6px currentColor, 0 12px currentColor; }
.brand-mark::after { top: 5px; left: 5px; height: 14px; width: 2px; }
.auth-aside h1 { max-width: 520px; margin: 0; font-size: 34px; font-weight: 620; line-height: 1.18; }
.auth-aside p { max-width: 500px; color: #cad9d3; margin: 16px 0 0; font-size: 16px; }
.auth-aside-foot { color: #b7ccc4; font-size: 12px; }
.auth-main { display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(100%, 380px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 28px; }
.auth-card h2 { margin: 0 0 6px; font-size: 22px; }
.auth-card .subtle { color: var(--muted); margin: 0 0 24px; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: var(--rail); border-radius: 5px; margin: 0 0 20px; }
.auth-switch button { border: 0; background: transparent; border-radius: 4px; min-height: 38px; color: var(--muted); }
.auth-switch button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px #12251f15; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 218px minmax(0, 1fr); grid-template-rows: 58px 1fr; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .brand { font-size: 14px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-label { color: var(--muted); }
.sidebar { grid-row: 2; background: var(--rail); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; min-height: calc(100vh - 58px); }
.nav-label { padding: 13px 10px 6px; color: #59675f; text-transform: uppercase; font-size: 10px; font-weight: 700; }
.nav-item { border: 0; background: transparent; color: #43504a; text-align: left; border-radius: 5px; padding: 10px 11px; min-height: 40px; }
.nav-item:hover { background: #f4f7f5; }
.nav-item.active { background: #fff; color: #165c4e; font-weight: 650; box-shadow: 0 1px 2px #18362c0c; }
.sidebar-bottom { margin-top: auto; padding: 10px; color: var(--muted); font-size: 12px; border-top: 1px solid #d7dfda; }
.main { min-width: 0; padding: 28px clamp(18px, 3vw, 40px) 48px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 670; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.layout-two { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(290px, .85fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-head { min-height: 48px; padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 14px; font-weight: 650; }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.metric { padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { font-size: 23px; font-weight: 650; line-height: 1.35; font-variant-numeric: tabular-nums; }
.metric-note { margin-top: 2px; color: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { white-space: nowrap; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #68766f; font-weight: 650; background: #f7f9f8; }
td, th { padding: 11px 13px; border-bottom: 1px solid #e9eeeb; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fbfa; }
.primary-text { font-weight: 600; }
.secondary-text { color: var(--muted); font-size: 12px; margin-top: 3px; }
.numeric { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 650; white-space: nowrap; background: #eef1ef; color: #55625c; }
.status.open, .status.approved, .status.paid, .status.active { background: var(--teal-soft); color: #145847; }
.status.pending, .status.draft { background: #edf0ee; color: #48584f; }
.status.rejected, .status.suspended, .status.closed { background: var(--red-soft); color: #853b37; }
.status.paused { background: var(--blue-soft); color: #395b6c; }
.btn { min-height: 34px; padding: 7px 11px; background: #fff; color: var(--ink); border: 1px solid #bdc9c2; border-radius: 4px; font-weight: 590; }
.btn:hover { background: #f4f7f5; }
.btn.primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.btn.primary:hover { background: #0e6b5b; }
.btn.danger { color: var(--red); border-color: #dcb7b4; }
.btn.small { min-height: 28px; padding: 4px 8px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 620; color: #46534d; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #c9d2cd; background: #fff; border-radius: 4px; min-height: 38px; padding: 8px 10px; color: var(--ink); }
.field textarea { min-height: 90px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #637269; }
.capacity-value { white-space: nowrap; }
.task-open-action { min-width: 112px; }
.task-open-action .btn { white-space: nowrap; }
.submission-task .secondary-text { white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.full-width { width: 100%; min-height: 40px; }
.auth-note { margin: 14px 0 0; }
.task-filters { margin: 0 0 14px; padding-left: 0; }
.notice-list { display: grid; gap: 12px; }
.account-panel { max-width: 520px; }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.filter { border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 4px; min-height: 30px; padding: 5px 9px; }
.filter.active { border-color: #c9d6d0; background: #eff5f2; color: #175c4d; font-weight: 620; }
.task-detail { position: sticky; top: 76px; }
.task-reward { font-size: 23px; font-weight: 670; font-variant-numeric: tabular-nums; white-space: nowrap; }
.task-meta { display: flex; gap: 14px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.lifecycle { border-left: 1px solid #c8d3cd; margin: 12px 0 18px 4px; padding-left: 17px; display: grid; gap: 13px; }
.life-step { position: relative; color: #68766f; font-size: 12px; }
.life-step::before { content: ""; width: 7px; height: 7px; background: #c2ccc6; border: 2px solid #fff; box-shadow: 0 0 0 1px #b8c5be; border-radius: 50%; position: absolute; left: -22px; top: 5px; }
.life-step.current { color: var(--ink); font-weight: 650; }
.life-step.current::before { background: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.life-step.complete { color: #236c5c; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: #3b4842; margin-bottom: 4px; font-weight: 620; }
.detail-copy { white-space: pre-wrap; line-height: 1.65; }
.evidence-link { overflow-wrap: anywhere; }
.hint { color: var(--muted); font-size: 12px; }
.divider { height: 1px; background: #e7ece9; margin: 15px 0; }
.toast { position: fixed; z-index: 20; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 36px)); padding: 11px 14px; border-radius: 5px; background: #1d2924; color: #fff; box-shadow: 0 8px 22px #12251f24; opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; pointer-events: none; }
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { background: #7f302d; }
.mobile-nav { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 184px minmax(0,1fr); }
  .layout-two { grid-template-columns: minmax(0,1fr); }
  .task-detail { position: static; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .auth-shell { display: block; min-height: 100svh; }
  .auth-aside { min-height: 165px; padding: 18px 20px; gap: 22px; }
  .auth-aside h1 { font-size: 24px; }
  .auth-aside p, .auth-aside-foot { display: none; }
  .auth-main { padding: 20px 14px; }
  .auth-card { padding: 22px 18px; }
  .app-shell { display: block; min-height: 100svh; padding-bottom: 62px; }
  .topbar { height: 54px; padding: 0 14px; }
  .topbar .brand { font-size: 13px; }
  .user-label { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar { display: none; }
  .main { padding: 20px 13px 30px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 21px; }
  .page-head p { font-size: 12px; }
  .metrics { gap: 8px; }
  .metric { padding: 11px 12px; }
  .metric-value { font-size: 20px; }
  .panel-head { padding: 11px 12px; }
  .panel-body { padding: 13px; }
  .panel-body.tight { padding: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .mobile-nav { position: fixed; z-index: 8; bottom: 0; inset-inline: 0; min-height: 58px; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: flex-start; gap: 3px; overflow-x: auto; padding: 5px 6px calc(5px + env(safe-area-inset-bottom)); }
  .mobile-nav .nav-item { min-height: 44px; min-width: 66px; flex: 1 0 auto; text-align: center; padding: 6px 8px; font-size: 11px; }
  .mobile-nav .nav-item.active { box-shadow: none; background: var(--teal-soft); }
  .sidebar-bottom { display: none; }
  .head-actions .btn { min-height: 32px; }
  table.compact-stack thead { display: none; }
  table.compact-stack, table.compact-stack tbody, table.compact-stack tr, table.compact-stack td { display: block; width: 100%; }
  table.compact-stack tr { padding: 9px 12px; border-bottom: 1px solid var(--line); }
  table.compact-stack td { border: 0; padding: 2px 0; }
  table.compact-stack td[data-label] { display: flex; justify-content: space-between; gap: 12px; }
  table.compact-stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 11px; flex: 0 0 82px; }
  .task-open-action { min-width: 0; margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
