/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f5f5f5;
  --border: #e5e5e5;
  --border-light: #f0f0f0;
  --text: #171717;
  --text-secondary: #737373;
  --text-tertiary: #a3a3a3;
  --accent: #171717;
  --accent-hover: #404040;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.03);
  --transition: 150ms ease;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Fira Code", monospace;
}

html {
  font-size: 15px;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--text);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

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

.app-sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: width 200ms ease;
  overflow: hidden;
}

.app-main {
  margin-left: 240px;
  flex: 1;
  padding: 32px 40px;
  max-width: 960px;
  transition: margin-left 200ms ease;
}

.app-main.full-width {
  margin-left: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Sidebar Collapsed ── */
.app-layout.sidebar-collapsed .app-sidebar {
  width: 56px;
}

.app-layout.sidebar-collapsed .app-main {
  margin-left: 56px;
}

.app-layout.sidebar-collapsed .sidebar-brand-text,
.app-layout.sidebar-collapsed .sidebar-link-text,
.app-layout.sidebar-collapsed .sidebar-label,
.app-layout.sidebar-collapsed .sidebar-user,
.app-layout.sidebar-collapsed .sidebar-footer form {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 150ms ease;
}

.app-layout.sidebar-collapsed .sidebar-brand {
  padding: 0 0 24px;
  justify-content: center;
}

.app-layout.sidebar-collapsed .sidebar-nav {
  padding: 0 8px;
}

.app-layout.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 8px;
  gap: 0;
}

.app-layout.sidebar-collapsed .sidebar-footer {
  padding: 12px 8px;
  display: flex;
  justify-content: center;
}

.app-layout.sidebar-collapsed .sidebar-section {
  margin-bottom: 16px;
}

/* ── Sidebar Toggle Button ── */
.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition);
  flex-shrink: 0;
  margin-left: auto;
}

.sidebar-collapse-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 200ms ease;
}

.app-layout.sidebar-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.app-layout.sidebar-collapsed .sidebar-collapse-btn {
  margin: 0 auto;
}

/* tooltip on collapsed icons */
.app-layout.sidebar-collapsed .sidebar-link {
  position: relative;
}

.app-layout.sidebar-collapsed .sidebar-link:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  background: var(--text);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}

/* ── Sidebar ── */
.sidebar-brand {
  padding: 0 20px 24px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: padding 200ms ease;
}

.sidebar-brand svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  transition: opacity 150ms ease;
}

.sidebar-nav {
  flex: 1;
  padding: 0 12px;
  transition: padding 200ms ease;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 0 8px;
  margin-bottom: 6px;
  transition: opacity 150ms ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 0.87rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}

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

.sidebar-link.active {
  background: var(--bg);
  color: var(--text);
  font-weight: 500;
}

.sidebar-link svg {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  flex-shrink: 0;
}

.sidebar-link.active svg,
.sidebar-link:hover svg {
  opacity: 0.8;
}

.sidebar-link-text {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 150ms ease;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  transition: padding 200ms ease;
}

.sidebar-user {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 150ms ease;
}

/* ── Typography ── */
h1,
h2,
h3,
h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
  border-color: #d4d4d4;
}

.card-body {
  padding: 20px;
}
.card-body-compact {
  padding: 16px 20px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  line-height: 1.4;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: #d4d4d4;
  color: var(--text);
}

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border);
}
.btn-danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 6px;
  border-radius: 6px;
}

/* ── Inputs ── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.87rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition);
  outline: none;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #a3a3a3;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

input[type="file"] {
  font-size: 0.85rem;
  font-family: var(--font);
  padding: 7px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  width: 100%;
}

input[type="file"]:hover {
  border-color: #a3a3a3;
}

input[type="color"] {
  width: 40px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: none;
}

label,
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-group {
  margin-bottom: 16px;
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

/* ── File/Folder List ── */
.item-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.item-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}

.item-row:last-child {
  border-bottom: none;
}
.item-row:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.item-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.item-icon.folder {
  background: #fef3c7;
  color: #d97706;
}

.item-icon.file {
  background: #eff6ff;
  color: #3b82f6;
}

.item-icon.file-pdf {
  background: #fef2f2;
  color: #ef4444;
}
.item-icon.file-img {
  background: #f0fdf4;
  color: #22c55e;
}

.item-name {
  flex: 1;
  font-size: 0.87rem;
  font-weight: 450;
}

.item-meta {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

/* ── Project Grid ── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.project-card {
  padding: 20px;
  cursor: pointer;
}

.project-card .project-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.project-card .project-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Tags / Badges ── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.badge-role {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: capitalize;
}

/* ── Breadcrumbs ── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  margin-bottom: 20px;
  color: var(--text-tertiary);
}

.breadcrumbs a {
  color: var(--text-secondary);
  transition: color var(--transition);
}

.breadcrumbs a:hover {
  color: var(--text);
}
.breadcrumbs .sep {
  margin: 0 2px;
}
.breadcrumbs .current {
  color: var(--text);
  font-weight: 500;
}

/* ── Toast / Messages ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success {
  border-left: 3px solid var(--success);
}
.toast.error {
  border-left: 3px solid var(--danger);
}

.toast-close {
  margin-left: auto;
  cursor: pointer;
  color: var(--text-tertiary);
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0 0 8px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tr:hover td {
  background: var(--surface-hover);
}

/* ── Detail Grid ── */
.detail-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  font-size: 0.85rem;
}

