/* Takt — Company LLM Wiki & Skill Forge Studio
   Architectural Daylight + Dark Studio unified design system.
   Matches / (studio.css): single-elevation hairlines, zero-pill metadata,
   Plus Jakarta Sans + IBM Plex Mono tabular numerals. */

:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f0f4f8;
  --surface-hover: #e8eef6;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --panel-3: #eef2f7;
  --line: rgba(10, 37, 64, 0.08);
  --line-2: rgba(10, 37, 64, 0.15);
  --line-strong: rgba(10, 37, 64, 0.15);
  --ink: #0a2540;
  --ink-2: #334155;
  --muted: #52637a;
  --faint: #7b8ca3;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-dim: rgba(79, 70, 229, 0.28);
  --accent-soft: rgba(79, 70, 229, 0.075);
  --accent-line: rgba(79, 70, 229, 0.28);
  --ok: #0f766e;
  --ok-soft: rgba(15, 118, 110, 0.08);
  --ok-line: rgba(15, 118, 110, 0.26);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.08);
  --warn-line: rgba(180, 83, 9, 0.26);
  --danger: #be123c;
  --danger-soft: rgba(190, 18, 60, 0.08);
  --danger-line: rgba(190, 18, 60, 0.26);
  --glass-bg: rgba(255, 255, 255, 0.86);
  --shadow-xs: 0 1px 1px rgba(10, 37, 64, 0.03), 0 1px 2px rgba(10, 37, 64, 0.04);
  --shadow-sm: 0 1px 2px rgba(10, 37, 64, 0.05), 0 4px 12px -2px rgba(10, 37, 64, 0.04);
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-w: 200px;
  --list-w: minmax(256px, 316px);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e17;
  --surface: #101624;
  --surface-2: #172033;
  --surface-hover: #1e2a42;
  --panel: #101624;
  --panel-2: #0d1320;
  --panel-3: #172033;
  --line: rgba(148, 163, 184, 0.13);
  --line-2: rgba(148, 163, 184, 0.24);
  --line-strong: rgba(148, 163, 184, 0.24);
  --ink: #f8fafc;
  --ink-2: #cbd5e1;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-dim: rgba(129, 140, 248, 0.34);
  --accent-soft: rgba(129, 140, 248, 0.12);
  --accent-line: rgba(129, 140, 248, 0.34);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.1);
  --ok-line: rgba(52, 211, 153, 0.3);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.1);
  --warn-line: rgba(251, 191, 36, 0.32);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --danger-line: rgba(251, 113, 133, 0.32);
  --glass-bg: rgba(16, 22, 36, 0.84);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.36);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

[data-theme="dark"] body {
  letter-spacing: 0.008em;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

button,
.btn,
.nav-item,
.mob-tab,
.link,
.list-item,
select,
input[type="checkbox"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  background: var(--bg);
}

/* --- Unified 1-Row, 3-Zone Top Bar Contract (58px, frosted) ------------------ */
.studio-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 58px;
  padding: 0 24px;
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  z-index: 20;
}

.studio-hd-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.studio-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
  white-space: nowrap;
  flex-shrink: 0;
}

.studio-brand-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  width: 26px;
  height: 26px;
  padding: 5.5px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 1px 3px rgba(79, 70, 229, 0.28);
}

[data-theme="dark"] .studio-brand-mark {
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 6px rgba(99, 102, 241, 0.35);
}

.studio-brand-mark span {
  width: 3px;
  border-radius: 2px;
  background: #ffffff;
}
.studio-brand-mark span:nth-child(1) { height: 6px; opacity: 0.72; }
.studio-brand-mark span:nth-child(2) { height: 13px; }
.studio-brand-mark span:nth-child(3) { height: 9px; opacity: 0.88; }

.org-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.org-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.org-switch-label {
  font-size: 11px;
  color: var(--faint);
}

.org-switch select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font-size: 12px;
  max-width: 190px;
  cursor: pointer;
}

.org-switch select:focus {
  outline: none;
  border-color: var(--accent);
}

.mockflag {
  font-size: 11px;
  font-weight: 600;
  color: var(--warn);
  white-space: nowrap;
}

.studio-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.studio-nav-link {
  position: relative;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 150ms ease;
}

.studio-nav-link:hover,
.studio-nav-link.is-active {
  color: var(--ink);
}

.studio-nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.studio-hd-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.user-bar a,
.link {
  color: var(--accent);
  text-decoration: none;
}

.user-bar a:hover,
.link:hover {
  text-decoration: underline;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 100ms ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line-strong);
}

.icon-btn:active {
  transform: scale(0.96);
}

/* --- Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease;
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

[data-theme="dark"] .btn.primary {
  color: #0b0f17;
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn.ghost:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.btn.danger {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

.btn.danger:hover:not(:disabled) {
  border-color: var(--danger);
}

.btn.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

/* --- System Banner ----------------------------------------------------------- */
.sys {
  padding: 9px 24px;
  background: var(--warn-soft);
  border-bottom: 1px solid var(--warn-line);
  color: var(--warn);
  font-size: 12.5px;
  flex-shrink: 0;
}

