:root {
  --bg: #f6f6fb;
  --bg-alt: #eceefa;
  --surface: #ffffff;
  --surface-2: #fbfbff;
  --text: #14151c;
  --text-soft: #40424f;
  --muted: #767a8a;
  --border: #e8e9f2;
  --border-soft: #eff0f8;
  --accent: #6d5efc;
  --accent-2: #ff6fae;
  --accent-dark: #5847e6;
  --accent-soft: #efeaff;
  --ring: rgba(109, 94, 252, 0.3);
  --success: #17a34a;
  --success-soft: #e7f7ec;
  --error: #e0483f;
  --error-soft: #fdeceb;
  --warn: #d68a1a;
  --warn-soft: #fdf1de;
  --code-bg: #14151c;
  --code-text: #e7e8f1;
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 40, 0.05);
  --shadow: 0 6px 20px rgba(24, 20, 60, 0.07);
  --shadow-lg: 0 20px 60px rgba(24, 20, 60, 0.16);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #0d0e13;
  --bg-alt: #14151d;
  --surface: #181920;
  --surface-2: #1c1d26;
  --text: #eef0f8;
  --text-soft: #c7c9d6;
  --muted: #8b8fa3;
  --border: #272834;
  --border-soft: #1f212b;
  --accent: #8b7bff;
  --accent-2: #ff85bd;
  --accent-dark: #a596ff;
  --accent-soft: #241f3a;
  --ring: rgba(139, 123, 255, 0.35);
  --success: #4ade80;
  --success-soft: #16281e;
  --error: #f2685f;
  --error-soft: #2e1a1a;
  --warn: #f0b429;
  --warn-soft: #302512;
  --code-bg: #0a0b10;
  --code-text: #d8dae6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0e13;
    --bg-alt: #14151d;
    --surface: #181920;
    --surface-2: #1c1d26;
    --text: #eef0f8;
    --text-soft: #c7c9d6;
    --muted: #8b8fa3;
    --border: #272834;
    --border-soft: #1f212b;
    --accent: #8b7bff;
    --accent-2: #ff85bd;
    --accent-dark: #a596ff;
    --accent-soft: #241f3a;
    --ring: rgba(139, 123, 255, 0.35);
    --success: #4ade80;
    --success-soft: #16281e;
    --error: #f2685f;
    --error-soft: #2e1a1a;
    --warn: #f0b429;
    --warn-soft: #302512;
    --code-bg: #0a0b10;
    --code-text: #d8dae6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* ---------- Shared bits ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 2px 8px rgba(109, 94, 252, 0.35);
  flex-shrink: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.ghost-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: all 0.15s ease;
}

.ghost-icon-btn:hover {
  border-color: var(--border);
  color: var(--accent);
  background: var(--surface);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.4rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 8px 22px rgba(109, 94, 252, 0.35);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(109, 94, 252, 0.42);
}

.primary-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ---------- Scrollbars ---------- */

.chat-scroll::-webkit-scrollbar,
.dashboard-main::-webkit-scrollbar,
.gen-log-box::-webkit-scrollbar,
.project-log-box::-webkit-scrollbar {
  width: 8px;
}

.chat-scroll::-webkit-scrollbar-thumb,
.dashboard-main::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

.gen-log-box::-webkit-scrollbar-thumb,
.project-log-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}

/* ================= WEBSITES GRID (shared by the dashboard) ================= */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.project-card {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  text-align: left;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
  animation: rise 0.3s ease both;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--ring);
}

.project-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 3px 10px rgba(109, 94, 252, 0.3);
}

.project-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.project-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.project-card-cloud-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-projects {
  text-align: center;
  padding: 4rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.empty-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(109, 94, 252, 0.35);
  margin-bottom: 1.2rem;
}

.empty-projects h2 {
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
}

.empty-projects p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ================= CREATE WEBSITE VIEW ================= */

.header-spacer {
  width: 34px;
  flex-shrink: 0;
}

