* {
  box-sizing: border-box;
}

.space-switcher {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 14rem;
  padding: 0.42rem 0.55rem;
  border: 1px solid #dbe3ec;
  border-radius: 0.8rem;
  background: #f8fafc;
}

.space-switcher-icon {
  display: grid;
  flex: 0 0 1.8rem;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border-radius: 0.55rem;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.75rem;
}

.space-switcher label {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 0.08rem;
}

.space-switcher label > span {
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.space-switcher select {
  width: 100%;
  max-width: 15rem;
  overflow: hidden;
  border: 0;
  padding: 0.12rem 1.5rem 0.12rem 0;
  background-color: transparent;
  color: #172033;
  font-size: 0.88rem;
  font-weight: 750;
  text-overflow: ellipsis;
}

.space-switcher select:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.space-role-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.28rem 0.45rem;
  background: #dcfce7;
  color: #166534;
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
}

.space-role-badge[data-tone="muted"] {
  background: #e5e7eb;
  color: #4b5563;
}

.member-invite-form {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) minmax(11rem, auto) auto;
  align-items: end;
  gap: 0.35rem 0.75rem;
  margin: 0;
}

.member-invite-form label {
  color: #475569;
  font-size: 0.78rem;
  font-weight: 750;
}

.member-invite-form > label:first-of-type {
  grid-column: 1;
  grid-row: 1;
}

.member-invite-form > label:nth-of-type(2) {
  grid-column: 2;
  grid-row: 1;
}

#memberInviteEmail,
#spaceCreateName {
  grid-column: 1;
  grid-row: 2;
}

#memberInviteRole,
#spaceCreateAdminEmail {
  grid-column: 2;
  grid-row: 2;
}

.member-invite-form > button {
  grid-column: 3;
  grid-row: 2;
}

.card-share-actions,
.card-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.card-share-actions {
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.quick-archive-btn {
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.35;
}

.card:hover .quick-archive-btn,
.card:focus-within .quick-archive-btn,
.quick-archive-btn:focus-visible {
  opacity: 1;
}

.card[tabindex="0"]:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}

details.dependency-control > summary {
  cursor: pointer;
  font-weight: 750;
  padding: 0.35rem 0;
}

.undo-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: min(30rem, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border-radius: 0.8rem;
  background: #172033;
  color: #fff;
  box-shadow: 0 12px 36px rgb(0 0 0 / 0.3);
}

.undo-toast[hidden] {
  display: none;
}

.undo-toast button {
  border: 0;
  background: transparent;
  color: #8fc5ff;
  font-weight: 800;
  cursor: pointer;
}

.analytics-card-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #d1d5db;
}

@media (max-width: 760px) {
  .member-invite-form {
    grid-template-columns: 1fr;
  }

  .member-invite-form > label,
  .member-invite-form > input,
  .member-invite-form > select,
  .member-invite-form > button {
    grid-column: 1;
    grid-row: auto;
  }

  .space-switcher label > span,
  .space-role-badge {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  .quick-archive-btn {
    opacity: 1;
  }
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top, #ffffff 0%, #f4f6f8 38%, #e8edf3 100%);
  color: #1f2937;
}

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

.app {
  margin: 0 auto;
  padding: 16px 20px 28px;
}

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

.logo {
  display: block;
  width: 112px;
}

.header-brand {
  flex: 0 0 auto;
  border-radius: 10px;
}

.header-brand:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 3px;
}

.floating-logo {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  padding: 5px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.floating-logo.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.floating-logo.is-board-view {
  display: none;
}

.floating-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.header-btn {
  flex-shrink: 0;
}

.header-controls {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.main-nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 6px;
}

.main-nav-btn {
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.82);
  color: #374151;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.main-nav-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.main-nav-btn.is-active {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

.header-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.menu-container {
  position: relative;
}

.menu-popover {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  min-width: 210px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.2);
}

.menu-popover[hidden] {
  display: none;
}

.global-more-menu,
.board-options-popover {
  right: 0;
}

.global-more-menu {
  width: 230px;
}

.menu-heading {
  display: block;
  padding: 5px 8px 7px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.menu-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  background: transparent;
  color: #1f2937;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover,
.menu-item.is-active {
  background: #f3f4f6;
}

.menu-item.is-active {
  font-weight: 800;
}

.menu-item-danger {
  color: #b91c1c;
}

.menu-divider {
  height: 1px;
  margin: 7px 4px;
  background: #e5e7eb;
}

.menu-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  color: #4b5563;
  font-size: 13px;
}

.menu-theme select {
  min-width: 100px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.notification-center {
  position: relative;
}

.notification-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.notification-count {
  min-width: 20px;
  border-radius: 999px;
  padding: 2px 6px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.notification-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  width: min(390px, calc(100vw - 32px));
  max-height: 520px;
  overflow: auto;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.2);
}

.notification-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 10px;
  color: #4b5563;
  font-size: 12px;
}

