﻿*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-size: 15px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a;
  background: #eef2f7;
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ── IDE grid ── */
.create-page {
  display: grid;
  grid-template-columns: 380px 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(127, 215, 199, 0.14), transparent 32%),
    radial-gradient(circle at top right, rgba(234, 220, 200, 0.16), transparent 28%),
    #f4f6f4;
}

/* ── Top bar ── */
.create-topbar {
  grid-column: 1 / -1;
  position: relative;
  height: 40px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
  z-index: 10;
}

.create-topbar-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.create-topbar-bg > rect {
  fill: #0b3f4a;
}

.create-topbar-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 100%;
  padding: 0 0.95rem;
}

.create-topbar-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 0.4rem;
  color: rgba(255,255,255,0.7);
  transition: background 0.15s ease, color 0.15s ease;
}

.create-topbar-back:hover {
  background: rgba(159,227,215,0.18);
  color: #dff6ef;
}

.create-topbar-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.01em;
  display:flex;
}

    .create-topbar-title  img {
        width: 100px;
        display: inline-block;
        margin-right: 10px;
    }

    .create-topbar-title span {
       
        display: inline-block;
       padding-top:1px;
    }

.create-topbar-content .projects-topbar-user {
  font-size: 0.84rem;
}

.create-topbar-content .projects-token-progress-label {
  font-size: 0.76rem;
}

.create-topbar-content .projects-topbar-logout {
  min-height: 30px;
  font-size: 0.8rem;
}

/* ── Welcome page ── */
.welcome-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  overflow: hidden;
  background: #f4f6f4;
}

.welcome-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.welcome-content {
  position: relative;
  width: 100%;
  max-width: 520px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.welcome-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 6px 18px rgba(11, 63, 74, 0.18));
}

.welcome-title {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 800;
  color: #0b3f4a;
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  margin: 0.75rem 0 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: #4a6b72;
  max-width: 440px;
}

.welcome-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.75rem;
  width: 100%;
}

.welcome-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(11, 63, 74, 0.06);
  backdrop-filter: blur(6px);
  text-align: left;
}

.welcome-feature-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.65rem;
  background: rgba(11, 63, 74, 0.07);
  color: #0b3f4a;
}

.welcome-feature-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.welcome-feature-text strong {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0b3f4a;
}

.welcome-feature-text span {
  font-size: 0.78rem;
  color: #5d7479;
  line-height: 1.45;
}

.welcome-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding: 0.85rem 2rem;
  border-radius: 0.9rem;
  background: #0b3f4a;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(11, 63, 74, 0.22);
  transition: background 0.18s ease, transform 0.14s ease;
}

.welcome-cta:hover {
  background: #10606d;
  color: #fff;
  transform: translateY(-1px);
}

@media (max-width: 540px) {
  .welcome-features {
    grid-template-columns: 1fr;
  }

  .welcome-title {
    font-size: 1.8rem;
  }
}

/* ── Welcome toast ── */
.welcome-toast {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.25rem;
  border-radius: 1rem;
  background: rgba(11, 63, 74, 0.92);
  color: #dff6ef;
  font-size: 0.88rem;
  line-height: 1.5;
  max-width: min(600px, calc(100vw - 3rem));
  min-height: 48px;
  box-shadow: 0 12px 40px rgba(11, 63, 74, 0.28), 0 0 0 1px rgba(159, 227, 215, 0.12);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  overflow: hidden;
}

.welcome-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.welcome-toast-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.55rem;
  background: rgba(159, 227, 215, 0.15);
  color: #9fe3d7;
}

.welcome-toast-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.welcome-toast-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: #9fe3d7;
  border-radius: 1px;
  margin-left: 1px;
  animation: welcome-blink 0.7s steps(2) infinite;
  vertical-align: text-bottom;
  flex-shrink: 0;
}

@keyframes welcome-blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

@media (max-width: 540px) {
  .welcome-toast {
    bottom: 1rem;
    font-size: 0.8rem;
    padding: 0.65rem 1rem;
    white-space: normal;
  }
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at top left, rgba(127, 215, 199, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(234, 220, 200, 0.2), transparent 32%),
    #f4f6f4;
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-card {
  padding: 2rem;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 24px 60px rgba(11, 63, 74, 0.1);
  backdrop-filter: blur(10px);
}

.login-kicker {
  display: inline-flex;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(11, 63, 74, 0.08);
  color: #295c62;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.login-title {
  margin: 1rem 0 0;
  color: #0b3f4a;
  font-size: 2rem;
  font-weight: 700;
}

.login-subtitle {
  margin: 0.65rem 0 1.5rem;
  color: #5d7479;
  line-height: 1.6;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-submit {
  border: none;
  min-height: 46px;
  border-radius: 0.9rem;
  background: #0b3f4a;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 22px rgba(11, 63, 74, 0.16);
  transition: background 0.18s ease, transform 0.14s ease;
}

.login-submit:hover {
  background: #10606d;
  transform: translateY(-1px);
}

.new-project-endpoint {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  border-radius: 0.75rem;
  background: rgba(11, 63, 74, 0.05);
  word-break: break-all;
  font-size: 0.85rem;
  color: #335a61;
}

/* ── Projects list page ── */
.projects-page {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(127, 215, 199, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(234, 220, 200, 0.18), transparent 26%),
    #f4f6f4;
}

.projects-topbar {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.projects-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.projects-topbar-usage {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.projects-topbar-token-usage {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.projects-topbar-actions .projects-token-progress {
  width: 60px;
  height: 7px;
  flex-shrink: 0;
}

.projects-topbar-actions .projects-token-progress .projects-token-progress-bar {
  background: hsl(calc(170 - clamp(0, var(--token-usage, 0), 100) * 1.7) 75% 45%);
  transition: width 0.2s ease, background-color 0.2s ease;
}

.projects-topbar-actions .projects-token-progress-label {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.projects-topbar-user {
  color: #e9f8f4;
  font-size: 0.8rem;
  text-decoration: none;
  text-shadow: 0 1px 1px rgba(6, 22, 27, 0.18);
}

.projects-topbar-user:hover {
  color: #ffffff;
}

.projects-topbar-actions .projects-topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #fff;
  color: #0b3f4a;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  text-shadow: none;
}

.projects-topbar-actions .projects-topbar-avatar:focus-visible {
  outline: 2px solid #7fd7c7;
  outline-offset: 3px;
}

.projects-topbar-logout {
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  min-height: 28px;
  padding: 0.2rem 0.65rem;
  border-radius: 0.55rem;
  font-size: 0.78rem;
}

.projects-topbar-logout:hover {
  background: rgba(255,255,255,0.14);
}

/* ── Topbar chat button ── */
.topbar-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  padding: 0.25rem 0.65rem;
  border-radius: 0.55rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.chat-channel-role-badge,
.chat-channel-permission-hint {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.chat-channel-role-badge {
  padding: 0.22rem 0.45rem;
  background: rgba(16, 96, 109, 0.1);
  color: #10606d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-channel-role-badge--admin {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

.chat-channel-role-badge--ägare {
  background: rgba(127, 215, 199, 0.18);
  color: #0b3f4a;
}

.chat-channel-permission-hint {
  padding: 0.22rem 0.5rem;
  background: #f3f7f5;
  color: #6a8080;
  font-weight: 700;
}

.topbar-chat-btn:hover {
  background: rgba(159,227,215,0.18);
  color: #dff6ef;
}

.topbar-chat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  animation: topbar-badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes topbar-badge-pop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.projects-topbar-impersonate {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.projects-topbar-impersonate-label {
  font-size: 0.75rem;
  color: #fbbf24;
  white-space: nowrap;
}

.projects-topbar-impersonate-btn {
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  min-height: 26px;
  padding: 0.15rem 0.6rem;
  border-radius: 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.projects-topbar-impersonate-btn:hover {
  background: rgba(251, 191, 36, 0.25);
}

.projects-token-progress {
  width: 120px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  overflow: hidden;
}

.projects-token-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7fd7c7 0%, #eadcc8 100%);
}

.projects-token-progress-over-limit .projects-token-progress-bar {
  background: linear-gradient(90deg, #f08a8a 0%, #d94c4c 55%, #8f1f1f 100%);
}

.projects-token-progress-over-limit + .projects-token-progress-label {
  color: #f4b1b1;
}

.projects-token-progress-extra .projects-token-progress-bar {
  background: linear-gradient(90deg, #f0c040 0%, #e6a020 100%);
}

.projects-token-extra-label {
  color: #f0c040;
  font-size: 0.7em;
  margin-left: 3px;
  cursor: pointer;
}

.projects-token-progress-label {
  color: #edf7f5;
  font-size: 0.74rem;
  text-shadow: 0 1px 1px rgba(6, 22, 27, 0.14);
}

.create-chat-userbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0 0.85rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid rgba(11, 63, 74, 0.08);
}

.create-chat-userbar .projects-topbar-user {
  color: #0b3f4a;
}

.create-chat-userbar .projects-token-progress {
  background: rgba(11, 63, 74, 0.1);
}

.create-chat-userbar .projects-token-progress-label {
  color: #5d7479;
}

.create-chat-userbar .projects-topbar-logout {
  border-color: rgba(11, 63, 74, 0.12);
  background: rgba(11, 63, 74, 0.04);
  color: #0b3f4a;
}

.create-chat-userbar .projects-topbar-logout:hover {
  background: rgba(11, 63, 74, 0.08);
}

.users-shell {
  padding-top: 1.5rem;
}

.users-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.users-panel-header {
  margin-bottom: 0;
}

.users-create-card,
.users-table-card {
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.78);
  padding: 1.2rem;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.05);
}

.users-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.users-section-header h2 {
  margin: 0;
  font-size: 1rem;
  color: #0b3f4a;
}

.users-section-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.users-create-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}

.users-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
}

.users-create-actions {
  display: flex;
  justify-content: flex-end;
}

.users-table {
  margin: 0;
}

.users-table thead th {
  color: #5d7479;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom-color: rgba(11, 63, 74, 0.1);
}

.users-table td {
  vertical-align: middle;
  border-color: rgba(11, 63, 74, 0.08);
}

.users-table .form-control {
  min-width: 120px;
}

.users-table-actions {
  min-width: 120px;
}

.users-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(11, 63, 74, 0.12);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  color: #335a61;
  transition: transform 0.14s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.users-edit-btn:hover {
  background: #fff;
  color: #0b3f4a;
  border-color: rgba(11, 63, 74, 0.18);
  transform: translateY(-1px);
}

/* ── Users: Last seen indicator ── */

.users-lastseen {
  font-size: 0.78rem;
  color: #888;
  white-space: nowrap;
}

.users-lastseen--online {
  color: #16a34a;
  font-weight: 600;
}

.users-lastseen--online::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  margin-right: 4px;
  vertical-align: middle;
}

.dark-mode .users-lastseen {
  color: rgba(255,255,255,0.45);
}

.dark-mode .users-lastseen--online {
  color: #4ade80;
}

.dark-mode .users-lastseen--online::before {
  background: #4ade80;
}

.backup-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: #6b7d82;
  font-size: 0.97rem;
}

.backup-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.backup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(11, 63, 74, 0.04);
}

.backup-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.backup-item-info strong {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-item-info small {
  color: #6b7d82;
  font-size: 0.8rem;
}

.backup-restore-btn {
  flex-shrink: 0;
}

.help-item {
  padding: 1rem 1.1rem;
  border-left: 3px solid #10606d;
  background: rgba(11, 63, 74, 0.03);
  border-radius: 0 0.5rem 0.5rem 0;
  margin-bottom: 0.85rem;
}

.help-item:last-child {
  margin-bottom: 0;
}

.help-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: #10606d;
  margin-bottom: 0.35rem;
}

.help-item-header svg {
  flex-shrink: 0;
  color: #10606d;
  fill: #10606d;
}

.help-item-header svg[fill="currentColor"] {
  fill: #10606d;
}

.help-item-header svg:not([fill="currentColor"]) {
  stroke: #10606d;
}

.help-item-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #555;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(11, 63, 74, 0.04);
}

.profile-stat-label {
  color: #5d7479;
  font-size: 0.82rem;
}

.projects-shell {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  padding: 2rem 1.4rem 2.4rem;
}

.projects-shell::before {
  content: "";
  position: fixed;
  inset: auto auto 8% 5%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(127, 215, 199, 0.12), transparent 70%);
  pointer-events: none;
  filter: blur(8px);
}

.projects-hero {
  position: relative;
  overflow: hidden;
  max-width: 1240px;
  margin: 0 auto 1.25rem;
  padding: 1.65rem 1.75rem 1.5rem;
  border-radius: 1.75rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(241, 252, 249, 0.84)),
    radial-gradient(circle at 92% 12%, rgba(127, 215, 199, 0.32), transparent 30%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(14px);
}

.projects-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.32), transparent 34%, rgba(127, 215, 199, 0.12) 68%, transparent 82%);
  pointer-events: none;
}

.projects-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.projects-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.projects-hero-copy {
  max-width: 720px;
}

.projects-hero-kicker {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(11, 63, 74, 0.08);
  color: #295c62;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.95rem;
}

.projects-hero-title {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.3rem);
  line-height: 1;
  letter-spacing: -0.05em;
  color: #0b3f4a;
}

.projects-hero-subtitle {
  margin: 0.8rem 0 0;
  max-width: 620px;
  color: #547177;
  font-size: 0.98rem;
  line-height: 1.6;
}

.projects-hero-update-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.9rem;
  padding: 0.48rem 0.75rem;
  border-radius: 999px;
  background: rgba(11, 63, 74, 0.07);
  border: 1px solid rgba(16, 96, 109, 0.12);
  color: #335b62;
  font-size: 0.82rem;
  font-weight: 700;
}

.projects-hero-update-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #43b581;
  box-shadow: 0 0 0 4px rgba(67, 181, 129, 0.13);
}

.projects-hero-actions {
  display: flex;
  align-items: stretch;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.projects-stat-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 150px;
  padding: 0.85rem 0.95rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.projects-stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  color: #0b3f4a;
}

.projects-stat-label {
  margin-top: 0.35rem;
  color: #6a7f82;
  font-size: 0.83rem;
}

.projects-primary-btn,
.projects-secondary-btn,
.projects-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.78rem 1.1rem;
  border-radius: 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.projects-primary-btn {
  border: none;
  background: #0b3f4a;
  color: #fff;
  box-shadow: 0 10px 22px rgba(11, 63, 74, 0.16);
}

.projects-primary-btn:hover {
  background: #0f4f5d;
  color: #fff;
  transform: translateY(-1px);
}

.projects-secondary-btn {
  border: 1px solid rgba(11, 63, 74, 0.14);
  background: rgba(255, 255, 255, 0.88);
  color: #335a61;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.projects-secondary-btn:hover {
  background: #fff;
  color: #0b3f4a;
  transform: translateY(-1px);
}

.projects-open-link {
  border: 1px solid rgba(11, 63, 74, 0.1);
  background: linear-gradient(135deg, #0b3f4a, #10606d);
  color: #fff;
  box-shadow: 0 8px 18px rgba(11, 63, 74, 0.12);
}

.projects-open-link:hover {
  color: #fff;
  transform: translateY(-1px);
}

/* ── Models info section ── */

.projects-models-info {
  max-width: 1240px;
  margin: 0 auto 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.88) 0%, rgba(240,248,245,0.82) 100%);
  border: 1px solid rgba(16, 96, 109, 0.1);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(8px);
}

.projects-models-info-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  color: #0b3f4a;
}

.projects-models-info-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.projects-models-info-desc {
  margin: 0 0 0.9rem;
  color: #5d7479;
  font-size: 0.88rem;
  line-height: 1.55;
  max-width: 720px;
}

.projects-models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.projects-model-card {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(16, 96, 109, 0.08);
}

.projects-model-emoji {
  font-size: 1.1rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.projects-model-card strong {
  font-size: 0.84rem;
  color: #0b3f4a;
}

.projects-model-price {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: #10606d;
  padding: 0.08rem 0.35rem;
  border-radius: 0.3rem;
  vertical-align: middle;
  margin-left: 0.2rem;
}

.projects-model-price--expensive {
  background: #c0392b;
}

.projects-model-use {
  font-size: 0.78rem;
  color: #6a8080;
  line-height: 1.35;
  margin-top: 0.15rem;
}

.projects-models-notice {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.6rem;
  background: rgba(16, 96, 109, 0.06);
  border: 1px solid rgba(16, 96, 109, 0.1);
  font-size: 0.82rem;
  color: #335b62;
  line-height: 1.4;
}

.projects-model-news-modal .modal-dialog {
  max-width: 560px;
  padding: 1rem;
}

.projects-model-news-content {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 1.75rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(240, 253, 249, 0.68)),
    radial-gradient(circle at top left, rgba(127, 215, 199, 0.45), transparent 45%),
    radial-gradient(circle at bottom right, rgba(234, 220, 200, 0.48), transparent 42%);
  box-shadow: 0 28px 80px rgba(5, 24, 30, 0.28);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}

.projects-model-news-content::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.42), transparent 34%, rgba(255, 255, 255, 0.2) 62%, transparent 78%);
  pointer-events: none;
}

.projects-model-news-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  filter: blur(12px);
  opacity: 0.8;
  pointer-events: none;
}

