/* Light theme (default) */
:root {
  --bg: #ffffff;
  --surface: #f8f8f7;
  --surface2: #f0f0ee;
  --border: #e5e5e2;
  --border-light: #d8d8d4;
  --text: #1a1a18;
  --muted: #7a7a72;
  --muted2: #5a5a54;
  --accent: #d4f57a;
  --accent-text: #4a7a00;
  --accent-dim: rgba(212, 245, 122, 0.18);
  --accent-glow: rgba(212, 245, 122, 0.25);
  --green: #1a8a4a;
  --orange: #c47d00;
  --red: #d93025;
  --placeholder: #b0b0a8;
  --nav-scrolled-bg: rgba(255, 255, 255, 0.85);
  --shadow: rgba(0, 0, 0, 0.08);
  --shadow-heavy: rgba(0, 0, 0, 0.15);
}

/* Dark theme */
html[data-theme="dark"] {
  --bg: #0c0c0b;
  --surface: #141413;
  --surface2: #1a1a18;
  --border: #252523;
  --border-light: #2e2e2b;
  --text: #e8e6df;
  --muted: #6b6960;
  --muted2: #9b9890;
  --accent: #d4f57a;
  --accent-text: #d4f57a;
  --accent-dim: rgba(212, 245, 122, 0.12);
  --accent-glow: rgba(212, 245, 122, 0.25);
  --green: #5dd68c;
  --orange: #f5a623;
  --red: #ff6b6b;
  --placeholder: #3a3a38;
  --nav-scrolled-bg: rgba(12, 12, 11, 0.85);
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-heavy: rgba(0, 0, 0, 0.6);
}

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

body.app {
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', sans-serif;
  font-weight: 300;
  line-height: 1.6;
}