/* --- Workspace Grid ---------------------------------------------------------- */
.workspace {
  display: grid;
  grid-template-columns: var(--nav-w) var(--list-w) minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.nav-rail {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 4px 10px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-item.on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
}

.nav-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.78;
}

.nav-item.on .nav-svg,
.nav-item:hover .nav-svg {
  opacity: 1;
}

.nav-divider {
  height: 1px;
  background: var(--line);
  margin: 10px 8px;
}

/* --- Middle List Panel ------------------------------------------------------- */
.list-panel {
  border-right: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.panel-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
}

.panel-hd .label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.panel-hd .count {
  color: var(--muted);
  font-size: 12px;
}

.filter {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--faint);
  pointer-events: none;
}

.search-kbd {
  position: absolute;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg);
  color: var(--faint);
  font-size: 10.5px;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.search-field:focus-within .search-kbd {
  opacity: 0;
}

.filter input {
  width: 100%;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0 32px 0 31px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-xs);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.filter input::placeholder {
  color: var(--faint);
}

.filter input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px;
}

.list-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  padding: 10px 11px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 140ms ease, border-color 140ms ease;
}

.list-item:hover {
  background: var(--surface);
  border-color: var(--line);
}

.list-item.on {
  background: var(--surface);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
}

.list-item .title {
  font-size: 13.5px;
  font-weight: 600;
  display: block;
  color: var(--ink);
  line-height: 1.35;
}

.list-item .meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}

/* Zero-pill clean inline metadata tag */
.kind-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

/* --- Main Detail Canvas ------------------------------------------------------ */
.detail {
  overflow-y: auto;
  background: var(--surface);
  padding: 28px 36px 56px;
  min-width: 0;
}

.detail > * {
  animation: viewIn 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(4px); }
}

.empty {
  min-height: 360px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
  max-width: 460px;
  margin: 0 auto;
  padding: 24px;
}

.empty .t {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.empty p {
  margin: 6px 0;
  font-size: 13.5px;
  line-height: 1.6;
}

.empty .hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--faint);
}

.page-hd {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  max-width: 860px;
}

.page-hd h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--ink);
}

.page-meta {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.prose {
  max-width: 760px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.prose h1,
.prose h2,
.prose h3 {
  margin: 1.5em 0 0.55em;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.015em;
}

.prose h1 { font-size: 1.4em; }
.prose h2 { font-size: 1.18em; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.prose h3 { font-size: 1.05em; }
.prose p { margin: 0.75em 0; }
.prose ul,
.prose ol { margin: 0.65em 0; padding-left: 1.4em; }
.prose li { margin: 4px 0; }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink);
}

.prose pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.5;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose a,
.prose .wiki-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.prose a:hover,
.prose .wiki-link:hover {
  text-decoration: underline;
}

.prose blockquote {
  margin: 0.9em 0;
  padding: 6px 14px;
  border-left: 3px solid var(--accent-line);
  color: var(--muted);
}

/* --- Forms & Inputs ---------------------------------------------------------- */
.form-grid {
  display: grid;
  gap: 14px;
  max-width: 760px;
}

.form-grid label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 9px 11px;
  border-radius: 7px;
  font-size: 13.5px;
  resize: vertical;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-grid textarea {
  min-height: 160px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus,
.edit-area:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.answer-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  max-width: 860px;
  margin-top: 16px;
}

.answer-box h3,
.answer-box h4 {
  color: var(--ink);
  margin: 14px 0 8px;
  font-size: 14px;
}

.answer-box pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
}

/* --- Findings & Logs --------------------------------------------------------- */
.findings {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  max-width: 860px;
}

.findings li {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-2);
}

.findings .sev-warn { border-left: 3px solid var(--warn); }
.findings .sev-error { border-left: 3px solid var(--danger); }
.findings .sev-info { border-left: 3px solid var(--accent); }

.log-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 860px;
}

.log-list li {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
}

.log-list .when {
  color: var(--faint);
  margin-right: 10px;
}

