*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #171F28;
  --navy-elevated: #243042;
  --red: #DC2626;
  --red-hover: #ef4444;
  --red-deep: #b91c1c;
  --white: #FFFFFF;

  --bg: #171F28;
  --bg-elevated: #243042;
  --surface: rgba(36, 48, 66, 0.92);
  --surface-solid: #243042;
  --surface-hover: #2c3a4f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.82);
  --text-muted: rgba(255, 255, 255, 0.52);
  --primary: #DC2626;
  --primary-hover: #ef4444;
  --primary-light: rgba(220, 38, 38, 0.16);
  --primary-glow: rgba(220, 38, 38, 0.35);
  --accent: #DC2626;
  --accent-2: #f87171;
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.14);
  --danger: #f87171;
  --danger-bg: rgba(220, 38, 38, 0.16);
  --agency: #fca5a5;
  --client: #93c5fd;
  --sidebar-bg: #121920;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-text: rgba(255, 255, 255, 0.55);
  --sidebar-text-active: #FFFFFF;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 28px 64px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 12px 40px var(--primary-glow);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }

/* ─── Login ─── */
#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 15% 10%, rgba(220, 38, 38, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 45% at 90% 90%, rgba(36, 48, 66, 0.9), transparent 50%),
    linear-gradient(155deg, #121920 0%, #171F28 45%, #1a2433 100%);
}

#login-view::before,
#login-view::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}

#login-view::before {
  width: 420px;
  height: 420px;
  top: -120px;
  right: -80px;
  background: rgba(220, 38, 38, 0.2);
}

#login-view::after {
  width: 360px;
  height: 360px;
  bottom: -100px;
  left: -60px;
  background: rgba(36, 48, 66, 0.8);
}

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(36, 48, 66, 0.78);
  backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(220, 38, 38, 0.06);
}

.login-brand { text-align: center; margin-bottom: 36px; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  color: var(--white);
}

.logo.small { font-size: 1.05rem; }

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(145deg, #DC2626 0%, #b91c1c 100%);
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.4);
}

.logo-icon.sm { width: 36px; height: 36px; border-radius: 12px; }
.logo-icon.lg { width: 48px; height: 48px; }

.login-tagline {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

#login-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

#login-form input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  margin-bottom: 18px;
  background: rgba(23, 31, 40, 0.7);
  color: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

#login-form input::placeholder { color: rgba(255, 255, 255, 0.32); }

#login-form input:focus {
  outline: none;
  border-color: rgba(220, 38, 38, 0.7);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 10px;
}

.demo-accounts {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

.demo-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 12px;
}

.demo-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(23, 31, 40, 0.55);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.86rem;
  margin-bottom: 8px;
  transition: all var(--transition);
}

.demo-btn:hover {
  border-color: rgba(220, 38, 38, 0.45);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: var(--white);
}

.demo-role {
  font-weight: 700;
  color: #fca5a5;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(145deg, #DC2626 0%, #b91c1c 100%);
  color: var(--white);
  box-shadow: 0 8px 22px rgba(220, 38, 38, 0.38);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(220, 38, 38, 0.48);
  filter: brightness(1.06);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  border-color: var(--border);
}

.btn-sm { padding: 8px 14px; font-size: 0.82rem; border-radius: 9px; }
.btn-full { width: 100%; }
.upload-btn, .upload-html-btn { cursor: pointer; }

/* ─── Layout ─── */
#main-view {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 272px;
  background: linear-gradient(180deg, #1a2433 0%, var(--sidebar-bg) 100%);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  flex-shrink: 0;
  position: relative;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.45), transparent 40%, transparent 60%, rgba(255, 255, 255, 0.08));
  pointer-events: none;
}

.sidebar-header { padding: 6px 10px 28px; }

.sidebar-nav { flex: 1; }

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.35);
  padding: 0 12px;
  margin-bottom: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 6px;
  font-family: inherit;
  transition: all var(--transition);
  position: relative;
}

