:root {
  --bg: #f7f7f8;
  --panel: #ffffff;
  --border: #e1e4e8;
  --muted: #6a737d;
  --accent: #0969da;
  --accent-soft: #ddf4ff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --text: #1f2328;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .tickler-name {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}
.topbar a.tickler-name { color: var(--accent); }
.topbar a.tickler-name:hover { text-decoration: underline; }
.topbar .spacer { flex: 1; }
#top-status { font-size: 12px; color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: 280px 1fr 380px;
  height: calc(100vh - 44px);
}

/* ---------- sidebar ---------- */
#sidebar {
  border-right: 1px solid var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-header input[type=search] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.sidebar-header .toggle {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-header select {
  width: 100%;
  padding: 5px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.sidebar-header .filter-row {
  display: flex;
  gap: 4px;
}
.sidebar-header .filter-row select#filter-board {
  flex: 0 0 88px;
}
.sidebar-header .filter-row .combo {
  flex: 1;
  min-width: 0;
  position: relative;
}
.combo-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 5px 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  margin: 0;
}
.combo-trigger:hover { background: #f9fafb; }
.combo-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo-label.muted { color: var(--muted); }
.combo-arrow {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 10px;
}
.combo-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  z-index: 50;
  overflow: hidden;
  max-height: 320px;
  display: flex;
  flex-direction: column;
}
.combo-panel[hidden] { display: none; }
.combo-search {
  padding: 6px 10px;
  font-size: 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  width: 100%;
}
.combo-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.combo-group-header {
  padding: 6px 12px 2px 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: #fafbfc;
}
.combo-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 5px 12px 5px 20px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
.combo-item.combo-clear {
  padding-left: 12px;
  font-style: italic;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.combo-item:hover { background: var(--accent-soft); }
.combo-item[aria-selected="true"] {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.sidebar-header .count {
  font-size: 11px;
  color: var(--muted);
}
.progress-meter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.progress-meter .pm-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-meter .pm-bar {
  position: relative;
  flex: 1;
  height: 12px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.progress-meter .pm-fill {
  height: 100%;
  background: linear-gradient(90deg, #34d058 0%, #1a7f37 50%, #0969da 100%);
  background-size: 200% 100%;
  background-position: right center;
  border-radius: 6px;
  transition: width 600ms cubic-bezier(.2,.8,.2,1);
}
.progress-meter .pm-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.5);
  pointer-events: none;
}
.progress-meter .pm-pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}
.progress-meter .pm-text {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.progress-meter .pm-num {
  font-weight: 600;
  color: var(--ok);
}

/* ---------- fireworks ---------- */
.fireworks-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5000;
  overflow: hidden;
}
.fireworks-msg {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.97);
  padding: 18px 36px;
  border-radius: 14px;
  box-shadow: 0 14px 50px rgba(0,0,0,0.25);
  text-align: center;
  animation: fwMsg 2.4s cubic-bezier(.16,1,.3,1) forwards;
}
.fireworks-msg .fw-pct {
  font-size: 28px;
  font-weight: 800;
  color: #1a7f37;
  letter-spacing: -0.5px;
}
.fireworks-msg .fw-sub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}
.fireworks-msg.fw-big .fw-pct { font-size: 36px; }
.fireworks-msg.fw-finale {
  background: linear-gradient(135deg, #fff8c5, #fff1a8, #ffd60a);
}
.fireworks-msg.fw-finale .fw-pct { font-size: 44px; color: #1f2328; }
.fw-particle {
  position: absolute;
  border-radius: 50%;
  background: var(--bg, #fff);
  animation: fwBurst 1.8s cubic-bezier(.16,1,.3,1) forwards;
  opacity: 0;
  box-shadow: 0 0 8px var(--bg, #fff);
  will-change: transform, opacity;
}
@keyframes fwBurst {
  0%   { transform: translate(-50%,-50%) scale(0.4); opacity: 1; }
  20%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 220px)) scale(1.2); opacity: 0; }
}
@keyframes fwMsg {
  0%   { transform: translateX(-50%) scale(0.4) rotate(-3deg); opacity: 0; }
  20%  { transform: translateX(-50%) scale(1.1) rotate(2deg); opacity: 1; }
  35%  { transform: translateX(-50%) scale(1.0) rotate(0); opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(1.0); }
}


.scope-hit {
  background: #fff8c5;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 500;
}

#row-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
#row-list li {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
#row-list li:hover { background: #f3f4f6; }
#row-list li.active { background: var(--accent-soft); }
#row-list li.more {
  cursor: default;
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
}
#row-list .m {
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
}
#row-list .n { font-size: 13px; }
#row-list .b { font-size: 11px; color: var(--muted); margin-top: 2px; }
#row-list .tagged { color: var(--ok); font-weight: 600; }