.projects-model-news-glow--one {
  top: -90px;
  right: -70px;
  background: radial-gradient(circle, rgba(127, 215, 199, 0.72), transparent 68%);
}

.projects-model-news-glow--two {
  bottom: -110px;
  left: -80px;
  background: radial-gradient(circle, rgba(234, 220, 200, 0.82), transparent 68%);
}

.projects-model-news-body {
  position: relative;
  z-index: 1;
  padding: 2rem;
  text-align: center;
}

.projects-model-news-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
  padding: 0.34rem 0.78rem;
  border: 1px solid rgba(16, 96, 109, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: #10606d;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.projects-model-news-icon {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  margin: 0 auto 1rem;
  border-radius: 1.35rem;
  background: linear-gradient(135deg, rgba(11, 63, 74, 0.96), rgba(16, 96, 109, 0.88));
  color: #fff;
  font-size: 2rem;
  box-shadow: 0 18px 36px rgba(11, 63, 74, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.projects-model-news-title {
  max-width: 440px;
  margin: 0 auto 0.8rem;
  color: #0b3f4a;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.projects-model-news-lead {
  max-width: 460px;
  margin: 0 auto 1.25rem;
  color: #42676e;
  font-size: 0.98rem;
  line-height: 1.62;
}

.projects-model-news-points {
  display: grid;
  gap: 0.7rem;
  margin: 0 0 1.35rem;
  text-align: left;
}

.projects-model-news-point {
  display: flex;
  gap: 0.75rem;
  padding: 0.82rem 0.9rem;
  border: 1px solid rgba(16, 96, 109, 0.1);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

.projects-model-news-point > span {
  flex: 0 0 auto;
  font-size: 1.25rem;
  line-height: 1.2;
}

.projects-model-news-point strong {
  display: block;
  color: #0b3f4a;
  font-size: 0.92rem;
  margin-bottom: 0.16rem;
}

.projects-model-news-point p {
  margin: 0;
  color: #607d82;
  font-size: 0.84rem;
  line-height: 1.45;
}

.projects-model-news-close {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 1rem;
  background: linear-gradient(135deg, #0b3f4a, #10606d);
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 14px 28px rgba(11, 63, 74, 0.24);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.projects-model-news-close:hover {
  background: linear-gradient(135deg, #0f4f5d, #14707e);
  box-shadow: 0 18px 34px rgba(11, 63, 74, 0.28);
  transform: translateY(-1px);
}

.projects-models-notice svg {
  flex-shrink: 0;
  color: #10606d;
}

.projects-panel {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.25rem;
  border-radius: 1.6rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(249, 253, 251, 0.72)),
    radial-gradient(circle at top right, rgba(127, 215, 199, 0.14), transparent 28%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);
}

.projects-agents-panel {
  padding: 1rem;
}

.projects-agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.projects-agent-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  aspect-ratio: 1;
  min-height: 150px;
  padding: 1rem;
  border: 1px solid rgba(11, 89, 102, 0.14);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.78);
  text-align: center;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.projects-agent-tile span {
  display: grid;
  flex: 1;
  place-items: center;
  width: 100%;
  color: #12383f;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.projects-agent-tile .projects-primary-btn {
  width: 100%;
  min-height: 38px;
  padding: 0 0.75rem;
  font-size: 0.85rem;
}

.projects-alert {
  border-radius: 1rem;
  border: 1px solid rgba(248, 113, 113, 0.18);
}

.projects-panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.projects-panel-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0b3f4a;
}

.projects-panel-subtitle {
  margin: 0.35rem 0 0;
  color: #5d7479;
  font-size: 0.95rem;
}

.projects-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: min(100%, 340px);
  padding: 0.82rem 0.95rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(11, 63, 74, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 24px rgba(15, 23, 42, 0.05);
  color: #8aa4a7;
}

.projects-search-wrap:focus-within {
  border-color: rgba(127, 215, 199, 0.65);
  box-shadow: 0 0 0 4px rgba(127, 215, 199, 0.18);
}

.projects-search-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: #0b3f4a;
  font-size: 0.95rem;
}

.projects-search-input::placeholder {
  color: #9ab0b3;
}

/* ── Panel toolbar (search + view toggle) ── */

.projects-panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.projects-view-toggle {
  display: flex;
  border: 1px solid rgba(11, 63, 74, 0.1);
  border-radius: 0.6rem;
  overflow: hidden;
}

.projects-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: rgba(255, 255, 255, 0.6);
  color: #8aa4a7;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.projects-view-btn:not(:last-child) {
  border-right: 1px solid rgba(11, 63, 74, 0.08);
}

.projects-view-btn:hover {
  background: rgba(127, 215, 199, 0.12);
  color: #0b3f4a;
}

.projects-view-btn.active {
  background: #0b3f4a;
  color: #fff;
}

/* ── List view ── */

.projects-view-list .projects-grid {
  grid-template-columns: 1fr;
  gap: 0;
}

.projects-view-list .projects-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: auto;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  box-shadow: none;
  background: transparent;
}

.projects-view-list .projects-card:first-child {
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.projects-view-list .projects-card:hover {
  transform: none;
  box-shadow: none;
  background: rgba(127, 215, 199, 0.04);
}

.projects-view-list .projects-card-checkbox {
  position: static;
  order: -1;
  flex-shrink: 0;
  padding-left: 0.65rem;
}

.projects-view-list .projects-card-content {
  flex: 1;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.65rem;
  min-width: 0;
}

.projects-view-list .projects-card-topline {
  display: none;
}

.projects-view-list .projects-card-title {
  font-size: 0.92rem;
  min-width: 140px;
  flex-shrink: 0;
}

.projects-view-list .projects-card-domain {
  font-size: 0.82rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projects-view-list .projects-card-actions {
  margin-top: 0;
  gap: 0.5rem;
  flex-shrink: 0;
}

.projects-view-list .projects-card-updated-inline {
  display: inline;
  color: #8aa4a7;
  font-size: 0.78rem;
  white-space: nowrap;
}

.projects-view-grid .projects-card-updated-inline {
  display: none;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.projects-group:not(:last-child) {
  margin-bottom: 1.4rem;
}

.projects-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(16, 96, 109, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.projects-group-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: #0b3f4a;
}

.projects-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(127, 215, 199, 0.18);
  color: #2d6b6f;
  font-size: 0.76rem;
  font-weight: 700;
}

.projects-group-grid {
  gap: 0.9rem;
}

.projects-card {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 249, 0.92)),
    radial-gradient(circle at top right, rgba(127, 215, 199, 0.16), transparent 42%);
  border: 1px solid rgba(16, 96, 109, 0.11);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.projects-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #7fd7c7, #0b3f4a);
  opacity: 0.75;
}

.projects-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.11);
  border-color: rgba(16, 96, 109, 0.2);
}

.projects-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  padding: 1.25rem;
}

.projects-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.projects-card-meta {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: rgba(127, 215, 199, 0.18);
  color: #2d6b6f;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.projects-card-updated {
  color: #708487;
  font-size: 0.78rem;
  white-space: nowrap;
}

.projects-card-title {
  color: #0b3f4a;
  text-decoration: none;
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.projects-card-title:hover {
  color: #0b3f4a;
}

.projects-card-domain {
  color: #637b80;
  font-size: 0.92rem;
  line-height: 1.55;
  word-break: break-word;
}

.projects-card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  flex-wrap: wrap;
}

.projects-delete-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  background: rgba(220, 53, 69, 0.06);
  border: 1px solid rgba(220, 53, 69, 0.25);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.projects-delete-bar span {
  font-size: 0.88rem;
  font-weight: 600;
  color: #555;
}

.projects-select-all-btn {
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: #555;
  transition: all 0.15s;
}

.projects-select-all-btn:hover {
  border-color: #999;
  color: #333;
}

.projects-delete-btn {
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.projects-delete-btn:hover:not(:disabled) {
  background: #b02a37;
}

.projects-delete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.projects-delete-info {
  font-size: 0.78rem;
  font-weight: 400;
  color: #8a9399;
  font-style: italic;
  margin-left: auto;
}

.projects-card-checkbox {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.projects-card-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #c4cdd5;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.chat-message--group-start {
  margin-top: 0.35rem;
}

.projects-card-checkbox input[type="checkbox"]:hover {
  border-color: #0b3f4a;
}

.projects-card-checkbox input[type="checkbox"]:checked {
  background: #0b3f4a;
  border-color: #0b3f4a;
}

.projects-card-checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.projects-card:has(input:checked) {
  border-color: #0b3f4a;
  box-shadow: 0 0 0 2px rgba(11, 63, 74, 0.2), 0 10px 26px rgba(15, 23, 42, 0.06);
}

.projects-preview-banner {
  position: relative;
  overflow: hidden;
  min-height: 42px;
}

.projects-preview-banner-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.projects-preview-banner-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.55rem 1.5rem;
  text-align: center;
}

.projects-preview-banner-icon {
  flex-shrink: 0;
  color: #f0d98c;
  filter: drop-shadow(0 0 4px rgba(240, 217, 140, 0.5));
}

.projects-preview-banner-text {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.01em;
  line-height: 1.45;
}

.projects-preview-banner-text strong {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.projects-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  min-height: 360px;
  padding: 2rem 1rem;
  text-align: center;
  border-radius: 1.35rem;
  border: 1px dashed rgba(148, 163, 184, 0.45);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(248, 250, 252, 0.82));
}

.projects-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 1.35rem;
  background: rgba(255, 255, 255, 0.85);
  color: #4b5563;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.projects-empty-state h3 {
  margin: 0;
  color: #0b3f4a;
  font-size: 1.35rem;
}

.projects-empty-state p {
  max-width: 520px;
  margin: 0;
  color: #647c80;
  line-height: 1.7;
}

/* ── Chat panel (left) ── */
.create-chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #f7faf8 0%, #edf3f1 100%);
  color: #1a1a1a;
  border-right: 1px solid #dfe9e5;
  box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.04);
}

.create-panel-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid #dfe9e5;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(10px);
}

.create-panel-header h1 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: #111;
}

.create-chat-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.create-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.32rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(11, 63, 74, 0.08);
  background: rgba(255, 255, 255, 0.92);
  color: #47676d;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.create-action-btn:hover {
  background: #f6fbf9;
  border-color: rgba(11, 63, 74, 0.14);
  color: #0b3f4a;
}

.create-action-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #0b3f4a, #10606d);
  border-color: #10606d;
  box-shadow: 0 3px 12px rgba(16, 96, 109, 0.3);
}

.create-action-btn.active:hover {
  color: #fff;
  background: linear-gradient(135deg, #10606d, #15808c);
  border-color: #15808c;
}

.create-action-btn--primary {
  background: #0b3f4a;
  border-color: #0b3f4a;
  color: #fff;
}

.create-action-btn--primary:hover {
  background: #10606d;
  border-color: #10606d;
  color: #fff;
}

.create-action-btn--danger {
  border-color: #f5c6cb;
  color: #c0392b;
}

.create-action-btn--danger:hover {
  background: #fdf0f0;
  border-color: #e6a0a8;
}

.create-action-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.create-plan-announcement-modal {
  overflow: hidden;
  border: 0;
  border-radius: 1.15rem;
  box-shadow: 0 28px 80px rgba(4, 36, 43, 0.3);
}

.create-plan-announcement-hero {
  position: relative;
  overflow: hidden;
  padding: 2.25rem 2.5rem 2rem;
  color: #fff;
  background:
    radial-gradient(circle at 90% 12%, rgba(159, 227, 215, 0.65), transparent 26%),
    radial-gradient(circle at 8% 105%, rgba(234, 220, 200, 0.35), transparent 33%),
    linear-gradient(135deg, #062e37 0%, #0b5964 58%, #168594 100%);
}

.create-plan-announcement-hero::after {
  position: absolute;
  inset: auto -30px -80px auto;
  width: 210px;
  height: 210px;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
}

.create-plan-announcement-orb {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 1rem;
  place-items: center;
  color: #07505d;
  background: #dff6ef;
  border-radius: 0.8rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
  font-size: 1.25rem;
}

.create-plan-announcement-kicker {
  color: #c7f7ed;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.create-plan-announcement-hero h2 {
  margin: 0.35rem 0 0.55rem;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 750;
  letter-spacing: -0.04em;
}

.create-plan-announcement-hero p {
  max-width: 540px;
  margin: 0;
  color: rgba(255, 255, 255, 0.87);
  font-size: 1.02rem;
  line-height: 1.6;
}

.create-plan-announcement-body {
  padding: 1.5rem 2.5rem 2rem;
}

.create-plan-announcement-step {
  display: flex;
  gap: 0.85rem;
  padding: 0.8rem 0;
}

.create-plan-announcement-step > span {
  display: grid;
  flex: 0 0 1.8rem;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #0b5964, #168594);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 800;
}

.create-plan-announcement-step strong {
  color: #143e45;
}

.create-plan-announcement-step p,
.create-plan-announcement-note {
  margin: 0.18rem 0 0;
  color: #60726f;
  font-size: 0.9rem;
  line-height: 1.5;
}

.create-plan-announcement-note {
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  color: #24535a;
  background: #eef8f5;
  border-left: 3px solid #7fd7c7;
  border-radius: 0 0.5rem 0.5rem 0;
}

.create-plan-announcement-close {
  width: 100%;
  margin-top: 1.35rem;
  padding: 0.7rem 1rem;
  color: #fff;
  background: linear-gradient(135deg, #0b3f4a, #10606d);
  border: 0;
  border-radius: 0.55rem;
  font-weight: 700;
}

.create-plan-announcement-close:hover {
  color: #fff;
  background: linear-gradient(135deg, #10606d, #168594);
}

.create-status {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: #5f787d;
  background: rgba(255, 255, 255, 0.74);
  border-bottom: 1px solid #dfe9e5;
  transition: background 0.25s ease, color 0.25s ease;
}

.create-status--running {
  background: linear-gradient(90deg, rgba(127, 215, 199, 0.18) 0%, rgba(127, 215, 199, 0.08) 50%, rgba(127, 215, 199, 0.18) 100%);
  background-size: 200% 100%;
  animation: status-pulse 2s ease-in-out infinite;
  color: #0b3f4a;
  font-weight: 500;
}

.create-status--quota {
  background: linear-gradient(135deg, #ffe082 0%, #f4c542 100%);
  border-bottom-color: #e0b93f;
  color: #4a3b00;
  font-weight: 700;
}

.create-status-link {
  color: inherit;
  text-decoration: none;
  display: block;
}

.create-status-link:hover,
.create-status-link:focus {
  color: inherit;
  text-decoration: none;
}

@keyframes status-pulse {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.create-chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem;
  background: linear-gradient(180deg, #f6faf8 0%, #edf3f1 100%);
}

.create-chat-empty {
  margin: auto;
  max-width: 360px;
  padding: 1.2rem;
  border: 1px solid rgba(16, 96, 109, 0.1);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.72);
  color: #5d7479;
  text-align: center;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(10px);
}

.create-chat-empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(11, 63, 74, 0.95), rgba(16, 96, 109, 0.88));
  color: #fff;
  font-size: 1.35rem;
}

.create-chat-empty h3 {
  margin: 0 0 0.45rem;
  color: #0b3f4a;
  font-size: 1.05rem;
  font-weight: 800;
}

.create-chat-empty p {
  margin: 0 0 0.9rem;
  font-size: 0.86rem;
  line-height: 1.5;
}

.create-chat-empty-tips {
  display: grid;
  gap: 0.45rem;
  text-align: left;
}

.create-chat-empty-tips span {
  position: relative;
  padding: 0.52rem 0.6rem 0.52rem 1.55rem;
  border-radius: 0.7rem;
  background: rgba(16, 96, 109, 0.06);
  color: #47676d;
  font-size: 0.78rem;
  line-height: 1.35;
}

.create-chat-empty-tips span::before {
  content: "✓";
  position: absolute;
  left: 0.58rem;
  top: 0.52rem;
  color: #10606d;
  font-weight: 800;
}

.create-chat-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid #dfe9e5;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}

.create-chat-form .form-label {
  display: none;
}

.create-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: #f7faf8;
  border: 1px solid #d8e5e1;
  border-radius: 0.75rem;
  padding: 0.5rem 0.55rem 0.5rem 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.create-chat-input-row:focus-within {
  border-color: #7fd7c7;
  box-shadow: 0 0 0 3px rgba(127, 215, 199, 0.2);
  background: #fff;
}

.create-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: #1a1a1a;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  min-height: 1.5em;
  max-height: 160px;
  overflow-y: auto;
}

.create-chat-input::placeholder {
  color: #aaa;
}

.create-chat-send {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 0.55rem;
  background: #0b3f4a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.create-chat-send:hover {
  background: #10606d;
}

.create-chat-send:active {
  transform: scale(0.93);
}

.create-chat-send:disabled {
  opacity: 0.4;
  cursor: default;
}

.create-chat-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.create-chat-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}

.create-chat-toolbar-left .create-prompt-select {
  flex: 0 0 auto;
  min-width: 106px;
}

.create-chat-attach {
  border: none;
  background: transparent;
  color: #6a7f82;
  padding: 0.3rem;
  border-radius: 0.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.create-chat-attach:hover {
  color: #0b3f4a;
  background: #eef7f4;
}

.create-chat-file-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.create-prompt-options-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.create-prompt-select {
  flex: 1;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
  background: #f5f5f5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 0.65rem center;
  background-size: 10px 6px;
  border: 1px solid #d8e5e1;
  color: #335b62;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.42rem 1.8rem 0.42rem 0.65rem;
  border-radius: 0.55rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.create-prompt-select:hover {
  border-color: #bbb;
}

.create-prompt-select:focus {
  border-color: #7fd7c7;
  box-shadow: 0 0 0 3px rgba(127, 215, 199, 0.18);
  background-color: #fff;
}

.create-prompt-select:disabled {
  opacity: 0.5;
  cursor: default;
}

.create-prompt-pills {
  display: inline-flex;
  border-radius: 0.55rem;
  overflow: hidden;
  border: 1px solid #d8e5e1;
  flex-shrink: 0;
}

.create-prompt-pill {
  border: none;
  background: #f5f5f5;
  color: #777;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.38rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1.2;
}

.create-prompt-pill:not(:last-child) {
  border-right: 1px solid #d8e5e1;
}

.create-prompt-pill:hover:not(.active):not(:disabled) {
  background: #eee;
  color: #444;
}

.create-prompt-pill.active {
  background: #0b3f4a;
  color: #fff;
}

.create-prompt-pill:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── Tier button ── */

.create-tier-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid #d8e5e1;
  background: #f5f8f7;
  color: #335b62;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.38rem 0.7rem;
  border-radius: 0.55rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  line-height: 1.3;
  flex-shrink: 0;
}

.create-tier-button:hover:not(:disabled) {
  border-color: #7fd7c7;
  background: #eef7f4;
}

.create-tier-button:focus-visible {
  border-color: #7fd7c7;
  box-shadow: 0 0 0 3px rgba(127, 215, 199, 0.18);
}

.create-tier-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.create-tier-button-emoji {
  font-size: 0.9rem;
  line-height: 1;
}

.create-tier-button-label {
  font-weight: 600;
  color: #0b3f4a;
}

.create-tier-button-price {
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: #10606d;
  padding: 0.1rem 0.38rem;
  border-radius: 0.35rem;
  line-height: 1.3;
}

.create-tier-button-price--expensive {
  background: #c0392b;
}

/* ── Tier modal ── */

#tierModal .modal-content {
  border: none;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

#tierModal .modal-header {
  border-bottom: 1px solid #e8eeec;
  padding: 1.1rem 1.4rem;
}

#tierModal .modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0b3f4a;
}

