/* Workspace color tokens and primitives adapted from shadcn/ui.
   https://ui.shadcn.com/docs/theming · Copyright (c) 2023 shadcn · ../assets/shadcn-ui-MIT.txt */
:root {
  color-scheme: light;
  --canvas: #f6f5ef;
  --background: #fffefa;
  --foreground: #1f302a;
  --card: #fffefa;
  --card-foreground: var(--foreground);
  --popover: #fffefa;
  --popover-foreground: var(--foreground);
  --primary: #205a44;
  --primary-hover: #153f30;
  --primary-foreground: #fffef8;
  --secondary: #eeeee5;
  --secondary-foreground: #425047;
  --muted: #f2f2eb;
  --muted-foreground: #59665e;
  --accent: #e2eddf;
  --accent-foreground: #234e37;
  --accent-border: #b7cdb9;
  --destructive: #943e34;
  --border: #dedfd4;
  --input: #879185;
  --ring: #39734d;
  --sidebar: #fcfbf5;
  --sidebar-foreground: #314238;
  --sidebar-muted: #617066;
  --sidebar-accent: #e4ede1;
  --sidebar-border: #dcdfd3;
  --forest: #10382e;
  --paper: #fff9e9;
  --radius: .625rem;
  --radius-md: .5rem;
  --radius-xl: .875rem;
  --shadow-xs: 0 1px 2px rgb(34 54 34 / .04);
  --shadow-sm: 0 2px 7px -5px rgb(31 54 37 / .16);
  --shadow-dialog: 0 24px 80px rgb(15 36 26 / .22);
  --overlay: rgb(20 34 26 / .44);
  --motion: .16s cubic-bezier(.2,.7,.3,1);
  --font-sans: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-display: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "STZhongsong", "SimSun", "STIX Two Text", Georgia, serif;
  --font-numeric: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --warn: #865120;
  --warn-fill: #fbefda;
  --warn-border: #e4ceaa;
  --danger: #963b30;
  --danger-fill: #fbeae4;
  --danger-border: #e8bdb1;
  --success: #235e43;
  --success-fill: #e4f1e6;
  --success-border: #b6d3b9;
  font-family: var(--font-sans);
}

*, *::before, *::after { box-sizing: border-box; }
body { min-width: 320px; margin: 0; background: var(--canvas); color: var(--foreground); font-size: 14px; line-height: 1.55; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
h1, h2, h3, h4 { line-height: 1.35; }
button, input, select, textarea { font: inherit; }
button { appearance: none; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--primary); text-underline-offset: 4px; }
:where(button, input, select, textarea, summary, a):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted-foreground); }
.danger-text { color: var(--danger) !important; }
.icon { display: block; flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.primary, .secondary, .icon-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 520;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  transition: background-color var(--motion), border-color var(--motion), color var(--motion), box-shadow var(--motion), transform var(--motion);
}
.primary { background: var(--primary); color: var(--primary-foreground); font-weight: 650; box-shadow: var(--shadow-xs); }
.primary:hover:enabled { background: var(--primary-hover); }
:is(.primary,.secondary):active:enabled { transform: translateY(1px); }
.secondary { background: var(--background); border-color: var(--input); box-shadow: var(--shadow-xs); }
.icon-button { flex: none; width: 36px; padding: 0; background: transparent; }
.secondary:hover:enabled, .icon-button:hover:enabled, .text-button:hover:enabled { background: var(--accent); color: var(--accent-foreground); }
.text-button { padding-inline: 8px; background: transparent; }
.full { width: 100%; }

label { display: grid; gap: 7px; min-width: 0; margin: 12px 0; font-weight: 550; }
label small, .field-note { display: block; color: var(--muted-foreground); font-size: 12px; font-weight: 400; line-height: 1.55; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px 11px;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  font-weight: 400;
  line-height: 1.5;
}
:is(input, select, textarea):not([type="radio"]):not([type="checkbox"]):focus-visible {
  outline: 0;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring), transparent 62%);
}
input::placeholder, textarea::placeholder { color: var(--muted-foreground); }
input:read-only, textarea:read-only { background: var(--muted); }
input[type="checkbox"], input[type="radio"] { margin: 0; accent-color: var(--primary); width: 16px; height: 16px; }
textarea { display: block; resize: vertical; }
select { padding-inline-end: 23px; }
details summary { cursor: pointer; color: var(--foreground); font-weight: 550; }
code, time, .metric-value { font-variant-numeric: tabular-nums; }
code, kbd { font-family: ui-monospace, Consolas, "Liberation Mono", monospace; }
.form-error { color: var(--danger); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.form-error:empty, .reference-notice:empty { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; align-items: start; }

.card, .job-panel, .settings-group {
  min-width: 0;
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.card-heading h2 { font-size: 17px; font-weight: 670; letter-spacing: .005em; }
.card-heading :is(.text-button, .secondary) { min-height: 30px; padding-block: 4px; font-size: 12px; }
.card-heading > .muted, .panel-empty { font-size: 12px; }
.panel-empty { padding: 17px 18px; color: var(--muted-foreground); }

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 520;
  white-space: nowrap;
}
.badge.neutral { background: var(--secondary); border-color: transparent; color: var(--secondary-foreground); }
.badge.good { color: var(--success); background: var(--success-fill); border-color: var(--success-border); }
.badge.warn { color: var(--warn); background: var(--warn-fill); border-color: var(--warn-border); }
.badge.bad { color: var(--danger); background: var(--danger-fill); border-color: var(--danger-border); }
.badge.blue { color: var(--accent-foreground); background: var(--accent); border-color: var(--accent-border); }

.segmented {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  min-height: 36px;
  padding: 3px;
  color: var(--muted-foreground);
  background: var(--muted);
  border-radius: var(--radius);
}
.segmented button {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 10px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.segmented button:hover { color: var(--foreground); }
.segmented button[aria-pressed="true"] { background: var(--background); border-color: var(--border); color: var(--accent-foreground); box-shadow: var(--shadow-xs); font-weight: 640; }

@media (prefers-reduced-motion: reduce) {
  .primary, .secondary, .icon-button, .text-button { transition: none; }
  :is(.primary,.secondary):active:enabled { transform: none; }
}