/* ---------- main ---------- */
#detail {
  overflow-y: auto;
  padding: 20px;
}
#empty-state {
  color: var(--muted);
  text-align: center;
  margin-top: 80px;
}
.row-header h1 {
  margin: 0 0 4px 0;
  font-size: 20px;
}
.row-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.current-tags {
  margin-bottom: 16px;
  font-size: 13px;
}
.current-tags .label { color: var(--muted); margin-right: 4px; }
.current-tags .muted { color: var(--muted); }
.current-tags code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.panel h2 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.panel-header h2 { margin: 0; }

.empty-card {
  text-align: center;
  padding: 28px 24px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fafbfc;
}
.empty-card .empty-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
}
.empty-card .empty-text {
  font-size: 12px;
  color: var(--muted);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.5;
}

.deal-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fafbfc;
}
.deal-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.deal-id { font-weight: 600; color: var(--accent); }
.deal-date { color: var(--muted); font-size: 12px; }
.deal-val { font-weight: 600; }
.conf {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.conf-high { background: #dcfce7; color: var(--ok); }
.conf-medium { background: #fef3c7; color: var(--warn); }
.conf-low { background: #fee2e2; color: #991b1b; }
.deal-signers { font-size: 12px; margin-bottom: 6px; }
.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  margin-top: 6px;
  font-size: 13px;
}
.kv .k { color: var(--muted); font-size: 12px; }
.kv .v { white-space: pre-wrap; }
.review {
  margin-top: 6px;
  font-size: 12px;
  color: var(--warn);
  background: #fff8c5;
  padding: 4px 8px;
  border-radius: 4px;
}

#folder-actions button,
.actions button,
button {
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  margin-right: 6px;
}
button:hover:not(:disabled) { background: #f3f4f6; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn, .btn-primary {
  display: inline-block;
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #0550ae; }

#folder-tree {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
  background: #fafbfc;
  border-radius: 4px;
}
#folder-tree details { margin: 2px 0; }
#folder-tree summary {
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
}
#folder-tree summary:hover { background: #eef1f4; }
#folder-tree summary.dir::before { content: "📁 "; }
#folder-tree .children {
  padding-left: 18px;
  border-left: 1px dotted var(--border);
}
#folder-tree .file-link {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 1px 4px;
  margin: 0;
  font: inherit;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: var(--accent);
  cursor: pointer;
  border-radius: 3px;
}
#folder-tree .file-link:hover {
  background: #eef1f4;
  text-decoration: underline;
}
#folder-tree .file-link::before { content: "📄 "; }
.small { font-size: 11px; }
.muted { color: var(--muted); }

/* ---------- case types panel ---------- */
#case-panel {
  border-left: 1px solid var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.eoir-status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #fff8c5 0%, #fff1a8 100%);
  border-bottom: 2px solid #d4a72c;
}
.eoir-status-banner[hidden] { display: none; }
.eoir-status-label {
  font-size: 10px;
  font-weight: 700;
  color: #7a5d00;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  white-space: nowrap;
}
.eoir-status-value {
  font-size: 16px;
  font-weight: 700;
  color: #1f2328;
  line-height: 1.2;
}

.case-header {
  padding: 12px 14px 6px 14px;
  border-bottom: 1px solid var(--border);
}
.case-header h2 {
  margin: 0 0 4px 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.case-meta { font-size: 12px; color: var(--muted); }
.board-label {
  padding: 10px 14px 2px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.tabs .tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  padding: 0;
  margin: 0;
}
.tabs .tab .tab-body {
  padding: 4px 10px 4px 4px;
  font-size: 11px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  margin: 0;
}
.tabs .tab .save-mark {
  width: 14px;
  height: 14px;
  margin: 4px 0 4px 6px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}
.tabs .tab.locked .save-mark {
  cursor: not-allowed;
  opacity: 0.8;
}
.tabs .tab.saved .save-mark {
  background: var(--ok);
  border-color: var(--ok);
}
.tabs .tab.saved .save-mark::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 4px;
  width: 3px;
  height: 7px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.tabs .tab.view-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.tabs .tab.view-active .tab-body {
  color: var(--accent);
  font-weight: 600;
}
.tab-count {
  display: inline-block;
  min-width: 16px;
  padding: 0 5px;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  border-radius: 9px;
  background: #e5e7eb;
  color: var(--muted);
}
.tab-count.selected {
  background: var(--accent);
  color: #fff;
}
.tabs .tab.view-active .tab-count:not(.selected) {
  background: var(--accent-soft);
  color: var(--accent);
}

.ct-controls {
  display: flex;
  gap: 8px;
  margin: 8px 12px;
  align-items: center;
}
.ct-controls #ct-search {
  flex: 1;
  margin: 0;
}
#deselect-all-btn {
  font-size: 11px;
  padding: 5px 8px;
  white-space: nowrap;
  margin: 0;
}

#ct-search {
  margin: 8px 12px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
#ct-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0 12px;
  margin: 0;
}
#ct-list li { margin: 0; }
#ct-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
}
#ct-list label:hover { background: #f3f4f6; }
#ct-list label.checked {
  background: var(--accent-soft);
  font-weight: 500;
}
#ct-list input[type=checkbox] { margin: 0; }
#ct-list .ref-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 6px 28px;
  padding: 6px 8px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