.create-view {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.create-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.create-card {
  width: 100%;
  max-width: 460px;
  height: fit-content;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.75rem 1.5rem;
  animation: rise 0.3s ease both;
}

/* ================= PROJECT VIEW ================= */

.project-view {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.project-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  border: none;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.back-btn:hover {
  color: var(--accent);
  background: var(--bg-alt);
}

.project-header-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-header-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  text-decoration: none;
  transition: all 0.15s ease;
}

.status-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.status-pill:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.status-pill:focus-visible,
.ghost-icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.live-pill {
  border-color: var(--success-soft);
  background: var(--success-soft);
  color: var(--success);
  font-weight: 700;
}

.live-pill:hover {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(23, 163, 74, 0.28);
}

.live-pill:hover .live-dot {
  background: #fff;
  animation: none;
}

.live-pill .pill-arrow {
  opacity: 0.7;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.live-pill:hover .pill-arrow {
  opacity: 1;
  transform: translate(1px, -1px);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: pulse 1.8s infinite ease-in-out;
}

/* ---------- Publish button ---------- */

.publish-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.publish-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 6px 18px rgba(109, 94, 252, 0.32);
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.publish-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(109, 94, 252, 0.4);
}

.publish-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.publish-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring), 0 6px 18px rgba(109, 94, 252, 0.32);
}

.publish-btn:disabled {
  cursor: not-allowed;
}

.publish-btn.busy {
  background: linear-gradient(135deg, var(--warn), var(--warn));
  box-shadow: none;
}

.publish-btn.busy .publish-btn-icon {
  animation: spin 1s linear infinite;
}

.publish-btn.published {
  background: linear-gradient(135deg, var(--success), var(--success));
  box-shadow: none;
}

.publish-caption {
  font-size: 0.72rem;
  color: var(--muted);
  min-height: 1em;
  max-width: 220px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-btn {
  width: 36px;
  height: 36px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Split layout ---------- */

.split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 420px 1fr;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
}

.chat-scroll:empty::before {
  content: "Describe the site you want, or a change to make, and I'll get started.";
  margin: auto;
  max-width: 240px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.preview-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface-2);
}

/* ---------- Chat messages ---------- */

.chat-turn {
  margin-bottom: 1.5rem;
  animation: rise 0.35s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.user-msg {
  justify-content: flex-end;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}

.avatar-user {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.avatar-assistant {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 3px 10px rgba(109, 94, 252, 0.3);
}

.avatar-spark {
  width: 9px;
  height: 9px;
  background: #fff;
  border-radius: 3px;
  opacity: 0.95;
  transform: rotate(45deg);
}

.msg-bubble {
  max-width: 260px;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 4px var(--radius);
  padding: 0.65rem 0.9rem;
}

.msg-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-content {
  flex: 1;
  min-width: 0;
  padding-top: 0.25rem;
}

.gen-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 26px;
}

.dots {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.4s infinite ease-in-out both;
}

.dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0.4);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.gen-status-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gen-timer {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
}

.gen-summary {
  margin: 0.1rem 0 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

.details-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.2rem 0;
}

.details-toggle:hover {
  color: var(--accent);
}

.details-toggle .chevron {
  transition: transform 0.2s ease;
}

.details-toggle.open .chevron {
  transform: rotate(180deg);
}

.gen-log-box {
  margin: 0.6rem 0 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.gen-error {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-top: 0.5rem;
  padding: 0.65rem 0.8rem;
  background: var(--error-soft);
  color: var(--error);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
}

.gen-error-text {
  margin: 0;
  line-height: 1.5;
}

/* System (activity) messages: GitHub push / Cloudflare deploy */

.system-turn {
  margin-bottom: 1.1rem;
}

.system-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0 auto;
  max-width: 100%;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
}

.system-msg-icon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.system-turn.busy .system-msg-icon {
  background: var(--warn);
  animation: pulse 1.2s infinite ease-in-out;
}

