/* ─── Self-hosted fonts (no third-party requests) ────────────────────── */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/bricolage-grotesque-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/bricolage-grotesque-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 800; font-display: swap; src: url("/fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2"); }

/* ─── Design tokens ─────────────────────────────────────────────────── */
:root {
  --ink:            #101828;
  --muted:          #667085;
  --line:           #e4e7ec;
  --surface:        #ffffff;
  --surface-soft:   #f8fafc;
  --primary:        #4f46e5;
  --primary-strong: #3730a3;
  --primary-soft:   #eef2ff;
  --accent:         #06b6d4;
  --danger:         #f04438;
  --danger-soft:    #fee2e2;
  --warning:        #f79009;
  --warning-soft:   #fef3c7;
  --ok:             #12b76a;
  --ok-soft:        #dcfce7;

  /* priority colours */
  --p-critical:     #f04438;
  --p-critical-bg:  #fee2e2;
  --p-critical-tx:  #991b1b;
  --p-high:         #f79009;
  --p-high-bg:      #fef3c7;
  --p-high-tx:      #92400e;
  --p-medium:       #4f46e5;
  --p-medium-bg:    #eef2ff;
  --p-medium-tx:    #3730a3;
  --p-low:          #12b76a;
  --p-low-bg:       #dcfce7;
  --p-low-tx:       #166534;

  /* sidebar */
  --sidebar-w: 220px;

  /* type */
  --font-body:    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", Inter, ui-sans-serif, system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font: 13px/1.5 var(--font-body);
  color: var(--ink);
  background: var(--surface-soft);
}

h1, h2, h3, h4, p { margin: 0; }

/* ─── Auth overlay ───────────────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-soft);
  z-index: 200;
}

.auth-card {
  width: 360px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.12);
  padding: 32px 28px;
  display: grid;
  gap: 18px;
}

.auth-brand {
  text-align: center;
  display: grid;
  gap: 6px;
}

.auth-logo {
  width: 273px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.auth-tagline {
  font-size: 12px;
  color: var(--muted);
}

.auth-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  border: 1px solid #fecdca;
  color: #b42318;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* ─── App shell ──────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

/* Account avatar trigger — only used on mobile (desktop keeps the footer). */
.account-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #c7d2fe;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.account-menu-btn:hover { background: #e0e7ff; }

.sidebar-logo {
  width: 216px;
  height: auto;
  display: block;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* workspace switcher */
.workspace-switcher {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--line);
}

.section-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 3px;
}

.workspace-current-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.workspace-current-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.workspace-switcher-panel {
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.workspace-list {
  list-style: none;
  margin: 0;
  padding: 6px 8px 4px;
  display: grid;
  gap: 3px;
}

.workspace-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}

.workspace-list-item:hover {
  background: var(--primary-soft);
  border-color: #c7d2fe;
}

.workspace-list-item.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.workspace-list-item strong {
  font-size: 12px;
  display: block;
}

.workspace-list-item small {
  font-size: 11px;
  color: var(--muted);
}

.workspace-list-item .btn-open {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.workspace-list-item .btn-open:hover {
  background: var(--primary-strong);
}

.workspace-create-area {
  padding: 6px 8px 8px;
  display: grid;
  gap: 6px;
}

.workspace-create-form {
  gap: 8px;
}

/* sidebar nav */
.sidebar-nav {
  padding: 10px 8px;
  display: grid;
  gap: 2px;
  align-content: start;
}

.workspace-nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.1s, color 0.1s;
}

.workspace-nav-btn:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.workspace-nav-btn.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
}

.nav-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  display: grid;
  gap: 5px;
  flex-shrink: 0;
}

.session-text {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Main content ───────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  gap: 16px;
  flex-shrink: 0;
}

.main-header-left h1 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.workspace-console {
  flex: 1;
  padding: 18px 20px;
  overflow: visible;
}

/* ─── Workspace views ────────────────────────────────────────────────── */
.workspace-view {
  display: grid;
  gap: 14px;
}

/* ─── Board toolbar ──────────────────────────────────────────────────── */
.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.board-toolbar-left {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.board-toolbar-left input {
  flex: 1;
  min-width: 0;
}

.board-toolbar-left select {
  width: 190px;
  flex-shrink: 0;
}

/* ─── Kanban board ───────────────────────────────────────────────────── */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  gap: 12px;
  align-items: start;
}

.kanban-column {
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 8px;
  border-bottom: 1px solid var(--line);
}

.col-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