.detail-label {
  color: var(--text-tertiary);
  font-weight: 500;
}

.detail-value {
  color: var(--text);
}

/* ── Checkbox ── */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.checkbox-tag input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ── Auth Pages ── */
.auth-container {
  width: 100%;
  max-width: 380px;
  padding: 20px;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

.auth-footer a {
  color: var(--text);
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ── Section Divider ── */
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

/* ── Action Bar ── */
.action-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* ── Spacing Utilities ── */
.mt-1 {
  margin-top: 4px;
}
.mt-2 {
  margin-top: 8px;
}
.mt-3 {
  margin-top: 16px;
}
.mt-4 {
  margin-top: 24px;
}
.mb-2 {
  margin-bottom: 8px;
}
.mb-3 {
  margin-bottom: 16px;
}
.mb-4 {
  margin-bottom: 24px;
}
.gap-2 {
  gap: 8px;
}
.gap-3 {
  gap: 12px;
}
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.inline {
  display: inline;
}
.hidden {
  display: none;
}

/* ── File Tree Explorer ── */
.file-tree {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.tree-node {
  user-select: none;
}

.tree-row {
  display: flex;
  align-items: center;
  padding: 0;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  color: var(--text);
  font-size: 0.87rem;
}

.tree-node:last-child > .tree-row {
  border-bottom: none;
}

.tree-row:hover {
  background: var(--surface-hover);
}
.tree-row.selected {
  background: #f0f5ff;
}

.tree-indent {
  display: inline-block;
  width: 20px;
  flex-shrink: 0;
}

.tree-toggle {
  width: 28px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 4px;
  transition: background var(--transition);
}

.tree-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.tree-toggle svg {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
  transition: transform 150ms ease;
}

.tree-toggle.expanded svg {
  transform: rotate(90deg);
}

.tree-toggle.empty {
  cursor: default;
  visibility: hidden;
}

.tree-icon {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 10px;
}

.tree-icon.folder {
  background: #fef3c7;
  color: #d97706;
}
.tree-icon.folder-open {
  background: #fde68a;
  color: #b45309;
}
.tree-icon.file {
  background: #eff6ff;
  color: #3b82f6;
}
.tree-icon.file-pdf {
  background: #fef2f2;
  color: #ef4444;
}
.tree-icon.file-img {
  background: #f0fdf4;
  color: #22c55e;
}

.tree-name {
  flex: 1;
  padding: 7px 0;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 450;
}

.tree-name:hover {
  color: var(--accent);
}

.tree-name a {
  color: inherit;
  text-decoration: none;
  display: block;
}

.tree-tags {
  display: flex;
  gap: 4px;
  margin-right: 8px;
  flex-shrink: 0;
}

.tree-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  padding-right: 14px;
  flex-shrink: 0;
  min-width: 60px;
  text-align: right;
}

.tree-actions {
  display: flex;
  gap: 2px;
  padding-right: 8px;
  opacity: 0;
  transition: opacity var(--transition);
  flex-shrink: 0;
}

.tree-row:hover .tree-actions {
  opacity: 1;
}

.tree-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition);
}

.tree-action-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.tree-children {
  overflow: hidden;
}

.tree-children.collapsed {
  display: none;
}

.tree-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.tree-loading .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--text-tertiary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.tree-empty {
  padding: 6px 16px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-style: italic;
}

/* ── Notification badge ── */
.notif-link {
  position: relative;
}
.notif-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* ── Page thumbnail cards ── */
.page-thumb-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  gap: 6px;
}
.page-thumb-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.page-thumb-num {
  font-size: 0.82rem;
  font-weight: 500;
}
.page-thumb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
}

/* ── Split panel (source PDF viewer) ── */
.app-main:has(.split-panel) {
  max-width: 100%;
}
.split-panel {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  height: calc(100vh - 180px);
  overflow: hidden;
}
.split-panel-left {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.split-panel-right {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-width: 0;
}
.page-list-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.page-list {
  overflow-y: auto;
  flex: 1;
}
.page-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text);
  transition: background 0.1s;
}
.page-list-item:hover {
  background: var(--surface-hover);
}
.page-list-item.active {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
  position: relative;
}
.page-list-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.page-list-item.active .page-list-num {
  font-weight: 600;
}
.page-list-num {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.page-list-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding-left: 24px;
}

/* ── Page preview (right panel) ── */
.page-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.page-preview-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.page-preview-img {
  flex: 1;
  min-width: 0;
  text-align: center;
  overflow: auto;
  max-height: calc(100vh - 280px);
  cursor: grab;
}
.page-preview-img img {
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  transform-origin: top left;
  transition: transform 0.15s ease;
}
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-hover);
  border-radius: var(--radius);
  padding: 2px 4px;
}
.zoom-btn {
  padding: 4px !important;
  min-width: 0 !important;
}
.zoom-level {
  font-size: 0.72rem;
  font-weight: 500;
  min-width: 36px;
  text-align: center;
  color: var(--text-secondary);
}
.page-preview-tags {
  width: 220px;
  min-width: 220px;
  padding-left: 20px;
  border-left: 1px solid var(--border);
}

/* ── Spinner ── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.spin {
  animation: spin 1s linear infinite;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .app-sidebar {
    display: none;
  }
  .app-main {
    margin-left: 0 !important;
    padding: 20px 16px;
  }
  .project-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    flex-direction: column;
  }
}