.system-turn.success .system-msg {
  color: var(--success);
  border-color: var(--success-soft);
}

.system-turn.success .system-msg-icon {
  background: var(--success);
}

.system-turn.error .system-msg {
  color: var(--error);
  border-color: var(--error-soft);
}

.system-turn.error .system-msg-icon {
  background: var(--error);
}

.system-msg-link {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- Composer ---------- */

.composer {
  padding: 0.9rem 1.25rem 1.1rem;
  flex-shrink: 0;
}

.composer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0.55rem 0.65rem 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.composer-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  padding: 0.1rem 0.5rem 0.35rem;
  max-height: 160px;
  font-family: inherit;
}

.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.1rem 0.35rem 0;
}

.composer-hint {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-hint kbd {
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05rem 0.3rem;
  font-size: 0.66rem;
}

.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(109, 94, 252, 0.4);
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.03);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Preview pane ---------- */

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.toolbar-url {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-spacer {
  flex: 1;
}

.viewport-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.viewport-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  transition: all 0.15s ease;
}

.viewport-btn:hover {
  color: var(--text);
}

.viewport-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--accent);
}

.icon-btn.run-btn:hover {
  color: var(--success);
}

.icon-btn.stop-btn:hover {
  color: var(--error);
}

.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Create project modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(13, 14, 19, 0.45);
  backdrop-filter: blur(4px);
  animation: modal-fade-in 0.16s ease;
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem 1.75rem 1.5rem;
  animation: modal-pop-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes modal-pop-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text);
}

.modal-header {
  padding-right: 1.5rem;
  margin-bottom: 1.3rem;
}

.modal-header-mark {
  display: inline-block;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px rgba(109, 94, 252, 0.35);
  margin-bottom: 0.7rem;
}

.modal-header h2 {
  margin: 0 0 0.3rem;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal-header p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.modal-field {
  margin-bottom: 1rem;
}

.modal-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 0.4rem;
}

.modal-input,
.modal-textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.75rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.modal-input:focus,
.modal-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.modal-input.available {
  border-color: var(--success);
}

.modal-input.available:focus {
  box-shadow: 0 0 0 3px var(--success-soft);
}

.modal-input.taken {
  border-color: var(--error);
}

.modal-input.taken:focus {
  box-shadow: 0 0 0 3px var(--error-soft);
}

.modal-textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}

.modal-name-status {
  min-height: 1rem;
  font-size: 0.76rem;
  font-weight: 600;
  margin-top: 0.4rem;
  padding-left: 0.1rem;
}

.modal-name-status.checking {
  color: var(--muted);
}

.modal-name-status.available {
  color: var(--success);
}

.modal-name-status.taken {
  color: var(--error);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.modal-cancel-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  transition: all 0.15s ease;
}

.modal-cancel-btn:hover {
  background: var(--bg-alt);
  border-color: var(--muted);
}

.modal-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Create form: optional details + style picker ---------- */

.create-card--wide {
  max-width: 700px;
}

.modal-optional-tag {
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
}

.modal-field-hint {
  margin: -0.15rem 0 0.7rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.modal-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

@media (max-width: 560px) {
  .modal-field-row {
    grid-template-columns: 1fr;
  }
}

.modal-field--styles {
  margin-bottom: 1.4rem;
}

.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 2.5rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tag-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.25rem 0.35rem 0.25rem 0.65rem;
  animation: tag-pop-in 0.12s ease both;
}

@keyframes tag-pop-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.tag-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.tag-chip-remove:hover {
  background: color-mix(in srgb, currentColor 20%, transparent);
}

.tag-input-field {
  flex: 1 1 90px;
  min-width: 90px;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.25rem 0.1rem;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}

@media (max-width: 560px) {
  .style-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.style-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.style-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.style-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
  background: var(--accent-soft);
}

.style-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  margin-bottom: 0.5rem;
}

