:root {
  --blue: #0052CC; --blue-hover: #0747A6;
  --text: #172B4D; --text-subtle: #6B778C;
  --canvas: #F4F5F7; --card: #FFFFFF;
  --border: #DFE1E6; --green: #36B37E; --yellow: #FFAB00; --red: #FF5630;
}
* { box-sizing: border-box; margin: 0; }
body { font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--text); background: var(--canvas); }

/* top nav */
.topnav { display: flex; justify-content: space-between; align-items: center;
  background: var(--blue); color: #fff; padding: 0 16px; height: 48px; }
.topnav-left { display: flex; align-items: center; gap: 20px; }
.logo { font-weight: 700; font-size: 16px; }
.topnav nav a { color: #DEEBFF; text-decoration: none; font-size: 14px; padding: 14px 10px; }
.topnav nav a.active, .topnav nav a:hover { color: #fff; border-bottom: 2px solid #fff; }
.search { border: none; border-radius: 3px; padding: 6px 10px; width: 220px; }
.ws-dot { width: 10px; height: 10px; border-radius: 50%; background: #ccc; display: inline-block; }
.ws-dot.live { background: var(--green); }

/* shell */
.shell { display: flex; min-height: calc(100vh - 48px); }
.sidebar { width: 240px; background: #fff; border-right: 1px solid var(--border); padding: 16px; }
.project-head { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.proj-avatar { width: 32px; height: 32px; border-radius: 4px; background: var(--blue);
  color: #fff; display: grid; place-items: center; font-weight: 700; }
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.side-nav a { color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: 4px; font-size: 14px; }
.side-nav a.active, .side-nav a:hover { background: var(--canvas); }

.main { flex: 1; padding: 24px 32px; }
.view { display: none; } .view.active { display: block; }
h1 { font-size: 20px; margin-bottom: 16px; }

/* board */
.board { display: flex; gap: 16px; align-items: flex-start; }
.column { background: var(--canvas); border-radius: 6px; width: 300px; min-height: 200px; padding: 8px; }
.column h3 { font-size: 12px; text-transform: uppercase; color: var(--text-subtle); padding: 4px 8px; }
.issue-card { background: var(--card); border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.12);
  padding: 10px; margin-bottom: 8px; cursor: grab; transition: box-shadow .12s ease, transform .12s ease; }
.issue-card:hover { background: #FAFBFC; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.issue-card .key { font-size: 12px; color: var(--text-subtle); }
.issue-card .summary { font-size: 14px; margin: 4px 0; }
.issue-card.dragging { opacity: .4; transform: rotate(2deg) scale(1.02); box-shadow: 0 8px 20px rgba(9,30,66,.3); cursor: grabbing; }

/* drop-target highlight (column/pane receiving a card) — Jira-style blue border before release */
.drop-target { outline: 2px solid var(--blue) !important; outline-offset: -2px;
  background: #EAF2FF !important; border-radius: 4px; }

/* card-sized placeholder shown at exact drop position before release */
.drop-placeholder { min-height: 58px; border: 2px dashed var(--blue); border-radius: 4px;
  background: rgba(0,82,204,.06); margin-bottom: 8px; box-sizing: border-box;
  pointer-events: none; }
.sprint-goal { margin: 0 0 6px; font-size: 12px; color: var(--text-subtle); }
.backlog-search { padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.ai-messages { max-height: 380px; overflow-y: auto; margin: 10px 0; }
.ai-msg { padding: 8px 10px; border-radius: 6px; margin-bottom: 6px; font-size: 13px; white-space: pre-wrap; }
.ai-msg.user { background: #EAF2FF; color: var(--text); align-self: flex-end; }
.ai-msg.assistant { background: var(--canvas); color: var(--text); }
.column, .backlog-pane { transition: background .12s ease, outline-color .12s ease; }

/* lozenges */
.lozenge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 3px; text-transform: uppercase; }
.lozenge.bug { background: #FFEBE6; color: #BF2600; }
.lozenge.story { background: #E3FCEF; color: #006644; }
.lozenge.task { background: #DEEBFF; color: #0747A6; }
.lozenge.epic { background: #EAE6FF; color: #403294; }
.lozenge.done { background: #E3FCEF; color: #006644; }
.lozenge.in-progress { background: #DEEBFF; color: #0747A6; }
.lozenge.to-do { background: #DFE1E6; color: #42526E; }

/* buttons */
.btn-primary { background: var(--blue); color: #fff; border: none; border-radius: 4px;
  padding: 8px 14px; cursor: pointer; font-size: 14px; }
.btn-primary:hover { background: var(--blue-hover); }
button { border: 1px solid var(--border); background: #fff; border-radius: 4px; padding: 8px 14px; cursor: pointer; }

/* drawer */
.drawer { position: fixed; top: 0; right: 0; width: 520px; height: 100vh; background: #fff;
  box-shadow: -4px 0 16px rgba(0,0,0,.15); z-index: 50; overflow-y: auto; }
.drawer-inner { padding: 24px; }
.drawer.hidden, .modal.hidden { display: none; }
.icon-btn { border: none; background: none; font-size: 16px; float: right; cursor: pointer; }
.drawer-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.key-badge { background: var(--canvas); color: var(--text-subtle); border-radius: 3px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.d-summary-input { width: 100%; border: 1px solid transparent; border-radius: 4px; font-size: 20px;
  font-weight: 700; padding: 6px 8px; color: var(--text); }
.d-summary-input:hover, .d-summary-input:focus { border-color: var(--border); background: #FAFBFC; }
.d-meta { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.d-meta label { font-size: 12px; color: var(--text-subtle); display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.d-meta select, .d-meta input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 13px; min-width: 180px; background: #fff; }
.d-desc-label { font-size: 12px; color: var(--text-subtle); display: block; margin: 12px 0; }
#d-description { width: 100%; min-height: 90px; padding: 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.drawer-actions { display: flex; gap: 8px; margin: 12px 0; }
.btn-danger { background: #fff; color: var(--red); border: 1px solid var(--red); border-radius: 4px;
  padding: 8px 14px; cursor: pointer; font-size: 14px; }
.btn-danger:hover { background: #FFEBE6; }
#d-comments { margin: 8px 0; }
.comment { background: var(--canvas); border-radius: 4px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; }
.comment b { font-size: 12px; }
#d-new-comment { width: 100%; min-height: 60px; margin: 8px 0; padding: 8px; border: 1px solid var(--border); border-radius: 4px; }
.drawer-section { margin: 16px 0; border-top: 1px solid var(--border); padding-top: 12px; }
.drawer-section h3 { font-size: 13px; margin: 0 0 8px; color: var(--text); }
.drawer-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer-section-head h3 { margin: 0; }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.inline-form input { flex: 1; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.subtask-list { margin-bottom: 8px; }
.att-item { padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; color: var(--blue); }
.att-item:hover { background: #EAF2FF; }
.tag { display: inline-block; background: #EAF2FF; color: var(--blue); border-radius: 3px; padding: 2px 8px; font-size: 12px; margin: 2px; }
.chk { flex-direction: row !important; justify-content: flex-start !important; }
.chk input { min-width: auto !important; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 60; }
.modal-box { background: #fff; border-radius: 6px; padding: 24px; width: 420px; }
.modal-box label { display: block; font-size: 12px; color: var(--text-subtle); margin: 10px 0 4px; }
.modal-box input, .modal-box select, .modal-box textarea { width: 100%; padding: 8px;
  border: 1px solid var(--border); border-radius: 4px; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* agents */
.agents-grid { display: flex; gap: 16px; margin-bottom: 24px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 16px; width: 300px; }
.card input { width: 100%; margin: 6px 0; padding: 8px; border: 1px solid var(--border); border-radius: 4px; }
.hint { font-size: 12px; color: var(--text-subtle); }
.token-out { background: #172B4D; color: #7EE787; padding: 10px; border-radius: 4px;
  font-size: 12px; word-break: break-all; margin-top: 8px; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }

/* backlog + sprint panes */
.backlog-board { align-items: stretch; }
.backlog-pane { background: #fff; border: 1px dashed var(--border); min-width: 260px; max-width: 320px;
  padding: 8px; border-radius: 6px; }
.sprint-pane { background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px; min-width: 0; flex: 1; }
.sprint-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sprint-head h3 { font-size: 14px; }
.sprint-actions { display: flex; gap: 4px; }
.mini { font-size: 11px; padding: 3px 8px; border-radius: 3px; }
.sprint-cols { display: flex; gap: 8px; overflow-x: auto; }
.sprint-col { min-width: 220px; }
.col-head { display: flex; align-items: center; justify-content: space-between; }
.col-remove { border: none; background: none; color: var(--text-subtle); cursor: pointer; font-size: 12px; }
.col-remove:hover { color: var(--red); }
.sprint-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.sprint-toolbar input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; }
.cols-edit { display: flex; gap: 8px; margin-bottom: 12px; }
.cols-edit input { padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; }
.card-meta { font-size: 12px; color: var(--text-subtle); }
.pts { background: var(--canvas); border-radius: 3px; padding: 1px 6px; margin-left: 4px; font-weight: 700; color: var(--text); }
.col-head h3 b, .col-head h4 b, .sprint-head h3 b { color: var(--text-subtle); font-weight: 600; }

/* toasts */
#toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #172B4D; color: #fff; padding: 10px 16px; border-radius: 4px; font-size: 13px;
  animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } }

/* v0.2 additions */
.logout-btn { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4);
  border-radius: 4px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.logout-btn:hover { background: rgba(255,255,255,.12); }
.column.wide { width: 100%; max-width: 420px; }
.filter-input { width: 100%; max-width: 420px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 14px; margin-bottom: 16px; }
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 240px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 14px; }
.search-bar select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.projects-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.proj-card { display: flex; gap: 12px; align-items: center; width: 280px; }
.person { display: flex; gap: 12px; align-items: center; width: 280px; }
.stat-row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.stat { width: 200px; }
.stat .big { font-size: 32px; font-weight: 700; margin: 8px 0; }
.bar { height: 8px; background: var(--canvas); border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--blue); }
.type-row { display: flex; gap: 10px; align-items: center; margin: 6px 0; }
.issue-row { cursor: pointer; }
.issue-row:hover { background: #FAFBFC; }
.login-box { text-align: center; }
.login-box label { text-align: left; }
.login-box input { margin-bottom: 4px; }
.login-error { color: var(--red); font-size: 13px; min-height: 18px; }
