/* Labor framework — styles. Everything is prefixed with .lab- and takes its colours
   from the host's variables where they exist. */
:root {
  --lab-accent: var(--color-primary, #2d8a4e);
  --lab-accent-soft: var(--color-primary-light, #e6f4ec);
  --lab-bg: var(--color-bg, #f8f9fa);
  --lab-surface: var(--color-surface, #ffffff);
  --lab-text: var(--color-text, #1a1a1a);
  --lab-muted: var(--color-muted, #80868b);
  --lab-border: var(--color-border, #e2e8f0);
  --lab-bar: #306969;
}

body.lab-open { overflow: hidden; }
#lab-root .hidden, .lab-prompt .hidden { display: none; }

.lab-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--lab-bg);
  color: var(--lab-text);
  display: flex;
  flex-direction: column;
  font-size: 0.92rem;
  line-height: 1.4;
}
.lab-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 8px 0 16px;
  padding-top: env(safe-area-inset-top, 0);
  box-sizing: content-box;
  background: var(--lab-bar);
  color: #fff;
}
.lab-bar-title { font-size: 1.2rem; font-weight: 600; }
.lab-close {
  min-width: 48px; min-height: 48px;
  background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer;
}
.lab-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 14px calc(28px + env(safe-area-inset-bottom, 0px));
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
.lab-intro { color: var(--lab-muted); margin-bottom: 4px; }
.lab-h {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lab-muted);
  margin: 20px 2px 8px;
}
.lab-meta { font-size: 0.78rem; color: var(--lab-muted); }
.lab-foot { margin: 14px 2px 0; }

.lab-card, .lab-news, .lab-mine {
  background: var(--lab-surface);
  border: 1px solid var(--lab-border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
}
.lab-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.lab-card-head + .lab-card-head { margin-top: 14px; }
.lab-card-title { font-weight: 600; font-size: 1rem; }
.lab-pitch { color: #4a4f55; margin-top: 4px; }
.lab-chip {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--lab-accent-soft);
  color: var(--lab-accent);
  vertical-align: middle;
  white-space: nowrap;
}
.lab-chip--new { background: #fff3d6; color: #8a5a00; }
.lab-chip--seen { background: #e8eaed; color: #4a4f55; }
.lab-chip--planned { background: #e1ecff; color: #1a4fb3; }
.lab-chip--declined { background: #e8eaed; color: #4a4f55; }

.lab-more { margin-top: 8px; }
.lab-more summary { color: var(--lab-accent); font-weight: 500; cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.lab-more p, .lab-news p, .lab-reply p { margin-top: 6px; }
.lab-more ul, .lab-news ul, .lab-reply ul { margin: 6px 0 0 18px; }
.lab-more li, .lab-news li, .lab-reply li { margin-top: 3px; }

/* switch */
.lab-switch { position: relative; flex-shrink: 0; width: 50px; height: 30px; cursor: pointer; }
.lab-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.lab-switch span {
  position: absolute; inset: 0; border-radius: 15px; background: #c5cad1; transition: background 0.15s; pointer-events: none;
}
.lab-switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s;
}
.lab-switch input:checked + span { background: var(--lab-accent); }
.lab-switch input:checked + span::after { transform: translateX(20px); }

.lab-rate { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.lab-thumb {
  min-width: 44px; min-height: 40px; border-radius: 10px; border: 1px solid var(--lab-border);
  background: var(--lab-surface); font-size: 1.1rem; cursor: pointer;
}
.lab-thumb--on { border-color: var(--lab-accent); background: var(--lab-accent-soft); }
.lab-why, .lab-row { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.lab-input, .lab-text {
  flex: 1; min-width: 0; width: 100%;
  border: 1px solid var(--lab-border); border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 16px; /* 16px keeps iOS from zooming in */
  background: var(--lab-surface); color: var(--lab-text);
  -webkit-user-select: text; user-select: text;
}
.lab-text { resize: vertical; margin-top: 8px; display: block; }
.lab-btn {
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--lab-accent);
  background: var(--lab-accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.lab-btn:disabled { opacity: 0.5; }
.lab-btn--ghost { background: var(--lab-surface); color: var(--lab-accent); }
.lab-link {
  background: none; border: none; color: var(--lab-muted); font: inherit; font-size: 0.82rem;
  text-decoration: underline; cursor: pointer; min-height: 36px; padding: 0 4px;
}
.lab-status { margin-top: 8px; color: var(--lab-accent); font-weight: 500; }

.lab-recording { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.lab-rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #e53e3e; animation: lab-pulse 1s infinite; }
@keyframes lab-pulse { 50% { opacity: 0.25; } }
#lab-rec-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 40px; }

.lab-news-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lab-news-title { font-weight: 600; }
.lab-news--unseen { border-color: var(--lab-accent); box-shadow: inset 3px 0 0 var(--lab-accent); }
.lab-older { display: none; }
.lab-mine-text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.lab-reply { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--lab-accent-soft); }
.lab-reply p:first-child { margin-top: 0; }

.lab-q { font-weight: 600; font-size: 1rem; margin-bottom: 8px; }
.lab-scale, .lab-options { display: flex; gap: 6px; flex-wrap: wrap; }
.lab-option {
  flex: 1; min-width: 44px; min-height: 44px; border-radius: 10px; border: 1px solid var(--lab-border);
  background: var(--lab-surface); font: inherit; font-weight: 600; cursor: pointer; padding: 0 10px;
}
.lab-option:active { background: var(--lab-accent-soft); border-color: var(--lab-accent); }
.lab-scale-legend { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--lab-muted); margin-top: 4px; }

/* question prompt that floats over the host app */
.lab-prompt {
  position: fixed;
  left: 10px; right: 10px;
  bottom: calc(var(--lab-prompt-offset, 92px) + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px 10px 14px;
  background: var(--lab-surface);
  color: var(--lab-text);
  border: 1px solid var(--lab-border);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  font-size: 0.9rem;
}
.lab-prompt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lab-prompt-x { min-width: 40px; min-height: 44px; background: none; border: none; color: var(--lab-muted); font-size: 1rem; cursor: pointer; }

/* pictures on the feedback card */
.lab-attach { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.lab-attach:empty { display: none; }
.lab-thumbbox { position: relative; display: inline-block; }
.lab-thumbimg {
  display: flex; align-items: center; justify-content: center;
  height: 64px; min-width: 48px; max-width: 120px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--lab-border); background: var(--lab-surface);
}
.lab-thumbimg--wait { width: 64px; }
.lab-spin {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--lab-border); border-top-color: var(--lab-accent);
  animation: lab-rot 0.8s linear infinite;
}
@keyframes lab-rot { to { transform: rotate(360deg); } }
.lab-thumbx {
  position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; padding: 0;
  border-radius: 50%; border: 1px solid var(--lab-border); background: var(--lab-surface);
  color: var(--lab-text); font-size: 0.75rem; line-height: 1; cursor: pointer;
}

/* changelog view */
.lab-bar { gap: 8px; }
.lab-back + .lab-bar-title { flex: 1; }
.lab-back {
  background: none; border: none; color: #fff; font: inherit; font-weight: 600;
  min-height: 44px; padding: 0 8px 0 0; cursor: pointer; white-space: nowrap;
}
.lab-link--plain { text-decoration: none; padding: 0; min-height: 0; font-size: inherit; }
.lab-cl { border-bottom: 1px solid var(--lab-border); padding: 4px 0; }
.lab-cl summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 10px; }
.lab-cl ul { margin: 4px 0 10px; padding-left: 20px; }
.lab-cl li { margin: 4px 0; overflow-wrap: anywhere; }
.lab-cl-group { margin: 10px 0 2px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--lab-muted); }

/* backlog */
.lab-tk { background: var(--lab-surface); border: 1px solid var(--lab-border); border-radius: 12px; margin-bottom: 6px; overflow: hidden; }
.lab-tk--drag { border-color: var(--lab-accent); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); position: relative; z-index: 2; }
.lab-tk-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 0; min-height: 52px; cursor: pointer; }
.lab-tk-grip {
  flex-shrink: 0; width: 34px; align-self: stretch; display: flex; align-items: center; justify-content: center;
  color: var(--lab-muted); font-size: 1.2rem; touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none;
}
.lab-tk:not([data-open]) .lab-tk-row { padding-left: 12px; }
.lab-tk-icon { flex-shrink: 0; font-size: 1.1rem; }
.lab-tk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lab-tk-title { font-weight: 700; overflow-wrap: anywhere; }
.lab-tk-sum { color: var(--lab-muted); font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-tk-arrows { flex-shrink: 0; display: flex; gap: 2px; }
.lab-tk-btn {
  width: 34px; height: 40px; border: 1px solid var(--lab-border); border-radius: 8px;
  background: var(--lab-surface); color: var(--lab-text); font: inherit; font-size: 1rem; cursor: pointer;
}
.lab-tk-btn--off { visibility: hidden; }
.lab-chip--tk-new { background: #fff3d6; color: #8a5a00; }
.lab-chip--tk-planned { background: #e1ecff; color: #1a4fb3; }
.lab-chip--tk-doing { background: var(--lab-accent-soft); color: var(--lab-accent); }
.lab-chip--tk-done, .lab-chip--tk-declined { background: #e8eaed; color: #4a4f55; }
.lab-tk-more { padding: 0 12px 12px 12px; border-top: 1px solid var(--lab-border); }
.lab-tk-more p { margin-top: 8px; }
.lab-tk-plan { margin-top: 8px; }
.lab-tk-plan summary { color: var(--lab-accent); font-weight: 500; cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.lab-tk-plantext { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; max-height: 320px; overflow-y: auto; }
.lab-tk-more blockquote {
  margin: 8px 0 0; padding: 4px 10px; border-left: 3px solid var(--lab-border); color: var(--lab-muted);
  font-size: 0.85rem; overflow-wrap: anywhere;
}
.lab-tk-notes { margin: 8px 0 0 18px; font-size: 0.85rem; }
.lab-tk-start { margin-top: 10px; }
.lab-tk-closed { margin-top: 8px; }
.lab-tk-closed summary { color: var(--lab-muted); cursor: pointer; min-height: 36px; display: flex; align-items: center; }
