:root {
  --bg: #eef2ff;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(148, 163, 184, 0.35);
  --text: #0f172a;
  --muted: #475569;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 16px 42px rgba(15, 23, 42, 0.14);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 35%),
    radial-gradient(circle at bottom right, rgba(99, 102, 241, 0.16), transparent 35%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.main-sidebar {
  background: rgba(15, 23, 42, 0.96);
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-block,
.guest-brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  flex-shrink: 0;
}

.brand-block h1,
.guest-brand h1,
.content-topbar h2,
.poster-card h3,
.empty-card h3 {
  margin: 0;
}

.brand-block p,
.guest-brand p,
.content-topbar p,
.user-email,
.poster-card p,
.asset-meta,
.asset-error,
.alert ul,
.guest-links {
  margin: 0;
  color: var(--muted);
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav a {
  padding: 12px 14px;
  border-radius: 12px;
  color: rgba(255,255,255,0.82);
}

.side-nav a.active,
.side-nav a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.user-card {
  margin-top: auto;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.user-name { font-weight: 700; }
.user-email { color: rgba(255,255,255,0.7); font-size: 13px; }

.main-content {
  padding: 20px;
  min-width: 0;
}

.content-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.card,
.alert,
.guest-card,
.editor-header-bar {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.card { padding: 18px; }
.card-grid {
  display: grid;
  gap: 18px;
}
.poster-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.poster-card {
  overflow: hidden;
  padding: 0;
}

.poster-thumb {
  aspect-ratio: 4 / 5;
  background: rgba(15,23,42,0.04);
  overflow: hidden;
}
.poster-thumb img { width: 100%; height: 100%; object-fit: cover; }
.poster-thumb-empty {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--muted); padding: 20px; text-align: center;
}
.poster-card-body { padding: 16px 16px 0; display: grid; gap: 6px; }
.card-actions {
  padding: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.card-actions form { margin: 0; }
.empty-card { display: grid; gap: 12px; max-width: 460px; }

.alert {
  padding: 14px 16px;
  margin-bottom: 14px;
}
.alert-success { border-left: 6px solid var(--success); }
.alert-danger { border-left: 6px solid var(--danger); }
.alert ul { padding-left: 18px; margin-top: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #111827; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: rgba(15, 23, 42, 0.06); color: var(--text); }
.btn.small { min-height: 34px; padding: 8px 10px; font-size: 13px; }
.w-full { width: 100%; }
.inline-actions { display: flex; gap: 10px; flex-wrap: wrap; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="color"],
select,
textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.96);
}
input[type="range"] { width: 100%; }
textarea { resize: vertical; }
.checkbox-inline {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.form-stack { display: grid; gap: 12px; }

.guest-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.guest-shell { width: min(100%, 460px); }
.guest-card { padding: 28px; display: grid; gap: 20px; }
.guest-links { text-align: center; }
.guest-links a { color: var(--primary-dark); font-weight: 700; }

.editor-header-bar {
  margin-bottom: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}
.title-field { min-width: min(100%, 460px); }
.status-box {
  min-width: 220px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(15,23,42,0.06);
  color: var(--text);
  font-weight: 700;
}
.status-box[data-type="success"] { background: rgba(22,163,74,0.14); color: #166534; }
.status-box[data-type="error"] { background: rgba(220,38,38,0.14); color: #991b1b; }

.pagination-wrap { margin-top: 18px; }

@media (max-width: 1120px) {
  .app-layout { grid-template-columns: 1fr; }
  .main-sidebar { gap: 14px; }
  .content-topbar,
  .editor-header-bar { flex-direction: column; align-items: stretch; }
}


/* Editor workspace overrides */
body.route-editor {
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.10), transparent 28%),
    linear-gradient(180deg, #eef2ff 0%, #f8fafc 100%);
}

.app-layout.editor-layout {
  display: block;
  min-height: 100vh;
}

.editor-main-content {
  padding: 18px 20px 20px;
}

.content-topbar.editor-content-topbar {
  position: sticky;
  top: 12px;
  z-index: 50;
  margin-bottom: 16px;
  padding: 14px 18px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.content-topbar.editor-content-topbar h2 {
  font-size: 22px;
  margin-bottom: 4px;
}

.editor-top-actions {
  align-items: center;
  justify-content: flex-end;
}

.editor-top-actions .btn {
  min-height: 40px;
  border-radius: 12px;
}

.editor-top-actions .icon-btn {
  min-width: 40px;
  padding: 0;
  font-size: 18px;
}

.editor-top-actions .zoom-readout {
  min-width: 72px;
  opacity: 1;
  cursor: default;
}

.editor-shell-figma {
  display: grid;
  gap: 16px;
}

.figma-header {
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(148,163,184,0.22);
  box-shadow: 0 16px 36px rgba(15,23,42,0.06);
}

.figma-header-left {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.title-field.compact {
  min-width: min(100%, 360px);
}

.figma-header-right {
  margin-left: auto;
}

.mini-hint {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.08);
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 1180px) {
  .content-topbar.editor-content-topbar {
    position: static;
  }

  .figma-header {
    align-items: start;
  }

  .figma-header-right {
    margin-left: 0;
    width: 100%;
  }
}


.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.editor-page-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.editor-page-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(37,99,235,0.16), rgba(124,58,237,0.16));
  color: #3730a3;
  font-size: 20px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.12);
}

.content-topbar.editor-content-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.content-topbar.editor-content-topbar > * { min-width: 0; }

.content-topbar.editor-content-topbar h2 {
  font-size: 20px;
  line-height: 1.15;
}

.content-topbar.editor-content-topbar p {
  font-size: 13px;
  color: #64748b;
}

.editor-top-actions {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.editor-tool-btn {
  position: relative;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(15,23,42,0.06);

.editor-tool-btn .tool-icon {
  font-size: 18px;
  line-height: 1;
}

.editor-tool-btn[data-tooltip]::after,
.file-inline[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(6px);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(15,23,42,0.18);
  transition: .18s ease;
  z-index: 30;
}

.editor-tool-btn:hover::after,
.editor-tool-btn:focus-visible::after,
.file-inline:hover::after,
.file-inline:focus-within::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.editor-tool-btn:hover,
.file-inline:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(37,99,235,0.14);
}

@media (max-width: 1180px) {
  .content-topbar.editor-content-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .editor-top-actions {
    justify-content: flex-start;
  }
}


/* Cleaner Figma-like editor header */
body.route-editor .content-topbar.editor-content-topbar {
  top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.90);
  border: 1px solid rgba(148,163,184,.22);
  box-shadow: 0 12px 34px rgba(15,23,42,.08);
}
body.route-editor .editor-page-meta { gap: 10px; }
body.route-editor .editor-page-mark { width: 38px; height: 38px; border-radius: 13px; }
body.route-editor .content-topbar.editor-content-topbar h2 { font-size: 18px; line-height: 1.1; }
body.route-editor .content-topbar.editor-content-topbar p { font-size: 12px; }
body.route-editor .editor-top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
body.route-editor .editor-top-actions .editor-tool-btn,
body.route-editor .editor-top-actions .zoom-readout { min-width: 40px; min-height: 40px; padding: 0 10px; border-radius: 12px; }
body.route-editor .editor-main-content { padding: 10px 12px 14px; }