.style-thumb-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.style-card-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.style-card-desc {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

/* ---------- Restore overlay ---------- */

.pull-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem 1.75rem;
  text-align: center;
  animation: modal-pop-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.pull-spinner {
  display: flex;
  justify-content: center;
  margin-bottom: 1.1rem;
}

.pull-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  font-weight: 800;
}

.pull-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.pull-card p.error-text {
  color: var(--error);
}

.pull-card .modal-cancel-btn {
  margin-top: 1.2rem;
}

/* ---------- Version history panel ---------- */

.version-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  justify-content: flex-end;
  background: rgba(13, 14, 19, 0.45);
  backdrop-filter: blur(4px);
  animation: modal-fade-in 0.16s ease;
}

.version-panel {
  width: 100%;
  max-width: 380px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  animation: panel-slide-in 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes panel-slide-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.version-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.version-panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.version-panel-hint {
  margin: 0 0 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.version-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.version-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.version-row-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.version-row-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.version-row:first-child .version-row-dot {
  background: var(--success);
}

.version-row-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.version-row-label {
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.version-row-time {
  font-size: 0.74rem;
  color: var(--muted);
}

.version-current-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.version-preview-btn {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.7rem;
  background: var(--surface);
  transition: all 0.15s ease;
}

.version-preview-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.version-empty {
  text-align: center;
  padding: 2rem 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Version preview overlay ---------- */

.version-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  animation: modal-fade-in 0.16s ease;
}

.version-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.version-preview-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-soft);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.version-preview-back:hover {
  background: var(--bg-alt);
  color: var(--accent);
}

.version-preview-title {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
}

.version-preview-label {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.version-preview-time {
  font-size: 0.74rem;
  color: var(--muted);
}

.version-preview-body {
  flex: 1;
  min-height: 0;
  background: var(--surface-2);
}

.version-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
}

.version-preview-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.version-current-tag {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--success);
}

.preview-body {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--surface-2);
}

.preview-placeholder,
.preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: var(--muted);
  text-align: center;
  padding: 2rem;
}

.preview-placeholder svg {
  opacity: 0.55;
}

.placeholder-text {
  margin: 0;
  font-size: 0.88rem;
  max-width: 320px;
}

.shimmer {
  width: 64%;
  max-width: 220px;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border) 25%, var(--border-soft) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.preview-loading-text {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
}

.preview-frame-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 0;
  transition: padding 0.2s ease;
}

.preview-frame {
  border: none;
  background: #fff;
  width: 100%;
  height: 100%;
  transition: width 0.2s ease, height 0.2s ease, border-radius 0.2s ease;
}

.preview-frame-wrap[data-viewport="tablet"],
.preview-frame-wrap[data-viewport="mobile"] {
  padding: 1.5rem;
  background: var(--bg-alt);
}

.preview-frame-wrap[data-viewport="tablet"] .preview-frame {
  width: 768px;
  height: 100%;
  max-height: 1024px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.preview-frame-wrap[data-viewport="mobile"] .preview-frame {
  width: 390px;
  height: 100%;
  max-height: 844px;
  border-radius: 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.project-log-box {
  margin: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--code-bg);
  color: var(--code-text);
  border-top: 1px solid var(--border);
  padding: 0.75rem 0.9rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  flex-shrink: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 42vh) 1fr;
  }

  .chat-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .project-header {
    flex-wrap: wrap;
  }

  .project-header-title {
    order: -1;
    flex-basis: 100%;
  }
}

@media (max-width: 640px) {
  .msg-bubble {
    max-width: 190px;
  }

  .project-header-status .pill-label {
    display: none;
  }

  .status-pill {
    padding: 0.4rem;
  }

  .live-pill .pill-label {
    display: inline;
  }

  .live-pill .pill-arrow,
  .header-divider {
    display: none;
  }

  .publish-caption {
    display: none;
  }

  .version-panel {
    max-width: 100%;
  }
}

/* ================= DASHBOARD + SIDEBAR ================= */