.notification-panel-header strong {
  color: #111827;
  font-size: 14px;
}

.notification-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notification-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px;
  background: #f9fafb;
  color: #374151;
  text-align: left;
  cursor: pointer;
}

.notification-item:hover,
.notification-item.is-unread {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.notification-item span,
.notification-item small,
.notification-item p,
.notification-item time {
  margin: 0;
}

.notification-item small,
.notification-item time {
  color: #6b7280;
  font-size: 11px;
}

.notification-item p {
  margin: 6px 0;
  color: #4b5563;
  font-size: 12px;
}

.notification-empty {
  margin: 0;
  padding: 16px;
}

.app-view[hidden] {
  display: none;
}

.feedback {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.feedback[data-type="info"] {
  background: #e0f2fe;
  color: #075985;
}

.feedback[data-type="error"] {
  background: #fee2e2;
  color: #991b1b;
}

.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
}

.board-toolbar {
  position: sticky;
  z-index: 24;
  top: 8px;
  backdrop-filter: blur(12px);
  box-shadow: 0 7px 22px rgba(15, 23, 42, 0.08);
}

.board-toolbar[hidden] {
  display: none;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-view-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.saved-view-actions {
  display: flex;
  gap: 8px;
}

.filter-label {
  margin: 0;
  color: #4b5563;
  font-size: 13px;
  font-weight: 700;
}

.color-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-filter-btn {
  width: 30px;
  height: 30px;
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.86), 0 1px 4px rgba(15, 23, 42, 0.16);
}

.color-filter-btn.card-blue {
  background: #3b82f6;
}

.color-filter-btn.card-purple {
  background: #8b5cf6;
}

.color-filter-btn.card-orange {
  background: #f97316;
}

.color-filter-btn.card-green {
  background: #22c55e;
}

.color-filter-btn.card-red {
  background: #ef4444;
}

.color-filter-btn.card-gray {
  background: #6b7280;
}

.color-filter-btn.is-selected {
  border-color: #111827;
}

.filter-group select,
.filter-group input {
  min-width: 180px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
  background: #ffffff;
}

.compact-field select,
.compact-field input {
  width: 100%;
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  padding: 7px 10px;
  background: #fff;
}

.compact-field select {
  min-width: 175px;
}

.board-toolbar .compact-action {
  min-height: 36px;
  padding: 7px 11px;
  white-space: nowrap;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.filter-text {
  flex: 1 1 240px;
  min-width: 220px;
}

.filter-text input {
  width: 100%;
}

.filter-summary {
  color: #6b7280;
  font-size: 13px;
  white-space: nowrap;
}

.filters-popover {
  right: 0;
  display: grid;
  width: min(320px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 100px));
  gap: 14px;
  overflow-y: auto;
  padding: 14px;
}

.filters-popover .filter-group select {
  width: 100%;
}

.board-options-popover {
  width: 230px;
}

.toolbar-count {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  place-items: center;
  border-radius: 999px;
  padding: 1px 6px;
  background: #111827;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.has-active-filters {
  box-shadow: inset 0 0 0 2px #2563eb;
}

.active-filter-row {
  display: flex;
  flex: 1 0 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 2px 2px 0;
}

.active-filter-row[hidden] {
  display: none;
}

.active-filter-chips {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-chip {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eff6ff;
  color: #1e40af;
  cursor: pointer;
  font-size: 12px;
}

.filter-chip:hover {
  background: #dbeafe;
}

.clear-filters-btn {
  padding: 5px 8px;
  font-size: 12px;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-screen[hidden] {
  display: none;
}

.auth-card {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: #fff;
  text-align: center;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

.auth-logo {
  width: 180px;
}

#googleSignInButton {
  display: flex;
  justify-content: center;
  margin: 24px 0 12px;
}

.dev-login-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
  padding: 16px;
  border: 2px dashed #d97706;
  border-radius: 14px;
  background: #fffbeb;
  text-align: left;
}

.dev-login-panel[hidden] {
  display: none;
}

.dev-login-panel strong {
  color: #92400e;
}

.dev-login-panel select {
  width: 100%;
}

.dev-mode-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: -10px 0 24px;
  padding: 10px 14px;
  border: 2px solid #d97706;
  border-radius: 12px;
  background: #fef3c7;
  color: #78350f;
}

.dev-mode-banner[hidden] {
  display: none;
}

.theme-select {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

.current-user,
.user-identity,
.feed-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions .current-user {
  max-width: 155px;
  gap: 7px;
}

.header-actions .current-user small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-user img,
.current-user span,
.user-identity img,
.user-identity > span,
.feed-author img,
.feed-author > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: #1e3a8a;
  object-fit: cover;
  font-weight: 800;
}

.header-actions .current-user img,
.header-actions .current-user span {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

.current-user small,
.user-identity small,
.feed-author time {
  display: block;
  color: #6b7280;
  font-size: 12px;
}

.card-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 18px;
}

.card-tab {
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 12px;
  background: transparent;
  cursor: pointer;
}

.card-tab.is-active {
  border-color: #111827;
  font-weight: 800;
}

.card-tab-panel[hidden] {
  display: none;
}

.markdown-view-switch,
.dependency-add-row,
.feed-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.markdown-view-switch .is-active {
  background: #111827;
  color: #fff;
}

.markdown-preview,
.dependency-control,
.feed-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  background: #f9fafb;
}