.kanban-col-header h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* column accent colours */
.col-open    { border-top: 3px solid var(--primary); }
.col-open    .status-dot  { background: var(--primary); }
.col-open    .count-pill  { background: var(--primary-soft); color: var(--primary-strong); }

.col-inprogress { border-top: 3px solid var(--warning); }
.col-inprogress .status-dot { background: var(--warning); }
.col-inprogress .count-pill { background: var(--warning-soft); color: var(--p-high-tx); }

.col-blocked    { border-top: 3px solid var(--danger); }
.col-blocked    .status-dot { background: var(--danger); }
.col-blocked    .count-pill { background: var(--danger-soft); color: var(--p-critical-tx); }

.col-done       { border-top: 3px solid var(--ok); }
.col-done       .status-dot { background: var(--ok); }
.col-done       .count-pill { background: var(--ok-soft); color: var(--p-low-tx); }

.count-pill {
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
}

.issue-column-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: grid;
  gap: 7px;
  min-height: 60px;
}

.issue-col-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 4px;
  text-align: center;
}

/* ─── Issue cards ────────────────────────────────────────────────────── */
.issue-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0;
  padding: 10px 10px 8px;
  display: grid;
  gap: 7px;
  cursor: default;
  transition: box-shadow 0.12s;
}

.issue-card:hover {
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.08);
}

/* priority border colours */
.issue-card.p-critical { border-left-color: var(--p-critical); }
.issue-card.p-high     { border-left-color: var(--p-high); }
.issue-card.p-medium   { border-left-color: var(--p-medium); }
.issue-card.p-low      { border-left-color: var(--p-low); }

.issue-card-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.issue-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.issue-chip {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
}

/* priority chip colours */
.chip-critical { background: var(--p-critical-bg); color: var(--p-critical-tx); }
.chip-high     { background: var(--p-high-bg);     color: var(--p-high-tx); }
.chip-medium   { background: var(--p-medium-bg);   color: var(--p-medium-tx); }
.chip-low      { background: var(--p-low-bg);      color: var(--p-low-tx); }
.chip-type     { background: #f1f5f9; color: #475467; }
.chip-project  { background: #f0f4ff; color: #4338ca; }

.issue-link {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.issue-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.issue-status-select {
  font: inherit;
  font-size: 11px;
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  width: 100%;
  cursor: pointer;
  color: var(--ink);
}

/* ─── Team view ──────────────────────────────────────────────────────── */
.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.member-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-info strong {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-info small {
  font-size: 11px;
  color: var(--muted);
}

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

.member-actions select {
  width: 110px;
  font-size: 12px;
  padding: 5px 7px;
}

/* ─── Projects view ──────────────────────────────────────────────────── */
.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.project-row {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-name {
  font-size: 13px;
  font-weight: 600;
}

.project-meta {
  font-size: 11px;
  color: var(--muted);
}

.project-key-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary-strong);
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ─── View cards (team/projects/billing containers) ──────────────────── */
.view-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.view-card-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.view-card-header h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* billing */
.billing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.code-box {
  margin: 0;
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #1d2a45;
  white-space: pre-wrap;
  min-height: 72px;
}

/* ─── Plan & usage ───────────────────────────────────────────────────── */
.plan-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}
.plan-summary-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.plan-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.plan-status {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 100px;
  text-transform: capitalize;
  background: var(--surface);
  color: var(--muted);
}
.plan-status.is-active   { background: var(--ok-soft);      color: #166534; }
.plan-status.is-trialing { background: var(--primary-soft); color: var(--primary-strong); }
.plan-status.is-warn     { background: var(--warning-soft); color: var(--p-high-tx); }
.plan-status.is-danger   { background: var(--danger-soft);  color: var(--p-critical-tx); }
.plan-provider { font-size: 11px; color: var(--muted); white-space: nowrap; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-tile {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  align-content: start;
}
.stat-tile-wide { grid-column: 1 / -1; }
.stat-tile-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value { font-size: 20px; font-weight: 700; color: var(--ink); }
.stat-value strong { font-weight: 800; }
.stat-bar {
  height: 7px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.stat-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s ease;
}
.stat-bar-fill.is-full { background: linear-gradient(90deg, var(--warning), var(--danger)); }

.plan-edit {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.plan-edit > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.plan-edit > summary::-webkit-details-marker { display: none; }
.plan-edit > summary::before { content: "⚙"; font-size: 12px; opacity: 0.8; }
.plan-edit[open] > summary { margin-bottom: 12px; }

/* ─── Inline form (team / projects single-row) ───────────────────────── */
.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  flex: 1;
  min-width: 140px;
}

.inline-field-narrow {
  flex: 0 0 130px;
}

.inline-submit {
  flex-shrink: 0;
  align-self: flex-end;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  align-self: flex-end;
  padding-bottom: 8px;
}
.inline-check input { width: auto; }

/* ─── Two-col form grid ──────────────────────────────────────────────── */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.compact-form {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

/* ─── Buttons ────────────────────────────────────────────────────────── */
input, select, button, textarea { font: inherit; }

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--ink);
}

input:focus, select:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(79, 70, 229, 0.15);
}

label {
  display: grid;
  gap: 4px;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
}

button {
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

button:hover  { background: var(--primary-strong); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-outline {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.btn-outline:hover { background: var(--surface-soft); }

.btn-ghost-sm {
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 5px;
}
.btn-ghost-sm:hover { background: var(--primary-soft); }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 3px 5px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--surface-soft); color: var(--ink); }

.btn-row {
  display: flex;
  gap: 6px;
}

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b42318; }

/* ─── Tabs (auth) ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 6px;
}

.tab {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 13px;
}
.tab.is-active {
  background: var(--primary);
  color: #fff;
}

/* ─── Stack & helpers ────────────────────────────────────────────────── */
.stack { display: grid; gap: 10px; }

.hidden { display: none !important; }

.muted  { color: var(--muted); font-size: 12px; }

.message {
  font-size: 12px;
  font-weight: 700;
  color: var(--danger);
  min-height: 16px;
  max-width: 40ch;
  text-align: right;
}

/* ─── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.18);
  padding: 24px 28px;
  width: 380px;
  max-width: calc(100vw - 32px);
  display: grid;
  gap: 18px;
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

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

.modal-divider { height: 1px; background: var(--line); margin: 4px 0 2px; }
.label-hint { font-weight: 400; font-size: 11px; color: var(--muted); margin-left: 4px; }

/* sidebar nav divider + new workspace button */
.sidebar-nav-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 4px;
}

.nav-btn-new {
  color: var(--primary);
  font-weight: 700;
}

.nav-btn-new:hover {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.workspace-switcher-actions {
  padding: 4px 8px 8px;
  display: flex;
  justify-content: flex-end;
}

/* ─── Issue card assignee row ────────────────────────────────────────── */
.issue-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.issue-assignee-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #c7d2fe;
  cursor: default;
}

/* ─── Detail drawer overlay ──────────────────────────────────────────── */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.40);
  z-index: 300;
  backdrop-filter: blur(2px);
}

