/* Hallmark · v2.0.0 · genre: modern-minimal · shape: app screen · theme: 砺算 · redesign: full · signature: training queue and recent results */
/* Hallmark · pre-emit critique: P5 H5 E4 S4 R5 V4 · weakest: E, long tables need explicit field labels when stacked. */
:root {
  --font-interface: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  --font-code: "Cascadia Code", Consolas, monospace;
  --text-secondary: #4c615b;
  --surface-subtle: #f6f9f8;
  --control-edge: #7b8d87;
  --nav-edge: #28443f;
  --nav-text: #e1eeea;
  --nav-subtle: #b6ccc5;
  --nav-hover: #1a3a35;
  --nav-selection: #254944;
  --focus-on-dark: #a5e1cd;
  --overlay: rgb(16 43 41 / 46%);
  --auth-heading: #f5fbf8;
  --workspace-width: 1480px;
  --page-inset: clamp(20px, 3vw, 40px);
  --panel-inset: 24px;
}

html, body { overflow-x: clip; }
body { color: var(--ink); font-family: var(--font-interface); }
pre, code, .dataset-format-guide pre, .invite-code-row input { font-family: var(--font-code); }

/* Shared shell and controls */
.content { max-width: var(--workspace-width); padding: 24px var(--page-inset) 48px; }
.topbar { min-height: 68px; padding: 12px var(--page-inset); }
.topbar h1 { font-size: 22px; letter-spacing: normal; overflow-wrap: break-word; min-width: 0; }
.topbar-title { min-width: 0; }
.topbar-actions { gap: 12px; }
.profile { min-height: 44px; }
.profile b { font-size: var(--font-table); }
.avatar, .profile-avatar { background: var(--blue-dark); }
.sidebar { background: var(--navy-deep); border-color: var(--nav-edge); }
.sidebar-brand { padding: 4px 8px 24px; letter-spacing: normal; }
.sidebar-brand small { color: var(--nav-subtle); font-weight: 400; letter-spacing: normal; }
.nav-section-label { color: var(--nav-subtle); letter-spacing: normal; }
.nav-item { color: var(--nav-text); font-size: var(--font-body); }
.nav-item > span { color: var(--nav-subtle); }
.nav-item:hover { color: var(--auth-heading); background: var(--nav-hover); }
.nav-item.active { color: var(--auth-heading); background: var(--nav-selection); }
.logout-button { min-height: 44px; margin-top: auto; color: var(--nav-subtle); text-align: left; padding-inline: 16px; }
.logout-button:hover { color: var(--auth-heading); background: var(--nav-hover); border-radius: var(--radius); }
.drawer-backdrop { background: var(--overlay); }
.menu-button, .icon-button {
  width: 44px;
  height: 44px;
  color: var(--blue-dark);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}
