/* Tickets page — feedback tickets + dev-hours log.
 *
 * Theme tokens only (see static/css/themes.css). The previous revision used
 * --input-bg / --card-bg which are not defined anywhere, so every input fell
 * back to a hardcoded #161a24 that sits *darker* than --bg-card and reads as
 * a black void on the form.
 */

.tks-intro {
  color: var(--text-secondary);
  max-width: 760px;
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.45;
}

.tks-status { font-size: 13px; color: var(--text-secondary); }
.tks-status-error { color: var(--danger, #e5534b); }

/* Tabs */
.tks-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tks-tab {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
}
.tks-tab:hover { color: var(--text-primary); }
.tks-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent, #4f8cff);
}

/* Forms */
.tks-form-card { margin-bottom: 16px; }
.tks-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 12px;
  margin-bottom: 10px;
}
.tks-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}
.tks-field-wide { grid-column: 1; }

.tks-field input,
.tks-field select,
.tks-field textarea,
.tks-toolbar select,
.tks-notes-input,
.tks-row-status,
.tks-hours-input {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tks-field input::placeholder,
.tks-field textarea::placeholder,
.tks-notes-input::placeholder,
.tks-hours-input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.tks-field input:hover,
.tks-field select:hover,
.tks-field textarea:hover,
.tks-toolbar select:hover,
.tks-notes-input:hover,
.tks-hours-input:hover {
  border-color: var(--border-light);
}
.tks-field input:focus,
.tks-field select:focus,
.tks-field textarea:focus,
.tks-toolbar select:focus,
.tks-notes-input:focus,
.tks-row-status:focus,
.tks-hours-input:focus {
  outline: none;
  border-color: var(--accent, #4f8cff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #4f8cff) 22%, transparent);
}
.tks-field textarea { resize: vertical; min-height: 88px; }
.tks-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.tks-form-error { color: var(--danger, #e5534b); font-size: 13px; }

/* Toolbar */
.tks-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 12px;
  gap: 12px;
}
.tks-toolbar-left { display: flex; gap: 8px; flex-wrap: wrap; }
.tks-toolbar select { width: auto; min-width: 140px; }
.tks-count { font-size: 13px; color: var(--text-secondary); }

/* Rows */
.tks-list { display: flex; flex-direction: column; gap: 10px; }
.tks-row { padding: 14px 16px; }
.tks-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tks-row-title {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1 1 200px;
  min-width: 0;
}
.tks-row-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.tks-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}
.tks-row-desc {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  color: var(--text-secondary);
}
.tks-row-notes {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.tks-notes-input { flex: 1; min-width: 0; }
.tks-row-notes-ro {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.tks-row-status { width: auto; min-width: 120px; padding: 5px 8px; font-size: 12px; }

/* Attachments — theme tokens only, so a chip is legible on either theme. */
.tks-field-label { display: block; }
.tks-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
}
.tks-attach-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tks-attach-btn { cursor: pointer; margin: 0; }
.tks-attach-chosen {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  min-width: 0;
  overflow-wrap: anywhere;
}
.tks-attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.tks-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.tks-chip-thumb { display: inline-flex; line-height: 0; }
.tks-chip-thumb img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  display: block;
}
.tks-chip-name {
  color: var(--text-primary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.tks-chip-name:hover { text-decoration: underline; }
.tks-chip-size { color: var(--text-muted); flex: none; }
.tks-chip-x {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  flex: none;
}
.tks-chip-x:hover { color: var(--danger, #dc2626); }
.tks-attach-inline { display: inline-block; margin-top: 8px; cursor: pointer; }
.tks-attach-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent, #4f8cff);
}
.tks-attach-link:hover { text-decoration: underline; }
.tks-attach-response {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.tks-attach-caption {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tks-empty {
  color: var(--text-muted);
  padding: 32px 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

/* Badges — tinted fills so they read on every theme */
.tks-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.tks-kind-feature,
.tks-st-open,
.tks-dl-in_progress {
  color: #93b4ff;
  background: color-mix(in srgb, #7aa2ff 18%, transparent);
  border-color: color-mix(in srgb, #7aa2ff 40%, transparent);
}
.tks-kind-feedback {
  color: #7dd3a8;
  background: color-mix(in srgb, #58c08c 18%, transparent);
  border-color: color-mix(in srgb, #58c08c 40%, transparent);
}
.tks-kind-bug,
.tks-st-declined {
  color: #f0a19c;
  background: color-mix(in srgb, #e5534b 18%, transparent);
  border-color: color-mix(in srgb, #e5534b 40%, transparent);
}
.tks-st-in_review,
.tks-st-planned,
.tks-dl-awaiting_signoff {
  color: #e8bf74;
  background: color-mix(in srgb, #d9a13c 18%, transparent);
  border-color: color-mix(in srgb, #d9a13c 45%, transparent);
}
.tks-st-in_progress {
  color: #c9a0ff;
  background: color-mix(in srgb, #b07aff 18%, transparent);
  border-color: color-mix(in srgb, #b07aff 40%, transparent);
}
.tks-st-resolved,
.tks-dl-signed_off {
  color: #7dd3a8;
  background: color-mix(in srgb, #58c08c 18%, transparent);
  border-color: color-mix(in srgb, #58c08c 40%, transparent);
}

/* Dev-log KPIs */
.tks-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.tks-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}
.tks-kpi-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.tks-kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}
.tks-kpi-months { grid-column: span 2; min-width: 0; }
.tks-kpi-months-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  margin-top: 6px;
  color: var(--text-secondary);
}
.tks-kpi-months-list b { color: var(--text-primary); font-variant-numeric: tabular-nums; }

.tks-dl-signoff { display: flex; gap: 6px; align-items: center; }
.tks-hours-input { width: 72px; padding: 5px 8px; font-size: 13px; }
.tks-row-signed {
  font-size: 12px;
  font-weight: 600;
  color: #7dd3a8;
  white-space: nowrap;
}

/* Inline edit form on each Dev Log row — Save persists without sign-off */
.tks-dl-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.tks-dl-hours {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 12px;
  max-width: 640px;
}
/* Measured, not typed — read-only styling says so before the label is read. */
.tks-dl-hours input[readonly] {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: default;
}
.tks-dl-hours-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -2px;
}
.tks-dl-hours-note b { color: var(--text-primary); }
@media (max-width: 720px) {
  .tks-dl-hours { grid-template-columns: 1fr 1fr; max-width: none; }
}
.tks-dl-edit .tks-field textarea { min-height: 56px; }

@media (max-width: 720px) {
  .tks-form-grid { grid-template-columns: 1fr; }
  .tks-field-wide { grid-column: auto; }
  .tks-row-head { align-items: flex-start; }
  .tks-row-actions { margin-left: 0; width: 100%; }
  .tks-toolbar { flex-direction: column; align-items: flex-start; }
  .tks-kpi-months { grid-column: span 1; }
}