/* LAYOUT */
.app-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.sidebar-link {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover, .sidebar-link.active {
  background: var(--surface);
  color: var(--text);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.sidebar-email {
  font-size: 12px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MAIN */
.app-main { flex: 1; padding: 40px 48px; max-width: 900px; }
.main { flex: 1; padding: 40px 48px; overflow-y: auto; }

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

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

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

.btn-back {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 7px;
  background: transparent;
  font-family: 'Geist', sans-serif;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-back:hover { color: var(--text); border-color: var(--border-light); }

.app-title {
  font-family: 'Instrument Serif', serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.page-title {
  font-family: 'Instrument Serif', serif;
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

/* BUTTONS */
.btn-primary {
  background: var(--accent);
  color: #0c0c0b;
  border: none;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Geist', sans-serif;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-family: 'Geist', sans-serif;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.btn-danger:hover { border-color: var(--red); background: rgba(255,107,107,0.08); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 14px;
  font-family: 'Geist', sans-serif;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: border-color 0.2s, color 0.2s;
}
.btn-ghost:hover { border-color: var(--border-light); color: var(--text); }

.btn-copy {
  background: var(--accent);
  color: #0c0c0b;
  border: none;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Geist', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
}
.btn-copy:hover { opacity: 0.85; }
.btn-copy.copied { background: var(--green); }

/* STATUS BADGE */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  border: 1px solid;
}
.status-pending           { color: var(--muted); border-color: var(--border); }
.status-approved          { color: var(--green); border-color: rgba(93,214,140,0.3); background: rgba(93,214,140,0.08); }
.status-changes_requested { color: var(--orange); border-color: rgba(245,166,35,0.3); background: rgba(245,166,35,0.08); }

/* PROJECTS GRID */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.project-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}
.project-card:hover { border-color: var(--border-light); }

.project-card-header { display: flex; align-items: center; justify-content: space-between; }
.project-date { font-size: 12px; color: var(--muted); font-family: 'DM Mono', monospace; }
.project-title { font-size: 16px; font-weight: 400; }
.project-meta { font-size: 12px; color: var(--muted); font-family: 'DM Mono', monospace; }

.project-card-footer { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

.project-link-row { display: flex; align-items: center; gap: 8px; }
.project-link-text { font-size: 11px; color: var(--muted); font-family: 'DM Mono', monospace; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 80px 40px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.empty-icon { font-size: 48px; }
.empty-state h3 { font-size: 20px; font-weight: 400; }
.empty-state p { color: var(--muted); font-size: 14px; }

/* FORM */
.form-wrap { max-width: 520px; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.field label { font-size: 14px; color: var(--text); }
.field input[type="text"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  font-family: 'Geist', sans-serif;
  transition: border-color 0.2s;
  outline: none;
}
.field input[type="text"]:focus { border-color: var(--accent); }

.upload-zone {
  border: 1.5px dashed var(--border-light);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  transition: all 0.2s;
  position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload-icon { font-size: 28px; margin-bottom: 12px; }
.upload-title { font-size: 15px; margin-bottom: 4px; }
.upload-sub { font-size: 12px; color: var(--muted); font-family: 'DM Mono', monospace; }

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  color: var(--accent-text);
}
.file-preview button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }

.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.form-errors { background: rgba(255,107,107,0.1); border: 1px solid rgba(255,107,107,0.3); border-radius: 8px; padding: 12px 16px; margin-bottom: 24px; font-size: 14px; color: var(--red); }

/* VERSION TABS */
.version-tabs {
  display: flex;
  gap: 3px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.v-tab {
  padding: 7px 16px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  border-radius: 6px 6px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  transition: all 0.15s;
  text-decoration: none;
}
.v-tab:hover { color: var(--text); background: var(--surface2); }
.v-tab.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
}
.v-tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* CONTENT GRID */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

/* PREVIEW CARD */
.preview-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface2);
}
.preview-image {
  width: 100%;
  position: relative;
  overflow: hidden;
}
.preview-img {
  display: block;
  width: 100%;
  height: auto;
}
.img-pin {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: #0c0c0b;
  pointer-events: auto;
  cursor: default;
  z-index: 5;
}
.preview-pdf-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 300px;
}
.pdf-icon-large { font-size: 48px; }
.pdf-filename { font-size: 13px; color: var(--muted); font-family: 'DM Mono', monospace; }
.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
}
.btn-new-version {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-new-version:hover { border-color: var(--accent); color: var(--accent-text); }

/* RIGHT COLUMN */
.right-col { display: flex; flex-direction: column; gap: 16px; }

/* LINK BOX */
.link-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.link-label {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.link-row { display: flex; align-items: center; gap: 8px; }
.link-text {
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--muted2);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-copy-small {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-copy-small:hover { border-color: var(--accent); color: var(--accent-text); }
.btn-copy-small.copied { border-color: var(--green); color: var(--green); }

/* COMMENTS */
.comments-header {
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.count-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--muted2);
}
.empty-comments { color: var(--muted); font-size: 13px; }
.comments-list { display: flex; flex-direction: column; gap: 10px; }

.comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  transition: border-color 0.15s;
}
.comment:hover { border-color: var(--border-light); }
.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.pin-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  display: flex; align-items: center; justify-content: center;
  color: #0c0c0b;
  flex-shrink: 0;
}
.pin-accent { background: var(--accent); }
.pin-orange { background: var(--orange); }
.comment-author { font-size: 13px; color: var(--text); font-weight: 400; }
.comment-time { font-size: 11px; color: var(--muted); font-family: 'DM Mono', monospace; margin-left: auto; }
.comment-body { font-size: 13px; color: var(--muted2); line-height: 1.6; }

@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 24px 20px; }
}

/* PASSWORD INDICATOR */
.password-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 20px;
}
.password-icon { font-size: 13px; }

/* FIELD PASSWORD */
.field input[type="password"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  font-family: 'Geist', sans-serif;
  transition: border-color 0.2s;
  outline: none;
}
.field input[type="password"]:focus { border-color: var(--accent); }
.field-hint { font-size: 12px; color: var(--muted); }

/* SETTINGS */
.settings-form { max-width: 520px; margin-top: 32px; }

.settings-section {
  margin-bottom: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-of-type { border-bottom: none; }

.settings-heading {
  font-size: 16px;
  font-weight: 400;
  margin-bottom: 6px;
}

.settings-hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

.settings-form .field input[type="email"],
.settings-form .field input[type="password"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  font-family: 'Geist', sans-serif;
  transition: border-color 0.2s;
  outline: none;
}
.settings-form .field input:focus { border-color: var(--accent); }

.settings-form .field-hint {
  font-size: 12px;
  color: var(--muted);
}

.settings-actions { margin-top: 8px; }

.settings-flash {
  background: var(--accent-dim);
  border: 1px solid rgba(212,245,122,0.2);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--accent-text);
}

/* THEME TOGGLE */
.theme-toggle {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  position: relative;
  padding: 0;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.theme-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s, background 0.2s;
}
html[data-theme="dark"] .theme-toggle {
  background: var(--surface);
  border-color: var(--border-light);
}
html[data-theme="dark"] .theme-toggle::after {
  transform: translateX(15px);
  background: var(--accent);
}
.theme-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
}
.theme-toggle-label {
  font-size: 11px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
}