.nav-item svg { opacity: 0.75; transition: opacity var(--transition); }

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text-active);
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.22), rgba(220, 38, 38, 0.08));
  color: var(--sidebar-text-active);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.35);
}

.nav-item.active svg { opacity: 1; color: #fca5a5; }

.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding-top: 18px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #DC2626, #991b1b);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.35);
}

.user-name { font-weight: 700; font-size: 0.88rem; color: #f8fafc; }
.user-role { font-size: 0.75rem; color: var(--sidebar-text); }

#logout-btn {
  width: 100%;
  color: var(--sidebar-text);
  border-color: rgba(255, 255, 255, 0.06);
}

#logout-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
}

.content {
  flex: 1;
  padding: 36px 44px 48px;
  overflow-y: auto;
  position: relative;
  background:
    radial-gradient(ellipse 55% 40% at 100% 0%, rgba(220, 38, 38, 0.08), transparent 55%),
    radial-gradient(ellipse 45% 35% at 0% 100%, rgba(36, 48, 66, 0.55), transparent 50%),
    var(--bg);
}

.page { animation: pageIn 0.35s ease; }

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

.page-header { margin-bottom: 32px; }

.page-header.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
  color: var(--white);
  background: none;
  -webkit-text-fill-color: unset;
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 620px;
}

.back-btn {
  background: rgba(36, 48, 66, 0.8);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit;
  transition: all var(--transition);
}

.back-btn:hover {
  color: var(--white);
  border-color: rgba(220, 38, 38, 0.4);
  background: var(--primary-light);
}

/* ─── Cards ─── */
.card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.card-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--white);
}

/* ─── Projects ─── */
.project-grid,
.html-pages-grid {
  gap: 18px;
}

.project-card,
.html-page-card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.project-card::before,
.html-page-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #DC2626, #f87171, transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.project-card:hover,
.html-page-card:hover {
  border-color: rgba(220, 38, 38, 0.35);
  box-shadow: var(--shadow), 0 0 0 1px rgba(220, 38, 38, 0.12);
  transform: translateY(-3px);
  background: var(--surface-hover);
}

.project-card:hover::before,
.html-page-card:hover::before { opacity: 1; }

.project-card.dragging {
  opacity: 0.5;
  transform: scale(0.98) rotate(1deg);
  box-shadow: var(--shadow-lg);
  cursor: grabbing;
}

.project-card.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.drag-handle {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all var(--transition);
}

.drag-handle:hover {
  background: var(--primary-light);
  color: #fca5a5;
}

.drag-handle:active { cursor: grabbing; }

.project-card h3,
.html-page-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: 1;
  margin-bottom: 0;
  color: var(--white);
}

.project-card-meta,
.html-page-card-meta {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.project-card-footer,
.html-page-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.badge-agency {
  background: var(--primary-light);
  color: #fca5a5;
}

.badge-client {
  background: rgba(147, 197, 253, 0.12);
  color: #93c5fd;
}

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
  background: rgba(36, 48, 66, 0.45);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.95rem;
  grid-column: 1 / -1;
}

/* ─── Project detail ─── */
.project-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 24px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.share-link-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(23, 31, 40, 0.55);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  border: 1px solid var(--border);
}

.share-label { color: var(--text-muted); white-space: nowrap; font-weight: 600; }

.share-link-box code {
  background: rgba(23, 31, 40, 0.8);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--border);
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  color: #fca5a5;
}

.share-link-box.full code {
  max-width: 100%;
  word-break: break-all;
  white-space: normal;
  display: block;
}

.detail-layout { max-width: 100%; }

/* ─── Upload zones ─── */
.upload-zone {
  margin: 20px 24px;
  padding: 40px 28px;
  border: 2px dashed rgba(220, 38, 38, 0.28);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-muted);
  transition: all var(--transition);
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.06), transparent);
}