#tierModal .modal-body {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.create-tier-option {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  border: 1.5px solid #e0e8e6;
  background: #fafcfb;
  border-radius: 0.7rem;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  outline: none;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.create-tier-option:hover:not(.active) {
  border-color: #b8d8d0;
  background: #f0f8f5;
}

.create-tier-option.active {
  border-color: #10606d;
  background: linear-gradient(135deg, rgba(16, 96, 109, 0.06) 0%, rgba(127, 215, 199, 0.08) 100%);
  box-shadow: 0 0 0 2px rgba(16, 96, 109, 0.12);
}

.create-tier-option:focus-visible {
  box-shadow: 0 0 0 3px rgba(127, 215, 199, 0.25);
}

.create-tier-option-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.create-tier-option-emoji {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

.create-tier-option-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: #0b3f4a;
}

.create-tier-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #10606d;
  background: rgba(16, 96, 109, 0.1);
  padding: 0.12rem 0.4rem;
  border-radius: 0.3rem;
  line-height: 1.3;
}

.create-tier-option.active .create-tier-badge {
  background: rgba(16, 96, 109, 0.18);
  color: #0a5561;
}

.create-tier-option-price {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: #10606d;
  padding: 0.12rem 0.45rem;
  border-radius: 0.35rem;
  line-height: 1.3;
}

.create-tier-option-price--expensive {
  background: #c0392b;
}

.create-tier-option-details {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-left: 1.45rem;
}

.create-tier-option-model {
  font-size: 0.74rem;
  font-weight: 500;
  color: #7a9a9e;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.create-tier-option-desc {
  font-size: 0.78rem;
  color: #6a8080;
  line-height: 1.4;
}

.create-tier-option-recommendation {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #0b3f4a;
  line-height: 1.4;
}

.create-tier-option-cost {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-top: 0.25rem;
  padding: 0.14rem 0.42rem;
  border-radius: 999px;
  background: rgba(16, 96, 109, 0.08);
  color: #10606d;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.create-tier-option-cost--expensive {
  background: rgba(192, 57, 43, 0.08);
  color: #a93226;
}

.create-chat-file-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.create-chat-file-picker.d-none {
  display: none;
}

.create-chat-file-picker select {
  flex: 1;
  min-width: 0;
  background: #fafafa;
  border: 1px solid #ddd;
  color: #1a1a1a;
  font-size: 0.82rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
}

.create-chat-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: #eff8f4;
  border: 1px solid #d0ebe3;
  color: #2d6b6f;
  font-size: 0.78rem;
  box-shadow: 0 6px 16px rgba(127, 215, 199, 0.16);
}

.create-chat-file-chip.d-none {
  display: none;
}

.create-chat-file-chip span {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-chat-file-clear {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.create-chat-empty {
  margin: auto;
  padding: 1.5rem;
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
}

.create-message-row {
  display: flex;
  gap: 0.55rem;
}

.create-message-row-user {
  justify-content: flex-end;
}

.create-message-row-user .create-message-avatar {
  order: 2;
}

.create-message-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 1.75rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  background: #bbb;
}

.create-message-row-assistant .create-message-avatar {
  background: #0b3f4a;
}

.create-message {
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.85rem;
  font-size: 0.88rem;
  line-height: 1.55;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.create-message-user {
  background: #0b3f4a;
  color: #fff;
}

.create-message-assistant {
  min-width: 0;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e8e8e8;
}

.create-message-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.45;
}

.create-message-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.create-message-markdown {
  white-space: normal;
}

.create-message-markdown > :first-child {
  margin-top: 0;
}

.create-message-markdown > :last-child {
  margin-bottom: 0;
}

.create-message-markdown p,
.create-message-markdown ul,
.create-message-markdown ol {
  margin-bottom: 0.65rem;
}

.create-message-markdown ul,
.create-message-markdown ol {
  padding-left: 1.4rem;
}

.create-message-markdown li + li {
  margin-top: 0.25rem;
}

.create-message-markdown li > ul,
.create-message-markdown li > ol {
  margin: 0.25rem 0 0;
}

.create-message-markdown :is(h3, h4, h5, h6) {
  margin: 0.9rem 0 0.4rem;
  font-size: 1em;
  font-weight: 700;
  line-height: 1.35;
}

.create-message-markdown h3 {
  font-size: 1.15em;
}

.create-message-markdown code {
  padding: 0.1rem 0.25rem;
  border-radius: 0.25rem;
  background: rgba(127, 215, 199, 0.14);
  color: inherit;
  font-size: 0.9em;
}

.create-message-markdown a {
  color: #0b6570;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.create-message-markdown .create-chat-table-wrap {
  max-width: 100%;
  margin: 0.65rem 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.create-chat-table-wrap:focus-visible {
  outline: 2px solid #0b6570;
  outline-offset: 2px;
}

.create-message-markdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
}

.create-message-markdown th,
.create-message-markdown td {
  min-width: 5rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid rgba(100, 116, 139, 0.35);
  vertical-align: top;
}

.create-message-markdown th {
  background: rgba(127, 215, 199, 0.14);
}

.create-message-markdown .create-chat-align-left { text-align: left; }
.create-message-markdown .create-chat-align-center { text-align: center; }
.create-message-markdown .create-chat-align-right { text-align: right; }

.create-message-token-box {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.28rem 0.55rem;
  border-radius: 0.5rem;
  background: #eff8f4;
  border: 1px solid #d0ebe3;
  color: #2d6b6f;
  font-size: 0.75rem;
  font-weight: 600;
}

.create-message-reference {
  display: inline-flex;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.create-message-user .create-message-reference {
  color: #93c5fd;
  background: rgba(255, 255, 255, 0.1);
}

.create-message-assistant .create-message-reference {
  color: #2d6b6f;
  background: rgba(127, 215, 199, 0.18);
}

/* ── Right panel (preview + code) ── */
.create-preview-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #f7faf8 0%, #eef4f1 100%);
  box-shadow: inset 1px 0 0 rgba(15, 23, 42, 0.04);
}

.create-preview-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "title device actions";
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid #dfe9e5;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(10px);
}

.create-preview-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
  color: #0b3f4a;
}

.create-preview-title {
  grid-area: title;
  justify-self: start;
  min-width: 0;
}

.create-preview-device-actions,
.create-preview-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.create-preview-device-actions {
  grid-area: device;
  justify-self: center;
}

.create-preview-actions {
  grid-area: actions;
  justify-self: end;
  margin-left: auto;
}

.create-preview-device-actions .btn,
.create-preview-actions .btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  border-radius: 0.5rem;
}

.create-preview-device-actions .btn,
.create-preview-actions .btn-ide-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  background: transparent;
  border: 1px solid #ddd;
  color: #888;
  transition: all 0.15s ease;
}

.create-preview-actions .btn-ide-tab--help {
  background: #10606d;
  border-color: #10606d;
  color: #fff;
}

.create-preview-actions .btn-ide-tab--help:hover {
  background: #0b3f4a;
  border-color: #0b3f4a;
  color: #fff;
}

.create-preview-device-actions .btn:hover,
.create-preview-actions .btn-ide-tab:hover {
  border-color: #aaa;
  color: #333;
}

.create-preview-device-actions .btn.active,
.create-preview-actions .btn-ide-tab.active {
  background: #0b3f4a;
  border-color: #0b3f4a;
  color: #fff;
}

.create-preview-frame-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.create-page--plan .create-chat-panel {
  border-right-color: rgba(16, 96, 109, 0.45);
  box-shadow: inset -3px 0 0 #10606d;
}

.create-page--plan .create-chat-form {
  background: linear-gradient(180deg, rgba(127, 215, 199, 0.16), rgba(255, 255, 255, 0.94));
  border-top-color: rgba(16, 96, 109, 0.3);
}

.create-plan-mode-guide {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  color: #234b50;
  background: linear-gradient(90deg, rgba(127, 215, 199, 0.28), rgba(234, 220, 200, 0.24));
  border-bottom: 1px solid rgba(16, 96, 109, 0.2);
  font-size: 0.86rem;
}

.create-plan-mode-badge,
.create-plan-model-badge {
  flex: 0 0 auto;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.create-plan-mode-badge {
  color: #fff;
  background: #10606d;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.create-plan-model-badge {
  margin-left: auto;
  color: #6c4510;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(151, 103, 32, 0.2);
}

.create-plan-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8faf9;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.create-plan-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
  padding: 0.65rem 1rem;
  color: #52605c;
  background: #fff;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  font-size: 0.85rem;
}

.create-plan-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.create-plan-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
}

.create-plan-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.create-plan-pane + .create-plan-pane {
  border-left: 1px solid rgba(148, 163, 184, 0.3);
}

.create-plan-pane-title {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem;
  color: #60706b;
  background: #f5f8f7;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.create-plan-editor-lock {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #0b6974;
  font-size: 0.68rem;
  letter-spacing: 0;
  text-transform: none;
}

.create-plan-editor-lock > span {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #16a085;
  box-shadow: 0 0 0 0 rgba(22, 160, 133, 0.45);
  animation: create-plan-lock-pulse 1.8s infinite;
}

@keyframes create-plan-lock-pulse {
  70% { box-shadow: 0 0 0 7px rgba(22, 160, 133, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 160, 133, 0); }
}

.create-plan-editor--locked {
  opacity: 0.78;
  filter: saturate(0.72);
  transition: opacity 160ms ease, filter 160ms ease;
}

.create-plan-editor,
.create-plan-preview {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.create-plan-preview {
  padding: clamp(1.25rem, 2.5vw, 2.5rem);
  color: #24332f;
  background:
    radial-gradient(circle at 100% 0, rgba(127, 215, 199, 0.2), transparent 30%),
    radial-gradient(circle at 0 100%, rgba(234, 220, 200, 0.22), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
  line-height: 1.65;
}

.create-plan-preview h1,
.create-plan-preview h2,
.create-plan-preview h3,
.create-plan-preview h4 {
  color: #0b3f4a;
  margin: 1.35rem 0 0.65rem;
  line-height: 1.25;
}

.create-plan-preview h1 {
  padding-bottom: 0.8rem;
  color: #083e49;
  border-bottom: 1px solid rgba(16, 96, 109, 0.18);
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  letter-spacing: -0.035em;
}

.create-plan-preview h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.2rem;
}

.create-plan-preview h2::before {
  content: "";
  width: 0.35rem;
  height: 1.15rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #10606d, #7fd7c7);
  box-shadow: 0 3px 10px rgba(16, 96, 109, 0.22);
}

.create-plan-preview h1:first-child,
.create-plan-preview h2:first-child {
  margin-top: 0;
}

.create-plan-preview p,
.create-plan-preview ul,
.create-plan-preview ol,
.create-plan-preview blockquote,
.create-plan-preview pre {
  margin: 0 0 0.9rem;
}

.create-plan-preview ul,
.create-plan-preview ol {
  padding-left: 1.35rem;
}

.create-plan-preview li {
  padding: 0.18rem 0 0.18rem 0.2rem;
}

.create-plan-preview li::marker {
  color: #168594;
  font-weight: 800;
}

.create-plan-preview blockquote {
  padding: 0.6rem 0.9rem;
  color: #526963;
  background: #f2f7f5;
  border-left: 3px solid #7fd7c7;
}

.create-plan-preview pre {
  overflow: auto;
  padding: 0.85rem;
  color: #e2e8f0;
  background: #17221f;
  border-radius: 0.5rem;
  box-shadow: 0 12px 28px rgba(15, 35, 31, 0.14);
}

.create-plan-preview hr {
  height: 1px;
  margin: 1.5rem 0;
  border: 0;
  background: linear-gradient(90deg, transparent, rgba(16, 96, 109, 0.3), transparent);
}

.create-plan-empty {
  display: grid;
  min-height: 100%;
  place-items: center;
  color: #71817c;
  text-align: center;
}

@media (max-width: 1100px) {
  .create-plan-mode-guide {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .create-plan-model-badge {
    margin-left: 0;
  }

  .create-plan-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 1fr) minmax(260px, 1fr);
    overflow: auto;
  }

  .create-plan-pane + .create-plan-pane {
    border-left: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
  }
}

.create-preview-frame-wrapper--mobile {
  padding: 1rem;
  align-items: flex-start;
  overflow: auto;
  background: linear-gradient(180deg, #edf4f1 0%, #e4ece9 100%);
}

.create-preview-device {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.create-preview-device--mobile {
  flex: 0 0 390px;
  width: 390px;
  max-width: 100%;
  height: 844px;
  min-height: 720px;
  border-radius: 1.4rem;
  overflow: hidden;
  border: 1px solid rgba(11, 63, 74, 0.16);
  background: #0f172a;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.2);
}

.create-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(180deg, #fcfdfc 0%, #f2f6f4 100%);
  overflow: hidden;
}

.create-preview-placeholder-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.create-preview-placeholder-mark {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  border-radius: 1.6rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 42px rgba(11, 63, 74, 0.08);
  backdrop-filter: blur(10px);
}

.create-preview-placeholder-orb {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0b3f4a, #7fd7c7 70%, #eadfcf);
  box-shadow: 0 0 0 10px rgba(127, 215, 199, 0.12);
}

.create-preview-panel iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.create-preview-console {
  display: flex;
  flex-direction: column;
  min-height: 140px;
  max-height: 220px;
  border-top: 1px solid rgba(11, 63, 74, 0.12);
  background: #0f172a;
}

.create-preview-console-output {
  flex: 1;
  overflow: auto;
  padding: 0.7rem 0.9rem;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.76rem;
  line-height: 1.55;
  color: #dbe7f1;
}

.create-preview-console-empty {
  color: #8ea1b5;
}

.create-preview-console-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  padding: 0.16rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.create-preview-console-time {
  color: #7dd3c8;
}

.create-preview-console-line-warn {
  color: #f6d28c;
}

.create-preview-console-line-error {
  color: #f5a3a3;
}

/* ── Code editor panel ── */
.create-code-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.create-code-panel.active {
  display: flex;
}

.create-preview-frame-wrapper.d-none-ide {
  display: none;
}

.create-code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.45rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e8e8e8;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.create-code-current-file {
  flex: 1;
  min-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.create-code-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.create-code-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.35rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 500;
}

.create-code-filter input {
  margin: 0;
}

.create-code-toolbar .btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  border-radius: 0.5rem;
}

.create-code-workspace {
  display: grid;
  grid-template-columns: 260px 1fr;
  flex: 1;
  min-height: 0;
}

.create-code-tree {
  min-height: 0;
  overflow: auto;
  padding: 0.75rem;
  background: #f8fafc;
  border-right: 1px solid #e5e7eb;
}

.create-code-tree-empty {
  color: #94a3b8;
  font-size: 0.82rem;
}

.create-tree-folder {
  margin-bottom: 0.2rem;
}

.create-tree-folder > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.35rem 0.45rem;
  border-radius: 0.45rem;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
}

.create-tree-folder > summary::-webkit-details-marker {
  display: none;
}

.create-tree-folder > summary:hover {
  background: #eef2f7;
}

