:root {
  --blue: #0c66e4;
  --blue-dark: #0055cc;
  --blue-soft: #e9f2ff;
  --text: #172b4d;
  --muted: #626f86;
  --line: #dcdfe4;
  --bg: #ffffff;
  --panel: #f7f8f9;
  --column: #f1f2f4;
  --danger: #c9372c;
  --green: #22a06b;
  --sidebar: 300px;
  --top: 56px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

.topbar {
  height: var(--top);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #fff; z-index: 60;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; padding: 0 10px 0 4px; letter-spacing: -.2px; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(135deg, #2684ff, #0c66e4); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 7px; border: 2px solid #fff; border-radius: 3px; }
.global-search { flex: 1; min-width: 0; max-width: 960px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; height: 36px; margin: 0 12px; color: var(--muted); }
.global-search input { flex: 1; min-width: 0; border: 0; outline: 0; height: 100%; background: transparent; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: #44546f; position: relative; }
.icon-btn:hover { background: #f1f2f4; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn.boxed { border: 1px solid var(--line); }
.badge { position: absolute; top: 2px; right: -2px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 4px; border-radius: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #0c66e4; color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; border: 2px solid #fff; }
.avatar.a2 { background: #6554c0; } .avatar.a3 { background: #ff8b00; } .avatar.a4 { background: #00875a; } .avatar.a5 { background: #172b4d; } .avatar.a6 { background: #de350b; }
.avatar.more { background: #dfe1e6; color: var(--text); }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -6px; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 4px; font-weight: 600; background: #f1f2f4; white-space: nowrap; }
.btn:hover { background: #dcdfe4; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.subtle { background: transparent; }
.btn.subtle:hover { background: #f1f2f4; }
.btn.subtle.active { background: var(--blue-soft); color: var(--blue); }
.btn.ghost { border: 1px solid var(--line); background: #fff; }
.btn.ghost .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px #dcfff1; }
.btn svg { width: 18px; height: 18px; }
.dd { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 8px 0 12px; border: 1px solid var(--line); border-radius: 4px; }
.dd svg { width: 16px; height: 16px; }

.shell { display: flex; min-height: calc(100vh - var(--top)); }
.sidebar { width: var(--sidebar); flex: none; border-right: 1px solid var(--line); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow: auto; }
.side-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; font-size: 15px; color: #44546f; }
.side-item:hover { background: #f1f2f4; }
.side-item.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; box-shadow: inset 3px 0 0 var(--blue); }
.side-item.nested { margin-left: 26px; font-size: 14px; }
.side-item .tail { margin-left: auto; width: 16px; height: 16px; }
.side-row { display: flex; align-items: center; }
.side-row .side-item { flex: 1; }
.side-sub { font-size: 12px; color: var(--muted); padding: 10px 12px 4px; }
.side-sub.small { padding-left: 38px; }
.side-project { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 30px; border-radius: 6px; }
.side-project:hover { background: #f1f2f4; }
.side-project .proj-name { flex: 1; font-size: 15px; }
.proj-icon { width: 22px; height: 22px; border-radius: 4px; background: linear-gradient(135deg, #79e2f2, #0c66e4); flex: none; }
.proj-icon.orion { background: linear-gradient(135deg, #8777d9, #403294); }
.proj-icon.soc { background: linear-gradient(135deg, #172b4d, #42526e); }
.proj-icon.mini { width: 20px; height: 20px; background: linear-gradient(135deg, #ff8b00, #de350b); }
.proj-icon.wiki { background: #2684ff; }
.chip { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 3px; background: #dfe1e6; }
.chip.try { margin-left: auto; background: #eae6ff; color: #5e4db2; }

.content { flex: 1; min-width: 0; padding: 16px 24px 32px; }
.crumbs { display: flex; gap: 8px; color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.crumbs a:hover { text-decoration: underline; }
.title-row { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.title-row h1 { margin-right: 6px; }
.tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.menu-btn { display: none; }
.tab { display: flex; align-items: center; gap: 6px; padding: 10px 10px; color: #44546f; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab svg { width: 18px; height: 18px; }
.tab:hover { background: #f1f2f4; }
.tab.active { color: var(--blue); border-color: var(--blue); }
.tab .count { font-size: 11px; background: #dfe1e6; padding: 1px 6px; border-radius: 3px; }
.board-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.board-search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 4px; height: 36px; padding: 0 10px; width: 240px; color: var(--muted); }
.board-search input { border: 0; outline: 0; flex: 1; min-width: 0; }
.swimlane-head { display: flex; align-items: center; gap: 6px; font-weight: 600; margin: 10px 0 10px; }
.swimlane-head span { color: var(--muted); font-weight: 400; }
.swimlane-head svg { width: 16px; height: 16px; }

.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.column { width: 220px; flex: none; background: var(--column); border-radius: 8px; padding: 8px; min-height: 420px; }
.column-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 6px 6px 10px; letter-spacing: .3px; }
.column-head .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column-head .num { background: #dfe1e6; color: var(--text); padding: 0 6px; border-radius: 3px; font-weight: 700; }
.column-head .limit { margin-left: auto; font-weight: 600; color: var(--muted); text-transform: none; }
.card { background: #fff; border-radius: 6px; padding: 10px 10px 8px; margin-bottom: 8px; box-shadow: 0 1px 1px rgba(9,30,66,.25), 0 0 1px rgba(9,30,66,.31); cursor: grab; }
.card:hover { background: #f7f8f9; }
.card.flag { background: #fff7d6; }
.card-title { font-size: 14px; line-height: 1.35; margin-bottom: 8px; }
.epic { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 3px; margin-bottom: 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epic.purple { background: #eae6ff; color: #5e4db2; } .epic.teal { background: #e3fcef; color: #006644; } .epic.blue { background: #deebff; color: #0747a6; } .epic.yellow { background: #fff0b3; color: #7f5f01; } .epic.gray { background: #dfe1e6; color: #42526e; } .epic.red { background: #ffebe6; color: #bf2600; }
.card-meta { display: flex; align-items: center; gap: 6px; }
.prio { display: inline-flex; gap: 2px; }
.prio i { width: 6px; height: 6px; border-radius: 50%; background: #dfe1e6; }
.prio.p1 i:nth-child(-n+1), .prio.p2 i:nth-child(-n+2), .prio.p3 i:nth-child(-n+3), .prio.p4 i:nth-child(-n+4) { background: #de350b; }
.type { width: 16px; height: 16px; border-radius: 3px; display: inline-block; }
.type.task { background: #4bade8; } .type.story { background: #63ba3c; } .type.bug { background: #e5493a; }
.key { font-size: 12px; color: var(--muted); margin-left: auto; margin-right: 4px; }
.card-meta .avatar.sm { width: 22px; height: 22px; font-size: 10px; border: 0; }
.due { font-size: 12px; color: var(--danger); font-weight: 600; margin-bottom: 8px; }

.settings-layout { display: flex; gap: 32px; margin-top: 20px; }
.settings-nav { width: 200px; flex: none; display: flex; flex-direction: column; gap: 2px; }
.snav { text-align: left; padding: 8px 12px; border-radius: 4px; color: #44546f; }
.snav:hover { background: #f1f2f4; }
.snav.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.settings-body { flex: 1; min-width: 0; max-width: 960px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0; max-width: 420px; }
.field input, .field select { height: 36px; border: 2px solid var(--line); border-radius: 4px; padding: 0 8px; font-size: 14px; font-weight: 400; color: var(--text); background: #fff; }
.field input:focus, .field select:focus { border-color: var(--blue); outline: 0; }
.field input[readonly] { background: var(--panel); }
.tbl { border-collapse: collapse; width: 100%; margin: 12px 0 16px; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 12px; color: var(--muted); }
.tbl code { background: var(--panel); padding: 2px 4px; border-radius: 3px; }
.recips { display: flex; gap: 4px; flex-wrap: wrap; }
.toggle { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }

.columns-config { display: flex; gap: 10px; overflow-x: auto; padding: 6px 0 12px; }
.col-card { width: 200px; flex: none; background: var(--column); border-radius: 8px; padding: 10px; }
.col-card .head { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 8px; }
.col-card .head .icon-btn { margin-left: auto; }
.status { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font-size: 12px; margin-bottom: 6px; text-transform: uppercase; font-weight: 600; color: #44546f; }
.limits { display: flex; gap: 6px; margin-top: 8px; }
.limits label { flex: 1; font-size: 11px; color: var(--muted); font-weight: 600; }
.limits input { width: 100%; height: 30px; border: 2px solid var(--line); border-radius: 4px; padding: 0 6px; margin-top: 2px; }
.limits input:focus { border-color: var(--blue); outline: 0; }
.col-card.unmapped { background: #fff; border: 2px dashed var(--line); }
.add-column-wrap { display: flex; align-items: center; gap: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { height: 32px; border: 2px solid var(--blue); border-radius: 4px; padding: 0 8px; width: 220px; }
.rule { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
.rule .state { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--green); }
.rule-builder { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.stats { display: flex; gap: 12px; margin: 16px 0; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; display: flex; flex-direction: column; color: var(--muted); }
.stat b { font-size: 26px; color: var(--text); }

.menu-anchor { position: relative; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 220px; background: #fff; border-radius: 6px; box-shadow: 0 8px 16px -4px rgba(9,30,66,.25), 0 0 1px rgba(9,30,66,.31); padding: 6px 0; z-index: 30; }
.menu.right { left: auto; right: 0; }
.menu button { display: block; width: 100%; text-align: left; padding: 8px 14px; }
.menu button:hover { background: #f1f2f4; }
.menu button.danger { color: var(--danger); }
.menu-head { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 6px 14px; }

.modal-backdrop { position: fixed; inset: var(--top) 0 0 0; background: rgba(9,30,66,.54); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal { background: #fff; border-radius: 8px; padding: 24px; width: 460px; box-shadow: 0 8px 24px rgba(9,30,66,.3); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 12px 0 20px; }
.checks label { display: flex; align-items: center; gap: 8px; padding: 6px 0; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #172b4d; color: #fff; padding: 10px 16px; border-radius: 6px; font-weight: 600; z-index: 60; box-shadow: 0 8px 16px rgba(9,30,66,.3); }

.file-banner { background: #ffebe6; color: #bf2600; padding: 12px 16px; font-weight: 600; text-align: center; }
.file-banner code { background: #fff; padding: 1px 6px; border-radius: 3px; }
.plain { list-style: none; padding: 0; margin: 12px 0; max-width: 560px; }
.plain li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; }
.app-grid { display: grid; grid-template-columns: repeat(3, 200px); gap: 12px; margin-top: 16px; }
.app-tile { border: 1px solid var(--line); border-radius: 8px; padding: 22px 16px; font-weight: 600; }
.issue-list { max-width: 720px; margin: 8px 0 20px; }
.issue-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; cursor: pointer; }
.issue-row:hover { background: var(--panel); }
.issue-row .key { margin: 0; }
.modal.issue { width: 1040px; max-width: calc(100% - 40px); max-height: 88vh; overflow: auto; padding: 0; }
.issue-head { display: flex; align-items: center; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.issue-head .crumbs { margin: 0; }
.type-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 4px; font-weight: 600; color: var(--muted); }
.type-btn:hover { background: #f1f2f4; }
.icon-btn .mini { position: absolute; right: 2px; bottom: 2px; font-size: 10px; font-weight: 700; background: #dfe1e6; border-radius: 3px; padding: 0 3px; }
.issue-body { display: grid; grid-template-columns: 1fr 340px; gap: 24px; padding: 16px 24px 24px; }
.issue-main h2 { font-size: 22px; margin: 4px 0 12px; }
.issue-main h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin: 18px 0 6px; }
.issue-main textarea { width: 100%; min-height: 64px; border: 2px solid var(--line); border-radius: 4px; padding: 8px; font: inherit; resize: vertical; margin-bottom: 8px; }
.comment { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.comment .who { font-weight: 600; }
.comment .when { color: var(--muted); font-size: 12px; margin-left: 6px; }
.watchers-box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px 12px; margin-bottom: 12px; }
.issue-side { border-left: 1px solid var(--line); padding-left: 20px; }
.issue-side .field { max-width: none; margin: 8px 0 12px; }
.section-toggle { display: flex; align-items: center; gap: 6px; width: 100%; padding: 10px 8px; font-weight: 600; border-radius: 4px; border: 1px solid var(--line); margin: 6px 0; }
.section-toggle:hover { background: #f1f2f4; }
.section-toggle svg { width: 16px; height: 16px; transition: transform .2s; }
.section-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.chips .chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.chips .chip button { font-size: 12px; line-height: 1; padding: 0 2px; color: var(--muted); }
.chips .chip button:hover { color: var(--danger); }

body.drawer-open .modal-backdrop { right: 376px; }

@media (max-width: 1180px) {
  body.drawer-open .modal-backdrop { right: 356px; }
  .menu-btn { display: inline-flex; }
  .sidebar { display: none; position: fixed; top: var(--top); left: 0; bottom: 0; z-index: 45; background: #fff; box-shadow: 8px 0 24px rgba(9,30,66,.15); }
  body.sidebar-open .sidebar { display: flex; }
  .modal { max-width: calc(100% - 24px); }
  .global-search { margin: 0 8px; }
  .content { padding: 14px 16px 32px; }
}
@media (max-width: 900px) {
  .settings-layout { flex-direction: column; gap: 12px; }
  .settings-nav { width: auto; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .issue-body { grid-template-columns: 1fr; padding: 12px 16px 20px; }
  .issue-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; }
  .title-row h1 { font-size: 20px; }
  .app-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { flex-wrap: wrap; }
  .topbar .btn.ghost { padding: 0 8px; }
}
@media (max-width: 640px) {
  .topbar .btn.primary { padding: 0 8px; }
  .avatars { display: none; }
  .column { width: 200px; }
}