.dashboard-shell {
  height: 100vh;
  display: flex;
  overflow: hidden;
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1rem;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.5rem 1.1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.5rem;
  min-width: 0;
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Account switcher (topbar) ---------- */

.topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 0.15rem;
}

.account-switcher {
  position: relative;
}

.account-switcher-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 40px;
  padding: 0.3rem 0.9rem 0.3rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.account-switcher-trigger:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 4px 14px rgba(109, 94, 252, 0.12);
}

.account-switcher-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.account-switcher-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(109, 94, 252, 0.35);
}

.account-switcher-label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  line-height: 1.2;
}

.account-switcher-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.account-switcher-role {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
}

.account-switcher-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.account-switcher-trigger[aria-expanded="true"] .account-switcher-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.account-switcher-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  width: 270px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.45rem;
  z-index: 60;
  animation: modal-pop-in 0.15s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  transform-origin: top right;
}

@media (max-width: 640px) {
  .account-switcher-label {
    display: none;
  }

  .account-switcher-trigger {
    padding: 0.3rem;
    gap: 0;
  }

  .account-switcher-menu {
    width: 240px;
  }
}

.account-switcher-menu-label {
  display: block;
  padding: 0.4rem 0.55rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-switcher-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.55rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  text-align: left;
  transition: background 0.12s ease;
}

.account-switcher-item:hover {
  background: var(--surface-2);
}

.account-switcher-item.active {
  background: var(--accent-soft);
}

.account-switcher-item:disabled {
  opacity: 0.6;
  cursor: default;
}

.account-switcher-item-avatar {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

.account-switcher-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
}

.account-switcher-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.account-switcher-item-role {
  font-size: 0.7rem;
  color: var(--muted);
}

.account-switcher-item.active svg {
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-toggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  border: none;
  padding: 0;
  background: rgba(10, 10, 20, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.dashboard-main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.dashboard-topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.topbar-spacer {
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dashboard-body {
  flex: 1;
  min-height: 0;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.75rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}

.stat-tile-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-tile-icon-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-tile-icon-success {
  background: var(--success-soft);
  color: var(--success);
}

.stat-tile-icon-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.stat-tile-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat-tile-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.billing-body {
  gap: 2rem;
}

.credit-meter {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.credit-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  transition: width 0.4s ease;
}

/* ---------- Balance hero ---------- */

.billing-hero {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 560px;
  background: linear-gradient(160deg, var(--accent-soft), var(--surface) 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow-sm);
}

.billing-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.billing-hero-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.billing-hero-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: 0.2rem;
}

.billing-hero-value {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.billing-plan-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
}

.billing-hero-meter {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.billing-hero-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.billing-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
}

.billing-hero-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-plan {
  background: var(--accent);
}

.dot-purchased {
  background: var(--success);
}

.billing-hero-renewal {
  color: var(--accent);
}

#refresh-balance {
  width: auto;
  height: auto;
  padding: 0.4rem 0.7rem;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
}

#refresh-balance.spinning svg {
  animation: refresh-spin 0.7s linear infinite;
}

@keyframes refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.billing-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.billing-change-plan-btn,
.billing-buy-credits-btn {
  align-self: flex-start;
  padding: 0.65rem 1.2rem;
  font-size: 0.88rem;
}

.outline-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.75rem 1.4rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface);
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.outline-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(20, 20, 40, 0.08);
}

.outline-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ---------- Change-plan modal ---------- */

.plan-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(13, 14, 19, 0.45);
  backdrop-filter: blur(4px);
  animation: modal-fade-in 0.16s ease;
}