.dependency-control {
  margin-top: 16px;
}

.dependency-add-row select {
  flex: 1;
}

.dependency-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid #e5e7eb;
}

.dependency-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: #2563eb;
  text-align: left;
  cursor: pointer;
}

.dependency-badge {
  display: inline-flex;
  margin-top: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #ede9fe;
  color: #5b21b6;
  font-size: 12px;
  font-weight: 800;
}

.tab-submit-btn {
  margin: 10px 0 16px;
}

.comment-submit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.comment-composer {
  position: relative;
}

.mention-suggestions {
  position: absolute;
  z-index: 20;
  right: 0;
  left: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 5px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.mention-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: #374151;
  text-align: left;
  cursor: pointer;
}

.mention-option:hover,
.mention-option.is-active {
  background: #eff6ff;
}

.mention-option span {
  color: #6b7280;
  font-size: 12px;
}

.comment-mention {
  border-radius: 5px;
  padding: 1px 4px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
}

.tab-feed,
.users-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.management-layout {
  display: grid;
  grid-template-columns: minmax(19rem, 0.7fr) minmax(28rem, 1.3fr);
  align-items: start;
  gap: 16px;
}

.management-panel {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.management-layout > .management-panel {
  margin-bottom: 0;
}

.space-create-panel {
  display: grid;
  grid-template-columns: minmax(17rem, 0.55fr) minmax(32rem, 1.45fr);
  align-items: end;
  gap: 20px;
  padding: 14px 16px;
}

.space-create-panel .management-panel-heading {
  align-items: center;
  margin-bottom: 0;
}

.space-create-panel .member-invite-form {
  min-width: 0;
}

.management-panel-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.management-panel-heading-inline {
  justify-content: space-between;
}

.management-panel-heading h3,
.management-panel-heading p {
  margin: 0;
}

.management-panel-heading h3 {
  color: #172033;
  font-size: 1rem;
}

.management-panel-heading p {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.4;
}

.management-icon {
  display: grid;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 0.65rem;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 1.2rem;
  font-weight: 800;
}

.count-badge,
.context-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.count-badge {
  min-width: 2rem;
  padding: 0.42rem 0.55rem;
  background: #e2e8f0;
  color: #334155;
}

.context-badge {
  padding: 0.3rem 0.5rem;
  background: #ede9fe;
  color: #6d28d9;
}

.status-badge {
  padding: 0.34rem 0.55rem;
  background: #dcfce7;
  color: #166534;
  white-space: nowrap;
}

.status-badge[data-status="archived"],
.status-badge[data-status="disabled"] {
  background: #e5e7eb;
  color: #4b5563;
}

.status-badge[data-status="failed"] {
  background: #fee2e2;
  color: #991b1b;
}

.management-badges,
.identity-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.feed-author {
  margin-bottom: 10px;
}

.feed-author div {
  min-width: 0;
}

.user-row {
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.management-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.management-row-main,
.management-row-controls,
.platform-user-footer,
.space-card-header,
.space-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.management-row-controls {
  padding-top: 12px;
  border-top: 1px solid #edf1f5;
}

.management-row-controls label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 750;
}

.management-row-controls select {
  min-width: 13rem;
}

.user-identity div {
  display: flex;
  flex-direction: column;
}

.user-identity .identity-title {
  flex-direction: row;
}

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

.invitations-panel,
.spaces-panel,
.platform-users-panel {
  margin-top: 16px;
}

.invitation-identity > span {
  border-radius: 10px;
}

.spaces-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 25rem), 1fr));
  gap: 14px;
}

.space-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border: 1px solid #dbe3ec;
  border-radius: 14px;
  background: #fff;
}

.space-card.is-archived {
  background: #f8fafc;
}

.space-card-header > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.space-card-header strong {
  overflow: hidden;
  color: #172033;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.space-card-header small,
.space-membership-note,
.platform-user-footer > span {
  color: #64748b;
  font-size: 0.78rem;
}

.space-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.space-stats > div {
  padding: 10px;
  border-radius: 10px;
  background: #f1f5f9;
  text-align: center;
}

.space-stats dt {
  color: #64748b;
  font-size: 0.68rem;
}

.space-stats dd {
  margin: 4px 0 0;
  color: #172033;
  font-size: 1.05rem;
  font-weight: 800;
}

.space-admin-pending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.78rem;
}

.space-admin-pending span {
  color: #a16207;
  text-align: right;
}