.create-tree-children {
  margin-left: 0.65rem;
  padding-left: 0.45rem;
  border-left: 1px solid #e5e7eb;
}

.create-tree-file {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.35rem 0.45rem;
  border-radius: 0.45rem;
  color: #475569;
  font-size: 0.82rem;
  cursor: pointer;
}

.create-tree-file:hover {
  background: #eef2f7;
  color: #0f172a;
}

.create-tree-file.active {
  background: #111827;
  color: #fff;
}

.create-code-editor {
  flex: 1;
  min-height: 0;
}

/* ── CLI panel ── */
.create-cli-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
  height: 440px;
  border-top: 2px solid #333;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
}

.create-cli-panel.d-none {
  display: none;
}

.create-cli-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  background: #111;
  border-bottom: 1px solid #333;
}

.create-cli-header-title {
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.create-cli-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
}

.create-cli-close:hover {
  color: #fff;
}

.create-cli-output {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.6rem 0.75rem;
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #d4d4d4;
  white-space: pre-wrap;
  word-break: break-all;
}

.create-cli-output div {
  padding: 1px 0;
}

.create-cli-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-top: 1px solid #333;
  background: #111;
}

.create-cli-prompt {
  color: #6c9eff;
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 600;
  user-select: none;
}

.create-cli-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #d4d4d4;
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.8rem;
  caret-color: #6c9eff;
}

.create-cli-input::placeholder {
  color: #555;
}

.create-cli-input:disabled {
  opacity: 0.5;
}