.menu-button:hover, .icon-button:hover { background: var(--blue-soft); }
.panel, .project-card, .pricing-card { box-shadow: none; }
.panel-heading h2, .section-intro h2 { min-width: 0; font-size: 18px; line-height: 1.4; overflow-wrap: break-word; }
.section-intro p, .muted, .field-hint, .empty-state { color: var(--text-secondary); }
.section-intro p { max-width: 64ch; line-height: 1.65; }
.field-hint, .tiny-note { font-size: var(--font-small); }
.empty-state { font-size: var(--font-body); line-height: 1.55; }
.status-chip { font-variant-numeric: tabular-nums; }
.button { min-height: 44px; font-size: var(--font-body); text-decoration: none; }
.button-primary:enabled { color: var(--panel); background: var(--blue-dark); box-shadow: none; }
.button-primary:enabled:hover { background: var(--navy); }
.button-secondary { color: var(--blue-dark); border-color: var(--line); background: var(--blue-soft); }
.button-secondary:enabled:hover { background: var(--canvas); }
.button-muted { background: var(--surface-subtle); color: var(--text-secondary); border: 1px solid var(--line); }
.button-muted:enabled:hover { background: var(--blue-soft); }
.button:disabled { color: var(--text-secondary); background: var(--canvas); box-shadow: none; }
.button:active:not(:disabled), .small-button:active:not(:disabled) { transform: translateY(1px); }
.small-button, .text-button { min-height: 36px; }
input:not([type="checkbox"]), select, textarea {
  min-width: 0;
  color: var(--ink);
  background-color: var(--panel);
  border-color: var(--control-edge);
  transition: none;
}
:is(input, select, textarea):disabled { color: var(--text-secondary); background-color: var(--canvas); }
input::file-selector-button {
  min-height: 32px;
  margin-inline-end: 8px;
  padding-inline: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  cursor: pointer;
}
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  transition: none;
}
:is(input, select, textarea):focus { box-shadow: none; }
.sidebar :is(button, a):focus-visible { outline-color: var(--focus-on-dark); }
.form-error:empty { display: none; }
.table-scroll { min-width: 0; }
.table-scroll:has(tbody:empty) { display: none; }
.table-scroll :is(th, td) { padding: 12px 16px; font-size: var(--font-table); }
.table-scroll th { color: var(--text-secondary); background: var(--surface-subtle); font-weight: 600; }
.table-scroll td small { color: var(--text-secondary); }
.table-scroll td { white-space: normal; overflow-wrap: anywhere; }
.table-scroll td:first-child { min-width: 0; }
.table-scroll tr:focus-visible { outline-offset: -2px; }
.table-scroll tr[data-job-id]:hover { background: var(--blue-soft); }
.list-toolbar { background: var(--panel); gap: 12px; }
.list-filter-fields { gap: 12px; }
.list-filter-fields input, .list-filter-fields select, .list-pagination select { border-color: var(--control-edge); }
.list-filter-actions .button { min-height: 40px; font-size: var(--font-table); }
.list-pagination { padding-block: 12px; }
.log-window { font-size: var(--font-table); }
.job-detail-context { display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* Sign in and invitation sign-up */
.login-shell { min-height: 100svh; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
.login-visual {
  min-height: 0;
  padding: 40px clamp(32px, 5vw, 72px);
  background: var(--navy-deep);
  color: var(--auth-heading);
}
.login-visual::before { content: none; }
.login-visual .brand { letter-spacing: normal; }
.login-visual .brand small { display: block; color: var(--nav-subtle); font-weight: 400; }
.login-copy { margin: auto 0; max-width: 550px; padding: 44px 0; }
.login-copy h1 {
  margin: 0 0 16px;
  min-width: 0;
  color: var(--auth-heading);
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.2;
  letter-spacing: normal;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.login-copy > p { margin: 0; color: var(--nav-text); max-width: 36ch; font-size: 16px; line-height: 1.75; }
.login-capabilities {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
  margin: 32px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--nav-edge);
}
.login-capabilities dt { color: var(--nav-subtle); font-size: var(--font-table); }
.login-capabilities dd { margin: 4px 0 0; color: var(--auth-heading); font-weight: 600; }
.login-footnote { color: var(--nav-subtle); font-size: var(--font-table); }
.login-panel { padding: 32px clamp(24px, 4vw, 64px); background: var(--surface-subtle); }
.login-card {
  width: min(100%, 440px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.login-card h2 { font-size: 26px; line-height: 1.3; letter-spacing: normal; }
.login-card > .muted { margin-bottom: 24px; line-height: 1.6; }
.login-card label { color: var(--ink); }
.login-card .button-primary { margin-top: 4px; }
.auth-switch { margin-top: 16px; padding-top: 12px; }
.auth-switch .button { padding-inline: 12px; }

/* Overview */
.workspace-welcome {
  padding: var(--panel-inset);
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--blue-soft);
  align-items: center;
}
.workspace-welcome .ws-title { font-size: 24px; line-height: 1.35; letter-spacing: normal; }
.workspace-welcome .ws-lede { color: var(--text-secondary); font-size: var(--font-body); }
.workspace-welcome .button-secondary { background: var(--panel); }
.workspace-welcome .button-secondary:hover { background: var(--surface-subtle); }
.ws-section-title { margin-top: 0; }
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 24px; }
.metric-card { padding: 16px; }
.metric-card small { color: var(--text-secondary); font-size: var(--font-table); }
.overview-work { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.overview-work .panel { min-width: 0; padding: 20px; }
.overview-work .panel-heading { margin-bottom: 8px; }
.overview-work .ws-attention { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 8px 0 0; }
.overview-work .ws-todo { min-height: 52px; padding: 8px 4px; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.overview-work .ws-todo:hover { background: var(--surface-subtle); }
.overview-work .ws-num { font-size: 20px; }
.overview-work .task-panel .job-title b { font-size: var(--font-body); }

/* Projects, datasets and results */
.project-layout { grid-template-columns: minmax(260px, .68fr) minmax(0, 1.5fr); }
.project-library { min-width: 0; }
.project-library > .panel-heading { margin: 0 0 12px; }
.project-library .project-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); }
.project-card { min-width: 0; border-radius: var(--radius); }
.project-card:hover { border-color: var(--control-edge); box-shadow: none; }
.project-stats { gap: 0; border-block: 1px solid var(--line); }
.project-stats div { background: transparent; padding: 8px 4px; }
.project-stats strong { font-variant-numeric: tabular-nums; }
.project-card-foot { flex-wrap: wrap; gap: 8px; }
.dataset-layout { grid-template-columns: minmax(0, 1fr) minmax(280px, 320px); }
.dataset-layout > .panel { min-width: 0; }
.dataset-upload-panel { scroll-margin-top: 24px; }
.dataset-upload-jump { display: none; }
.dataset-table-panel .table-title { padding: 16px; }
.dataset-table-panel .list-toolbar { padding-inline: 16px; }
.dataset-table-panel table { table-layout: fixed; }
.dataset-table-panel th:first-child { width: 23%; }
.dataset-table-panel th:nth-child(2) { width: 21%; }
.dataset-table-panel th:last-child { width: 15%; }
.dataset-table-panel .table-scroll :is(th, td) { padding-inline: 8px; }
.dataset-row-action { color: var(--blue-dark); font-size: var(--font-table); }
.dataset-row-action span { color: var(--blue); font-size: var(--font-small); }
.dataset-training-action { background: var(--blue-dark); }
.dataset-training-action:hover { background: var(--navy); }
.results-intro .ws-actions { flex: none; }
.cmp-toolbar { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) auto; align-items: end; gap: 12px; }
.cmp-toolbar label { min-width: 0; color: var(--text-secondary); font-size: var(--font-table); }
.cmp-toolbar label :is(input[type="search"], select) { width: 100%; min-width: 0; height: 40px; border-color: var(--control-edge); }
.cmp-count { margin: 0; min-height: 40px; display: flex; align-items: center; }
.cmp-check { width: 18px; height: 18px; }
.cmp-name small { font-family: var(--font-interface); }
.cmp-bar-track { background: var(--canvas); }

/* Billing and account settings */
.pricing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.3fr); }
.pricing-grid .formula-card { background: var(--blue-soft); color: var(--ink); }
.pricing-grid .formula-card :is(p, span) { color: var(--text-secondary); }
.pricing-card strong, .billing-total strong, #profile-id { font-variant-numeric: tabular-nums; }
.profile-settings { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: start; }
.profile-identity { display: grid; gap: 16px; }
.profile-body { gap: 16px; align-items: start; }
.profile-details { grid-template-columns: minmax(0, 1fr); }
.profile-details > div { padding: 8px 0; }
.profile-details > div:last-child { border-bottom: 0; }
.profile-details dt, .profile-note, .profile-methods :is(th, td) { color: var(--text-secondary); }
.profile-state { background: var(--canvas); color: var(--text-secondary); }
.profile-state-active { background: var(--green-soft); color: var(--green); }
.profile-login-method { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; }
.profile-password-settings, .profile-more-methods { margin: 0; border-top: 1px solid var(--line); padding: 0; }
.profile-card summary { min-height: 44px; align-content: center; padding: 8px 0; color: var(--blue-dark); cursor: pointer; font-weight: 600; }
.profile-card .job-form { margin-bottom: 4px; }