.upload-zone svg { color: #f87171; opacity: 0.85; }

.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: #fecaca;
  transform: scale(1.01);
}

.upload-zone p { margin-top: 14px; font-size: 0.92rem; font-weight: 600; color: var(--text-secondary); }
.upload-hint { font-size: 0.82rem; opacity: 0.8; display: block; margin-top: 6px; }

.html-upload-zone { margin: 0 0 22px; }

/* ─── Files ─── */
.files-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(23, 31, 40, 0.45);
}

.files-count {
  font-size: 0.86rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sort-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 4px;
}

.sort-btn,
.sort-dir-btn {
  border: 1px solid var(--border);
  background: rgba(36, 48, 66, 0.9);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.sort-btn:hover,
.sort-dir-btn:hover {
  border-color: rgba(220, 38, 38, 0.4);
  color: #fca5a5;
}

.sort-btn.active {
  background: var(--primary-light);
  border-color: rgba(220, 38, 38, 0.45);
  color: #fecaca;
}

.sort-dir-btn {
  width: 34px;
  padding: 6px 0;
  font-size: 1rem;
}

.file-ext {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--primary-light);
  color: #fca5a5;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-right: 6px;
  letter-spacing: 0.04em;
}

.file-share-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--success-bg);
  color: #6ee7b7;
  font-size: 0.68rem;
  font-weight: 700;
  vertical-align: middle;
  white-space: nowrap;
}

.icon-btn.share-active {
  color: #6ee7b7;
  background: var(--success-bg);
}

.files-list.view-list,
.files-list:not(.view-grid):not(.view-list) { padding: 8px 12px 16px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.file-item:hover {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.15);
}

.file-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.18), rgba(36, 48, 66, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.file-info { flex: 1; min-width: 0; }

.file-name {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--white);
}

.file-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.file-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: rgba(23, 31, 40, 0.55);
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.icon-btn:hover {
  border-color: rgba(220, 38, 38, 0.4);
  color: #fca5a5;
  background: var(--primary-light);
  transform: translateY(-1px);
}

.icon-btn.danger:hover {
  background: var(--danger-bg);
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--danger);
}

/* ─── Modals ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.72);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--navy-elevated);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(220, 38, 38, 0.08);
  border: 1px solid var(--border-strong);
  animation: modalIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--white);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--white);
}

.modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

#new-project-form { padding: 26px; }

#new-project-form label,
.share-modal-body label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

#new-project-form input,
#new-project-form select,
#new-project-form textarea,
.share-modal-body select,
.share-modal-body input[type="datetime-local"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  margin-bottom: 18px;
  background: rgba(23, 31, 40, 0.75);
  color: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
}

#new-project-form option,
.share-modal-body option {
  background: #243042;
  color: #fff;
}

#new-project-form input:focus,
#new-project-form select:focus,
#new-project-form textarea:focus,
.share-modal-body select:focus,
.share-modal-body input:focus {
  outline: none;
  border-color: rgba(220, 38, 38, 0.65);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.share-modal-body { padding: 26px; }

.share-modal-desc {
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.share-result { margin-bottom: 8px; }

.share-expiry-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(36, 48, 66, 0.9);
  border: 1px solid var(--border);
}

.view-toggle-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.view-toggle-btn:hover {
  color: #fca5a5;
  background: var(--primary-light);
}

.view-toggle-btn.active {
  background: rgba(23, 31, 40, 0.9);
  color: #fecaca;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.files-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Grid view (default) */
.project-grid.view-grid,
.html-pages-grid.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

/* List view */
.project-grid.view-list,
.html-pages-grid.view-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-grid.view-list .project-card,
.html-pages-grid.view-list .html-page-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 16px 20px;
}

.project-grid.view-list .drag-handle {
  display: none;
}

.project-grid.view-list .project-card-top {
  flex: 1 1 220px;
  margin-bottom: 0;
  min-width: 0;
}

.project-grid.view-list .project-card-meta {
  flex: 2 1 280px;
  margin-bottom: 0;
  min-width: 0;
}