/* ANSI color classes */
.ansi-bold { font-weight: 700; }
.ansi-black { color: #555; }
.ansi-red { color: #f87171; }
.ansi-green { color: #4ade80; }
.ansi-yellow { color: #fbbf24; }
.ansi-blue { color: #60a5fa; }
.ansi-magenta { color: #c084fc; }
.ansi-cyan { color: #22d3ee; }
.ansi-white { color: #e5e5e5; }

.create-chat-actions .btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

/* ── Scrollbar ── */
.create-chat-log::-webkit-scrollbar {
  width: 6px;
}

.create-chat-log::-webkit-scrollbar-track {
  background: transparent;
}

.create-chat-log::-webkit-scrollbar-thumb {
  background: #d5d5d5;
  border-radius: 3px;
}

.create-chat-log::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* ── Onboarding overlay ── */
.create-onboarding {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: #f7faf8;
  overflow: hidden;
}

.create-onboarding.active {
  display: flex;
}

.create-onboarding-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.create-onboarding-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
}

.create-onboarding-logo {
  margin-bottom: 1.5rem;
}

.create-onboarding-logo svg {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}

.create-onboarding-title {
  font-size: 2.4rem;
  font-weight: 700;
  color: #0b3f4a;
  margin: 0 0 0.6rem;
  letter-spacing: -0.03em;
}

.create-onboarding-subtitle {
  font-size: 1.08rem;
  color: #5e767b;
  margin: 0 0 2.2rem;
  font-weight: 400;
  line-height: 1.55;
}

.create-onboarding-features {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.create-onboarding-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.create-onboarding-feature-icon {
  width: 3.2rem;
  height: 3.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  background: #fff;
  color: #2d5d62;
  border: 1px solid #e2ece8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.create-onboarding-feature:hover .create-onboarding-feature-icon {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
}

.create-onboarding-feature-label {
  font-size: 0.78rem;
  color: #6d8185;
  font-weight: 500;
}

.create-onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.create-onboarding-file-actions {
  justify-content: center;
}

.create-onboarding-form .create-prompt-options-bar {
  justify-content: center;
}

.create-onboarding-input {
  width: 100%;
  padding: 1.05rem 1.2rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: #1a1a1a;
  background: #fff;
  border: 1px solid #d8e5e1;
  border-radius: 1rem;
  resize: none;
  font-family: inherit;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.create-onboarding-input:focus {
  outline: none;
  border-color: #7fd7c7;
  box-shadow: 0 4px 24px rgba(127, 215, 199, 0.18);
  background: #fff;
}

.create-onboarding-input::placeholder {
  color: #bbb;
}

.create-onboarding-submit {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 2rem;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: #0b3f4a;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.create-onboarding-submit:hover {
  background: #10606d;
  box-shadow: 0 4px 16px rgba(11, 63, 74, 0.16);
}

.create-onboarding-submit:active {
  transform: scale(0.97);
}

/* ── Mobile info button & popover (hidden on desktop) ── */
.topbar-mobile-info-btn {
  display: none;
}

.topbar-mobile-popover {
  display: none;
}

/* ── Mobile tab bar (hidden on desktop) ── */
.create-mobile-tabs {
  display: none;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .create-topbar {
    overflow: visible;
  }

  .create-topbar-bg {
    overflow: hidden;
  }

  .projects-preview-banner-content {
    padding: 0.4rem 0.75rem;
    gap: 0.4rem;
    flex-wrap: wrap;
  }

  .projects-preview-banner-text {
    font-size: 0.68rem;
    line-height: 1.35;
  }

  .projects-preview-banner-text strong {
    display: block;
    font-size: 0.72rem;
  }

  .projects-preview-banner-icon {
    width: 14px;
    height: 14px;
  }

  .create-page {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: 100vh;
    height: 100dvh;
    padding-bottom: 52px;
  }

  .create-chat-panel {
    grid-column: 1;
    grid-row: 2;
    height: 100%;
    min-height: 0;
  }

  .create-preview-panel {
    grid-column: 1;
    grid-row: 2;
    height: 100%;
    min-height: 0;
  }

  .create-page.mobile-show-chat .create-chat-panel {
    display: flex;
  }

  .create-page.mobile-show-chat .create-preview-panel {
    display: none;
  }

  .create-page.mobile-show-preview .create-chat-panel {
    display: none;
  }

  .create-page.mobile-show-preview .create-preview-panel {
    display: flex;
  }

  .create-mobile-tabs {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 800;
    height: 52px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #dfe9e5;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
  }

  .create-mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    border: none;
    background: transparent;
    color: #7c939a;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
  }

  .create-mobile-tab:hover {
    background: rgba(127, 215, 199, 0.08);
  }

  .create-mobile-tab.active {
    color: #0b3f4a;
  }

  .create-mobile-tab.active svg {
    color: #10606d;
  }

  .create-preview-header {
    grid-template-columns: 1fr auto;
    grid-template-areas: "actions device";
    padding: 0.4rem 0.65rem;
  }

  .create-preview-title {
    display: none;
  }

  .create-preview-device-actions .btn,
  .create-preview-actions .btn {
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
  }

  .create-panel-header {
    padding: 0.4rem 0.6rem;
  }

  .create-action-btn {
    font-size: 0.72rem;
    padding: 0.28rem 0.5rem;
  }

  .create-chat-form {
    padding: 0.5rem 0.65rem;
  }

  .create-code-workspace {
    grid-template-columns: 1fr;
  }

  .create-code-tree {
    display: none;
  }

  .create-code-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.4rem;
    padding: 0.4rem 0.65rem;
  }

  .create-code-toolbar-actions {
    flex-wrap: nowrap;
  }

  .create-onboarding-card {
    padding: 2rem 1.25rem;
  }

  .create-onboarding-title {
    font-size: 1.5rem;
  }

  .create-onboarding-features {
    gap: 1rem;
  }

  .create-cli-panel {
    height: 320px;
    bottom: 52px;
  }

  .create-topbar-content .projects-topbar-usage,
  .create-topbar-content .projects-topbar-logout {
    display: none;
  }

  .topbar-mobile-info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 0.45rem;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .topbar-mobile-info-btn:hover {
    background: rgba(159,227,215,0.18);
    color: #dff6ef;
  }

  .topbar-mobile-popover {
    display: none;
    position: absolute;
    top: 100%;
    right: 0.5rem;
    margin-top: 0.35rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #dfe9e5;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(10px);
    z-index: 100;
    min-width: 200px;
    flex-direction: column;
    gap: 0.5rem;
  }

  .topbar-mobile-popover.active {
    display: flex;
  }

  .topbar-mobile-popover-user {
    color: #0b3f4a;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
  }

  .topbar-mobile-popover-user:hover {
    color: #10606d;
  }

  .topbar-mobile-popover-usage {
    display: flex;
    align-items: center;
    gap: 0.55rem;
  }

  .topbar-mobile-popover-usage .projects-token-progress {
    background: rgba(11, 63, 74, 0.1);
  }

  .topbar-mobile-popover-label {
    color: #5d7479;
    text-shadow: none;
  }

  .projects-shell {
    padding: 3rem 0.85rem 1.4rem;
  }

  .projects-hero {
    padding: 1.4rem 1.15rem;
    border-radius: 1.3rem;
  }

  .projects-panel {
    padding: 1rem;
    border-radius: 1.2rem;
  }

  .projects-hero-title {
    font-size: 2rem;
  }

  .projects-hero-subtitle {
    font-size: 0.95rem;
  }

  .projects-hero-actions,
  .projects-card-actions {
    width: 100%;
  }

  .projects-stat-card,
  .projects-primary-btn,
  .projects-secondary-btn,
  .projects-open-link,
  .projects-search-wrap {
    width: 100%;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .projects-view-list .projects-card-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .projects-view-list .projects-card-title {
    min-width: 0;
  }

  .projects-view-list .projects-card-domain {
    white-space: normal;
  }

  .projects-view-list .projects-card-actions {
    width: 100%;
  }

  .projects-panel-toolbar {
    width: 100%;
  }
}

/* ── Dark mode mobile tab bar ── */
@media (max-width: 768px) {
  .dark-mode .create-mobile-tabs {
    background: rgba(17, 24, 39, 0.96);
    border-top-color: #1e293b;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
  }

  .dark-mode .create-mobile-tab {
    color: #4b5563;
  }

  .dark-mode .create-mobile-tab:hover {
    background: rgba(127, 215, 199, 0.06);
  }

  .dark-mode .create-mobile-tab.active {
    color: #7fd7c7;
  }

  .dark-mode .create-mobile-tab.active svg {
    color: #7fd7c7;
  }

  .dark-mode .topbar-mobile-popover {
    background: rgba(17, 24, 39, 0.96);
    border-color: #1e293b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }

  .dark-mode .topbar-mobile-popover-user {
    color: #e2e8f0;
  }

  .dark-mode .topbar-mobile-popover-user:hover {
    color: #7fd7c7;
  }

  .dark-mode .topbar-mobile-popover-usage .projects-token-progress {
    background: rgba(148, 163, 184, 0.15);
  }

  .dark-mode .topbar-mobile-popover-label {
    color: #94a3b8;
  }
}

/* ── Dark mode toggle button ── */
.create-darkmode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 0.45rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  margin-left: auto;
}

.create-darkmode-toggle:hover {
  background: rgba(159,227,215,0.18);
  color: #dff6ef;
}

.create-darkmode-icon-sun {
  display: none;
}

.dark-mode .create-darkmode-icon-moon {
  display: none;
}

.dark-mode .create-darkmode-icon-sun {
  display: block;
}

/* ── Dark mode ── */
.dark-mode,
.dark-mode body {
  color: #d4dde4;
  background: #0f1520;
}

.dark-mode .create-page {
  background:
    radial-gradient(circle at top left, rgba(127, 215, 199, 0.06), transparent 32%),
    radial-gradient(circle at top right, rgba(234, 220, 200, 0.04), transparent 28%),
    #111827;
}

.dark-mode .create-chat-panel {
  background: linear-gradient(180deg, #111827 0%, #0f1520 100%);
  color: #d4dde4;
  border-right-color: #1e293b;
}

.dark-mode .create-panel-header {
  background: rgba(17, 24, 39, 0.92);
  border-bottom-color: #1e293b;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.dark-mode .create-panel-header h1 {
  color: #e2e8f0;
}

.dark-mode .create-action-btn {
  border-color: rgba(148, 163, 184, 0.15);
  background: rgba(30, 41, 59, 0.8);
  color: #94a3b8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dark-mode .create-action-btn:hover {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

.dark-mode .create-action-btn--primary {
  background: #0f4f5d;
  border-color: #0f4f5d;
  color: #fff;
}

.dark-mode .create-action-btn--primary:hover {
  background: #10606d;
  border-color: #10606d;
}

.dark-mode .create-action-btn--danger {
  border-color: rgba(248, 113, 113, 0.25);
  color: #f87171;
}

.dark-mode .create-action-btn--danger:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.35);
}

.dark-mode .create-plan-announcement-modal {
  background: #111827;
}

.dark-mode .create-plan-announcement-body {
  background: #111827;
}

.dark-mode .create-plan-announcement-step strong {
  color: #d5f4ed;
}

.dark-mode .create-plan-announcement-step p {
  color: #a7b8b3;
}

.dark-mode .create-plan-announcement-note {
  color: #c8e8e1;
  background: rgba(16, 96, 109, 0.22);
}

.dark-mode .create-status {
  color: #7c939a;
  background: rgba(17, 24, 39, 0.7);
  border-bottom-color: #1e293b;
}

.dark-mode .create-status--running {
  background: linear-gradient(90deg, rgba(127, 215, 199, 0.1) 0%, rgba(127, 215, 199, 0.03) 50%, rgba(127, 215, 199, 0.1) 100%);
  background-size: 200% 100%;
  animation: status-pulse 2s ease-in-out infinite;
  color: #7fd7c7;
}

.dark-mode .create-status--quota {
  background: linear-gradient(135deg, #ffe082 0%, #f4c542 100%);
  border-bottom-color: #e0b93f;
  color: #4a3b00;
}

.dark-mode .create-chat-log {
  background: linear-gradient(180deg, #111827 0%, #0f1520 100%);
}

.dark-mode .create-chat-empty {
  color: #4b5563;
}

.dark-mode .create-message-assistant {
  background: #1e293b;
  color: #d4dde4;
  border-color: #334155;
}

.dark-mode .create-message-markdown a {
  color: #7fd7c7;
}

.dark-mode .create-chat-table-wrap:focus-visible {
  outline-color: #7fd7c7;
}

.dark-mode .create-message-user {
  background: #0b3f4a;
  color: #fff;
}

.dark-mode .create-message-token-box {
  background: rgba(127, 215, 199, 0.1);
  border-color: rgba(127, 215, 199, 0.2);
  color: #7fd7c7;
}

.dark-mode .create-message-avatar {
  background: #374151;
}

.dark-mode .create-message-row-assistant .create-message-avatar {
  background: #0b3f4a;
}

.dark-mode .create-chat-form {
  border-top-color: #1e293b;
  background: rgba(17, 24, 39, 0.95);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.3);
}

.dark-mode .create-chat-input-row {
  background: #1e293b;
  border-color: #334155;
}

.dark-mode .create-chat-input-row:focus-within {
  border-color: #7fd7c7;
  box-shadow: 0 0 0 3px rgba(127, 215, 199, 0.15);
  background: #1a2332;
}

.dark-mode .create-chat-input {
  color: #e2e8f0;
}

.dark-mode .create-chat-input::placeholder {
  color: #4b5563;
}

.dark-mode .create-chat-send {
  background: #0f4f5d;
}

.dark-mode .create-chat-send:hover {
  background: #10606d;
}

.dark-mode .create-prompt-select {
  background-color: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

.dark-mode .create-prompt-select:focus {
  border-color: #7fd7c7;
  box-shadow: 0 0 0 3px rgba(127, 215, 199, 0.12);
  background-color: #1a2332;
}

.dark-mode .create-prompt-pills {
  border-color: #334155;
}

.dark-mode .create-prompt-pill {
  background: #1e293b;
  color: #64748b;
}

.dark-mode .create-prompt-pill:not(:last-child) {
  border-right-color: #334155;
}

.dark-mode .create-prompt-pill:hover:not(.active):not(:disabled) {
  background: #263043;
  color: #94a3b8;
}

.dark-mode .create-prompt-pill.active {
  background: #0f4f5d;
  color: #fff;
}

/* ── Dark mode: Tier button ── */

.dark-mode .create-tier-button {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

.dark-mode .create-tier-button:hover:not(:disabled) {
  border-color: #7fd7c7;
  background: #263043;
}

.dark-mode .create-tier-button:focus-visible {
  border-color: #7fd7c7;
  box-shadow: 0 0 0 3px rgba(127, 215, 199, 0.12);
}

.dark-mode .create-tier-button-label {
  color: #e2e8f0;
}

.dark-mode .create-tier-button-price {
  background: #0f4f5d;
  color: #d1faf0;
}

/* ── Dark mode: Tier modal ── */

.dark-mode #tierModal .modal-content {
  background: #111827;
  color: #e2e8f0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
}

.dark-mode #tierModal .modal-header {
  border-bottom-color: #1e293b;
}

.dark-mode #tierModal .modal-title {
  color: #e2e8f0;
}

.dark-mode #tierModal .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.dark-mode .create-tier-option {
  border-color: #283040;
  background: #0f172a;
}

.dark-mode .create-tier-option:hover:not(.active) {
  border-color: #3b5060;
  background: #162030;
}

.dark-mode .create-tier-option.active {
  border-color: #1a8a9a;
  background: linear-gradient(135deg, rgba(16, 96, 109, 0.15) 0%, rgba(127, 215, 199, 0.08) 100%);
  box-shadow: 0 0 0 2px rgba(26, 138, 154, 0.2);
}

.dark-mode .create-tier-option-label {
  color: #e2e8f0;
}

.dark-mode .create-tier-badge {
  color: #7fd7c7;
  background: rgba(127, 215, 199, 0.12);
}

.dark-mode .create-tier-option.active .create-tier-badge {
  background: rgba(127, 215, 199, 0.18);
  color: #9fe3d7;
}

.dark-mode .create-tier-option-price {
  background: #0f4f5d;
  color: #d1faf0;
}

.dark-mode .create-tier-button-price--expensive,
.dark-mode .create-tier-option-price--expensive {
  background: #a93226;
  color: #fde8e6;
}

.dark-mode .create-tier-option-model {
  color: #5e7f84;
}

.dark-mode .create-tier-option-desc {
  color: #6b8a8e;
}

.dark-mode .create-tier-option-recommendation {
  color: #d1faf0;
}

.dark-mode .create-tier-option-cost {
  background: rgba(127, 215, 199, 0.12);
  color: #7fd7c7;
}

.dark-mode .create-tier-option-cost--expensive {
  background: rgba(169, 50, 38, 0.18);
  color: #f2b8b2;
}

.dark-mode .create-chat-empty {
  border-color: rgba(127, 215, 199, 0.12);
  background: rgba(15, 23, 42, 0.58);
  color: #94a3b8;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.dark-mode .create-chat-empty h3 {
  color: #e2e8f0;
}

.dark-mode .create-chat-empty-tips span {
  background: rgba(127, 215, 199, 0.08);
  color: #94a3b8;
}

.dark-mode .create-chat-empty-tips span::before {
  color: #7fd7c7;
}

.dark-mode .create-chat-attach {
  color: #64748b;
}

.dark-mode .create-chat-attach:hover {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
}

.dark-mode .create-chat-file-chip {
  background: rgba(127, 215, 199, 0.1);
  border-color: rgba(127, 215, 199, 0.2);
  color: #7fd7c7;
}

.dark-mode .create-preview-panel {
  background: linear-gradient(180deg, #111827 0%, #0d1117 100%);
}

.dark-mode .create-preview-header {
  background: rgba(17, 24, 39, 0.92);
  border-bottom-color: #1e293b;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.dark-mode .create-preview-header h2 {
  color: #e2e8f0;
}

.dark-mode .create-preview-device-actions .btn,
.dark-mode .create-preview-actions .btn-ide-tab {
  border-color: #334155;
  color: #64748b;
}

.dark-mode .create-preview-actions .btn-ide-tab--help {
  background: #10606d;
  border-color: #10606d;
  color: #fff;
}

.dark-mode .create-preview-actions .btn-ide-tab--help:hover {
  background: #14808f;
  border-color: #14808f;
  color: #fff;
}

.dark-mode .help-item {
  background: rgba(10, 30, 40, 0.6);
  border-left-color: #1a8a9a;
}

.dark-mode #helpModal .modal-content {
  background: #111827;
  color: #e2e8f0;
}

.dark-mode #helpModal .modal-header {
  border-bottom-color: #1e293b;
}

.dark-mode #helpModal .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.dark-mode .help-item-header {
  color: #9fe3d7;
}

.dark-mode .help-item-header svg {
  color: #9fe3d7;
  fill: #9fe3d7;
}

.dark-mode .help-item-header svg:not([fill="currentColor"]) {
  stroke: #9fe3d7;
}

.dark-mode .help-item-text {
  color: #e2e8f0;
}

.dark-mode .create-preview-device-actions .btn:hover,
.dark-mode .create-preview-actions .btn-ide-tab:hover {
  border-color: #475569;
  color: #94a3b8;
}

.dark-mode .create-preview-device-actions .btn.active,
.dark-mode .create-preview-actions .btn-ide-tab.active {
  background: #0f4f5d;
  border-color: #0f4f5d;
  color: #fff;
}

.dark-mode .create-preview-frame-wrapper {
  border-color: rgba(148, 163, 184, 0.1);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.dark-mode .create-plan-panel,
.dark-mode .create-plan-editor,
.dark-mode .create-plan-pane,
.dark-mode .create-plan-preview {
  background: #0d1117;
  border-color: rgba(148, 163, 184, 0.1);
}

.dark-mode .create-page--plan .create-chat-panel {
  border-right-color: rgba(127, 215, 199, 0.45);
  box-shadow: inset -3px 0 0 #7fd7c7;
}

.dark-mode .create-page--plan .create-chat-form {
  background: linear-gradient(180deg, rgba(16, 96, 109, 0.24), rgba(17, 24, 39, 0.96));
  border-top-color: rgba(127, 215, 199, 0.28);
}

.dark-mode .create-plan-mode-guide {
  color: #d5f4ed;
  background: linear-gradient(90deg, rgba(16, 96, 109, 0.42), rgba(94, 69, 35, 0.28));
  border-bottom-color: rgba(127, 215, 199, 0.22);
}

.dark-mode .create-plan-model-badge {
  color: #f3d49f;
  background: rgba(15, 23, 42, 0.56);
  border-color: rgba(243, 212, 159, 0.2);
}

.dark-mode .create-plan-toolbar {
  background: #111827;
  border-bottom-color: #1e293b;
  color: #94a3b8;
}

.dark-mode .create-plan-pane-title {
  color: #94a3b8;
  background: #111827;
  border-bottom-color: #1e293b;
}

.dark-mode .create-plan-preview {
  color: #cbd5e1;
  background:
    radial-gradient(circle at 100% 0, rgba(16, 96, 109, 0.3), transparent 32%),
    radial-gradient(circle at 0 100%, rgba(94, 69, 35, 0.22), transparent 34%),
    linear-gradient(180deg, #101720 0%, #0d1117 100%);
}

.dark-mode .create-plan-preview h1,
.dark-mode .create-plan-preview h2,
.dark-mode .create-plan-preview h3,
.dark-mode .create-plan-preview h4 {
  color: #9fe3d7;
}

.dark-mode .create-plan-preview blockquote {
  color: #a7b8b3;
  background: #111827;
}

.dark-mode .create-plan-editor-lock {
  color: #9fe3d7;
}


.dark-mode .create-preview-frame-wrapper--mobile {
  background: linear-gradient(180deg, #0f1520 0%, #0d1117 100%);
}

.dark-mode .create-preview-placeholder {
  background: linear-gradient(180deg, #111827 0%, #0d1117 100%);
}

.dark-mode .create-preview-placeholder-mark {
  background: rgba(30, 41, 59, 0.72);
  border-color: rgba(51, 65, 85, 0.5);
}

.dark-mode .create-code-toolbar {
  background: rgba(17, 24, 39, 0.92);
  border-bottom-color: #1e293b;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.dark-mode .create-code-current-file {
  color: #94a3b8;
}

.dark-mode .create-code-filter {
  border-color: #334155;
  background: #1e293b;
  color: #94a3b8;
}

.dark-mode .create-code-toolbar .btn {
  color: #94a3b8;
  border-color: #334155;
}

.dark-mode .create-code-toolbar .btn:hover {
  color: #e2e8f0;
  border-color: #475569;
}

.dark-mode .create-code-toolbar .btn-outline-success {
  color: #7fd7c7;
  border-color: rgba(127, 215, 199, 0.3);
}

.dark-mode .create-code-toolbar .btn-outline-success:hover {
  background: rgba(127, 215, 199, 0.12);
  color: #9fe3d7;
}

.dark-mode .create-code-toolbar .btn-outline-danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.25);
}

.dark-mode .create-code-toolbar .btn-outline-danger:hover {
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
}

.dark-mode .create-code-tree {
  background: #0d1117;
  border-right-color: #1e293b;
}

.dark-mode .create-code-tree-empty {
  color: #4b5563;
}

.dark-mode .create-tree-folder > summary {
  color: #94a3b8;
}

.dark-mode .create-tree-folder > summary:hover {
  background: #1e293b;
}

.dark-mode .create-tree-children {
  border-left-color: #1e293b;
}

.dark-mode .create-tree-file {
  color: #94a3b8;
}

.dark-mode .create-tree-file:hover {
  background: #1e293b;
  color: #e2e8f0;
}

.dark-mode .create-tree-file.active {
  background: #0f4f5d;
  color: #fff;
}

.dark-mode .create-chat-log::-webkit-scrollbar-thumb {
  background: #334155;
}

.dark-mode .create-chat-log::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.dark-mode .create-onboarding {
  background: #0f1520;
}

.dark-mode .create-onboarding-title {
  color: #e2e8f0;
}

.dark-mode .create-onboarding-subtitle {
  color: #7c939a;
}

.dark-mode .create-onboarding-feature-icon {
  background: #1e293b;
  color: #7fd7c7;
  border-color: #334155;
}

.dark-mode .create-onboarding-feature-label {
  color: #7c939a;
}

.dark-mode .create-onboarding-input {
  color: #e2e8f0;
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.dark-mode .create-onboarding-input:focus {
  border-color: #7fd7c7;
  box-shadow: 0 4px 24px rgba(127, 215, 199, 0.12);
  background: #1a2332;
}

.dark-mode .create-onboarding-input::placeholder {
  color: #4b5563;
}

.dark-mode .create-onboarding-submit {
  background: #0f4f5d;
}

.dark-mode .create-onboarding-submit:hover {
  background: #10606d;
}

.dark-mode .create-chat-actions .btn.active {
  background: #0f4f5d;
  color: #fff;
  border-color: #0f4f5d;
}

.dark-mode .projects-delete-bar {
  background: rgba(220, 53, 69, 0.1);
  border-color: rgba(220, 53, 69, 0.3);
}

.dark-mode .projects-delete-bar span {
  color: #e2e8f0;
}

.dark-mode .projects-select-all-btn {
  border-color: #475569;
  color: #94a3b8;
}

.dark-mode .projects-select-all-btn:hover {
  border-color: #64748b;
  color: #e2e8f0;
}

.dark-mode .projects-card-checkbox input[type="checkbox"] {
  border-color: #475569;
  background: rgba(30, 41, 59, 0.85);
}

.dark-mode .projects-card-checkbox input[type="checkbox"]:hover {
  border-color: #7fd7c7;
}

.dark-mode .projects-card-checkbox input[type="checkbox"]:checked {
  background: #10606d;
  border-color: #10606d;
}

.dark-mode .projects-card:has(input:checked) {
  border-color: #7fd7c7;
  box-shadow: 0 0 0 2px rgba(127, 215, 199, 0.25), 0 10px 26px rgba(0, 0, 0, 0.15);
}

/* ── Dark mode: Models info ── */

.dark-mode .projects-models-info {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.92) 0%, rgba(15, 30, 35, 0.88) 100%);
  border-color: #1e293b;
}

.dark-mode .projects-models-info-header {
  color: #e2e8f0;
}

.dark-mode .projects-models-info-desc {
  color: #94a3b8;
}

.dark-mode .projects-model-card {
  background: rgba(30, 41, 59, 0.6);
  border-color: #283040;
}

.dark-mode .projects-model-card strong {
  color: #e2e8f0;
}

.dark-mode .projects-model-price {
  background: #0f4f5d;
  color: #d1faf0;
}

.dark-mode .projects-model-price--expensive {
  background: #a93226;
  color: #fde8e6;
}

.dark-mode .projects-model-use {
  color: #6b8a8e;
}

.dark-mode .projects-models-notice {
  background: rgba(16, 96, 109, 0.1);
  border-color: rgba(26, 138, 154, 0.2);
  color: #94a3b8;
}

.dark-mode .projects-models-notice svg {
  color: #7fd7c7;
}

.dark-mode .projects-model-news-content {
  border-color: rgba(127, 215, 199, 0.2);
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.86), rgba(15, 23, 35, 0.78)),
    radial-gradient(circle at top left, rgba(127, 215, 199, 0.24), transparent 45%),
    radial-gradient(circle at bottom right, rgba(234, 220, 200, 0.16), transparent 42%);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.dark-mode .projects-model-news-kicker {
  border-color: rgba(127, 215, 199, 0.2);
  background: rgba(15, 23, 42, 0.58);
  color: #7fd7c7;
}

.dark-mode .projects-model-news-title,
.dark-mode .projects-model-news-point strong {
  color: #e2e8f0;
}

.dark-mode .projects-model-news-lead,
.dark-mode .projects-model-news-point p {
  color: #94a3b8;
}

.dark-mode .projects-model-news-point {
  border-color: rgba(127, 215, 199, 0.12);
  background: rgba(15, 23, 42, 0.48);
}

.dark-mode .projects-model-news-close {
  background: linear-gradient(135deg, #10606d, #1a8a9a);
}

/* ── Dark mode: View toggle ── */

.dark-mode .projects-view-toggle {
  border-color: #334155;
}

.dark-mode .projects-view-btn {
  background: rgba(30, 41, 59, 0.7);
  color: #64748b;
}

.dark-mode .projects-view-btn:not(:last-child) {
  border-right-color: #334155;
}

.dark-mode .projects-view-btn:hover {
  background: rgba(127, 215, 199, 0.08);
  color: #94a3b8;
}

.dark-mode .projects-view-btn.active {
  background: #10606d;
  color: #fff;
}

/* ── Dark mode: List view ── */

.dark-mode .projects-view-list .projects-card {
  background: transparent;
  border-bottom-color: #1e293b;
}

.dark-mode .projects-view-list .projects-card:first-child {
  border-top-color: #1e293b;
}

.dark-mode .projects-view-list .projects-card:hover {
  background: rgba(127, 215, 199, 0.03);
}

.dark-mode .projects-view-list .projects-card-updated-inline {
  color: #4b5e66;
}

.dark-mode .projects-group-header {
  background: #1e293b;
}

.dark-mode .projects-group-title {
  color: #e2e8f0;
}

.dark-mode .projects-group-count {
  background: rgba(127, 215, 199, 0.12);
  color: #7fd7c7;
}

/* ── Dark mode: Projects page core ── */

.dark-mode .projects-page {
  background:
    radial-gradient(circle at top left, rgba(127, 215, 199, 0.06), transparent 28%),
    radial-gradient(circle at top right, rgba(234, 220, 200, 0.04), transparent 26%),
    #0f1520;
}

.dark-mode .projects-shell::before {
  background: radial-gradient(circle, rgba(127, 215, 199, 0.05), transparent 70%);
}

.dark-mode .projects-hero {
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.94), rgba(15, 23, 35, 0.86)),
    radial-gradient(circle at 92% 12%, rgba(127, 215, 199, 0.12), transparent 32%);
  border-color: #1e293b;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.2);
}

.dark-mode .projects-hero-kicker {
  background: rgba(127, 215, 199, 0.1);
  color: #7fd7c7;
}

.dark-mode .projects-hero-title {
  color: #e2e8f0;
}

.dark-mode .projects-hero-subtitle {
  color: #7c939a;
}

.dark-mode .projects-hero-update-pill {
  background: rgba(127, 215, 199, 0.08);
  border-color: rgba(127, 215, 199, 0.14);
  color: #9fb9bd;
}

.dark-mode .projects-stat-card {
  background: rgba(30, 41, 59, 0.7);
  border-color: #334155;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.15);
}

.dark-mode .projects-stat-value {
  color: #e2e8f0;
}

.dark-mode .projects-stat-label {
  color: #64748b;
}

.dark-mode .projects-primary-btn {
  background: #10606d;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

.dark-mode .projects-primary-btn:hover {
  background: #1a8a9a;
}

.dark-mode .projects-secondary-btn {
  border-color: #334155;
  background: rgba(30, 41, 59, 0.7);
  color: #94a3b8;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.dark-mode .projects-secondary-btn:hover {
  background: rgba(51, 65, 85, 0.8);
  color: #e2e8f0;
  border-color: #475569;
}

.dark-mode .projects-open-link {
  background: linear-gradient(135deg, #0f4f5d, #10606d);
  border-color: #1a8a9a;
}

/* ── Dark mode: Panel ── */

.dark-mode .projects-panel {
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.78), rgba(15, 23, 35, 0.72)),
    radial-gradient(circle at top right, rgba(127, 215, 199, 0.07), transparent 30%);
  border-color: #1e293b;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.2);
}

.dark-mode .projects-panel-title {
  color: #e2e8f0;
}

.dark-mode .projects-panel-subtitle {
  color: #64748b;
}

.dark-mode .projects-search-wrap {
  background: rgba(30, 41, 59, 0.7);
  border-color: #334155;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px rgba(0, 0, 0, 0.1);
  color: #64748b;
}

.dark-mode .projects-search-wrap:focus-within {
  border-color: rgba(127, 215, 199, 0.5);
  box-shadow: 0 0 0 4px rgba(127, 215, 199, 0.1);
}

.dark-mode .projects-search-input {
  color: #e2e8f0;
}

.dark-mode .projects-search-input::placeholder {
  color: #4b5e66;
}

/* ── Dark mode: Cards ── */

.dark-mode .projects-card {
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.82), rgba(22, 32, 48, 0.76)),
    radial-gradient(circle at top right, rgba(127, 215, 199, 0.08), transparent 42%);
  border-color: #283040;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.15);
}

.dark-mode .projects-card::before {
  background: linear-gradient(180deg, #7fd7c7, #10606d);
  opacity: 0.65;
}

.dark-mode .projects-card:hover {
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  border-color: #3b5060;
}

.dark-mode .projects-card-meta {
  background: rgba(127, 215, 199, 0.1);
  color: #7fd7c7;
}

.dark-mode .projects-card-updated {
  color: #4b5e66;
}

.dark-mode .projects-card-title {
  color: #e2e8f0;
}

.dark-mode .projects-card-title:hover {
  color: #e2e8f0;
}

.dark-mode .projects-card-domain {
  color: #6b8a8e;
}

/* ── Dark mode: Delete bar ── */

.dark-mode .projects-delete-info {
  color: #64748b;
}

/* ── Dark mode: Empty state ── */

.dark-mode .projects-empty-state {
  border-color: rgba(71, 85, 105, 0.4);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.5), rgba(22, 32, 48, 0.6));
}

.dark-mode .projects-empty-icon {
  background: rgba(30, 41, 59, 0.85);
  color: #64748b;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.dark-mode .projects-empty-state h3 {
  color: #e2e8f0;
}

.dark-mode .projects-empty-state p {
  color: #7c939a;
}

/* ── Dark mode: Topbar user/logout ── */

.dark-mode .projects-topbar-user {
  color: rgba(255, 255, 255, 0.85);
}

.dark-mode .projects-topbar-user:hover {
  color: #fff;
}

.dark-mode .projects-topbar-logout {
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
}

.dark-mode .projects-topbar-logout:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* ── Dark mode: Modals on /list ── */

.dark-mode #createModal .modal-content,
.dark-mode #renameModal .modal-content {
  background: #111827;
  color: #e2e8f0;
}

