/* App shell: topbar, sidebar, board-area frame, and the sign-in screen.
   The board colour lives on .board-area (--board-color) only — the topbar,
   sidebar and auth screen always sit on the neutral house background. */

#app { height: 100%; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}

.topbar .brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
  color: var(--brand);
  padding: 0 4px;
}

.topbar .board-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
  color: var(--ink);
}
.topbar .board-heading .board-heading-name { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .board-heading .board-heading-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }

.role-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  background: var(--surface-alt);
  border-radius: 999px;
  padding: 2px 8px;
}

.topbar .btn-ghost { min-height: 32px; padding: 0 10px; color: var(--ink-soft); }
.topbar .btn-ghost:hover { color: var(--ink); }
.topbar .btn-ghost.on { background: var(--brand-tint); color: var(--brand); }
.topbar .btn-ghost.has-update { color: var(--ink); gap: 5px; }
.topbar .update-mark { color: var(--warn-ink); flex-shrink: 0; }

/* Who else is on the board — overlapping initials; a green ring = viewing the
   board, a brand-coloured one = has a card open. */
.presence { display: flex; align-items: center; padding-left: 6px; margin-right: 2px; }
.presence-avatar {
  width: 26px; height: 26px; font-size: 10px;
  margin-left: -6px;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ok-ink);
  cursor: default;
}
.presence-avatar.in-card { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--brand); }
.presence-more { background: var(--surface-alt); color: var(--ink-soft); box-shadow: 0 0 0 2px var(--surface); }

.bell-btn { position: relative; }
.badge-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

@media (max-width: 720px) {
  .topbar .board-heading .board-heading-name { max-width: 24vw; }
  .topbar .hide-narrow { display: none; }
}

/* ---------- Workspace split ---------- */
.workspace { flex: 1; display: flex; min-height: 0; position: relative; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: margin-left var(--t);
}
.workspace.sidebar-collapsed .sidebar { margin-left: calc(var(--sidebar-w) * -1); }

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 10px 16px;
}
.sidebar-head h2 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}

.board-list { list-style: none; overflow-y: auto; padding: 4px 8px 12px; flex: 1; }

.board-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--r-md);
  cursor: pointer;
  position: relative;
  transition: background var(--t-fast);
}
.board-item + .board-item { margin-top: 1px; }
.board-item:hover { background: var(--surface-alt); }
.board-item.active { background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 600; }
.board-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 7px; bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

.board-dot {
  width: 18px; height: 18px;
  border: none;
  border-radius: 5px;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
}
.board-item .board-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.board-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
  flex-shrink: 0;
}
.board-del {
  border: none;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  padding: 3px 4px;
  border-radius: 5px;
  opacity: 0;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.board-item:hover .board-del { opacity: 1; }
.board-del:hover { background: var(--danger-tint); color: var(--danger); }

@media (max-width: 640px) {
  .sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 30;
    box-shadow: var(--shadow-lg);
  }
}

/* ---------- Board area ---------- */
.board-area {
  flex: 1;
  min-width: 0;
  position: relative;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--board-color) 24%, transparent) 0%,
                            color-mix(in srgb, var(--board-color) 12%, transparent) 120px,
                            transparent 340px),
    var(--page-b);
}
/* Fallback for engines without color-mix. */
@supports not (background: color-mix(in srgb, red, blue)) {
  .board-area { background: var(--page-b); box-shadow: inset 0 3px 0 var(--board-color); }
}

.board-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: var(--ink-soft);
}
.board-empty .board-empty-inner { max-width: 340px; }
.board-empty h3 { font-size: 16px; color: var(--ink); margin-bottom: 6px; }

/* ---------- Sign-in screen ---------- */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  z-index: 400;
}
.auth-shell { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .mark {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  display: block;
  border-radius: 13px;
  background: #fff;
  padding: 7px;
  box-shadow: var(--shadow-md);
}
.auth-brand .kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brand);
}
.auth-brand .name { font-size: 17px; font-weight: 700; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 30px 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.auth-card h1 { font-size: 20px; margin-bottom: 6px; }
.auth-card .lead { color: var(--ink-soft); font-size: 13px; margin-bottom: 22px; }
.auth-card .btn { width: 100%; min-height: 44px; font-size: 14px; }

.auth-error {
  background: var(--danger-tint);
  color: var(--danger);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
}
.auth-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
}