.log-list .action {
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  margin-right: 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.tag::before {
  content: "#";
  color: var(--faint);
}

.edit-area {
  width: 100%;
  max-width: 860px;
  min-height: 360px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
  margin-top: 6px;
}

.conflict {
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 12.5px;
  max-width: 860px;
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Skill Forge & Eval Studio ----------------------------------------------- */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0 8px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 760px;
}

.pipeline .pl {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.pipeline .pl.on {
  color: var(--accent);
  font-weight: 700;
}

.pipeline .sep {
  color: var(--faint);
  font-size: 11px;
}

.forge-step {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  padding: 16px 18px 18px 48px;
  margin-top: 12px;
  max-width: 760px;
}

.forge-step > .step-n {
  position: absolute;
  left: 16px;
  top: 16px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

.forge-step > .step-t {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 3px;
}

.forge-step > .step-why {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.5;
}

.forge-step .form-grid {
  max-width: none;
}

.hint {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
  line-height: 1.5;
  margin-top: 2px;
}

.hint code {
  color: var(--muted);
  font-family: var(--font-mono);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chip {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

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

.choice-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.choice-card:hover {
  border-color: var(--line-strong);
}

.choice-card input {
  width: auto;
  margin-top: 2px;
  grid-row: span 2;
}

.choice-card .cc-t {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.choice-card .cc-d {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.5;
}

.choice-card:has(input:checked) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.pick-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pick-bar .grow {
  flex: 1;
}

.adv > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 0;
  list-style: none;
}

.adv > summary::-webkit-details-marker {
  display: none;
}

.adv > summary::before {
  content: "+";
  display: inline-block;
  width: 14px;
  color: var(--accent);
  font-weight: 700;
}

.adv[open] > summary::before {
  content: "−";
}

.adv > summary:hover {
  color: var(--ink);
}

.adv > .form-grid {
  padding-top: 8px;
}

.out-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  border-left: 2px solid var(--line-strong);
  padding-left: 12px;
  margin-top: 12px;
}

/* Skill Studio Mode Switcher & Eval Scorecard */
.skill-studio-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 18px;
  max-width: 860px;
}

.skill-studio-tab {
  position: relative;
  background: none;
  border: 0;
  padding: 9px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.skill-studio-tab:hover,
.skill-studio-tab.is-active {
  color: var(--ink);
}

.skill-studio-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.eval-scorecard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  margin: 14px 0;
}

.eval-kpi {
  padding-right: 14px;
}

.eval-kpi + .eval-kpi {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.eval-kpi-label {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 4px;
}

.eval-kpi-val {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.eval-kpi-val.is-ok { color: var(--ok); }
.eval-kpi-val.is-warn { color: var(--warn); }
.eval-kpi-val.is-danger { color: var(--danger); }

.eval-kpi-sub {
  display: block;
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 2px;
}

.eval-cases-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 8px;
  flex-wrap: wrap;
}

.eval-revise-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin: 0 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  flex-wrap: wrap;
}

/* --- Mobile Bottom Tab Bar & Master-Detail Back Button (Hidden on Desktop) --- */
.mobile-bottom-nav {
  display: none;
}

.mobile-back-btn {
  display: none;
}

/* --- Responsive Breakpoints -------------------------------------------------- */
@media (max-width: 1024px) and (min-width: 769px) {
  .workspace {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }
  .nav-rail {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
    gap: 4px;
  }
  .nav-label,
  .nav-divider {
    display: none;
  }
  .nav-item {
    width: auto;
    white-space: nowrap;
    padding: 6px 10px;
  }
  .detail {
    padding: 20px 18px 36px;
  }
}

/* Dedicated Mobile Architecture (<= 768px):
   - Single-row 52px frosted header + 58px native bottom dock = 110px (13.0% of 844px)
   - True Master-Detail drill-down (100% list OR 100% detail with <- Wróć do listy)
   - 16px inputs, >= 44px touch targets, zero horizontal overflow */
@media (max-width: 768px) {
  .studio-hd {
    height: 52px;
    padding: 0 12px;
    gap: 8px;
  }
  .studio-hd-left {
    gap: 8px;
  }
  .studio-brand {
    font-size: 15px;
    gap: 8px;
  }
  .org-badge,
  .org-switch,
  .user-bar {
    display: none !important;
  }
  .studio-nav {
    gap: 12px;
  }
  .studio-nav-link {
    font-size: 13px;
    padding: 4px 0;
  }
  .studio-nav-link.is-active {
    display: none;
  }
  .studio-hd-right {
    gap: 6px;
  }
  #refreshBtn {
    width: 40px;
    height: 40px;
    padding: 0;
  }
  #refreshBtn .btn-label {
    display: none;
  }
  .icon-btn {
    width: 40px;
    height: 40px;
  }
  .nav-rail {
    display: none;
  }
  .workspace {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }
  .list-panel {
    flex: 1 1 auto;
    border-right: 0;
    border-bottom: 0;
    max-height: none;
    min-height: 0;
  }
  .detail {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px 14px 28px;
  }
  .workspace[data-mobile-detail="1"] .list-panel {
    display: none;
  }
  .workspace[data-mobile-detail="1"] .detail {
    display: block;
  }
  .mobile-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 12px 0 8px;
    margin: 0 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
  }
  .mobile-back-btn:active {
    transform: scale(0.98);
  }
  .search-kbd {
    display: none;
  }
  .filter input,
  .form input,
  .form textarea,
  .form select {
    font-size: 16px;
    min-height: 42px;
  }
  .list-item {
    padding: 12px;
    min-height: 50px;
  }
  .btn {
    min-height: 40px;
  }
  .page-hd {
    flex-direction: column;
    gap: 10px;
  }
  .eval-scorecard {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .eval-kpi + .eval-kpi {
    padding-left: 0;
    border-left: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  /* Native Glassmorphic Mobile Bottom Dock (58px + safe area) */
  .mobile-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 2px;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
    min-height: calc(58px + env(safe-area-inset-bottom, 0px));
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--line);
    flex-shrink: 0;
    z-index: 25;
  }
  .mob-tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    padding: 4px 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease;
  }
  .mob-tab svg {
    width: 19px;
    height: 19px;
  }
  .mob-tab.on {
    color: var(--accent);
    background: var(--accent-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