.dark-mode #createModal .modal-header,
.dark-mode #renameModal .modal-header {
  border-bottom-color: #1e293b;
}

.dark-mode #createModal .modal-footer,
.dark-mode #renameModal .modal-footer {
  border-top-color: #1e293b;
}

.dark-mode #createModal .btn-close,
.dark-mode #renameModal .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.dark-mode #createModal .form-control,
.dark-mode #renameModal .form-control {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

.dark-mode #createModal .form-control:focus,
.dark-mode #renameModal .form-control:focus {
  border-color: #7fd7c7;
  box-shadow: 0 0 0 3px rgba(127, 215, 199, 0.12);
  background: #1a2332;
}

.dark-mode #createModal .form-label,
.dark-mode #renameModal .form-label {
  color: #94a3b8;
}

.dark-mode #createModal .form-text {
  color: #64748b;
}

.dark-mode #createModal .btn-secondary,
.dark-mode #renameModal .btn-secondary {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

.dark-mode #createModal .btn-dark,
.dark-mode #renameModal .btn-dark {
  background: #10606d;
  border-color: #10606d;
}

@media (max-width: 575.98px) {
  .projects-model-news-modal .modal-dialog {
    margin: 0.75rem;
    padding: 0;
  }

  .projects-model-news-body {
    padding: 1.35rem;
  }

  .projects-model-news-point {
    padding: 0.72rem;
  }
}

/* ── Dark mode: Existing project modal on /new ── */

.dark-mode #existingProjectModal .modal-content {
  background: #111827;
  color: #e2e8f0;
}

.dark-mode #existingProjectModal .modal-header {
  border-bottom-color: #1e293b;
}

.dark-mode #existingProjectModal .modal-footer {
  border-top-color: #1e293b;
}

.dark-mode #existingProjectModal .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.dark-mode #existingProjectModal .btn-outline-secondary {
  border-color: #334155;
  color: #94a3b8;
}

.dark-mode #existingProjectModal .btn-outline-secondary:hover {
  background: #1e293b;
  color: #e2e8f0;
}

/* ── Dark mode: Alert ── */

.dark-mode .projects-alert {
  background: rgba(220, 53, 69, 0.1);
  border-color: rgba(220, 53, 69, 0.3);
  color: #f87171;
}

/* ════════════════════════════════════════════════════════════════
   CHAT PAGE – Light Discord Clone
   ════════════════════════════════════════════════════════════════ */

.chat-page {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(127, 215, 199, 0.10), transparent 32%),
    radial-gradient(circle at bottom right, rgba(234, 220, 200, 0.10), transparent 28%),
    #f4f6f4;
}

.chat-topbar {
  flex-shrink: 0;
}

/* ── Chat body (sidebar + main) ── */

.chat-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Sidebar ── */

.chat-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #0e2a30;
  border-right: 1px solid rgba(127, 215, 199, 0.12);
}

.chat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(127, 215, 199, 0.10);
}

.chat-sidebar-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.45);
}

.chat-add-channel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.chat-add-channel-btn:hover {
  background: rgba(159, 227, 215, 0.15);
  color: #9fe3d7;
}

.chat-channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0;
}

.chat-channel-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  text-decoration: none;
  color: rgba(255,255,255,0.55);
  font-size: 0.88rem;
  border-radius: 0;
  transition: background 0.12s, color 0.12s;
}

.chat-channel-item:hover {
  background: rgba(159, 227, 215, 0.08);
  color: rgba(255,255,255,0.85);
}

.chat-channel-item--active {
  background: rgba(159, 227, 215, 0.14);
  color: #fff;
}

.chat-channel-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.chat-channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-channel-item--unread {
  color: #fff;
  font-weight: 600;
}

.chat-unread-badge {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.chat-no-channels {
  padding: 1.2rem 0.85rem;
  color: rgba(255,255,255,0.3);
  font-size: 0.82rem;
  text-align: center;
}

/* ── Main area ── */

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
}

.chat-channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  gap: 0.5rem;
}

.chat-channel-header-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.chat-channel-header-icon {
  font-size: 1.1rem;
  opacity: 0.6;
}

.chat-channel-header-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a1a;
}

.chat-channel-header-desc {
  font-size: 0.78rem;
  color: #888;
  margin-left: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-channel-header-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex-shrink: 0;
}

.chat-header-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.5rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #666;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.chat-header-btn:hover {
  background: #f0f0f0;
  color: #333;
}

.chat-header-btn--danger:hover {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.chat-pinned-count {
  font-weight: 600;
  color: #d97706;
}

/* ── Messages ── */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-message {
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  transition: background 0.12s;
  position: relative;
}

.chat-message:hover {
  background: #f7f7f8;
}

.chat-message:hover .chat-message-actions {
  opacity: 1;
}

.chat-message--pinned {
  border-left: 3px solid #d97706;
  background: rgba(217, 119, 6, 0.04);
}

/* ── Message grouping (continuation) ── */

.chat-message--continuation {
  padding-top: 0.1rem;
}

.chat-message--continuation .chat-message-header {
  display: none;
}

.chat-message--continuation .chat-message-content {
  padding-left: 2.1rem;
}

.chat-message--continuation .chat-message-image-wrap,
.chat-message--continuation .chat-reactions {
  margin-left: 2.1rem;
}

.chat-no-messages {
  margin: auto;
  width: min(420px, 100%);
  max-width: 420px;
  padding: 1.4rem;
  border: 1px solid rgba(16, 96, 109, 0.1);
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(240,248,245,0.84));
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
  text-align: center;
  color: #607d82;
}

.chat-no-messages-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  border-radius: 1rem;
  background: #0b3f4a;
  color: #9fe3d7;
  font-size: 1.5rem;
  font-weight: 800;
}

.chat-no-messages h3 {
  margin: 0 0 0.4rem;
  color: #0b3f4a;
  font-size: 1.05rem;
}

.chat-no-messages p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
}

/* ── Unread divider ── */

.chat-new-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.6rem 0;
  color: #dc3545;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-new-divider::before,
.chat-new-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #dc3545;
  opacity: 0.45;
}

/* ── Reactions ── */

.chat-reactions {
  padding-left: 2.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  min-height: 0;
  margin-top: 0.2rem;
}

.chat-reactions:empty,
.chat-reactions:not(:has(.chat-reaction-chip)) .chat-reaction-add {
  opacity: 0;
}

.chat-message:hover .chat-reactions .chat-reaction-add {
  opacity: 1;
}

.chat-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.45rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f7f7f8;
  cursor: pointer;
  font-size: 0.78rem;
  transition: background 0.12s, border-color 0.12s;
}

.chat-reaction-chip:hover {
  background: #eef0f2;
  border-color: #ccc;
}

.chat-reaction-chip--mine {
  background: rgba(16, 96, 109, 0.08);
  border-color: rgba(16, 96, 109, 0.3);
}

.chat-reaction-emoji {
  font-size: 0.88rem;
  line-height: 1;
}

.chat-reaction-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: #555;
}

.chat-reaction-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px dashed #d1d5db;
  border-radius: 50%;
  background: transparent;
  color: #aaa;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, opacity 0.15s;
}

.chat-reaction-add:hover {
  background: #f0f0f0;
  color: #555;
  border-style: solid;
}

.chat-reaction-info {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #bbb;
  cursor: pointer;
  padding: 0;
  transition: color 0.12s, background 0.12s;
}

.chat-reaction-info:hover {
  background: #f0f0f0;
  color: #666;
}

.dark-mode .chat-reaction-info {
  color: rgba(255,255,255,0.25);
}

.dark-mode .chat-reaction-info:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
}

/* ── Read receipts ── */

.chat-read-receipt {
  position: relative;
  width: fit-content;
  margin: 0.12rem 0 0 2.1rem;
  color: #64748b;
  font-size: 0.72rem;
}

.chat-read-receipt[hidden] {
  display: none;
}

.chat-read-receipt summary {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
  transition: background 0.12s, color 0.12s;
}

.chat-read-receipt summary::-webkit-details-marker {
  display: none;
}

.chat-read-receipt summary:hover,
.chat-read-receipt[open] summary {
  background: #eef6f5;
  color: #0b6670;
}

.chat-read-count {
  font-weight: 600;
}

.chat-read-popover {
  position: absolute;
  z-index: 30;
  left: 0;
  top: calc(100% + 0.3rem);
  min-width: 150px;
  max-width: min(280px, 75vw);
  padding: 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.chat-read-popover strong {
  display: block;
  margin-bottom: 0.4rem;
  color: #334155;
  font-size: 0.72rem;
}

.chat-read-users {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.chat-read-users span {
  padding: 0.16rem 0.4rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  white-space: nowrap;
}

.dark-mode .chat-read-receipt {
  color: rgba(255,255,255,0.42);
}

.dark-mode .chat-read-receipt summary:hover,
.dark-mode .chat-read-receipt[open] summary {
  background: rgba(127, 215, 199, 0.1);
  color: #7fd7c7;
}

.dark-mode .chat-read-popover {
  border-color: rgba(255,255,255,0.1);
  background: #14282e;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.dark-mode .chat-read-popover strong,
.dark-mode .chat-read-users span {
  color: rgba(255,255,255,0.78);
}

.dark-mode .chat-read-users span {
  background: rgba(255,255,255,0.07);
}

/* ── Reaction detail modal ── */

.chat-reaction-detail-modal {
  max-width: 320px;
  min-width: 220px;
}

.chat-reaction-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #f0ede5;
}

.chat-reaction-detail-row:last-child {
  border-bottom: none;
}

.chat-reaction-detail-emoji {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}

.chat-reaction-detail-users {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.45rem;
}

.chat-reaction-detail-user {
  font-size: 0.82rem;
  color: #333;
  font-weight: 500;
}

.dark-mode .chat-reaction-detail-row {
  border-bottom-color: rgba(255,255,255,0.06);
}

.dark-mode .chat-reaction-detail-user {
  color: rgba(255,255,255,0.75);
}

/* ── Emoji picker ── */

.chat-emoji-picker {
  position: fixed;
  z-index: 200;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  padding: 0.5rem;
}

.chat-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.15rem;
}

.chat-emoji-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 1.15rem;
  cursor: pointer;
  transition: background 0.12s;
}

.chat-emoji-btn:hover {
  background: #f0f0f0;
}

/* ── Link previews ── */

.chat-link {
  color: #10606d;
  text-decoration: underline;
  word-break: break-all;
}

.chat-link:hover {
  color: #0b3f4a;
}

.chat-link-preview {
  display: flex;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  margin-top: 0.35rem;
  margin-left: 2.1rem;
  border-left: 3px solid #10606d;
  background: #f9fafb;
  border-radius: 4px;
  max-width: 480px;
  overflow: hidden;
}

.chat-link-preview-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.chat-link-preview-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.chat-link-preview-site {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
  font-weight: 600;
}

.chat-link-preview-title {
  font-size: 0.82rem;
  color: #10606d;
  line-height: 1.3;
}

.chat-link-preview-desc {
  font-size: 0.76rem;
  color: #666;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── YouTube embed ── */

.chat-youtube-embed {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 225px;
  margin: 0.4rem 0 0.2rem 2.1rem;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.chat-youtube-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

/* ── Edited badge ── */

.chat-message-edited {
  font-size: 0.68rem;
  color: #aaa;
  font-weight: 400;
  font-style: italic;
}

/* ── Inline edit ── */

.chat-edit-textarea {
  width: 100%;
  border: 1px solid #10606d;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.88rem;
  font-family: inherit;
  line-height: 1.4;
  resize: vertical;
  min-height: 2.2rem;
  max-height: 200px;
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(16, 96, 109, 0.12);
}

.chat-edit-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.3rem;
}

.chat-edit-save,
.chat-edit-cancel {
  border: none;
  border-radius: 4px;
  padding: 0.2rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}

.chat-edit-save {
  background: #0b3f4a;
  color: #fff;
}

.chat-edit-save:hover {
  background: #10606d;
}

.chat-edit-cancel {
  background: transparent;
  color: #888;
}

.chat-edit-cancel:hover {
  background: #f0f0f0;
  color: #333;
}

/* ── Search panel ── */

.chat-search-panel {
  border-bottom: 1px solid #e5e7eb;
  background: #fefdf8;
  flex-shrink: 0;
  max-height: 320px;
  display: flex;
  flex-direction: column;
}

.chat-search-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid #f0ebe0;
}

.chat-search-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.chat-search-input:focus {
  border-color: #10606d;
  box-shadow: 0 0 0 2px rgba(16, 96, 109, 0.12);
}

.chat-search-close {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  color: #888;
}

.chat-search-results {
  overflow-y: auto;
  padding: 0.3rem 1rem 0.5rem;
}

.chat-search-result {
  padding: 0.4rem 0;
  border-bottom: 1px solid #f0ebe0;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s;
}

.chat-search-result:hover {
  background: rgba(16, 96, 109, 0.05);
}

.chat-search-result:last-child {
  border-bottom: none;
}

.chat-search-result strong {
  font-size: 0.8rem;
  color: #1a1a1a;
}

.chat-search-result time {
  font-size: 0.68rem;
  color: #aaa;
  margin-left: 0.35rem;
}

.chat-search-result p {
  font-size: 0.78rem;
  color: #555;
  margin: 0.15rem 0 0;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-search-empty {
  padding: 0.8rem 0;
  text-align: center;
  color: #aaa;
  font-size: 0.82rem;
}

/* ── Message highlight (search jump) ── */

.chat-message--highlight {
  animation: chat-highlight-flash 2s ease-out;
}

@keyframes chat-highlight-flash {
  0%, 30% { background: rgba(16, 96, 109, 0.12); }
  100% { background: transparent; }
}

/* ── Toast container ── */

.chat-toast-container {
  position: absolute;
  bottom: 5rem;
  right: 1rem;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
}

.chat-toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  pointer-events: auto;
  animation: chat-toast-in 0.25s ease-out;
  transition: opacity 0.4s;
}

.chat-toast--success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.chat-toast--danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.chat-toast--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.chat-toast--fade {
  opacity: 0;
}

.chat-toast-close {
  border: none;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  margin-left: auto;
  line-height: 1;
}

.chat-toast-close:hover {
  opacity: 1;
}

@keyframes chat-toast-in {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Jump to latest button ── */

.chat-jump-latest {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 0.78rem;
  font-weight: 600;
  color: #10606d;
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
}

.chat-jump-latest:hover {
  background: #f0f9f7;
  box-shadow: 0 4px 12px rgba(0,0,0,0.14);
}

/* ── Drag-and-drop overlay ── */

.chat-main.chat-drag-over {
  outline: 2px dashed #10606d;
  outline-offset: -4px;
  background: rgba(16, 96, 109, 0.04);
}

.chat-message-reply-ref {
  display: flex;
  align-items: stretch;
  gap: 0;
  font-size: 0.78rem;
  color: #888;
  margin-left: 2.1rem;
  margin-bottom: 0.25rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s;
}

.chat-message-reply-ref:hover {
  background: rgba(0,0,0,0.03);
}

.chat-reply-line {
  width: 2px;
  min-height: 100%;
  border-radius: 1px;
  background: #10606d;
  flex-shrink: 0;
  margin-right: 0.5rem;
  opacity: 0.5;
}

.chat-reply-ref-body {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.4rem 0.2rem 0;
  min-width: 0;
}

.chat-reply-ref-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0b3f4a;
  color: #9fe3d7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-reply-author {
  font-weight: 600;
  color: #10606d;
  white-space: nowrap;
}

.chat-reply-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
  color: #777;
}

.chat-message-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-message-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chat-message-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0b3f4a;
  color: #9fe3d7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-message-author {
  font-size: 0.85rem;
  color: #1a1a1a;
}

.chat-message-time {
  font-size: 0.7rem;
  color: #aaa;
}

.chat-message-pin-badge {
  font-size: 0.7rem;
}