.space-admin-pending[data-delivery-status="failed"] {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.space-admin-pending[data-delivery-status="failed"] span {
  color: #b91c1c;
}

.space-card-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid #edf1f5;
}

.space-membership-note {
  margin-right: auto;
}

.platform-user-footer {
  padding-top: 12px;
  border-top: 1px solid #edf1f5;
}

.trash-header {
  margin-top: 28px;
}

.trash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.trash-row div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trash-row small {
  color: #6b7280;
}

html[data-theme="dark"] body {
  background: radial-gradient(circle at top, #1f2937 0%, #111827 48%, #030712 100%);
  color: #e5e7eb;
}

html[data-theme="dark"] .header,
html[data-theme="dark"] .filters,
html[data-theme="dark"] .column,
html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .metric-panel,
html[data-theme="dark"] .management-panel,
html[data-theme="dark"] .user-row,
html[data-theme="dark"] .space-card,
html[data-theme="dark"] .trash-row,
html[data-theme="dark"] .feed-item,
html[data-theme="dark"] .dependency-control,
html[data-theme="dark"] .markdown-preview,
html[data-theme="dark"] .notification-panel,
html[data-theme="dark"] .mention-suggestions,
html[data-theme="dark"] .menu-popover {
  border-color: #374151;
  background: #111827;
  color: #e5e7eb;
}

html[data-theme="dark"] .space-switcher {
  border-color: #374151;
  background: #111827;
}

html[data-theme="dark"] .space-switcher select {
  background-color: transparent;
  color: #f9fafb;
}

html[data-theme="dark"] .management-panel-heading h3,
html[data-theme="dark"] .space-card-header strong,
html[data-theme="dark"] .space-stats dd {
  color: #f3f4f6;
}

html[data-theme="dark"] .management-panel-heading p,
html[data-theme="dark"] .management-row-controls label,
html[data-theme="dark"] .space-card-header small,
html[data-theme="dark"] .space-membership-note,
html[data-theme="dark"] .platform-user-footer > span,
html[data-theme="dark"] .space-stats dt {
  color: #9ca3af;
}

html[data-theme="dark"] .management-row-controls,
html[data-theme="dark"] .space-card-actions,
html[data-theme="dark"] .platform-user-footer {
  border-color: #374151;
}

html[data-theme="dark"] .space-stats > div {
  background: #1f2937;
}

html[data-theme="dark"] .space-admin-pending {
  border-color: #854d0e;
  background: #422006;
  color: #fde68a;
}

html[data-theme="dark"] .space-admin-pending span {
  color: #fcd34d;
}

html[data-theme="dark"] .space-admin-pending[data-delivery-status="failed"] {
  border-color: #991b1b;
  background: #450a0a;
  color: #fecaca;
}

html[data-theme="dark"] .space-admin-pending[data-delivery-status="failed"] span {
  color: #fca5a5;
}

html[data-theme="dark"] .notification-panel-header,
html[data-theme="dark"] .notification-panel-header strong,
html[data-theme="dark"] .notification-item,
html[data-theme="dark"] .mention-option,
html[data-theme="dark"] .mention-option span {
  color: #e5e7eb;
}

html[data-theme="dark"] .notification-item {
  background: #1f2937;
}

html[data-theme="dark"] .notification-item:hover,
html[data-theme="dark"] .notification-item.is-unread,
html[data-theme="dark"] .mention-option:hover,
html[data-theme="dark"] .mention-option.is-active {
  border-color: #1d4ed8;
  background: #172554;
}

html[data-theme="dark"] .dev-login-panel,
html[data-theme="dark"] .dev-mode-banner {
  border-color: #f59e0b;
  background: #451a03;
  color: #fef3c7;
}

html[data-theme="dark"] .dev-login-panel strong {
  color: #fcd34d;
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  border-color: #4b5563;
  background: #1f2937;
  color: #f9fafb;
}

html[data-theme="dark"] .filter-label,
html[data-theme="dark"] .filter-summary,
html[data-theme="dark"] .column-sort-menu label,
html[data-theme="dark"] .menu-heading,
html[data-theme="dark"] .menu-theme,
html[data-theme="dark"] .card-meta,
html[data-theme="dark"] .feed-author time,
html[data-theme="dark"] .current-user small,
html[data-theme="dark"] .user-identity small {
  color: #9ca3af;
}

html[data-theme="dark"] .secondary-btn {
  background: #374151;
  color: #f9fafb;
}

html[data-theme="dark"] .menu-item {
  color: #e5e7eb;
}

html[data-theme="dark"] .menu-item:hover,
html[data-theme="dark"] .menu-item.is-active {
  background: #1f2937;
}

html[data-theme="dark"] .menu-item-danger {
  color: #fca5a5;
}

html[data-theme="dark"] .menu-divider {
  background: #374151;
}

html[data-theme="dark"] .column-count {
  background: #374151;
  color: #d1d5db;
}

html[data-theme="dark"] .filter-chip {
  border-color: #1d4ed8;
  background: #172554;
  color: #bfdbfe;
}

html[data-theme="dark"] .primary-btn,
html[data-theme="dark"] .markdown-view-switch .is-active {
  background: #f9fafb;
  color: #111827;
}

html[data-theme="dark"] .card-tab.is-active {
  border-color: #f9fafb;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.column {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 14px;
  padding: 12px;
  min-height: 500px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.column-header {
  margin-bottom: 8px;
}

.column-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.column-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.column-count {
  display: inline-grid;
  min-width: 24px;
  min-height: 24px;
  margin-left: 4px;
  place-items: center;
  border-radius: 999px;
  padding: 2px 7px;
  background: #eef2f7;
  color: #4b5563;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.column-header .column-sort-toggle {
  max-width: 150px;
  overflow: hidden;
  padding: 7px 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.column-sort-menu {
  right: 0;
  display: grid;
  width: 230px;
  gap: 10px;
  padding: 12px;
}

.column-sort-menu label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}

.column-sort-menu select {
  width: 100%;
  min-width: 0;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
  color: #1f2937;
}

.column-sort-menu .column-sort-direction {
  width: 100%;
  padding: 7px 9px;
}

.column h2 {
  margin: 0;
  font-size: 18px;
}

.add-card-btn {
  border: 0;
  border-radius: 10px;
  padding: 7px 9px;
  background: #111827;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
}

.add-card-btn:hover {
  background: #374151;
}

.drop-zone {
  flex: 1;
  min-height: 420px;
  padding: 4px;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.drop-zone.drag-over {
  background: #eef2ff;
  outline: 2px dashed #6366f1;
}

.card {
  background: #ffffff;
  border-left: 6px solid #9ca3af;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  cursor: grab;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.card:active {
  cursor: grabbing;
}

.card.dragging {
  opacity: 0.55;
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.card.due-soon {
  border-top: 2px solid #f59e0b;
  border-right: 2px solid #f59e0b;
  border-bottom: 2px solid #f59e0b;
  background: #fffbeb;
}

.card.overdue {
  border-top: 2px solid #dc2626;
  border-right: 2px solid #dc2626;
  border-bottom: 2px solid #dc2626;
  background: #fef2f2;
}

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

.card-header h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.unread-activity-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  margin-bottom: 8px;
  padding: 3px 8px;
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.card.has-unread-activity {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3), 0 10px 24px rgba(15, 23, 42, 0.08);
}

.collapse-card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.card-header .collapse-card-btn {
  background-color: transparent;
}

.card.is-collapsed .card-header h3 {
  margin-bottom: 0;
}

.card.is-collapsed .card-body {
  display: none;
}

.card.is-collapsed .backlog-status,
.card.is-collapsed .archive-status {
  display: none;
}

.card p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.4;
  color: #4b5563;
  white-space: pre-wrap;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #6b7280;
}

.due-date-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0 0 8px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}

.due-date-badge.due-soon {
  background: #fde68a;
  color: #78350f;
}

.due-date-badge.overdue {
  background: #fecaca;
  color: #991b1b;
}

.blocked-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
}

