﻿:root {
  color-scheme: light;
  --ink: #18221f;
  --muted: #65736d;
  --subtle: #eef3ef;
  --line: #d9e2dc;
  --panel: #ffffff;
  --panel-soft: #f8faf8;
  --brand: #276749;
  --brand-dark: #1f513a;
  --accent: #c26b3a;
  --yellow: #f4c95d;
  --red: #c74b44;
  --blue: #426a8c;
  --shadow: 0 18px 45px rgba(24, 34, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f3f7f4;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(232, 240, 234, 0.92), rgba(248, 250, 248, 0.95)),
    #f3f7f4;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.shell.collect-shell {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.collect-sidebar {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  height: auto;
  padding: 14px 22px;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

.collect-sidebar .brand-lockup {
  margin-bottom: 0;
}

.collect-sidebar .nav-list {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.collect-sidebar .nav-button {
  width: auto;
  min-width: 0;
  padding: 9px 12px;
  white-space: nowrap;
}

.brand-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-weight: 800;
}

.brand-title {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-button {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav-button:hover {
  background: var(--subtle);
}

.nav-button.active {
  color: var(--ink);
  border-color: var(--line);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(24, 34, 31, 0.06);
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
}

.nav-icon svg,
.icon svg {
  display: block;
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.sidebar-panel {
  margin-top: 26px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.sidebar-panel h3 {
  margin: 0 0 8px;
  font-size: 0.88rem;
}

.sidebar-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.main {
  min-width: 0;
  padding: 22px clamp(16px, 3vw, 34px) 42px;
}

.collect-main {
  padding-top: 18px;
}

.topbar {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 880px;
  font-size: clamp(1.9rem, 2.7vw, 3.2rem);
  line-height: 1.03;
  letter-spacing: 0;
}

.page-note {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sync-shell {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.sync-status-card {
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 24px rgba(24, 34, 31, 0.06);
}

.sync-status-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.sync-refresh {
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-weight: 750;
  text-decoration: none;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.btn.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: white;
}

.btn.secondary:hover {
  background: var(--subtle);
}

.btn.danger {
  background: var(--red);
}

.btn.warning {
  color: #2f2819;
  background: var(--yellow);
}

.icon-btn {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

.icon-btn:hover {
  background: var(--subtle);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(136px, 160px));
  gap: 10px;
  justify-content: start;
  margin-bottom: 18px;
}

.metrics-grid.compact-metrics {
  max-width: 700px;
}

.metric {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(24, 34, 31, 0.06);
}

.metric-button {
  width: 100%;
  color: inherit;
  text-align: left;
  appearance: none;
}

.metric-button:hover {
  border-color: rgba(39, 103, 73, 0.4);
  background: var(--panel-soft);
}

.metric-active {
  border-color: var(--brand);
  background: #eff7f1;
  box-shadow: inset 0 0 0 1px rgba(39, 103, 73, 0.18);
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  line-height: 1;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel + .panel,
.stack > .panel + .panel {
  margin-top: 18px;
}

.panel-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 18px 0;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.panel-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-body {
  padding: 18px;
}

.project-list {
  display: grid;
  gap: 10px;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.project-row:hover {
  border-color: rgba(39, 103, 73, 0.45);
  box-shadow: 0 12px 26px rgba(24, 34, 31, 0.06);
}

.project-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.project-row h3 {
  margin: 0;
  font-size: 1rem;
}

.link-title {
  display: inline;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 850;
  text-align: left;
}

.link-title:hover {
  color: var(--brand);
  text-decoration: underline;
}

.project-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.84rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--subtle);
  font-size: 0.75rem;
  font-weight: 800;
}

.badge.success {
  color: #155c38;
  background: #dff2e7;
}

.badge.warning {
  color: #6b4d00;
  background: #fff1c7;
}

.badge.danger {
  color: #7d1d18;
  background: #f8d6d4;
}

.badge.info {
  color: #214866;
  background: #dcecf8;
}

.badge.neutral {
  color: var(--muted);
  background: #edf1ed;
}

.progress-track {
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: var(--subtle);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.progress-label {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.workflow {
  display: grid;
  gap: 8px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.step-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-size: 0.82rem;
  font-weight: 850;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.field.full {
  grid-column: 1 / -1;
}

label,
.field-label {
  color: #2c3834;
  font-size: 0.86rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  outline: none;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(39, 103, 73, 0.14);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.segment {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  font-weight: 800;
}

.segment.active {
  color: white;
  border-color: var(--brand);
  background: var(--brand);
}

.help-text {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.switch-line {
  display: flex;
  gap: 10px;
  align-items: center;
}

.switch-line input {
  width: auto;
  min-height: 0;
}

.ai-box,
.soft-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.ai-box h3,
.soft-box h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.ai-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.api-strip {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

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

.protocol-grid.protocol-stack {
  grid-template-columns: minmax(0, 1fr);
}

.analysis-grid.detail-stack {
  grid-template-columns: minmax(0, 1fr);
}

.protocol-card,
.analysis-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.protocol-card strong,
.analysis-card strong {
  display: block;
  margin-bottom: 8px;
}

.preline {
  white-space: pre-line;
}

.structured-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding-left: 18px;
}

.structured-list li {
  line-height: 1.45;
}

.structured-list strong {
  display: inline;
  margin: 0;
}

.structured-sections {
  display: grid;
  gap: 14px;
}

.structured-sections section {
  display: grid;
  gap: 4px;
}

.structured-sections strong {
  margin: 0;
}

.structured-sections p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.sample-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.sample-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.sample-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.protocol-variable-list {
  display: grid;
  gap: 8px;
}

.protocol-variable-item {
  grid-template-columns: minmax(0, 1fr);
}

.protocol-variable-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.protocol-variable-actions {
  justify-content: flex-start;
}

.chip-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.data-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #35413d;
  background: var(--panel-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td input,
td select {
  min-width: 100px;
  min-height: 34px;
  padding: 6px 8px;
}

.collect-today-panel {
  margin-bottom: 18px;
}

.today-task-list {
  display: grid;
  gap: 10px;
}

.today-task-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.today-task-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.today-task-card p {
  margin: 0;
  color: var(--muted);
}

.collect-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.45fr);
  gap: 18px;
}

.collect-table {
  min-width: 1620px;
  table-layout: auto;
}

.collect-table th,
.collect-table td {
  padding: 8px 6px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.collect-table th {
  font-size: 0.72rem;
  line-height: 1.25;
}

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

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

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

.collect-table th:nth-child(n + 4):not(:last-child),
.collect-table td:nth-child(n + 4):not(:last-child) {
  min-width: 132px;
}

.collect-table th:last-child,
.collect-table td:last-child {
  width: 58px;
}

.collect-table td input,
.collect-table td select {
  width: 100%;
  min-width: 0;
  padding: 5px 6px;
  font-size: 0.9rem;
}

.collect-table th:nth-child(-n + 3),
.collect-table td:nth-child(-n + 3) {
  position: sticky;
  z-index: 2;
  background: white;
}

.collect-table th:nth-child(1),
.collect-table td:nth-child(1) {
  left: 0;
}

.collect-table th:nth-child(2),
.collect-table td:nth-child(2) {
  left: 78px;
}

.collect-table th:nth-child(3),
.collect-table td:nth-child(3) {
  left: 216px;
}

.collect-table th:nth-child(-n + 3) {
  z-index: 3;
  background: var(--panel-soft);
}

.calendar-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-header > div {
  display: grid;
  gap: 8px;
}

.scope-switch {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scope-pill {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-weight: 750;
}

.scope-pill.active {
  color: white;
  border-color: var(--brand);
  background: var(--brand);
}

.scope-pill:hover {
  border-color: rgba(39, 103, 73, 0.45);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-align: center;
  text-transform: uppercase;
}

.month-cell {
  min-height: 72px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  text-align: left;
}

.month-cell:hover {
  border-color: rgba(39, 103, 73, 0.55);
}

.month-cell.active {
  border-color: var(--brand);
  background: #eff7f1;
  box-shadow: inset 0 0 0 2px rgba(39, 103, 73, 0.18);
}

.month-cell.muted {
  background: transparent;
  border-color: transparent;
}

.month-cell strong {
  display: block;
  margin-bottom: 6px;
}

.day-dot {
  display: inline-flex;
  margin: 2px 0;
  padding: 2px 5px;
  border-radius: 999px;
  color: #214866;
  background: #dcecf8;
  font-size: 0.64rem;
  font-weight: 800;
}

.day-dot.done {
  color: #155c38;
  background: #dff2e7;
}

.day-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.day-panel h3 {
  margin: 0 0 10px;
}

.day-task {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.day-task p {
  margin: 0;
  color: var(--muted);
}

.task-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.test-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.test-calendar-cell {
  display: grid;
  gap: 4px;
  min-height: 104px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.test-calendar-cell.done {
  border-color: rgba(39, 103, 73, 0.42);
  background: #eff7f1;
}

.test-calendar-cell span,
.test-calendar-cell small,
.test-calendar-cell em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.test-calendar-cell strong {
  margin: 0;
  font-size: 1.35rem;
}

.chart {
  width: 100%;
  height: auto;
  min-height: 260px;
}

.chart text {
  fill: var(--muted);
  font-size: 12px;
}

.report {
  display: grid;
  gap: 14px;
}

.report-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.report-section h3 {
  margin: 0 0 8px;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  transform: translateY(120%);
  transition: transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-panel {
    display: none;
  }

  .dashboard-grid,
  .collect-layout,
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 16px 12px 32px;
  }

  .topbar,
  .project-row,
  .panel-header {
    display: grid;
  }

  .toolbar {
    justify-content: start;
  }

  .nav-list,
  .metrics-grid,
  .dashboard-grid,
  .form-grid,
  .segmented,
  .protocol-grid,
  .analysis-grid,
  .protocol-variable-grid,
  .collect-layout {
    grid-template-columns: 1fr;
  }

  .api-strip {
    grid-template-columns: 1fr;
  }

  .month-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .toolbar,
  .no-print,
  .toast {
    display: none !important;
  }

  .shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .panel,
  .report-section {
    box-shadow: none;
    break-inside: avoid;
  }
}



.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.auth-copy {
  margin-bottom: 18px;
}

.auth-form-grid {
  grid-template-columns: minmax(0, 1fr);
}

.auth-toolbar {
  justify-content: flex-start;
  margin-top: 8px;
}

.auth-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.auth-error {
  margin: 10px 0 0;
  color: var(--red);
  font-weight: 700;
}

.topbar-user {
  max-width: 280px;
}