/* ─── Detail panel ───────────────────────────────────────────────────── */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 40px rgba(16, 24, 40, 0.12);
  z-index: 310;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-panel.is-open {
  transform: translateX(0);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  gap: 10px;
}

.detail-header-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.detail-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-save-status {
  font-size: 11px;
  font-weight: 600;
  min-width: 60px;
  text-align: right;
}

.detail-save-status.is-ok    { color: var(--ok); }
.detail-save-status.is-error { color: var(--danger); }

.detail-close {
  color: var(--muted);
  padding: 5px;
}

.detail-close svg {
  display: block;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 32px;
  display: grid;
  gap: 14px;
  align-content: start;
}

/* Screenshot area */
.detail-screenshot-wrap {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.detail-screenshot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.detail-screenshot-placeholder span {
  font-size: 12px;
  max-width: 26ch;
}

.detail-screenshot-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  cursor: zoom-in;
}

/* ─── Screenshot lightbox ────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.85);
  backdrop-filter: blur(2px);
  cursor: zoom-out;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }

/* Title + description — editable, auto-save on blur */
.detail-title-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: var(--ink);
  background: transparent;
  transition: border-color 0.12s, background 0.12s;
}

.detail-title-input:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.detail-title-input:focus {
  border-color: var(--primary);
  background: var(--surface);
  outline: 3px solid rgba(79, 70, 229, 0.15);
}

.detail-description-textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  color: #344054;
  line-height: 1.6;
  resize: vertical;
  min-height: 60px;
  background: transparent;
  transition: border-color 0.12s, background 0.12s;
}

.detail-description-textarea:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.detail-description-textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
  outline: 3px solid rgba(79, 70, 229, 0.15);
}