.blocked-reason {
  border-left: 3px solid #ef4444;
  padding-left: 10px;
  color: #991b1b;
  font-weight: 700;
}

.card-link {
  display: inline-flex;
  margin: 0 0 12px;
  color: #0f766e;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.card-link:hover {
  text-decoration: underline;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.card-checklist {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.checklist-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.checklist-heading h4 {
  margin: 0;
  font-size: 13px;
}

.checklist-progress {
  border-radius: 999px;
  padding: 3px 7px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 700;
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

.checklist-item label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #374151;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
}

.checklist-item input {
  flex: 0 0 auto;
  margin: 2px 0 0;
}

.checklist-item.is-completed span {
  color: #6b7280;
  text-decoration: line-through;
}

.checklist-add-form {
  display: flex;
  gap: 7px;
}

.checklist-add-input {
  min-width: 0;
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 8px;
  background: #ffffff;
  font-size: 13px;
}

.checklist-add-btn {
  flex: 0 0 auto;
  padding: 7px 9px;
  font-size: 12px;
}

.modal-checklist {
  margin: 2px 0 4px;
}

.modal-checklist .card-checklist {
  margin-top: 0;
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
}

.modal-checklist .checklist-item label {
  font-weight: 400;
}

.modal-checklist .checklist-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
}

.modal-checklist .checklist-add-input {
  width: auto;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tags span {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #f3f4f6;
  color: #374151;
}

.tag-suggestions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: -2px;
}

.tag-suggestions-label {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

.tag-suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-suggestion-btn {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tag-suggestion-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.tag-suggestion-btn.is-selected {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1d4ed8;
}

.card-blue {
  border-left-color: #3b82f6;
}

.card-purple {
  border-left-color: #8b5cf6;
}

.card-orange {
  border-left-color: #f97316;
}

.card-green {
  border-left-color: #22c55e;
}

.card-red {
  border-left-color: #ef4444;
}

.card-gray {
  border-left-color: #6b7280;
}

.empty-state {
  margin: 8px 0 0;
  color: #6b7280;
  font-size: 14px;
}

.backlog-section,
.archive-section,
.analytics-section,
.activity-section,
.assistant-section {
  margin-top: 28px;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
}

.backlog-section,
.archive-section,
.analytics-section,
.activity-section,
.assistant-section {
  margin: 0 0 28px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.section-header p {
  margin: 0;
  color: #6b7280;
}

.section-list,
.archive-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.analytics-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.activity-filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.activity-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 700;
}

.activity-filters input {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 10px;
  background: #ffffff;
  color: #111827;
}

.activity-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  color: #4b5563;
  font-size: 14px;
}

.activity-summary strong {
  color: #111827;
  font-size: 24px;
}

.activity-summary-chip {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}

.activity-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-item {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 14px;
  border: 1px solid #e5e7eb;
  border-left: 6px solid #9ca3af;
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
}

.activity-time time {
  color: #6b7280;
  font-size: 13px;
  font-weight: 700;
}

.activity-content {
  min-width: 0;
}

.activity-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.activity-title-row h3 {
  margin: 0;
  font-size: 15px;
}

.activity-title-row span {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 4px 8px;
  background: #ecfeff;
  color: #155e75;
  font-size: 12px;
  font-weight: 800;
}

.activity-content > p {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.activity-content > p + .markdown-content {
  margin-top: 8px;
  border-left: 3px solid #d1d5db;
  padding-left: 10px;
}

.assistant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: #6b7280;
  font-size: 13px;
}

.assistant-meta span,
.assistant-meta strong {
  border-radius: 999px;
  padding: 5px 9px;
  background: #f3f4f6;
}

.assistant-meta strong {
  background: #fef3c7;
  color: #92400e;
}

.assistant-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.assistant-suggestion {
  border: 1px solid #e5e7eb;
  border-left: 6px solid #9ca3af;
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
}

.assistant-suggestion.is-high {
  border-left-color: #ef4444;
}

.assistant-suggestion.is-medium {
  border-left-color: #f59e0b;
}

.assistant-suggestion.is-low {
  border-left-color: #3b82f6;
}

.assistant-suggestion-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.assistant-suggestion-header h3 {
  margin: 6px 0 0;
  font-size: 15px;
}

.assistant-suggestion-header > span,
.assistant-severity {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  font-weight: 800;
}

.assistant-severity {
  background: #ecfeff;
  color: #155e75;
}

.assistant-suggestion p {
  margin: 0 0 10px;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.4;
}

.assistant-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.assistant-card-link {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 5px 9px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.assistant-card-link:hover {
  border-color: #94a3b8;
  background: #e2e8f0;
}

.assistant-card-muted,
.assistant-action-text {
  color: #6b7280;
  font-size: 13px;
}

.assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assistant-color-change {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.color-theme-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-left-width: 5px;
  border-radius: 8px;
  padding: 7px 9px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.color-confirmation-modal {
  width: min(580px, calc(100% - 32px));
}

.color-confirmation-card {
  margin: 0;
  color: #111827;
  font-weight: 800;
}

.color-change-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}

.color-change-option {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.color-change-option > span {
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}

.color-change-arrow {
  color: #6b7280;
  font-size: 22px;
  font-weight: 800;
}

.color-confirmation-reason {
  border-radius: 10px;
  padding: 12px;
  background: #f3f4f6;
}

.color-confirmation-reason strong {
  font-size: 13px;
}

.color-confirmation-reason p {
  margin: 5px 0 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.4;
}

.color-confirmation-actions {
  justify-content: flex-end;
}

.color-confirmation-actions button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.analytics-range-btn.is-selected {
  background: #111827;
  color: #ffffff;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.metric-panel {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  background: #ffffff;
}

.metric-panel-wide {
  grid-column: span 2;
}

.metric-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.metric-value {
  margin: 0;
  color: #111827;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.metric-caption,
.metric-inline {
  margin: 8px 0 0;
  color: #6b7280;
  font-size: 14px;
}

.status-counts,
.cycle-metrics,
.analytics-list,
.throughput-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-counts {
  margin-top: 16px;
}

.status-count,
.throughput-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: #4b5563;
  font-size: 14px;
}

.status-count strong,
.throughput-row strong {
  color: #111827;
}

.cycle-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.cycle-metrics div {
  border-radius: 10px;
  padding: 12px;
  background: #f9fafb;
}

.cycle-metrics span {
  display: block;
  color: #111827;
  font-size: 20px;
  font-weight: 800;
}

.cycle-metrics small,
.analytics-row small {
  color: #6b7280;
  font-size: 12px;
}

.analytics-row {
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
}

.analytics-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.analytics-row h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.analytics-row p {
  margin: 0 0 4px;
  color: #4b5563;
  font-size: 13px;
}

.throughput-row {
  grid-template-columns: 90px minmax(90px, 1fr) 32px;
}

.throughput-bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.throughput-bar {
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: #0f766e;
}

.backlog-card,
.archived-card {
  cursor: default;
}

.backlog-status,
.archive-status {
  margin: 6px 0 0;
  font-size: 13px;
  color: #6b7280;
}

.backlog-card-actions,
.archive-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* Modal */

.modal {
  width: min(50%, calc(100% - 32px));
  border: 0;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.35);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
}

.modal-content h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.modal-meta {
  border-radius: 10px;
  padding: 10px 12px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 13px;
}

.modal-meta p {
  margin: 0;
}

.modal-content label {
  font-weight: 700;
  font-size: 14px;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
  background: #ffffff;
}

.modal-content textarea {
  resize: vertical;
}

.duplicate-warning {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid #f59e0b;
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffbeb;
  color: #78350f;
  font-size: 13px;
}

.duplicate-warning[hidden] {
  display: none;
}

.duplicate-warning-title {
  margin: 0;
  font-weight: 800;
}

.duplicate-warning-caption {
  margin: 0;
  color: #92400e;
  line-height: 1.35;
}

.duplicate-warning-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.duplicate-warning-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.duplicate-warning-item strong,
.duplicate-warning-item span {
  min-width: 0;
}

.duplicate-warning-item strong {
  overflow-wrap: anywhere;
  color: #111827;
}

.duplicate-warning-item span {
  flex: 0 0 auto;
  color: #92400e;
  font-weight: 700;
}

.markdown-editor {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.markdown-editor textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border: 1px solid #d1d5db;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  padding: 6px;
  background: #f9fafb;
}

.markdown-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.markdown-toolbar button:hover {
  border-color: #d1d5db;
  background: #ffffff;
}

.reference-url-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.reference-url-row input {
  flex: 1;
}

.import-modal {
  width: min(640px, calc(100% - 32px));
}

.notes-modal {
  width: min(620px, calc(100% - 32px));
}

.block-control {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
}

.block-status {
  border-radius: 10px;
  padding: 10px 12px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 700;
}

.block-actions {
  display: flex;
  gap: 8px;
}

.file-import-btn {
  align-self: flex-start;
}

.import-actions {
  justify-content: flex-end;
}

.import-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
}

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

.import-preview-header h3 {
  margin: 0;
  font-size: 16px;
}

.import-preview-header span {
  color: #6b7280;
  font-size: 13px;
}

.import-preview-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.import-preview-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  background: #f9fafb;
}

.import-preview-card > div {
  flex: 1;
  min-width: 0;
}

.import-preview-card h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.import-preview-card p {
  margin: 0 0 10px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.import-preview-card .duplicate-warning {
  margin-top: 10px;
}

.import-preview-card .duplicate-warning p {
  margin: 0;
}

.import-preview-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.import-preview-controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
}

.import-preview-controls select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 10px;
  background: #ffffff;
  color: #111827;
}