.plan-modal {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  animation: modal-pop-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.plan-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.plan-modal-header .modal-close-btn {
  position: static;
  flex-shrink: 0;
}

.plan-modal-header h2 {
  margin: 0 0 0.3rem;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.plan-modal-sub {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  max-width: 480px;
}

.plan-modal-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: var(--error-soft);
  color: var(--error);
  font-size: 0.85rem;
  font-weight: 600;
}

.plan-modal-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(2px);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.credits-modal {
  max-width: 620px;
}

/* ---------- Shared section chrome ---------- */

.billing-section h2,
.billing-info h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.billing-section-sub {
  margin: 0 0 1.1rem;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 640px;
}

/* ---------- Plan cards ---------- */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  max-width: 920px;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(20, 20, 40, 0.08);
}

.plan-card-skeleton {
  min-height: 172px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: plan-skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes plan-skeleton-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.plan-card-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.plan-card-popular {
  border-color: var(--accent);
}

.plan-card-tag {
  position: absolute;
  top: -10px;
  left: 1.1rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.plan-card-name {
  font-weight: 700;
  font-size: 1rem;
}

.plan-card-price {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.plan-card-price-amount {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.plan-card-price-period {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.plan-card-credits {
  font-size: 0.85rem;
  color: var(--muted);
}

.plan-card-btn {
  margin-top: 0.4rem;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.plan-card-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.plan-card-btn:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: default;
}

/* ---------- Credit packs ---------- */

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  max-width: 720px;
  margin-bottom: 1.1rem;
}

.pack-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 0.75rem;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.pack-card:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(20, 20, 40, 0.08);
}

.pack-card:disabled {
  opacity: 0.6;
  cursor: default;
}

.pack-card-loading {
  opacity: 0.6;
}

.pack-card-credits {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.pack-card-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.pack-card-price {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.credits-modal-success {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 600;
}

.custom-pack-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.3rem 0 1.1rem;
  max-width: 480px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.custom-pack-divider::before,
.custom-pack-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.custom-pack {
  max-width: 480px;
}

.custom-pack label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.custom-pack-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.custom-pack-row input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  font-size: 0.92rem;
}

.custom-pack-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.custom-pack-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.custom-pack-row .primary-btn {
  padding: 0.6rem 1.1rem;
  white-space: nowrap;
}

/* ---------- Info card ---------- */

.billing-info {
  max-width: 700px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
}

.billing-info ul {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.billing-info li {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}

.billing-info li strong {
  color: inherit;
}

.websites-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.websites-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 230px;
  max-width: 380px;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.search-field svg {
  flex-shrink: 0;
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.88rem;
  color: var(--text);
}

/* ---------- Website status pills ---------- */

.project-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.site-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

.site-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.site-status-pill.running,
.site-status-pill.publishing {
  animation: none;
}

.site-status-pill.running .site-status-dot,
.site-status-pill.publishing .site-status-dot {
  animation: pulse 1.8s infinite ease-in-out;
}

.site-status-pill.running {
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent);
}

.site-status-pill.publishing {
  border-color: var(--warn-soft);
  background: var(--warn-soft);
  color: var(--warn);
}

.site-status-pill.published {
  border-color: var(--success-soft);
  background: var(--success-soft);
  color: var(--success);
}

/* ---------- Loading skeleton ---------- */

.project-card-skeleton {
  height: 92px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--border-soft) 25%, var(--border) 50%, var(--border-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.project-grid.is-loading {
  pointer-events: none;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
}

.pagination-summary {
  font-size: 0.82rem;
  color: var(--muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination-page {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.pagination-page:hover {
  background: var(--surface-2);
  color: var(--text);
}

.pagination-page.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-soft);
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }

  .dashboard-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .dashboard-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-backdrop {
    display: block;
  }

  .sidebar-toggle {
    display: flex;
  }
}

@media (max-width: 640px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .websites-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-field {
    min-width: 0;
    max-width: none;
  }
}

/* ================= WEBSITE DETAILS PAGE ================= */

.details-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.details-header .back-btn {
  margin-top: 0.15rem;
}

.details-header-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.details-header-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.details-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.details-slug {
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--mono);
}

.details-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  flex-shrink: 0;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.65rem 0.9rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
  border-radius: var(--radius-sm);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
}

.tab-panel.active {
  display: flex;
}

/* ---------- Detail cards (Overview + Metrics) ---------- */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.detail-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.detail-card-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.detail-card-value {
  font-size: 0.98rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-card-value a {
  color: var(--accent);
  text-decoration: none;
}

.detail-card-value a:hover {
  text-decoration: underline;
}

/* ---------- Tab toolbar / hints ---------- */

.tab-panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tab-panel-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.tab-panel-hint-inline {
  font-weight: 400;
  color: var(--muted);
}

/* ---------- Loading skeletons ---------- */

.tab-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.tab-skeleton-grid .project-card-skeleton {
  height: 84px;
}

.tab-skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tab-skeleton-stack .project-card-skeleton {
  height: 62px;
}

/* ---------- Empty / error states ---------- */

.tab-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tab-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 1rem;
}

.tab-empty-state h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.tab-empty-state p {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 32rem;
}

.tab-error-state {
  text-align: center;
  padding: 2.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.tab-error-state p {
  margin: 0;
  color: var(--error);
  font-size: 0.9rem;
}

/* ---------- Deployment / metrics status pills ---------- */

.site-status-pill.status-success {
  border-color: var(--success-soft);
  background: var(--success-soft);
  color: var(--success);
}

.site-status-pill.status-failure {
  border-color: var(--error-soft);
  background: var(--error-soft);
  color: var(--error);
}

.site-status-pill.status-building {
  border-color: var(--warn-soft);
  background: var(--warn-soft);
  color: var(--warn);
}

.site-status-pill.status-building .site-status-dot {
  animation: pulse 1.8s infinite ease-in-out;
}

.site-status-pill.status-pending {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

/* ---------- Metrics activity chart ---------- */

.metrics-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem 1.4rem;
  box-shadow: var(--shadow-sm);
}

.metrics-chart-card h3 {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.chart-wrap {
  position: relative;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 96px;
  border-bottom: 1px solid var(--border-soft);
}

.chart-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
}

.chart-col:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}

.chart-col:hover .chart-bar,
.chart-col:focus-visible .chart-bar {
  background: var(--accent-dark);
}

.chart-bar {
  width: 100%;
  min-height: 2px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  transition: background 0.12s ease;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  padding-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.chart-tooltip {
  position: absolute;
  bottom: 100%;
  transform: translate(-50%, -8px);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow);
  z-index: 5;
}

.chart-tooltip strong {
  font-size: 0.82rem;
}

.chart-tooltip span {
  opacity: 0.75;
}

/* ---------- Deployment list ---------- */

.deployment-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.deployment-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}

.deployment-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.deployment-row-branch {
  font-weight: 700;
  font-size: 0.88rem;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deployment-row-meta {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deployment-row-duration {
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ---------- Confirm dialog ---------- */

.modal-card--confirm {
  max-width: 380px;
}

.modal-card--confirm .modal-header {
  margin-bottom: 1.4rem;
}

.modal-card--confirm .modal-header p {
  margin-top: 0.3rem;
}

.modal-danger-btn {
  border: 1px solid var(--error);
  background: var(--error);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  transition: all 0.15s ease;
}

.modal-danger-btn:hover {
  filter: brightness(1.08);
}

/* ---------- Domain list ---------- */

.tab-panel-action-btn {
  padding: 0.55rem 1.05rem;
  font-size: 0.85rem;
}

.domain-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.domain-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}

.domain-row-main {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.domain-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.domain-row-hostname {
  font-weight: 700;
  font-size: 0.9rem;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-row-meta {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-row-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.domain-dns-panel {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.domain-dns-heading {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-soft);
}

.dns-record-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
}

.dns-record-label {
  flex-shrink: 0;
  width: 4.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.dns-record-value {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  overflow-x: auto;
  white-space: nowrap;
}

.copy-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Blog list ---------- */

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.blog-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.blog-row:hover {
  border-color: var(--accent-soft);
}

.blog-row-thumb {
  position: relative;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
}

.blog-row-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-row-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.blog-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-top: 0.1rem;
}

.blog-row-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.blog-row-title {
  font-weight: 700;
  font-size: 0.96rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.blog-row-excerpt {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-row-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.blog-row-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  padding-top: 0.1rem;
}

.blog-row-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.blog-row-toggle:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.blog-row-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Blog post editor modal ---------- */

.blog-content-textarea {
  min-height: 220px;
}

/* ---------- Blog publish banner ---------- */
/* Fixed + above the modal layer (z-index 100) so it stays visible even while
   the "New post" modal is open on top of it — otherwise a "done" update
   lands invisibly behind the modal and looks stuck until the page reloads. */

.blog-publish-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 150;
  max-width: min(380px, calc(100vw - 2.5rem));
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}

.blog-publish-banner.busy {
  border-color: var(--warn-soft);
  background: var(--warn-soft);
  color: var(--warn);
}

.blog-publish-banner.busy::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.8s infinite ease-in-out;
  flex-shrink: 0;
}

.blog-publish-banner.success {
  border-color: var(--success-soft);
  background: var(--success-soft);
  color: var(--success);
}

.blog-publish-banner.error {
  border-color: var(--error-soft);
  background: var(--error-soft);
  color: var(--error);
}

/* ---------- Blog integration CTA ---------- */

.blog-integrate-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

.blog-integrate-cta-text h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 800;
}

.blog-integrate-cta-text p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-soft);
  max-width: 40rem;
  line-height: 1.5;
}

.blog-integrate-cta .tab-panel-action-btn {
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .blog-integrate-cta {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .details-header-actions {
    width: 100%;
  }

  .details-header-actions .primary-btn {
    flex: 1;
    justify-content: center;
  }

  .deployment-row {
    flex-wrap: wrap;
  }

  .deployment-row-duration {
    order: 3;
    width: 100%;
    padding-left: 2.6rem;
  }

  .dns-record-row {
    flex-wrap: wrap;
  }

  .dns-record-label {
    width: auto;
  }

  .blog-row {
    flex-wrap: wrap;
  }

  .blog-row-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 0;
  }
}

/* ================= USERS PAGE ================= */

.users-body {
  gap: 1.5rem;
  max-width: 720px;
}

.users-invite-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  background: linear-gradient(160deg, var(--accent-soft), var(--surface) 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow-sm);
}

.users-invite-copy {
  flex: 1;
  min-width: 220px;
}

.users-invite-copy h2 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: 800;
}

