:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --text: #1b1f27;
  --muted: #667085;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --accent-text: #3730a3;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --radius: 10px;

  --st-todo: #98a2b3;
  --st-in_progress: #2e90fa;
  --st-blocked: #f04438;
  --st-in_review: #9e77ed;
  --st-done: #12b76a;
  --st-verified: #0e7490;

  --pr-low: #98a2b3;
  --pr-medium: #2e90fa;
  --pr-high: #f79009;
  --pr-critical: #f04438;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --border: #2a2f3a;
    --text: #e6e8ec;
    --muted: #98a1b3;
    --accent: #818cf8;
    --accent-soft: #23264a;
    --accent-text: #c7cbff;
    --danger: #f97066;
    --danger-soft: #3a1714;
    --warn: #fdb022;
    --warn-soft: #33260c;
    --ok: #47cd89;
    --ok-soft: #0f2a1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #1f232c; --border: #2a2f3a; --text: #e6e8ec; --muted: #98a1b3;
  --accent: #818cf8; --accent-soft: #23264a; --accent-text: #c7cbff; --danger: #f97066; --danger-soft: #3a1714;
  --warn: #fdb022; --warn-soft: #33260c; --ok: #47cd89; --ok-soft: #0f2a1d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; display: flex; gap: 10px; align-items: center; }