.import-preview-card button {
  flex-shrink: 0;
}

.notes-actions {
  justify-content: flex-end;
}

.notes-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  border-top: 1px solid #e5e7eb;
  padding-top: 14px;
}

.notes-history-header h3 {
  margin: 0;
  font-size: 16px;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

.note-item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  background: #f9fafb;
}

.note-item time {
  display: block;
  margin-bottom: 8px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}

.note-item p,
.markdown-content p {
  margin: 0;
  color: #374151;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.markdown-content {
  color: #374151;
  font-size: 14px;
  line-height: 1.45;
}

.card-body > .markdown-content,
.import-preview-card .markdown-content,
.empty-card-content {
  margin-bottom: 12px;
}

.markdown-content p,
.markdown-content ul,
.markdown-content blockquote,
.markdown-content pre {
  margin: 0 0 10px;
}

.markdown-content > :last-child {
  margin-bottom: 0;
}

.markdown-content ul {
  padding-left: 20px;
}

.markdown-content li + li {
  margin-top: 4px;
}

.markdown-content blockquote {
  border-left: 3px solid #cbd5e1;
  padding-left: 10px;
  color: #4b5563;
}

.markdown-content code {
  border-radius: 5px;
  padding: 2px 5px;
  background: #e5e7eb;
  color: #111827;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
}