.users-invite-copy p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.users-invite-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.users-invite-form input {
  font: inherit;
  min-width: 220px;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.users-invite-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.users-invite-form button {
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.users-invite-message {
  width: 100%;
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.4;
}

.users-invite-message-success {
  background: var(--success-soft);
  color: var(--success);
}

.users-invite-message-error {
  background: var(--error-soft);
  color: var(--error);
}

.users-readonly-note {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.users-section h2 {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  font-weight: 800;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.users-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  box-shadow: var(--shadow-sm);
}

.users-row-skeleton {
  height: 58px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.users-row-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.users-row-avatar-pending {
  background: var(--surface-2);
  color: var(--muted);
}

.users-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.users-row-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.users-row-email {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.users-row-role-badge {
  flex-shrink: 0;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.users-row-role-owner {
  background: var(--accent-soft);
  color: var(--accent);
}

.users-row-role-collaborator {
  background: var(--success-soft);
  color: var(--success);
}

.users-row-you-badge {
  flex-shrink: 0;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.users-row-remove,
.users-row-revoke {
  flex-shrink: 0;
}

.users-row-resend {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

@media (max-width: 560px) {
  .users-invite-card {
    flex-direction: column;
    align-items: stretch;
  }

  .users-invite-form input {
    min-width: 0;
    flex: 1;
  }
}