.project-grid.view-list .project-card-footer,
.html-pages-grid.view-list .html-page-card-footer {
  flex: 0 0 auto;
  margin-left: auto;
  border-top: none;
  padding-top: 0;
  gap: 16px;
}

.html-pages-grid.view-list .html-page-card h3 {
  flex: 1 1 200px;
  margin-bottom: 0;
  min-width: 0;
}

.html-pages-grid.view-list .html-page-card-meta {
  flex: 2 1 300px;
  margin-bottom: 0;
  min-width: 0;
}

.files-list.view-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px 16px;
}

.files-list.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 16px;
}

.files-list.view-grid .file-item {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 16px;
  border: 1px solid var(--border);
  background: rgba(23, 31, 40, 0.35);
}

.files-list.view-grid .file-item:hover {
  background: var(--surface-hover);
  border-color: rgba(220, 38, 38, 0.3);
  box-shadow: var(--shadow-sm);
}

.files-list.view-grid .file-icon {
  width: 56px;
  height: 56px;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.files-list.view-grid .file-info {
  width: 100%;
}

.files-list.view-grid .file-name {
  white-space: normal;
  word-break: break-word;
}

.files-list.view-grid .file-meta {
  margin-top: 6px;
}

.files-list.view-grid .file-actions {
  margin-top: 14px;
  justify-content: center;
  width: 100%;
}

/* ─── HTML Editor ─── */
.html-editor-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.html-editor-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.html-title-input {
  flex: 1;
  min-width: 200px;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 4px 0;
  font-family: inherit;
  color: var(--white);
  background: transparent;
}

.html-title-input:focus {
  outline: none;
  border-bottom-color: var(--primary);
}

.html-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.html-editor-actions .btn.active {
  background: var(--primary-light);
  color: #fecaca;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.html-editor-layout {
  display: grid;
  gap: 18px;
  min-height: calc(100vh - 300px);
}

.html-editor-layout.split { grid-template-columns: 1fr 1fr; }
.html-editor-layout.code-only .html-preview-pane { display: none; }
.html-editor-layout.code-only { grid-template-columns: 1fr; }
.html-editor-layout.preview-only .html-code-pane { display: none; }
.html-editor-layout.preview-only { grid-template-columns: 1fr; }

.html-code-pane,
.html-preview-pane {
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.pane-label {
  padding: 12px 16px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: rgba(23, 31, 40, 0.55);
}

.html-code-editor {
  flex: 1;
  width: 100%;
  min-height: 480px;
  border: none;
  padding: 18px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.86rem;
  line-height: 1.6;
  resize: vertical;
  background: #0f141b;
  color: #e2e8f0;
}

.html-code-editor:focus { outline: none; }

.html-preview-frame {
  flex: 1;
  width: 100%;
  min-height: 480px;
  border: none;
  background: #fff;
}

.danger-text { color: var(--danger) !important; }
.danger-text:hover { background: var(--danger-bg) !important; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: linear-gradient(135deg, #243042, #171F28);
  color: white;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  border: 1px solid rgba(220, 38, 38, 0.35);
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes toastIn {
  from { transform: translateY(16px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(220, 38, 38, 0.45); background-clip: padding-box; }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    padding: 16px;
  }

  #main-view { flex-direction: column; }

  .sidebar-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-section-label { display: none; }

  .nav-item {
    width: auto;
    flex-shrink: 0;
    margin-bottom: 0;
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
  }

  .user-info { margin-bottom: 0; flex: 1; }

  #logout-btn { width: auto; }

  .content { padding: 24px 18px 32px; }

  .page-header.row { flex-direction: column; }
  .page-header h1 { font-size: 1.6rem; }
  .project-detail-header { flex-direction: column; }
  .html-editor-layout.split { grid-template-columns: 1fr; }
  .html-editor-title-row { flex-direction: column; align-items: stretch; }
}