.markdown-content pre {
  overflow: auto;
  border-radius: 8px;
  padding: 10px;
  background: #111827;
  color: #f9fafb;
}

.markdown-content pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
}

.markdown-content a {
  position: relative;
  z-index: 1;
  color: #0f766e;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  user-select: text;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  object-fit: contain;
}

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

.modal-actions-left,
.modal-actions-right {
  display: flex;
  gap: 8px;
}

.primary-btn,
.secondary-btn,
.delete-btn,
.backlog-btn,
.archive-btn,
.block-btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.primary-btn {
  background: #111827;
  color: #ffffff;
}

.secondary-btn {
  background: #e5e7eb;
  color: #111827;
}

.delete-btn {
  background: #fee2e2;
  color: #991b1b;
}

.backlog-btn {
  background: #dcfce7;
  color: #166534;
}

.archive-btn {
  background: #fef3c7;
  color: #92400e;
}

.block-btn {
  background: #fee2e2;
  color: #991b1b;
}

.primary-btn:hover {
  background: #374151;
}

.secondary-btn:hover {
  background: #d1d5db;
}

.delete-btn:hover {
  background: #fecaca;
}

.backlog-btn:hover {
  background: #bbf7d0;
}

.archive-btn:hover {
  background: #fde68a;
}

