:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
}

.app-frame {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.app-sidebar {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}
.brand__mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.brand__name {
  font-weight: 700;
}
.brand__tag,
.muted {
  color: var(--muted);
  font-size: 0.92rem;
}
.nav {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}
.nav__link,
.chip,
.button {
  border-radius: 12px;
  transition: 0.15s ease;
}
.nav__link {
  padding: 12px 14px;
  background: transparent;
}
.nav__link:hover,
.chip:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar-card,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.sidebar-card {
  padding: 16px;
}
.sidebar-user {
  margin-top: 4px;
  font-weight: 600;
  word-break: break-word;
}
.app-main {
  padding: 24px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}
.topbar h1,
.card h3,
.hero h2 {
  margin: 0;
}
.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
}
.topbar__actions,
.card__head,
.hero,
.auth-links,
.chips {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.content,
.stack {
  display: grid;
  gap: 16px;
}
.card {
  padding: 18px;
}
.card__head {
  justify-content: space-between;
  margin-bottom: 16px;
}
.grid {
  display: grid;
  gap: 16px;
}
.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.button,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.button--ghost {
  background: #fff;
  color: var(--text);
}
.metric strong {
  font-size: 1.7rem;
  display: block;
  margin-top: 8px;
}
.form label {
  display: grid;
  gap: 6px;
}
.form input,
.form select,
.form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}
.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.placeholder {
  min-height: 100px;
  border: 1px dashed var(--line);
  border-radius: 14px;
}
.board {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.column {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fafafa;
  padding: 14px;
  min-height: 160px;
}
.column__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.task {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
}
.task:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.pill,
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}
.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 50;
}
.toast {
  background: #111827;
  color: #fff;
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-width: 320px;
}
.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.auth-card {
  width: min(100%, 440px);
}
.hero {
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 960px) {
  .app-frame {
    grid-template-columns: 1fr;
  }
  .app-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .grid--2,
  .grid--3 {
    grid-template-columns: 1fr;
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);

  display: flex;
  justify-content: center;
  align-items: center;

  z-index: 1000;
}

.hidden {
  display: none;
}

.modal-content {
  width: 500px;
  max-width: 90vw;

  background: white;
  border-radius: 12px;
  padding: 24px;
}

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

.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.permission-item {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

#permissions-container {
  max-height: 350px;
  overflow-y: auto;

  border: 1px solid #ddd;
  border-radius: 8px;

  padding: 1rem;
  margin-top: 1rem;
}

.permission-group {
  margin-bottom: 1.5rem;
}

.permission-group h4 {
  margin-bottom: 0.75rem;
}

.permission-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.perm-group-label {
  grid-column: 1 / -1;
  margin-top: 10px;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.perm-group-label:first-child {
  margin-top: 0;
}

.perm-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-700);
  font-weight: 400;
  cursor: pointer;
}
.perm-label:hover {
  color: var(--ink-900);
}

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  transition:
    background-color 0.3s ease,
    box-shadow 0.3s ease;
}
.status-indicator.connected {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}
.status-indicator.disconnected {
  background-color: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

/* Target the specific invitation containers */
#workspace-invitations,
#workspace-members,
#project-members,
#project-invitations,
#workspace-feed {
  max-height: 350px;
  /* Adjust this height to whatever fits your design best */
  overflow-y: auto;
  /* Adds a vertical scrollbar ONLY when the content exceeds the max-height */
  padding-right: 8px;
  /* Optional: Adds a little breathing room so content doesn't hug the scrollbar */
}

/* Optional: Make the scrollbars look clean and modern */
#workspace-invitations::-webkit-scrollbar,
#workspace-feed::-webkit-scrollbar {
  width: 6px;
}

#workspace-invitations::-webkit-scrollbar-thumb,
#workspace-feed::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.15); /* Light grey thumb */
  border-radius: 4px;
}

#workspace-invitations::-webkit-scrollbar-track,
#workspace-feed::-webkit-scrollbar-track {
  background: transparent;
}

.topbar__actions {
  justify-content: end;
  width: 100%;
  margin-left: auto;
}

/* Make the button only take minimum space */
.topbar__actions .button {
  white-space: nowrap;
  min-width: max-content;
}

#workspace-members {
  max-height: 200px;
  display: grid;
  grid-template-columns: repeat(2, 2fr);
}

/* Member Row */
.workspace-member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  transition: all 0.25s ease;
  margin-bottom: 12px;
}

.workspace-member-row:hover {
  border-color: #6366f1;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.12);
  transform: translateY(-2px);
}

/* Left Section */
.workspace-member-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Avatar */
.workspace-member-avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.workspace-member-avatar img,
.avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #6366f1;
  color: white;
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Details */
.workspace-member-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workspace-member-name {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.workspace-member-email {
  font-size: 14px;
  color: #6b7280;
}

/* Roles */
.workspace-member-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #c7d2fe;
}

/* Responsive */
@media (max-width: 768px) {
  .workspace-member-row {
    padding: 14px;
  }

  .workspace-member-info {
    gap: 12px;
  }

  .workspace-member-avatar {
    width: 48px;
    height: 48px;
  }

  .workspace-member-name {
    font-size: 15px;
  }

  .workspace-member-email {
    font-size: 13px;
  }

  .role-badge {
    font-size: 11px;
    padding: 3px 8px;
  }
}