#ct-list .ref-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
#ct-list .ref-m-input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
#ct-list .ref-m-input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
#ct-list .empty-hint {
  padding: 14px 8px;
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
  list-style: none;
}

.selected-preview {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  background: #fafbfc;
}
.selected-preview label {
  display: block;
  color: var(--muted);
  margin-bottom: 2px;
}
.selected-preview code {
  display: block;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  word-break: break-word;
  color: #24292f;
}

.actions {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
#save-btn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-size: 13px;
  padding: 7px 12px;
}
#save-btn:hover:not(:disabled) { background: #0550ae; }

#untag-btn {
  font-size: 13px;
  padding: 7px 12px;
  background: #fff;
  color: var(--muted);
  border-color: var(--border);
}
#untag-btn:hover:not(:disabled) {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}


#save-status { font-size: 11px; color: var(--muted); }

/* ---------- settings gear + config banner ---------- */
.gear {
  font-size: 16px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
  margin: 0 0 0 8px;
  text-decoration: none;
  color: var(--text);
}
.gear:hover { background: #f3f4f6; }

.config-banner {
  background: #fff8c5;
  border-bottom: 1px solid #d4a72c;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.config-banner button,
.config-banner a {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent);
}

/* ---------- settings page ---------- */
.settings-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 22px 48px;
}
.settings-page-title {
  margin: 4px 0 8px;
  font-size: 20px;
}

/* ---------- settings: hosted Connection + Case Types editor ---------- */
.settings-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.settings-section:first-of-type {
  margin-top: 12px;
  padding-top: 0;
  border-top: none;
}
.settings-section-title {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.info-list {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 13px;
}
.info-list dt {
  color: var(--muted);
  font-size: 12px;
}
.info-list dd {
  margin: 0;
  word-break: break-word;
}
.info-list dd.bad { color: #b42318; }
.info-list code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
}
.info-list a { color: var(--accent); }

.ct-editor-status {
  font-size: 11px;
  min-height: 14px;
  margin-bottom: 8px;
}
.ct-editor-status.ok { color: var(--ok); }
.ct-editor-status.bad { color: #b42318; }

.ct-edit-board {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.ct-edit-board-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text);
}
.ct-edit-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: #e5e7eb;
  border-radius: 9px;
  padding: 0 6px;
  min-width: 16px;
  text-align: center;
}
.ct-edit-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 220px;
  overflow-y: auto;
}
.ct-edit-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
}
.ct-edit-item:hover { background: #f3f4f6; }
.ct-edit-name {
  flex: 1;
  font-size: 13px;
  cursor: text;
  border-radius: 4px;
  padding: 2px 4px;
}
.ct-edit-name:hover { background: var(--accent-soft); }
.ct-edit-name:focus {
  outline: 2px solid var(--accent-soft);
  background: var(--accent-soft);
}
.ct-edit-rename-input {
  flex: 1;
  padding: 3px 6px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  outline: 2px solid var(--accent-soft);
}
.ct-edit-remove {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  line-height: 1;
  font-size: 16px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
}
.ct-edit-remove:hover:not(:disabled) {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.ct-edit-remove:disabled { opacity: 0.3; cursor: not-allowed; }
.ct-edit-usage {
  flex-shrink: 0;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0 7px;
  line-height: 18px;
}
.ct-edit-empty {
  padding: 6px 10px;
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
}
.ct-edit-add {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}
.ct-edit-add-input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.ct-edit-add-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ct-edit-add-btn {
  flex-shrink: 0;
  margin: 0;
  font-size: 12px;
  padding: 5px 12px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.ct-edit-add-btn:hover:not(:disabled) { background: #0550ae; }

.suggest-badge {
  display: inline-block;
  margin-left: auto;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  background: #fff8c5;
  color: var(--warn);
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
#ct-list label.suggested span:first-of-type { font-weight: 500; }

/* ---------- auth: topbar user chip + sign-in page ---------- */
.topbar .user-chip {
  font-size: 12px;
  color: var(--muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .logout-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.topbar .logout-link:hover { text-decoration: underline; }

body.bare {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}
.signin {
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.signin h1 {
  font-size: 18px;
  text-align: center;
  margin: 0 0 18px;
  color: var(--text);
}
.btn-google {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
  background: #fff;
}
.btn-google:hover { background: #f9fafb; }
.signin-or {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 14px 0;
}
.signin-form { display: flex; flex-direction: column; gap: 12px; }
.signin-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.signin-form input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
}
.signin-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.signin-form button {
  margin-top: 4px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.signin-form button:hover { filter: brightness(0.95); }
.signin-err {
  color: #cf222e;
  font-size: 12px;
  margin: 0;
}
.signin-foot { font-size: 11px; text-align: center; margin: 16px 0 0; }