h2 { font-size: 15px; margin: 0 0 12px; }
p { margin: 4px 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; justify-content: center; }
.right { text-align: right; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between, .between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.pad { padding: 16px; }
.danger-text { color: var(--danger); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------------------ controls */
input, select, textarea {
  font: inherit; color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.success:hover { filter: brightness(1.08); background: var(--ok); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.ghost.danger { color: var(--danger); background: transparent; }
.btn.ghost.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link:hover { text-decoration: underline; }
.icon-btn {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  width: 32px; height: 32px; border-radius: 8px; font-size: 16px;
  display: inline-grid; place-items: center; position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.small { width: 24px; height: 24px; font-size: 12px; }

.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > input, .field > select { width: 100%; }
.field-label { font-weight: 500; font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; line-height: 1;
  padding: 4px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge[class*="status-"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }
.status-todo { --dot: var(--st-todo); }
.status-in_progress { --dot: var(--st-in_progress); }
.status-blocked { --dot: var(--st-blocked); }
.status-in_review { --dot: var(--st-in_review); }
.status-done { --dot: var(--st-done); }
.status-verified { --dot: var(--st-verified); }
.badge.status-verified { background: color-mix(in srgb, var(--st-verified) 14%, transparent); color: var(--text); }

.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.prio i { width: 8px; height: 8px; border-radius: 2px; background: var(--pc); }
.prio-low { --pc: var(--pr-low); }
.prio-medium { --pc: var(--pr-medium); }
.prio-high { --pc: var(--pr-high); }
.prio-critical { --pc: var(--pr-critical); }
.prio-critical { color: var(--danger); font-weight: 600; }

.type {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  padding: 2px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.type-bug { background: var(--danger-soft); color: var(--danger); }
.type-feature { background: var(--ok-soft); color: var(--ok); }
.type-improvement { background: var(--accent-soft); color: var(--accent-text); }

.key-pill {
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 4px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-text); margin-right: 8px;
}
.key { font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); white-space: nowrap; }

.avatar {
  --hue: 240;
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 600;
  background: hsl(var(--hue) 70% 88%);
  color: hsl(var(--hue) 55% 30%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .avatar { background: hsl(var(--hue) 35% 28%); color: hsl(var(--hue) 70% 85%); }
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatar.unassigned { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border); }
.avatars { display: flex; }
.avatars .avatar { border: 2px solid var(--surface); margin-left: -6px; }
.avatars .avatar:first-child { margin-left: 0; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: inherit; }
.user-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags:empty { display: none; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 13px;
}
.tag button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13px; cursor: pointer;
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 18px 12px;
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); padding: 0 8px; }
.brand:hover { text-decoration: none; }
.logo {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 800;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { margin-top: auto; padding: 0 10px; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.search { flex: 1; max-width: 460px; }
.search input { width: 100%; background: var(--surface); }
.topbar .dropdown:first-of-type { margin-left: auto; }
main { padding: 24px 28px 48px; max-width: 1320px; width: 100%; outline: none; display: flex; flex-direction: column; gap: 18px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }
.crumbs .copy { width: 24px; height: 24px; font-size: 13px; }

/* dropdown menus */
.dropdown { position: relative; }
.menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px;
}
.dropdown.open .menu { display: block; }
.menu > button {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit;
  background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.menu > button:hover { background: var(--surface-2); }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; flex-direction: column; }
.menu-head.row { flex-direction: row; justify-content: space-between; align-items: center; }
.menu-foot { display: block; text-align: center; padding: 8px; border-top: 1px solid var(--border); margin-top: 6px; font-size: 13px; }
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }

.bell .count {
  position: absolute; top: 1px; right: 0;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
}
.notif-menu { width: min(380px, calc(100vw - 32px)); }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.notif-list.page-list { max-height: none; }
.notif > button {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
  font: inherit; color: inherit; background: none; border: 0; padding: 10px; border-radius: 8px; cursor: pointer;
}
.page-list .notif > button { border-radius: 0; border-bottom: 1px solid var(--border); padding: 14px 16px; }
.notif > button:hover { background: var(--surface-2); }
.notif.unread > button { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.notif-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.none { padding: 14px; text-align: center; }

/* ------------------------------------------------------------------ cards / tables */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.card.flush > .card-head { padding: 16px 18px 0; }
.card-head h2 { margin: 0; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2.tight { grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3.tight { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-bottom: 16px; }
.stat {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; color: inherit;
}
.stats.compact .stat { box-shadow: none; background: var(--surface-2); border-color: transparent; }
a.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat.warn .stat-value { color: var(--warn); }
.stat.danger .stat-value { color: var(--danger); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.tickets tbody tr, .table.report tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.inactive td { opacity: .55; }
.table td.nowrap { white-space: nowrap; }
.table td.overdue { color: var(--danger); font-weight: 500; }
.table td.num, .table.report td { font-variant-numeric: tabular-nums; }
.title-cell { display: flex; gap: 8px; align-items: center; min-width: 220px; }
.title-cell span:last-child { overflow: hidden; text-overflow: ellipsis; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }

.filters-card { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type="search"] { flex: 1 1 240px; }
.ticket-list { display: flex; flex-direction: column; gap: 12px; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.pager:empty { display: none; }
.pager > span { margin-right: auto; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 32px; }
.spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }

/* ------------------------------------------------------------------ dashboard */
.project-sum { list-style: none; margin: 0; padding: 0; }
.project-sum li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.project-sum li:last-child { border-bottom: 0; }
.project-sum a { color: var(--text); display: flex; align-items: center; min-width: 0; }

.status-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.status-bar .seg { background: var(--dot); }
.status-bar .seg.empty { flex: 1; background: var(--surface-2); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.legend strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ projects */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.project-card { display: flex; flex-direction: column; gap: 10px; color: inherit; }
.project-card:hover { border-color: var(--accent); text-decoration: none; }
.project-card.archived { opacity: .65; }
.project-meta { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }
.project-meta strong { color: var(--text); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a, .tabs button {
  font: inherit; font-weight: 500; background: none; border: 0; cursor: pointer;
  padding: 9px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs.small { margin: -18px -18px 16px; padding: 0 12px; }
.tab-body { display: flex; flex-direction: column; gap: 16px; }

.board-filters { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.board { display: grid; grid-template-columns: repeat(6, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.column {
  background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px;
  border: 2px solid transparent; transition: border-color .12s;
}
.column.drop { border-color: var(--accent); border-style: dashed; }
.column header { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; padding: 2px 4px 10px; }
.column header .muted { margin-left: auto; font-weight: 500; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.cards { display: flex; flex-direction: column; gap: 8px; }
.more { display: block; padding: 6px; }
.ticket-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  color: inherit; box-shadow: var(--shadow); cursor: grab;
}
.ticket-card:hover { border-color: var(--accent); text-decoration: none; }
.ticket-card:active { cursor: grabbing; }
.ticket-card .small { white-space: nowrap; }
.ticket-card p { margin: 0; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }

.add-member .row > .picker { flex: 1 1 260px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }

/* picker / autocomplete */
.picker { position: relative; min-width: 0; }
.picker input { width: 100%; }
.picker-list {
  display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
  list-style: none; margin: 0; padding: 4px; max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg);
}
.picker.open .picker-list, .picker-list.open { display: block; }
.picker-list li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.picker-list li .muted { margin-left: auto; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-list li.active, .picker-list li:hover { background: var(--accent-soft); }
.picker-list li.none { cursor: default; justify-content: center; }
.picker-list li.none:hover { background: none; }

/* ------------------------------------------------------------------ ticket page */
.ticket-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ticket-head-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; flex: 1; }
.ticket-head-actions { display: flex; gap: 8px; align-items: center; }
.ticket-title { font-size: 24px; overflow-wrap: anywhere; }
.ticket-title.editable { cursor: text; border-radius: 6px; margin: -2px -6px; padding: 2px 6px; }
.ticket-title.editable:hover { background: var(--surface-2); }
.title-input { font-size: 22px; font-weight: 700; width: 100%; }
.status-select { font-weight: 600; padding-left: 26px; background-image: radial-gradient(circle at 13px 50%, var(--dot) 4.5px, transparent 5px); }

.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.ticket-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ticket-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 72px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }

.props { display: flex; flex-direction: column; gap: 12px; }
.prop { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; }
.prop-label { color: var(--muted); font-size: 13px; }
.prop-value { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.prop-value > select, .prop-value > input, .prop-value .picker { width: 100%; }
.inline-edit { width: 100%; display: flex; flex-direction: column; gap: 4px; }
.props.dates .prop-value { font-size: 13px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); }
.progress span.over { background: var(--danger); }

.comments { display: flex; flex-direction: column; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment:first-child { padding-top: 0; }
.comment-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.comment-body { overflow-wrap: anywhere; }
.mention { background: var(--accent-soft); color: var(--accent-text); border-radius: 4px; padding: 0 3px; font-weight: 500; }
.composer-wrap { display: flex; gap: 12px; padding-top: 16px; }
.composer { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.composer-input { position: relative; }
.mention-pop { top: auto; bottom: calc(100% + 4px); }

.files { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.files.inline { margin-top: 0; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; flex-wrap: wrap; }
.file .link { font-weight: 500; overflow-wrap: anywhere; text-align: left; }
.file .icon-btn { margin-left: auto; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px; cursor: pointer; text-align: center;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.busy { opacity: .6; pointer-events: none; }

.worklog-form input[type="number"] { width: 100px; }
.worklogs, .timeline { list-style: none; margin: 16px 0 0; padding: 0; }
.worklogs li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline { margin: 0; }
.timeline li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.timeline .change { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ reports */
.score { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.score-bar { width: 60px; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.score-bar i { display: block; height: 100%; background: var(--sc); }
.score.good { --sc: var(--ok); }
.score.ok { --sc: var(--warn); }
.score.low { --sc: var(--danger); }
.note { max-width: 820px; }
.dev-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dev-head h2 { margin: 0; font-size: 20px; }
.dev-score { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dev-score .score strong { font-size: 22px; }
.metrics { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 0; }
.metrics dt { color: var(--muted); }
.metrics dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ modal / toasts */
.backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 17, 21, .45);
  display: grid; place-items: start center; padding: 8vh 16px 16px; overflow-y: auto;
  animation: fade .12s ease-out;
}
.modal {
  width: 100%; max-width: 480px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: rise .15s ease-out;
}
.modal.wide { max-width: 680px; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 0; }
.modal header h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px 18px 18px; }
.modal-body > input { width: 100%; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

#toasts { position: fixed; bottom: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg);
  font-size: 13px; max-width: 380px; transition: opacity .4s, transform .4s; animation: rise .15s ease-out;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ------------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px 28px;
}
.login-card .brand { justify-content: center; font-size: 18px; margin-bottom: 4px; }
.login-card .form { margin-top: 8px; }

/* ------------------------------------------------------------------ responsive */
.nav-scrim { display: none; }
@media (max-width: 1100px) {
  .hide-md { display: none; }
  .ticket-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; width: 248px;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .35); }
  .menu-btn { display: inline-grid; }
  .grid-2, .ticket-layout { grid-template-columns: minmax(0, 1fr); }
  .ticket-side { position: static; order: -1; }
  .topbar { padding: 10px 16px; }
  main { padding: 18px 16px 40px; }
}
@media (max-width: 600px) {
  .hide-sm { display: none; }
  .grid-2.tight, .grid-3.tight { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 22px; }
  .board { grid-template-columns: repeat(6, 78vw); scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; }
  .title-cell { min-width: 160px; }
  .ticket-head-actions { width: 100%; }
  .dev-score { margin-left: 0; align-items: flex-start; }
}

/* ------------------------------------------------------------------ verification */
.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-top: 14px; border-radius: var(--radius); border: 1px solid var(--border);
}
.banner.pending { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.banner.verified { background: color-mix(in srgb, var(--st-verified) 12%, var(--surface)); border-color: color-mix(in srgb, var(--st-verified) 35%, transparent); }
.banner-icon { font-size: 18px; }
.card.highlight { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.card-sub { padding: 0 18px 10px; margin-top: -6px; color: var(--muted); font-size: 13px; }
.card:not(.flush) > .card-sub { padding: 0; }
.chip-row { padding: 0 18px 14px; }
.chip.person { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; }
.chip.person strong { color: var(--danger); }
.copy-key { padding: 2px 8px; font-size: 12px; }

/* ------------------------------------------------------------------ markdown editor */
.md-editor { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.md-editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.md-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--border); background: var(--surface-2); padding: 0 6px; }
.md-tabs { display: flex; }
.md-tabs button {
  font: inherit; font-size: 13px; font-weight: 500; background: none; border: 0; cursor: pointer;
  padding: 8px 10px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.md-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.md-toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; flex: 1; }
.md-toolbar button {
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; min-width: 28px; height: 26px; padding: 0 6px;
  background: none; border: 0; border-radius: 5px; color: var(--muted); cursor: pointer;
}
.md-toolbar button:hover { background: var(--surface); color: var(--text); }
.md-help { margin-left: auto; font-size: 11px; color: var(--muted); padding-right: 4px; }
.md-body textarea.md-input { border: 0; border-radius: 0; box-shadow: none !important; display: block; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 10px 12px; }
.md-preview { padding: 10px 14px; min-height: 120px; }

/* rendered markdown */
.markdown { line-height: 1.6; overflow-wrap: anywhere; }
.markdown.plain { white-space: pre-wrap; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p, .markdown ul, .markdown ol, .markdown pre, .markdown blockquote, .markdown table { margin: 0 0 10px; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 16px 0 8px; line-height: 1.3; display: block; }
.markdown h1 { font-size: 20px; } .markdown h2 { font-size: 17px; } .markdown h3 { font-size: 15px; } .markdown h4 { font-size: 14px; }
.markdown ul, .markdown ol { padding-left: 22px; }
.markdown li + li { margin-top: 2px; }
.markdown ul.task-list { padding-left: 4px; }
.markdown li.task-item { list-style: none; display: flex; gap: 8px; align-items: baseline; }
.task-box { flex: none; width: 14px; height: 14px; border: 1.5px solid var(--muted); border-radius: 3px; display: inline-grid; place-items: center; font-size: 10px; position: relative; top: 2px; }
.task-box.checked { background: var(--ok); border-color: var(--ok); color: #fff; }
.markdown code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.markdown pre { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.markdown pre code { background: none; padding: 0; }
.markdown blockquote { border-left: 3px solid var(--border); padding: 2px 12px; color: var(--muted); }
.markdown table { border-collapse: collapse; display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 6px 10px; }
.markdown th { background: var(--surface-2); }
.markdown img { max-width: 100%; border-radius: 6px; }
.markdown hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.comment-body.markdown, .comment-body .markdown { white-space: normal; }

/* ------------------------------------------------------------------ integrations */
.metrics.left dd { text-align: left; font-weight: 500; }
.metrics.left { grid-template-columns: max-content 1fr; }
.actions-row { margin-top: 16px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.6; }
.steps code, .page-head code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.slack-preview { font-size: 14px; line-height: 1.65; background: var(--surface-2); border-radius: 8px; padding: 12px 14px; border-left: 4px solid #4a154b; }

/* ------------------------------------------------------------------ upcoming tasks */
.up-toolbar { gap: 12px; }
.up-group { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.up-group h2 { display: flex; align-items: center; margin: 0; }
.up-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.up-card { display: flex; flex-direction: column; gap: 8px; color: inherit; }
.up-card:hover { border-color: var(--accent); text-decoration: none; }
.up-title { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.up-meta { gap: 12px; margin-top: auto; }
.badge.up-draft { background: var(--surface-2); color: var(--muted); }
.badge.up-ready { background: var(--ok-soft); color: var(--ok); }
.badge.up-converted { background: var(--accent-soft); color: var(--accent-text); }
.badge.up-dropped { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.ac-meter { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ac-bar { width: 54px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ac-bar i { display: block; height: 100%; background: var(--ok); }
.refs { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ref-rows { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.ref-rows:empty { display: none; }
.ref-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 6px; align-items: center; }
.ref-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ref-list li { display: flex; flex-direction: column; overflow-wrap: anywhere; }
@media (max-width: 600px) { .ref-row { grid-template-columns: 1fr auto; } .ref-row input:first-child { grid-column: 1 / -1; } }
