:root {
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --surface-3: #e9edf1;
  --border: #e0e4e8;
  --border-strong: #cdd3d9;
  --text: #20252a;
  --text-muted: #69737d;
  --text-faint: #949da5;
  --accent: #315a7d;
  --accent-strong: #244c6d;
  --accent-soft: #e4eef6;
  --danger: #a13e38;
  --shadow: 0 16px 48px rgba(34, 45, 55, .14), 0 2px 8px rgba(34, 45, 55, .08);
  --radius: 10px;
  --topbar: 56px;
  --sidebar: 244px;
  --inspector: 320px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181b;
    --surface: #1b1f23;
    --surface-2: #24292e;
    --surface-3: #2c3238;
    --border: #30363d;
    --border-strong: #444c56;
    --text: #ecf0f3;
    --text-muted: #a5afb8;
    --text-faint: #737d86;
    --accent: #7aa8ca;
    --accent-strong: #91bddc;
    --accent-soft: #233746;
    --danger: #ef8b83;
    --shadow: 0 18px 54px rgba(0, 0, 0, .42), 0 2px 8px rgba(0, 0, 0, .28);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  font-weight: 600;
}

.button:hover {
  background: var(--surface-2);
}

.button.primary {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.danger {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

.button.danger:hover {
  filter: brightness(.92);
}

.button.quiet {
  color: var(--text-muted);
  border-color: var(--border);
  font-weight: 500;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 7px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.icon-button.small {
  width: 28px;
  height: 28px;
  padding: 5px;
}

.icon-button svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

kbd {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-color: var(--border-strong);
  border-radius: 4px;
  color: var(--text-faint);
  background: var(--surface-2);
  font: 10px/1.5 var(--mono);
}

code {
  font: 12px/1.4 var(--mono);
}

.connect {
  position: fixed;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  overflow-y: auto;
  background:
    radial-gradient(circle at 15% 15%, color-mix(in srgb, var(--accent-soft) 70%, transparent), transparent 32rem),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--surface-3) 80%, transparent), transparent 28rem),
    var(--bg);
}

.connect-card {
  width: min(100%, 560px);
  padding: 42px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
}

.connect-mark {
  display: block;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.connect-card h1 {
  max-width: 470px;
  margin: 0;
  font-size: clamp(30px, 6vw, 44px);
  line-height: 1.04;
  letter-spacing: -.045em;
}

.connect-copy {
  margin: 20px 0 24px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.6;
}

.connect-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.connect-warning {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--border));
  border-radius: 8px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
}