.block-btn:hover {
  background: #fecaca;
}

@media (max-width: 900px) {
  .app {
    padding: 10px;
  }

  .floating-logo {
    width: 50px;
    top: 8px;
    left: 8px;
  }

  .header {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
  }

  .logo {
    width: 88px;
  }

  .header-controls {
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    min-width: min(360px, 100%);
  }

  .space-switcher {
    max-width: min(100%, 22rem);
  }

  .management-layout {
    grid-template-columns: 1fr;
  }

  .space-create-panel {
    display: block;
  }

  .space-create-panel .management-panel-heading {
    align-items: flex-start;
    margin-bottom: 16px;
  }

  .member-invite-form {
    grid-template-columns: 1fr;
  }

  .member-invite-form > label:first-of-type,
  .member-invite-form > label:nth-of-type(2),
  #memberInviteEmail,
  #spaceCreateName,
  #memberInviteRole,
  #spaceCreateAdminEmail,
  .member-invite-form > button {
    grid-column: 1;
    grid-row: auto;
  }

  .main-nav {
    order: 2;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 2px;
  }

  .main-nav-btn {
    flex: 0 0 auto;
  }

  .header-actions {
    order: 1;
    margin-left: auto;
  }

  .notification-center {
    flex: 0 0 auto;
  }

  .notification-toggle {
    width: auto;
  }

  .notification-panel button {
    flex: none;
  }

  .board-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    top: 4px;
    gap: 6px;
  }

  .saved-view-controls {
    grid-column: 1 / -1;
    width: 100%;
  }

  .saved-view-controls .compact-field {
    flex: 1;
  }

  .saved-view-controls select,
  .filter-text,
  .filter-text input {
    width: 100%;
  }

  .filter-text {
    min-width: 0;
  }

  .active-filter-row {
    grid-column: 1 / -1;
  }

  .filters-popover,
  .board-options-popover {
    right: 0;
  }

  .filters-popover {
    width: min(330px, calc(100vw - 20px));
  }

  .kanban {
    grid-template-columns: 1fr;
  }

  .column {
    min-height: auto;
  }

  .drop-zone {
    min-height: 180px;
  }

  .modal-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .modal-actions-left,
  .modal-actions-right {
    width: 100%;
  }

  .modal-actions-left {
    flex-direction: column;
  }

  .reference-url-row {
    flex-direction: column;
  }

  .analytics-grid,
  .assistant-list,
  .cycle-metrics {
    grid-template-columns: 1fr;
  }

  .color-change-preview {
    grid-template-columns: 1fr;
  }

  .color-change-arrow {
    transform: rotate(90deg);
    text-align: center;
  }

  .metric-panel-wide {
    grid-column: span 1;
  }

  .analytics-filters,
  .activity-filters,
  .block-actions {
    flex-direction: column;
  }

  .activity-filters label,
  .activity-filters button {
    width: 100%;
  }

  .activity-item {
    grid-template-columns: 1fr;
  }

  .user-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .management-row-main,
  .management-row-controls,
  .platform-user-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .management-row-controls label {
    align-items: stretch;
    flex-direction: column;
  }

  .management-row-controls select {
    width: 100%;
    min-width: 0;
  }

  .space-card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .space-admin-pending {
    align-items: flex-start;
    flex-direction: column;
  }

  .space-admin-pending span {
    text-align: left;
  }

  .space-membership-note {
    margin-right: 0;
  }

  .trash-row {
    align-items: stretch;
    flex-direction: column;
  }

  .user-actions {
    justify-content: stretch;
  }

  .user-actions button {
    flex: 1;
  }

  .card-tabs {
    overflow-x: auto;
  }

  .file-import-btn {
    width: 100%;
  }

  .import-preview-card {
    flex-direction: column;
  }

  .import-preview-controls {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .import-preview-card button {
    width: 100%;
  }

  .modal-actions-right button,
  .delete-btn,
  .backlog-btn,
  .archive-btn,
  .block-btn {
    width: 100%;
  }

  .backlog-card-actions,
  .archive-card-actions {
    flex-direction: column;
  }
}