/* Meta grid */
.detail-meta-grid {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.detail-meta-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.detail-meta-row:last-child {
  border-bottom: none;
}

.detail-meta-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.detail-meta-value {
  font-size: 12px;
  color: var(--ink);
}

.detail-select {
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.detail-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  font-size: 12px;
}

/* Comments section */
.detail-section {
  display: grid;
  gap: 10px;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.comment-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: start;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.comment-bubble {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 0 8px 8px 8px;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

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

.comment-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.comment-date {
  font-size: 11px;
  color: var(--muted);
}

.comment-body {
  font-size: 13px;
  color: #344054;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
}

/* Comment form */
.comment-form {
  display: grid;
  gap: 8px;
}

.comment-input-wrap {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: start;
}

.comment-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 60px;
  background: var(--surface);
  color: var(--ink);
}

.comment-textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(79, 70, 229, 0.15);
}

.comment-form-footer {
  display: flex;
  justify-content: flex-end;
}

/* ─── Workspace view grid ────────────────────────────────────────────── */
.workspace-view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.workspace-view-grid > .view-card:first-child {
  grid-column: 1 / -1;
}

.view-card-danger {
  border-color: var(--danger);
  background: #fff5f5;
}

.view-card-danger .view-card-header h2 {
  color: var(--danger);
}

/* ─── Project actions (key badge + delete) ───────────────────────────── */
.project-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Sidebar footer actions ─────────────────────────────────────────── */
.sidebar-footer-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.imprint-link {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  margin-top: 6px;
  display: block;
}
.imprint-link:hover { text-decoration: underline; }

/* ─── Form error ─────────────────────────────────────────────────────── */
.form-error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 600;
  margin: 0;
}

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .kanban-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 840px) {
  :root { --sidebar-w: 190px; }
}

@media (max-width: 600px) {
  .detail-panel { width: 100vw; }
  .detail-meta-grid { grid-template-columns: 1fr; }
  .detail-meta-row { grid-template-columns: 80px 1fr; }
}

@media (max-width: 680px) {
  /* The desktop layout pins html/body and scrolls each pane internally. On
     phones, let the whole page scroll and stack the chrome vertically. */
  html, body { height: auto; overflow: auto; }
  .app-shell { flex-direction: column; height: auto; min-height: 100vh; }

  /* Sidebar becomes a compact, stacked top bar (not a horizontal strip). */
  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow: visible;
    position: relative; /* anchor the account dropdown */
  }
  .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
  }
  .sidebar-logo { height: 30px; width: auto; }
  .account-menu-btn { display: inline-flex; }
  .sidebar-body { flex-direction: column; overflow: visible; min-height: 0; }
  .workspace-switcher { padding: 10px 14px; }

  /* Nav as a horizontal, scrollable pill row (keeps the header compact). */
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .workspace-nav-btn {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px;
  }
  .workspace-nav-btn.is-active { border-color: var(--primary); }
  .sidebar-nav-divider { display: none; }

  /* Account actions live in a dropdown opened from the top-right icon. */
  .sidebar-footer {
    position: absolute;
    top: 50px;
    right: 10px;
    width: 248px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 44px -12px rgba(16, 24, 40, 0.3);
    z-index: 60;
  }
  .sidebar-footer.is-open { display: flex; }
  .session-text { white-space: normal; overflow: visible; }
  .sidebar-footer-actions { flex-direction: column; align-items: flex-start; gap: 8px; }
  .imprint-link { margin: 2px 0 0; }

  /* Page scrolls naturally; drop the fixed-height main pane. */
  .main-content { height: auto; overflow: visible; }

  .kanban-grid { grid-template-columns: 1fr; }
  .billing-grid { grid-template-columns: 1fr; }
  /* minmax(0,…) + min-width:0 let the column shrink to the viewport instead of
     blowing out to its content's min-content width (which clipped the page) */
  .workspace-view-grid { grid-template-columns: minmax(0, 1fr); }
  .workspace-view-grid > .view-card:first-child { grid-column: 1; }
  .view-card { min-width: 0; }
  .member-row { flex-wrap: wrap; }
  .member-actions { flex-wrap: wrap; row-gap: 6px; }
  /* Stack form fields full-width (align-items:flex-end would right-align them
     once the axis turns vertical). */
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-field, .inline-field-narrow { flex: 1 1 auto; min-width: 0; width: 100%; }
  .inline-check { align-self: flex-start; padding-bottom: 0; }
  .inline-submit { align-self: stretch; }
  .form-row-2 { grid-template-columns: 1fr; }
  .board-toolbar { flex-wrap: wrap; }
  .board-toolbar-left { flex-wrap: wrap; }
  .board-toolbar-left select { width: 100%; }
  .message { text-align: left; }
}