.fine {
  margin: 22px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.app {
  display: flex;
  height: 100dvh;
  flex-direction: column;
}

.topbar {
  display: flex;
  min-height: var(--topbar);
  padding: 0 14px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: flex;
  min-width: calc(var(--sidebar) - 14px);
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -.01em;
}

.brand-sub {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 550;
}

.base-heading {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.base-heading strong {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.base-heading span {
  color: var(--text-faint);
  font-size: 11px;
}

.topbar-spacer {
  flex: 1;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.segmented button {
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--text-muted);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

.segmented button[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(20, 30, 40, .12);
}

.command-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.offline {
  padding: 6px 12px;
  color: #684c0d;
  background: #fff0c2;
  font-size: 12px;
  text-align: center;
}

.workspace {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--inspector);
}

.sidebar,
.inspector {
  min-height: 0;
  background: var(--surface);
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

.sidebar-head {
  display: flex;
  height: 42px;
  padding: 0 10px 0 14px;
  align-items: center;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.source-list {
  min-height: 0;
  padding: 2px 8px 12px;
  flex: 1;
  overflow-y: auto;
}

.account-group {
  margin-bottom: 16px;
}

.account-label {
  padding: 7px 7px 5px;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.base-item {
  display: flex;
  width: 100%;
  padding: 7px 8px;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 7px;
  color: var(--text-muted);
  background: transparent;
  text-align: left;
}

.base-item:hover {
  color: var(--text);
  background: var(--surface-2);
}

.base-item.active {
  color: var(--text);
  background: var(--accent-soft);
  font-weight: 650;
}

.base-icon {
  width: 19px;
  height: 19px;
  padding: 3px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 5px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 65%, var(--surface));
}

.base-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.base-item span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-empty {
  padding: 10px 8px;
  color: var(--text-faint);
  font-size: 12px;
}

.sidebar-foot {
  padding: 8px;
  border-top: 1px solid var(--border);
}

.sidebar-action {
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  color: var(--text-muted);
  background: transparent;
  font-size: 12px;
  text-align: left;
}

.sidebar-action:hover {
  color: var(--text);
  background: var(--surface-2);
}

.surface {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--bg);
}

.surface-empty {
  display: grid;
  min-height: 100%;
  padding: 48px;
  place-items: center;
}

.empty-card {
  max-width: 520px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
}

.empty-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: -.025em;
}

.empty-card p {
  margin: 0 0 18px;
  color: var(--text-muted);
}

.view-pad {
  min-width: 0;
  padding: 18px 20px 48px;
}

.table-shell {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  height: 38px;
  padding: 7px 10px;
  overflow: hidden;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: 0;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th {
  color: var(--text-faint);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover td {
  background: var(--surface-2);
}

.data-table tbody tr.selected td {
  background: var(--accent-soft);
}

.title-cell {
  color: var(--text);
  font-weight: 650;
}

.status-pill,
.priority-pill {
  display: inline-flex;
  max-width: 100%;
  padding: 2px 7px;
  overflow: hidden;
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
}

.status-pill[data-status="done"] {
  color: #277350;
  background: #dff3e9;
}

.status-pill[data-status="in progress"] {
  color: #6d5611;
  background: #f8edc9;
}

.status-pill[data-status="next"] {
  color: #315a7d;
  background: #dfebf4;
}

.board {
  display: flex;
  width: max-content;
  min-height: calc(100dvh - var(--topbar) - 78px);
  align-items: flex-start;
  gap: 12px;
}

.board-column {
  width: 270px;
  padding: 8px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}

.board-column-head {
  display: flex;
  padding: 4px 4px 10px;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
}

.count {
  display: inline-grid;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  color: var(--text-faint);
  background: var(--surface-3);
  font-size: 10px;
}

.board-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.board-card {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(25, 35, 45, .04);
  text-align: left;
}

.board-card:hover,
.board-card.selected {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.board-card.selected {
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.board-card strong {
  display: block;
  margin-bottom: 9px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-faint);
  font-size: 11px;
}

.inspector {
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.inspector-empty {
  padding: 26px 22px;
}

.inspector-empty h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.inspector-empty p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.inspector-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.inspector-head .eyebrow {
  margin-bottom: 5px;
  font-size: 10px;
}

.inspector-head h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 19px;
  letter-spacing: -.02em;
}

.inspector-form {
  display: flex;
  padding: 18px;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field span {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .025em;
}

.field input,
.capture-input,
.modal-input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
}

.field input:focus,
.capture-input:focus,
.modal-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.inspector-actions {
  display: flex;
  padding-top: 6px;
  align-items: center;
  gap: 8px;
}

.save-state {
  color: var(--text-faint);
  font-size: 11px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  display: grid;
  z-index: 20;
  padding: 20px;
  place-items: start center;
  background: rgba(14, 18, 22, .38);
  backdrop-filter: blur(2px);
}

.modal {
  width: min(100%, 620px);
  margin-top: min(13vh, 110px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  padding: 15px 16px 11px 18px;
  align-items: center;
  justify-content: space-between;
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
}

.modal-form {
  display: flex;
  padding: 4px 18px 20px;
  flex-direction: column;
  gap: 14px;
}

.modal-copy,
.modal-note,
.modal-error {
  margin: 0;
  font-size: 12px;
}

.modal-copy {
  color: var(--text-muted);
}

.modal-note {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-2);
}

.modal-error {
  color: var(--danger);
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.modal-field span {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .025em;
}

.modal-actions {
  display: flex;
  padding-top: 2px;
  justify-content: flex-end;
  gap: 8px;
}

.capture {
  padding: 4px 18px 20px;
}

.capture-hint {
  margin: 9px 0 14px;
  color: var(--text-faint);
  font-size: 12px;
}

.capture-preview {
  display: grid;
  margin: 14px 0;
  padding: 10px 12px;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
}

.capture-preview .key {
  color: var(--text-faint);
}

.capture-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  z-index: 30;
  width: min(360px, calc(100vw - 36px));
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.toast.error {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
}

@media (max-width: 1040px) {
  :root {
    --sidebar: 220px;
    --inspector: 290px;
  }

  .brand {
    min-width: auto;
  }

  .brand-sub,
  .command-button {
    display: none;
  }
}

@media (max-width: 780px) {
  body {
    overflow: auto;
  }

  .app {
    min-height: 100dvh;
    height: auto;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    flex-wrap: wrap;
    padding-block: 8px;
  }

  .base-heading {
    order: 3;
    width: 100%;
  }

  .workspace {
    display: block;
  }

  .sidebar {
    max-height: 210px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .surface {
    min-height: 480px;
  }

  .inspector {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .connect-card {
    padding: 30px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}