.chat-message-content {
  padding-left: 2.1rem;
  font-size: 0.88rem;
  color: #333;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-message-actions {
  position: absolute;
  top: 0.25rem;
  right: 0.4rem;
  display: flex;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity 0.12s;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 0.1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.chat-msg-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: #888;
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.12s, color 0.12s;
}

.chat-msg-action-btn:hover {
  background: #f0f0f0;
  color: #333;
}

.chat-delete-btn:hover {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.chat-no-messages {
  color: #607d82;
  font-size: 0.9rem;
}

/* ── Reply bar ── */

.chat-reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1rem;
  background: #f0f9f7;
  border-top: 1px solid #d1e8e3;
  font-size: 0.8rem;
  color: #555;
  flex-shrink: 0;
}

.chat-reply-bar-content {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow: hidden;
}

.chat-reply-bar-close {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  color: #888;
  padding: 0 0.3rem;
}

/* ── Message input ── */

.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  font-family: inherit;
  line-height: 1.4;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s;
}

.chat-input:focus {
  border-color: #10606d;
  box-shadow: 0 0 0 2px rgba(16, 96, 109, 0.12);
}

.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: #0b3f4a;
  color: #9fe3d7;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #10606d;
}

/* ── Empty state ── */

.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: #aaa;
}

/* ── Pinned panel ── */

.chat-pinned-panel,
.chat-members-panel {
  border-bottom: 1px solid #e5e7eb;
  background: #fefdf8;
  max-height: 220px;
  overflow-y: auto;
  flex-shrink: 0;
}

.chat-pinned-panel-header,
.chat-members-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
  border-bottom: 1px solid #f0ebe0;
}

.chat-pinned-close,
.chat-members-close {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  color: #888;
}

.chat-pinned-list,
.chat-members-list {
  padding: 0.3rem 1rem 0.5rem;
}

.chat-pinned-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f5f0e5;
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s;
}

.chat-pinned-item:hover {
  background: rgba(0,0,0,0.04);
}

.chat-pinned-item:last-child {
  border-bottom: none;
}

.chat-pinned-item time {
  font-size: 0.7rem;
  color: #aaa;
}

.chat-member-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0;
  font-size: 0.85rem;
}

.chat-member-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-member-role {
  margin-left: auto;
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  background: rgba(16, 96, 109, 0.08);
  color: #10606d;
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-member-presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  flex-shrink: 0;
}

.chat-member-item--online .chat-member-presence-dot {
  background: #43b581;
}

.chat-member-item--recent .chat-member-presence-dot {
  background: #f59e0b;
}

.chat-member-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0b3f4a;
  color: #9fe3d7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
}

/* ── Modals ── */

.chat-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-modal {
  background: #fff;
  border-radius: 10px;
  width: 400px;
  max-width: 92vw;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  overflow: hidden;
}

.chat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 700;
  font-size: 0.92rem;
}

.chat-modal-close {
  border: none;
  background: transparent;
  font-size: 1.3rem;
  cursor: pointer;
  color: #888;
  line-height: 1;
}

.chat-modal-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.chat-modal-footer {
  padding: 0.65rem 1rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}

.chat-form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-form-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.chat-form-input:focus {
  border-color: #10606d;
  box-shadow: 0 0 0 2px rgba(16, 96, 109, 0.12);
}

.chat-form-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #555;
  cursor: pointer;
  margin-top: 0.2rem;
}

.chat-form-toggle input[type="checkbox"] {
  accent-color: #0b3f4a;
}

.chat-form-error {
  font-size: 0.8rem;
  color: #dc3545;
  min-height: 1rem;
}

.chat-modal-btn {
  border: none;
  border-radius: 6px;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.chat-modal-btn--primary {
  background: #0b3f4a;
  color: #fff;
}

.chat-modal-btn--primary:hover {
  background: #10606d;
}

/* ── Dark mode: Chat ── */

.dark-mode .chat-page {
  background: #0c1a1e;
}

.dark-mode .chat-sidebar {
  background: #08181c;
  border-right-color: rgba(127, 215, 199, 0.08);
}

.dark-mode .chat-main {
  background: #111e22;
}

.dark-mode .chat-channel-header {
  border-bottom-color: rgba(255,255,255,0.08);
}

.dark-mode .chat-channel-header-name {
  color: #e0e0e0;
}

.dark-mode .chat-channel-header-desc {
  color: rgba(255,255,255,0.4);
}

.dark-mode .chat-channel-role-badge {
  background: rgba(127, 215, 199, 0.12);
  color: #7fd7c7;
}

.dark-mode .chat-channel-role-badge--admin {
  background: rgba(217, 119, 6, 0.16);
  color: #fbbf24;
}

.dark-mode .chat-channel-role-badge--ägare {
  background: rgba(127, 215, 199, 0.18);
  color: #d1faf0;
}

.dark-mode .chat-channel-permission-hint {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
}

.dark-mode .chat-header-btn {
  color: rgba(255,255,255,0.5);
}

.dark-mode .chat-header-btn:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
}

.dark-mode .chat-message:hover {
  background: rgba(255,255,255,0.03);
}

.dark-mode .chat-message--pinned {
  background: rgba(217, 119, 6, 0.06);
}

.dark-mode .chat-no-messages {
  border-color: rgba(127, 215, 199, 0.12);
  background: linear-gradient(135deg, rgba(14, 34, 40, 0.88), rgba(8, 24, 28, 0.82));
  color: rgba(255,255,255,0.58);
}

.dark-mode .chat-no-messages h3 {
  color: #e2e8f0;
}

.dark-mode .chat-new-divider {
  color: #e85d6f;
}

.dark-mode .chat-new-divider::before,
.dark-mode .chat-new-divider::after {
  background: #e85d6f;
}

.dark-mode .chat-reaction-chip {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
}

.dark-mode .chat-reaction-chip:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

.dark-mode .chat-reaction-chip--mine {
  background: rgba(127, 215, 199, 0.1);
  border-color: rgba(127, 215, 199, 0.3);
}

.dark-mode .chat-reaction-count {
  color: rgba(255,255,255,0.6);
}

.dark-mode .chat-reaction-add {
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.3);
}

.dark-mode .chat-reaction-add:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.6);
}

.dark-mode .chat-emoji-picker {
  background: #14282e;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.dark-mode .chat-emoji-btn:hover {
  background: rgba(255,255,255,0.08);
}

.dark-mode .chat-link {
  color: #7fd7c7;
}

.dark-mode .chat-link:hover {
  color: #9fe3d7;
}

.dark-mode .chat-link-preview {
  background: rgba(255,255,255,0.04);
  border-left-color: #7fd7c7;
}

.dark-mode .chat-link-preview-title {
  color: #7fd7c7;
}

.dark-mode .chat-link-preview-desc {
  color: rgba(255,255,255,0.5);
}

.dark-mode .chat-message-edited {
  color: rgba(255,255,255,0.35);
}

.dark-mode .chat-edit-textarea {
  background: #0c1a1e;
  border-color: #10606d;
  color: #e0e0e0;
}

.dark-mode .chat-edit-cancel:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
}

.dark-mode .chat-search-panel {
  background: #0e2228;
  border-bottom-color: rgba(255,255,255,0.06);
}

.dark-mode .chat-search-panel-header {
  border-bottom-color: rgba(255,255,255,0.06);
}

.dark-mode .chat-search-input {
  background: #0c1a1e;
  border-color: rgba(255,255,255,0.12);
  color: #e0e0e0;
}

.dark-mode .chat-search-result {
  border-bottom-color: rgba(255,255,255,0.04);
}

.dark-mode .chat-search-result:hover {
  background: rgba(127, 215, 199, 0.06);
}

.dark-mode .chat-search-result strong {
  color: #e0e0e0;
}

.dark-mode .chat-search-result p {
  color: rgba(255,255,255,0.6);
}

@keyframes chat-highlight-flash-dark {
  0%, 30% { background: rgba(127, 215, 199, 0.12); }
  100% { background: transparent; }
}

.dark-mode .chat-message--highlight {
  animation-name: chat-highlight-flash-dark;
}

.dark-mode .chat-toast--success {
  background: #0e2a22;
  border-color: rgba(127, 215, 199, 0.2);
  color: #7fd7c7;
}

.dark-mode .chat-toast--danger {
  background: #2a1218;
  border-color: rgba(220, 53, 69, 0.2);
  color: #f87171;
}

.dark-mode .chat-toast--info {
  background: #0e1a2a;
  border-color: rgba(96, 165, 250, 0.2);
  color: #93c5fd;
}

.dark-mode .chat-jump-latest {
  background: #14282e;
  border-color: rgba(255,255,255,0.1);
  color: #7fd7c7;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.dark-mode .chat-jump-latest:hover {
  background: #1a3a42;
}

.dark-mode .chat-main.chat-drag-over {
  outline-color: #7fd7c7;
  background: rgba(127, 215, 199, 0.04);
}

.dark-mode .chat-message-avatar {
  background: #0e4a55;
}

.dark-mode .chat-message-author {
  color: #e0e0e0;
}

.dark-mode .chat-message-content {
  color: rgba(255,255,255,0.8);
}

.dark-mode .chat-message-actions {
  background: #1a2e33;
  border-color: rgba(255,255,255,0.1);
}

.dark-mode .chat-msg-action-btn {
  color: rgba(255,255,255,0.5);
}

.dark-mode .chat-msg-action-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.dark-mode .chat-reply-bar {
  background: #0e2a30;
  border-top-color: rgba(127, 215, 199, 0.1);
  color: rgba(255,255,255,0.6);
}

.dark-mode .chat-input-area {
  background: #111e22;
  border-top-color: rgba(255,255,255,0.08);
}

.dark-mode .chat-input {
  background: #0c1a1e;
  border-color: rgba(255,255,255,0.12);
  color: #e0e0e0;
}

.dark-mode .chat-input:focus {
  border-color: #10606d;
}

.dark-mode .chat-pinned-panel,
.dark-mode .chat-members-panel {
  background: #0e2228;
  border-bottom-color: rgba(255,255,255,0.06);
}

.dark-mode .chat-pinned-panel-header,
.dark-mode .chat-members-panel-header {
  border-bottom-color: rgba(255,255,255,0.06);
}

.dark-mode .chat-pinned-item {
  border-bottom-color: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.7);
}

.dark-mode .chat-pinned-item:hover {
  background: rgba(255,255,255,0.06);
}

.dark-mode .chat-member-name {
  color: rgba(255,255,255,0.78);
}

.dark-mode .chat-member-role {
  background: rgba(127, 215, 199, 0.1);
  color: #7fd7c7;
}

.dark-mode .chat-member-presence-dot {
  background: #64748b;
}

.dark-mode .chat-modal {
  background: #14282e;
  color: #e0e0e0;
}

.dark-mode .chat-modal-header {
  border-bottom-color: rgba(255,255,255,0.08);
}

.dark-mode .chat-modal-footer {
  border-top-color: rgba(255,255,255,0.08);
}

.dark-mode .chat-form-input {
  background: #0c1a1e;
  border-color: rgba(255,255,255,0.12);
  color: #e0e0e0;
}

.dark-mode .chat-form-label {
  color: rgba(255,255,255,0.5);
}

.dark-mode .chat-form-toggle {
  color: rgba(255,255,255,0.6);
}

.dark-mode .chat-empty-state {
  color: rgba(255,255,255,0.3);
}

/* ── Chat mobile ── */

@media (max-width: 700px) {
  html, body {
    min-width: 0;
  }

  .chat-page {
    height: 100svh;
  }

  .chat-body {
    width: 100%;
    min-width: 0;
  }

  .chat-main,
  .chat-channel-header,
  .chat-messages,
  .chat-input-area {
    min-width: 0;
  }

  .chat-channel-header {
    padding: 0.7rem 0.8rem;
  }

  .chat-channel-header-name {
    font-size: 1rem;
  }

  .chat-messages {
    padding: 0.75rem;
  }

  .chat-message {
    padding: 0.55rem 0.5rem;
  }

  .chat-message-content,
  .chat-message-body {
    overflow-wrap: anywhere;
  }

  .chat-input-area {
    padding: 0.6rem max(0.75rem, env(safe-area-inset-right)) max(0.6rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  }

  .chat-input {
    min-width: 0;
    font-size: 16px;
  }

  .chat-sidebar {
    width: 180px;
  }
  .chat-channel-header-desc {
    display: none;
  }
  .chat-reply-preview {
    max-width: 180px;
  }
}

@media (max-width: 480px) {
  .chat-sidebar {
    width: 56px;
  }
  .chat-channel-name,
  .chat-sidebar-title,
  .chat-sidebar-header {
    display: none;
  }
  .chat-sidebar {
    align-items: center;
    padding-top: 0.5rem;
  }
  .chat-channel-item {
    justify-content: center;
    padding: 0.5rem;
  }
}

@media (max-width: 700px) {
  .chat-sidebar {
    width: 260px;
    align-items: stretch;
    padding-top: 0;
  }
  .chat-channel-name,
  .chat-sidebar-title,
  .chat-sidebar-header {
    display: revert;
  }
  .chat-channel-item {
    justify-content: flex-start;
    padding: 0.4rem 0.85rem;
  }
}

/* ── Chat: Image messages ── */

.chat-message-image-wrap {
  padding-left: 2.1rem;
  margin-top: 0.3rem;
}

.chat-message-image {
  max-width: min(420px, 100%);
  max-height: 320px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.chat-message-image:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ── Chat: Image lightbox modal ── */

.chat-image-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
  backdrop-filter: blur(4px);
  animation: chat-image-modal-in 0.2s ease-out;
}

.chat-image-modal.active {
  display: flex;
}

.chat-image-modal-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.chat-image-modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.chat-image-modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

@keyframes chat-image-modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Chat: Attach button ── */

.chat-attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #888;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}

.chat-attach-btn:hover {
  background: #f0f0f0;
  color: #333;
}

/* ── Chat: Image preview bar ── */

.chat-image-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.chat-image-preview img {
  max-height: 80px;
  max-width: 120px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #e0e0e0;
}

.chat-image-preview-remove {
  border: none;
  background: rgba(220, 53, 69, 0.08);
  color: #dc3545;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.12s;
}

.chat-image-preview-remove:hover {
  background: rgba(220, 53, 69, 0.18);
}

.chat-image-preview-edit {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.chat-image-preview-edit:hover span {
  text-decoration: underline;
}

.chat-image-editor {
  width: min(1000px, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 1.25rem;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #24292f;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.35);
}

.chat-image-editor::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.chat-image-editor-header,
.chat-image-editor-toolbar,
.chat-image-editor-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.chat-image-editor-header {
  justify-content: space-between;
}

.chat-image-editor-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.chat-image-editor-toolbar label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-image-editor-stage {
  display: flex;
  justify-content: center;
  padding: 0.5rem;
  overflow: auto;
  background: #e5e7eb;
  border-radius: 6px;
}

.chat-image-editor-stage canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 55dvh;
  object-fit: contain;
  cursor: crosshair;
  touch-action: none;
}

.chat-image-editor-warning {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: #6b7280;
}

.chat-image-editor-status {
  min-height: 1.5em;
  margin: 0.5rem 0;
  font-size: 0.875rem;
}

.chat-image-editor-footer {
  justify-content: flex-end;
  margin-bottom: 0;
}

.chat-image-editor button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dark-mode .chat-image-editor {
  background: #0e2228;
  border-color: rgba(255,255,255,0.12);
  color: #e5e7eb;
}

.dark-mode .chat-image-editor-stage {
  background: #09171b;
}

.dark-mode .chat-image-editor-warning {
  color: #b0bec5;
}

/* ── Dark mode: Chat images & attach ── */

.dark-mode .chat-message-image {
  border-color: rgba(255,255,255,0.08);
}

.dark-mode .chat-message-image:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.dark-mode .chat-attach-btn {
  color: rgba(255,255,255,0.4);
}

.dark-mode .chat-attach-btn:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
}

.dark-mode .chat-image-preview {
  background: #0e2228;
  border-top-color: rgba(255,255,255,0.06);
}

.dark-mode .chat-image-preview img {
  border-color: rgba(255,255,255,0.1);
}

/* ── Dark mode: Improved reply ref ── */

.dark-mode .chat-reply-line {
  background: #7fd7c7;
}

.dark-mode .chat-reply-author {
  color: #7fd7c7;
}

.dark-mode .chat-reply-preview {
  color: rgba(255,255,255,0.4);
}

.dark-mode .chat-reply-ref-avatar {
  background: #0e4a55;
}

.dark-mode .chat-message-reply-ref:hover {
  background: rgba(255,255,255,0.03);
}

/* ── Chat: Date separators ── */

.chat-date-separator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.8rem 0 0.4rem;
  color: #888;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-date-separator::before,
.chat-date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.dark-mode .chat-date-separator {
  color: rgba(255,255,255,0.35);
}

.dark-mode .chat-date-separator::before,
.dark-mode .chat-date-separator::after {
  background: rgba(255,255,255,0.08);
}

/* ── Chat: Continuation hover timestamp ── */

.chat-message-hover-time {
  position: absolute;
  left: 0;
  top: 0.25rem;
  width: 2.1rem;
  text-align: center;
  font-size: 0.62rem;
  color: #aaa;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  font-variant-numeric: tabular-nums;
}

.chat-message:hover .chat-message-hover-time {
  opacity: 1;
}

.dark-mode .chat-message-hover-time {
  color: rgba(255,255,255,0.35);
}

/* ── Chat: @mentions ── */

.chat-mention {
  background: rgba(16, 96, 109, 0.12);
  color: #10606d;
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  font-weight: 600;
}

.dark-mode .chat-mention {
  background: rgba(127, 215, 199, 0.12);
  color: #7fd7c7;
}

/* ── Chat: #channel links ── */

.chat-channel-link {
  background: rgba(16, 96, 109, 0.08);
  color: #10606d;
  padding: 0.05rem 0.25rem;
  border-radius: 3px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s;
}

.chat-channel-link:hover {
  background: rgba(16, 96, 109, 0.18);
  color: #0b3f4a;
}

.dark-mode .chat-channel-link {
  background: rgba(127, 215, 199, 0.08);
  color: #7fd7c7;
}

.dark-mode .chat-channel-link:hover {
  background: rgba(127, 215, 199, 0.18);
  color: #9fe3d7;
}

/* ── Chat: Code blocks ── */

.chat-code-block {
  display: block;
  margin: 0.35rem 0;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  background: #f1f3f5;
  border: 1px solid #e5e7eb;
  font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  color: #333;
}

.chat-code-inline {
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: #f1f3f5;
  border: 1px solid #e5e7eb;
  font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 0.82em;
  color: #c0392b;
}

.dark-mode .chat-code-block {
  background: #0c1a1e;
  border-color: rgba(255,255,255,0.1);
  color: #d4d4d4;
}

.dark-mode .chat-code-inline {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  color: #f87171;
}

/* ── Chat: Delete confirmation toast action buttons ── */

.chat-toast-action {
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.25rem;
  transition: background 0.12s;
}

.chat-toast-action--confirm {
  background: #dc3545;
  color: #fff;
}

.chat-toast-action--confirm:hover {
  background: #b02a37;
}

.chat-toast-action--cancel {
  background: transparent;
  color: inherit;
}

.chat-toast-action--cancel:hover {
  background: rgba(0,0,0,0.08);
}

.dark-mode .chat-toast-action--cancel:hover {
  background: rgba(255,255,255,0.1);
}

/* ── Chat: Mobile sidebar ── */

.chat-mobile-hamburger {
  display: none;
}

.chat-sidebar-overlay {
  display: none;
}

@media (max-width: 700px) {
  .chat-mobile-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 60;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #0b3f4a;
    color: #9fe3d7;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: background 0.15s;
  }

  .chat-mobile-hamburger:hover {
    background: #10606d;
  }

  .chat-sidebar {
    position: fixed;
    left: 0;
    top: 40px;
    bottom: 0;
    z-index: 200;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .chat-sidebar--open {
    transform: translateX(0);
  }

  .chat-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }

  .chat-sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }
}

