:root {
  --bg: #0b0d11;
  --bg-elev: #12161c;
  --panel: #161b22;
  --text: #e5e7eb;
  --subtle: #a9b1bd;
  --muted: #8b93a2;
  --border: #273043;
  --primary: #4f79ff;
  --primary-600: #3e66e0;
  --danger: #ff5d5d;
  --ok: #17c964;
  --warn: #f5a524;
  --chip-bg: #0f1720;
  --focus: #7aa2ff66;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html {
  background: linear-gradient(
          180deg,
          #0b0d11 0%,
          #0e141b 40%,
          #0b0d11 100%
  );
}

body {
  min-height: 100vh;
  background: transparent;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #0b0d11, #0e141b);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI,
    Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
}

a {
  color: var(--primary);
  text-decoration: none;
}


.container {
  max-width: 1450px;
  margin: 0 auto;
  padding: 24px 16px 56px 16px;
}

.header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand .logo {
  width: 36px;
  height: 36px;
  background: radial-gradient(
    circle at 30% 30%,
    #7aa2ff,
    #4f79ff 55%,
    #354466
  );
  border-radius: 10px;
  box-shadow: inset 0 1px 0 #ffffff22, var(--shadow);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.button {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease, background 0.2s ease;
}
.button:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
}
.button.secondary {
  background: #1b2330;
  color: var(--text);
  border: 1px solid var(--border);
}
.button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.button.danger {
  background: #2a0f12;
  border: 1px solid #3b1b1f;
  color: #ff9aa9;
}
.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
  margin-bottom: 16px;
}
.hero h2 {
  margin: 0 0 6px 0;
  font-size: 18px;
}
.hero p {
  margin: 0;
  color: var(--subtle);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.label {
  font-weight: 600;
  color: var(--subtle);
}
.input,
.select
 {
  background: #0c1117;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 3px 0px;
  border-radius: 10px;
  outline: none;
}

.textarea {
  background: #0c1117;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 10px;
  border-radius: 10px;
  outline: none;
}
.input:focus,
.select:focus,
.textarea:focus {
  box-shadow: 0 0 0 3px var(--focus);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 10px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  color: var(--subtle);
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 900px;
}

.table thead th {
  text-align: left;
  padding: 12px;
  color: var(--subtle);
  font-weight: 700;
  background: #0f141b;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody tr {
  border-top: 1px solid var(--border);
}

.row {
  background: linear-gradient(180deg, #0f141b, #131924);
}

.table td {
  padding: 12px;
  vertical-align: middle;
  border-top: 1px solid var(--border);
}

.traf-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 1px 0 #00000055, 0 0 0 1px #00000033;
  display: inline-block;
}
.traf-green {
  background: radial-gradient(circle at 30% 30%, #28ff84, #17c964);
}
.traf-yellow {
  background: radial-gradient(circle at 30% 30%, #ffd56a, #f5a524);
}
.traf-red {
  background: radial-gradient(circle at 30% 30%, #ff7e7e, #ff5d5d);
}

.status-pill {
  padding: 5px 8px;
  border-radius: 8px;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--text);
  background: #0f141b;
}

.status-open {
  color: #9edea7;
  border-color: #274630;
  background: #0e2015;
}
.status-in_progress {
  color: #b8cffc;
  border-color: #273b6e;
  background: #0e1626;
}
.status-blocked {
  color: #ffd59d;
  border-color: #5b3b1a;
  background: #24150a;
}
.status-done,
.status-closed {
  color: #a9b1bd;
  border-color: #273043;
  background: #0f141b;
}

.sev-chip {
  padding: 4px 8px;
  border-radius: 8px;
  font-weight: 700;
  border: 1px solid var(--border);
}
.sev-low {
  color: #a9b1bd;
}
.sev-medium {
  color: #b8cffc;
}
.sev-high {
  color: #ffc9a6;
}
.sev-critical {
  color: #ff9aa9;
  border-color: #512229;
  background: #2a0f12;
}

.actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.drag {
  cursor: grab;
  opacity: 0.9;
}
.drag:active {
  cursor: grabbing;
}

.insert-row {
  background: #0b0f16;
}
.insert-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}
.insert-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--subtle);
  background: #0b0f16;
  cursor: pointer;
}
.insert-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 16, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
}
.modal {
  width: 520px;
  max-width: calc(100vw - 24px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.modal-header {
  padding: 14px 16px 8px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  margin: 0;
  font-size: 16px;
}
.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Notes and helpers */
.note {
  color: var(--muted);
  font-size: 12px;
}
.helper {
  color: var(--muted);
  font-size: 12px;
}
.insert-btn.small {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-left: 4px;
  font-size: 12px;
  border-radius: 50%;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.insert-btn.small:hover {
  border-color: var(--primary);
  color: var(--text);
  background: #1b2330;
}

.title{
  font-weight: 1000;
}

/* Base select */
.select {
  appearance: none;
  background: #0c1117;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  line-height: 1.4;
  padding: 4px 6px; /* compact default */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus);
}

.select.inline {
  font-size: 12px;
  padding: 2px 4px; /* extra-compact, for table cells */
  height: auto;
}

/* Dropdown options (applied when user opens dropdown) */
.select option {
  padding: 10px 12px;
  font-size: 14px;
  background: #0c1117;
  color: var(--text);
}

/* Hover/active states for better UX */
.select option:hover,
.select option:checked {
  background: var(--primary);
  color: #fff;
}

.input.inline {
  padding: 6px 8px;
  font-size: 12px;
}

/* Link rendering */
.link-line {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.issue-link-icon {
  text-decoration: none;
  font-size: 14px;
}
.issue-link-text {
  color: var(--primary);
  cursor: pointer;
  word-break: break-all;
}
.issue-link-text.link-empty {
  color: var(--muted);
  border-bottom: 1px dashed var(--border);
}

/* Summary */
.summary {
  margin: 12px 10px 0 10px; /* small side margins */
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.summary-bar {
  display: flex;
  height: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: #0f141b;
  border: 1px solid var(--border);
  margin: 0 10px; /* inner side margin so it doesn't touch edges */
}
.summary-seg { height: 100%; }
.summary-seg.open { background: #2c6e49; }
.summary-seg.in-progress { background: #355070; }
.summary-seg.blocked { background: #9a6324; }
.summary-seg.done { background: #495057; }
.summary-seg.closed { background: #343a40; }

.summary-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--subtle);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
}
.legend-dot.status-open { background: #2c6e49; }
.legend-dot.status-in_progress { background: #355070; }
.legend-dot.status-blocked { background: #9a6324; }
.legend-dot.status-done { background: #495057; }
.legend-dot.status-closed { background: #343a40; }

.summary-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px 12px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text);
}
.summary-info .traf-dot { vertical-align: middle; margin-right: 6px; }

/* Animate summary segments smoothly */
.summary-seg {
  height: 100%;
  transition: width 240ms ease-in-out;
  will-change: width;
}

/* Optional: subtle fade-in when bar renders */
.summary-bar {
  transition: opacity 180ms ease-in-out;
}
.summary-bar:empty {
  opacity: 0;
}

/* Animate status summary segments smoothly */
.summary-seg {
  height: 100%;
  transition: width 240ms ease-in-out;
  will-change: width;
}

/* Progress row: bar + counts side by side */
.summary-prog {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 0 10px;
}

/* Progress bar style (similar to status bar but a bit smaller) */
.summary-prog-bar {
  flex: 1 1 auto;
  display: flex;
  height: 10px;
  border-radius: 8px;
  overflow: hidden;
  background: #0f141b;
  border: 1px solid var(--border);
  min-width: 160px;
}

.summary-prog-seg {
  height: 100%;
  transition: width 240ms ease-in-out;
  will-change: width;
}
.summary-prog-seg.prog-green { background: #17c964; }
.summary-prog-seg.prog-yellow { background: #f5a524; }
.summary-prog-seg.prog-red { background: #ff5d5d; }

/* Progress counts next to bar */
.summary-prog-counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text);
}
.summary-prog-counts .prog-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Keep existing summary bar styling; adding subtle opacity transition is optional */
.summary-bar {
  transition: opacity 180ms ease-in-out;
}
.summary-bar:empty { opacity: 0; }

/* Inline elements and inputs */
.select.inline {
  padding: 4px 8px;
  font-size: 12px;
  height: 28px;
}
.input.inline {
  padding: 6px 8px;
  font-size: 12px;
}

/* Link rendering */
.link-line {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.issue-link-icon {
  text-decoration: none;
  font-size: 14px;
}
.issue-link-text {
  color: var(--primary);
  cursor: pointer;
  word-break: break-all;
}
.issue-link-text.link-empty {
  color: var(--muted);
  border-bottom: 1px dashed var(--border);
}

/* Markdown */
.editable.desc.md p {
  margin: 4px 0;
}
.editable.desc.md ul,
.editable.desc.md ol {
  margin: 4px 0 4px 18px;
}
.textarea.md-inline {
  width: 100%;
  min-height: 120px;
}

/* Attachments */
.atts {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.button.tiny {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 8px;
}
.att-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #0f141b;
}
.att-name {
  color: var(--primary);
  font-weight: 600;
  max-width: 260px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.att-del {
  background: transparent;
  border: 0;
  color: #ff9aa9;
  cursor: pointer;
  font-weight: 700;
}
.att-del:hover {
  color: #ff5d5d;
}

/* Bulk bar */
.bulkbar {
  margin: 10px 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Summary */
.summary {
  margin: 12px 10px 0 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.summary-bar {
  display: flex;
  height: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: #0f141b;
  border: 1px solid var(--border);
  margin: 0 10px;
  transition: opacity 180ms ease-in-out;
}
.summary-bar:empty {
  opacity: 0;
}
.summary-seg {
  height: 100%;
  transition: width 240ms ease-in-out;
  will-change: width;
}
.summary-seg.open {
  background: #2c6e49;
}
.summary-seg.in-progress {
  background: #355070;
}
.summary-seg.blocked {
  background: #9a6324;
}
.summary-seg.done {
  background: #495057;
}
.summary-seg.closed {
  background: #343a40;
}
.summary-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--subtle);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot.status-open {
  background: #2c6e49;
}
.legend-dot.status-in_progress {
  background: #355070;
}
.legend-dot.status-blocked {
  background: #9a6324;
}
.legend-dot.status-done {
  background: #495057;
}
.legend-dot.status-closed {
  background: #343a40;
}
.summary-prog {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 0 10px;
}
.summary-prog-bar {
  flex: 1 1 auto;
  display: flex;
  height: 10px;
  border-radius: 8px;
  overflow: hidden;
  background: #0f141b;
  border: 1px solid var(--border);
  min-width: 160px;
}
.summary-prog-seg {
  height: 100%;
  transition: width 240ms ease-in-out;
  will-change: width;
}
.summary-prog-seg.prog-green {
  background: #17c964;
}
.summary-prog-seg.prog-yellow {
  background: #f5a524;
}
.summary-prog-seg.prog-red {
  background: #ff5d5d;
}
.summary-prog-counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text);
}
.summary-prog-counts .prog-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Kanban view */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 1100px) {
  .kanban {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  .kanban {
    grid-template-columns: 1fr;
  }
}
.k-col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: 75vh;
}
.k-head {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.k-title {
  font-weight: 700;
}
.k-count {
  font-size: 12px;
  color: var(--subtle);
}
.k-body {
  padding: 10px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.k-card {
  background: #0f141b;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: grab;
}
.k-card:active {
  cursor: grabbing;
}
.k-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.k-title-text {
  font-weight: 700;
}
.k-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.k-drop {
  min-height: 24px;
  border: 1px dashed transparent;
  border-radius: 8px;
}
.k-drop.over {
  border-color: var(--primary);
  background: #0f1724;
}
.toolbar .view-toggle {
  background: #1b2330;
}

/* small polish */
.k-link {
  color: var(--primary);
  text-decoration: none;
}