@media (max-width: 1280px) {
  .dataset-layout { grid-template-columns: minmax(0, 1fr); }
  .dataset-upload-jump { display: inline-flex; }
  .dataset-upload-panel { max-width: 640px; }
}

@media (max-width: 960px) {
  .app-shell { display: block; }
  .sidebar {
    visibility: hidden;
    transform: translateX(-105%);
  }
  .sidebar.open { visibility: visible; transform: none; }
  .menu-button { display: inline-grid; place-items: center; }
  body:has(.sidebar.open) .drawer-backdrop:not(.open) { display: block; z-index: 19; }
}

@media (max-width: 820px) {
  :root { --page-inset: 16px; --panel-inset: 20px; }
  .topbar h1 { font-size: 20px; }
  .login-shell { grid-template-columns: minmax(0, 1fr); }
  .login-panel { min-height: 100svh; padding: 24px 16px; }
  .mobile-brand { margin-bottom: 24px; font-size: var(--font-body); letter-spacing: normal; }
  .overview-work, .project-layout, .profile-settings { grid-template-columns: minmax(0, 1fr); }
  .overview-work .panel { padding: 16px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card:nth-child(odd) { border-right: 1px solid var(--line); }
  .metric-card:nth-child(n + 3) { border-bottom: 0; }
  .section-intro { flex-wrap: wrap; }
  .table-scroll { padding: 8px; }
  .table-scroll tbody tr { margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px; }
  .table-scroll tbody tr:last-child { border-bottom: 0; }
  .table-scroll tbody td { padding: 4px 0; align-items: baseline; }
  .table-scroll td[data-label]::before { font-size: var(--font-small); }
  .table-scroll td[data-label] { justify-content: space-between; gap: 12px; text-align: right; }
  .table-cell-value { min-width: 0; }
  .table-scroll .progress-wrap { display: grid; justify-items: end; }
  .table-scroll .progress-track { min-width: 70px; }
  .table-scroll .dataset-row-action { padding-block: 8px; }
  .dataset-table-panel .table-scroll td { padding-inline: 0; }
  .cmp-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 16px; }
  .cmp-toolbar label:first-child, .cmp-count { grid-column: 1 / -1; }
  .cmp-count { min-height: 0; }
  .cmp-table .text-button, .table-scroll .small-button { min-height: 44px; }
  .pricing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pricing-grid .formula-card { grid-column: 1 / -1; }
  .list-pagination > div { gap: 4px; }
}

@media (max-width: 440px) {
  .topbar-actions { gap: 8px; }
  .login-card { padding: 24px; }
  .workspace-welcome .ws-actions, .workspace-welcome .button { width: 100%; }
  .workspace-welcome .button { flex: auto; }
  .pricing-card { padding: 12px; }
  .pricing-card strong { font-size: 23px; }
  .profile-body { gap: 12px; }
  .profile-avatar { flex-basis: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; scroll-behavior: auto !important; }
}