.dark-mode .chat-mobile-hamburger {
  background: #10606d;
  color: #d1faf0;
}

/* ── Chat: Sidebar online users ── */

.chat-sidebar-online {
  padding: 0.5rem 0.65rem;
  border-top: 1px solid rgba(127, 215, 199, 0.10);
  overflow-y: auto;
  max-height: 180px;
  scrollbar-width: thin;
  scrollbar-color: rgba(127, 215, 199, 0.45) rgba(255, 255, 255, 0.04);
}

.chat-sidebar-online::-webkit-scrollbar {
  width: 8px;
}

.chat-sidebar-online::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.chat-sidebar-online::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(127, 215, 199, 0.72), rgba(16, 96, 109, 0.72));
  border: 2px solid #0e2a30;
  border-radius: 999px;
}

.chat-sidebar-online::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #9fe3d7, #1a8a9a);
}

.chat-sidebar-online-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.35);
  margin-bottom: 0.35rem;
}

.chat-sidebar-online-user {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.24rem 0.28rem;
  border-radius: 0.45rem;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
}

.chat-sidebar-online-avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #9fe3d7;
  font-size: 0.62rem;
  font-weight: 800;
}

.chat-sidebar-online-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sidebar-online-state {
  margin-left: auto;
  color: rgba(255,255,255,0.35);
  font-size: 0.66rem;
  font-weight: 700;
}

.chat-sidebar-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  flex-shrink: 0;
}

.chat-sidebar-online-user--online .chat-sidebar-online-dot {
  background: #43b581;
  box-shadow: 0 0 0 3px rgba(67, 181, 129, 0.14);
}

.chat-sidebar-online-user--recent .chat-sidebar-online-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

/* ── Chat: Sidebar help button ── */

.chat-sidebar-footer {
  padding: 0.5rem 0.65rem;
  border-top: 1px solid rgba(127, 215, 199, 0.10);
  margin-top: auto;
}

.chat-sidebar-help-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #888;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.chat-sidebar-help-btn:hover {
  background: rgba(0,0,0,0.05);
  color: #10606d;
}

.dark-mode .chat-sidebar-footer {
  border-top-color: rgba(255,255,255,0.06);
}

.dark-mode .chat-sidebar-help-btn {
  color: rgba(255,255,255,0.4);
}

.dark-mode .chat-sidebar-help-btn:hover {
  background: rgba(255,255,255,0.06);
  color: #9fe3d7;
}

/* ── Chat: Help modal ── */

.chat-help-modal {
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
}

.chat-help-section {
  margin-bottom: 1.1rem;
}

.chat-help-section h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0 0 0.45rem;
}

.chat-help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
}

.chat-help-table td {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid #f0ede5;
  vertical-align: middle;
}

.chat-help-table td:first-child {
  white-space: nowrap;
  font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
  color: #666;
  width: 40%;
}

.chat-help-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.82rem;
}

.chat-help-list li {
  padding: 0.2rem 0;
}

.chat-help-list kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: #f1f3f5;
  border: 1px solid #ddd;
  font-family: inherit;
  font-size: 0.78em;
  line-height: 1.3;
}

.dark-mode .chat-help-table td {
  border-bottom-color: rgba(255,255,255,0.06);
}

.dark-mode .chat-help-table td:first-child {
  color: rgba(255,255,255,0.5);
}

.dark-mode .chat-help-list kbd {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
}

.agents-page { min-height: 100vh; background: linear-gradient(145deg, #f3faf8, #f8f4ed); color: #12383f; }
.agents-topbar { background: linear-gradient(90deg, #06161b, #0b3f4a 58%, #10606d); }
.agents-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 72px; }
.agents-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.agents-kicker { display: block; margin-bottom: 8px; color: #14808f; font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.agents-heading h1 { margin: 0 0 8px; font-size: clamp(2rem, 5vw, 3.4rem); }
.agents-heading p { max-width: 680px; margin: 0; color: #527078; }
.agents-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.agents-primary-button, .agents-secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px; border: 0; border-radius: 10px; font-weight: 750; text-decoration: none; cursor: pointer; }
.agents-primary-button { background: #0b5966; color: #fff; }
.agents-primary-button:hover { background: #084854; color: #fff; }
.agents-empty { padding: 28px; border: 1px solid rgba(11,89,102,.13); border-radius: 18px; background: rgba(255,255,255,.88); text-align: center; }
.agents-form { display: grid; grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); gap: 18px; }
.agents-form label:not(.agents-check) { display: grid; gap: 7px; color: #315860; font-size: .82rem; font-weight: 750; }
.agents-form input, .agents-form select, .agents-form textarea { width: 100%; min-width: 0; padding: 11px 13px; border: 1px solid #c9dcda; border-radius: 9px; background: #fff; color: #12383f; font: inherit; }
.agents-form textarea { resize: vertical; min-height: 160px; }
.agents-prompt-field { grid-column: 1 / -1; }
.agents-vscode-paste textarea { min-height: 190px; font-family: Consolas, "Liberation Mono", Menlo, monospace; font-size: .86rem; line-height: 1.55; }
.agents-embed-field { display: grid; grid-column: 1 / -1; gap: 12px; }
.agents-input-action { display: flex; gap: 8px; }
.agents-input-action input[readonly] { background: #f7fbfa; color: #315860; }
.agents-icon-button { display: inline-grid; place-items: center; flex: 0 0 44px; min-height: 44px; border: 1px solid #c4d8d6; border-radius: 10px; background: #eef7f5; color: #164d56; cursor: pointer; }
.agents-icon-button:hover { border-color: #8bb7ae; background: #e0efeb; }
.agents-copy-button { flex: 0 0 auto; }
.agents-check { display: flex; grid-column: 1 / -1; align-items: center; gap: 9px; margin: 0; color: #315860; font-size: .88rem; }
.agents-check input { flex: 0 0 17px; width: 17px; height: 17px; padding: 0; }
.agents-list { margin: 0; padding: 0; list-style: none; border: 1px solid #d5e4e1; border-radius: 16px; background: rgba(255,255,255,.92); overflow: hidden; box-shadow: 0 16px 42px rgba(29,74,80,.06); }
.agents-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 24px; padding: 20px 24px; border-bottom: 1px solid #e2ece9; border-left: 3px solid transparent; }
.agents-row:last-child { border-bottom: 0; }
.agents-row--default { border-left-color: #37a38d; }
.agents-row--missing-vscode { border: 1px solid #dc3545; border-left: 4px solid #dc3545; box-shadow: inset 0 0 0 1px rgba(220,53,69,.22), 0 10px 28px rgba(220,53,69,.08); }
.agents-row-details { min-width: 0; }
.agents-row-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.agents-row-heading h2 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.agents-row-model { display: block; margin-top: 6px; color: #315860; font-size: .8rem; }
.agents-row-prompt { margin: 6px 0 0; color: #607a7f; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agents-row-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.agents-row-actions form { margin: 0; }
.agents-default-badge { padding: 5px 9px; border-radius: 999px; background: #daf3ed; color: #0a685f; font-size: .72rem; font-weight: 800; }
.agents-warning-badge { padding: 5px 9px; border-radius: 999px; background: #fde8ea; color: #a6192e; font-size: .72rem; font-weight: 800; }
.agents-secondary-button { border: 1px solid #c4d8d6; background: #eef7f5; color: #164d56; }
.agents-secondary-button:hover { border-color: #8bb7ae; background: #e0efeb; color: #164d56; }
.agents-delete-button { min-height: 42px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: #a33a36; cursor: pointer; }
.agents-delete-button:hover { background: #fff0ef; }
.agents-modal .modal-content { border: 1px solid #d5e4e1; border-radius: 18px; color: #12383f; }
.agents-modal .modal-header, .agents-modal .modal-footer { border-color: #e2ece9; padding: 18px 24px; }
.agents-modal .modal-body { padding: 24px; }
.agents-page :focus-visible, .agents-modal :focus-visible { outline: 3px solid #258da1; outline-offset: 3px; }
.agent-chat-frame-body { height: 100vh; margin: 0; overflow: hidden; background: #edf6f4; color: #173b42; font-family: Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif; }
.agent-chat-frame { display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; width: 100%; height: 100vh; background: linear-gradient(180deg,#f9fcfb,#edf6f4); }
.agent-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid #d7e6e3; background: rgba(255,255,255,.9); }
.agent-chat-header h1 { margin: 2px 0 0; font-size: 1rem; }
.agent-chat-header-actions { display: flex; align-items: center; gap: 9px; }
.agent-chat-header select, .agent-chat-new { max-width: 240px; padding: 7px 9px; border: 1px solid #cbdedb; border-radius: 8px; background: #fff; color: #315860; font-size: .78rem; text-decoration: none; }
.agent-chat-messages { min-height: 0; padding: 22px clamp(14px,4vw,36px); overflow-y: auto; scroll-behavior: smooth; }
.agent-chat-welcome, .agent-chat-empty { max-width: 520px; margin: auto; padding: 40px 24px; text-align: center; }
.agent-chat-message { width: fit-content; max-width: min(760px,88%); margin: 0 0 16px; }
.agent-chat-message--user { margin-left: auto; }
.agent-chat-message span { display: block; margin: 0 8px 5px; color: #668086; font-size: .7rem; font-weight: 750; }
.agent-chat-message p { margin: 0; padding: 12px 15px; border: 1px solid #d2e2df; border-radius: 4px 15px 15px; background: #fff; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-chat-message--user p { border-color: #0b5966; border-radius: 15px 4px 15px 15px; background: #0b5966; color: #fff; }
.agent-chat-thinking { display: flex; align-items: center; gap: 5px; color: #527078; font-size: .75rem; }
.agent-chat-thinking span { width: 6px; height: 6px; border-radius: 50%; background: #1692a1; animation: agent-chat-pulse 1s infinite alternate; }
.agent-chat-thinking--hidden, .agent-chat-error--hidden { display: none; }
@keyframes agent-chat-pulse { from { opacity: .25; } to { opacity: 1; transform: translateY(-2px); } }
.agent-chat-error { padding: 8px 18px; background: #fff0ef; color: #9b302c; font-size: .8rem; }
.agent-chat-compose { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 10px; padding: 13px clamp(14px,4vw,36px) 16px; border-top: 1px solid #d7e6e3; background: rgba(255,255,255,.94); }
.agent-chat-compose textarea { padding: 12px 14px; border: 1px solid #c7dad7; border-radius: 12px; resize: none; color: #173b42; font: inherit; }
.agent-chat-compose button { display: grid; place-items: center; border: 0; border-radius: 12px; background: #0b5966; color: #fff; cursor: pointer; }
.agent-chat-compose button:disabled { cursor: wait; opacity: .45; }
@media (max-width: 760px) { .agents-heading { align-items: flex-start; flex-direction: column; } .agents-heading-actions, .agents-row-actions { justify-content: flex-start; } .agents-form, .agents-row { grid-template-columns: 1fr; } .agents-row { gap: 16px; padding: 18px; } .agents-modal .modal-body { padding: 18px; } .agent-chat-header select { max-width: 135px; } }

@media (max-width: 700px), (max-device-width: 700px), (pointer: coarse) and (max-width: 1024px) {
  html,
  body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .chat-page {
    width: 100%;
    max-width: 100vw;
    height: 100svh;
    min-width: 0;
  }

  .chat-topbar,
  .chat-body,
  .chat-main,
  .chat-channel-header,
  .chat-messages,
  .chat-input-area {
    width: 100%;
    min-width: 0;
    max-width: 100vw;
  }

  .chat-body {
    display: block;
    position: relative;
  }

  .chat-main {
    height: 100%;
  }

  .chat-sidebar {
    position: fixed;
    top: 40px;
    bottom: 0;
    left: 0;
    z-index: 200;
    width: min(82vw, 300px);
    max-width: calc(100vw - 44px);
    transform: translateX(-100%);
  }

  .chat-sidebar.chat-sidebar--open {
    transform: translateX(0);
  }

  .chat-mobile-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: max(1rem, env(safe-area-inset-bottom));
    left: max(1rem, env(safe-area-inset-left));
    z-index: 60;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #0b3f4a;
    color: #9fe3d7;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  }

  .chat-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }

  .chat-sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .create-topbar-content {
    min-width: 0;
    overflow: hidden;
  }

  .create-topbar-content .projects-topbar-usage,
  .create-topbar-content .projects-topbar-logout {
    display: none;
  }

  .create-topbar-title {
    min-width: 0;
    overflow: hidden;
  }

  .chat-channel-header-actions {
    flex-shrink: 1;
  }

  .chat-header-btn span,
  .chat-channel-header-desc {
    display: none;
  }

  .chat-input {
    min-width: 0;
    font-size: 16px;
  }
}

html.is-mobile-layout,
html.is-mobile-layout body {
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

html.is-mobile-layout .chat-page {
  width: 100%;
  max-width: 100vw;
  height: 100svh;
  min-width: 0;
}

html.is-mobile-layout .chat-topbar,
html.is-mobile-layout .chat-body,
html.is-mobile-layout .chat-main,
html.is-mobile-layout .chat-channel-header,
html.is-mobile-layout .chat-messages,
html.is-mobile-layout .chat-input-area {
  width: 100%;
  min-width: 0;
  max-width: 100vw;
}

html.is-mobile-layout .chat-body {
  display: block;
  position: relative;
}

html.is-mobile-layout .chat-main {
  height: 100%;
}

html.is-mobile-layout .chat-sidebar {
  position: fixed;
  top: 40px;
  bottom: 0;
  left: 0;
  z-index: 200;
  width: min(82vw, 300px);
  max-width: calc(100vw - 44px);
  transform: translateX(-100%);
}

html.is-mobile-layout .chat-sidebar.chat-sidebar--open {
  transform: translateX(0);
}

html.is-mobile-layout .chat-mobile-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: max(1rem, env(safe-area-inset-left));
  z-index: 60;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #0b3f4a;
  color: #9fe3d7;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

html.is-mobile-layout .chat-sidebar-overlay {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

html.is-mobile-layout .chat-sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

html.is-mobile-layout .create-topbar-content {
  min-width: 0;
  overflow: hidden;
}

html.is-mobile-layout .create-topbar-content .projects-topbar-usage,
html.is-mobile-layout .create-topbar-content .projects-topbar-logout {
  display: none;
}

html.is-mobile-layout .create-topbar-title {
  min-width: 0;
  overflow: hidden;
}

html.is-mobile-layout .chat-channel-header-actions {
  flex-shrink: 1;
}

html.is-mobile-layout .chat-header-btn span,
html.is-mobile-layout .chat-channel-header-desc {
  display: none;
}

html.is-mobile-layout .chat-input {
  min-width: 0;
  font-size: 16px;
}
