*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
summary { list-style: none; cursor: pointer; &::-webkit-details-marker { display: none; } }
form.button_to { display: contents; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.icon-button {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text-2); cursor: pointer;
  &:hover { background: var(--surface-2); color: var(--text); }
}

.input {
  width: 100%; height: 38px; padding: 0 12px;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  &:hover { border-color: var(--accent); }
  &:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
}

select.input, select.field, .choice__toggle {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2391959A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}

.swatch { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--swatch); }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--brand-strong); background: var(--brand-soft);
}

.key { font-size: 12px; font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.badge { padding: 1px 8px; border-radius: 999px; font-size: 11px; color: var(--accent); background: var(--accent-soft); }
.empty { color: var(--text-muted); }
.eyebrow { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

.popover {
  position: absolute; z-index: 5; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}

.priority {
  display: inline-flex; color: var(--text-muted);
  .icon { width: 16px; height: 16px; stroke-width: 2.4; }
  &[data-priority="low"] { color: var(--accent); }
  &[data-priority="high"] { color: var(--warning); }
  &[data-priority="urgent"] { color: var(--danger); }
}

.meta.is-overdue { color: var(--danger); }

.button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-weight: 500; cursor: pointer;
}
.button--primary { background: var(--brand); color: #fff; &:hover { background: var(--brand-strong); } }
.button--secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); &:hover { background: var(--column); border-color: var(--text-muted); } }
.button--danger { background: transparent; color: var(--danger); border-color: currentColor; &:hover { color: #fff; background: var(--danger); } }
.button--ghost { background: transparent; color: var(--text-2); border-color: var(--border-strong); &:hover { color: var(--text); background: var(--surface-2); } }
.button--compact { height: 26px; padding: 0 8px; font-size: 12px; }

.hint { font-size: 12px; color: var(--text-muted); }
.alert { padding: 8px 12px; border-radius: var(--radius); color: var(--danger); background: light-dark(#F4D6D6, #3A1414); }

.avatars { display: inline-flex; margin-left: auto; .avatar { box-shadow: 0 0 0 2px var(--surface); } .avatar + .avatar { margin-left: -3px; } }
.avatar--more { color: var(--text-2); background: var(--surface-2); }
.avatar--image { object-fit: cover; }

/* Project labels: the label's exact color, with black or white text for contrast (Label#text_color) */
.labels { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.label {
  max-width: 100%; padding: 1px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid var(--label); border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 16px;
  color: var(--label-text); background: var(--label);
}
.parent-chip {
  --kind: var(--success);
  &[data-kind="bug"] { --kind: var(--danger); }
  &[data-kind="feature"] { --kind: var(--accent); }
  align-self: flex-start; max-width: 100%; padding: 1px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-radius: 999px; font-size: 11px; font-weight: 500; line-height: 16px;
  color: var(--kind); background: color-mix(in srgb, var(--kind) 12%, transparent);
}
/* Assignees without a photo (cards, ticket panel) get a thin ring in their text color so they read as avatars, not tags;
   the outer ring separates overlapping avatars */
:is(.card, .picker) .avatar:not(.avatar--image, .avatar--more) { box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1px color-mix(in srgb, currentColor 55%, transparent); }
.meta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--text-muted); .icon { width: 14px; height: 14px; } }

.markdown {
  overflow-wrap: anywhere;
  > * + * { margin-top: 8px; }
  ul, ol { padding-left: 20px; list-style: revert; }
  li:has(> input[type="checkbox"]) { list-style: none; margin-left: -20px; }
  a { color: var(--accent); text-decoration: underline; }
  code { padding: 1px 4px; border-radius: 4px; font-size: 0.9em; background: var(--surface-2); }
  pre { padding: 10px 12px; overflow-x: auto; border-radius: var(--radius); background: var(--surface-2); code { padding: 0; background: none; } }
  blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
  table { border-collapse: collapse; th, td { padding: 4px 8px; border: 1px solid var(--border-strong); } }
  h1, h2, h3 { font-size: 1.05em; }
  hr { border: 0; border-top: 1px solid var(--border); }
}

.mention { padding: 0 4px; border-radius: 4px; font-weight: 500; color: var(--accent); background: var(--accent-soft); }
.ticket-ref { font-weight: 500; color: var(--accent); &.is-done { text-decoration: line-through; color: var(--text-muted); } }
