:root {
  --bg: #eef2f4;
  --panel: #ffffff;
  --panel-soft: #f8fafb;
  --ink: #17242d;
  --muted: #61707a;
  --line: #d4dde3;
  --accent: #154c57;
  --accent-deep: #0e2e35;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eef3f4 0, #f6f8f9 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(246, 248, 249, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #12333c 0, #183f49 100%);
}

.login-card {
  width: min(100%, 420px);
  padding: 28px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.login-card p {
  line-height: 1.45;
}

.login-error {
  color: #8a2d2d;
  font-weight: 700;
}

.admin-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.admin-shell.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #12333c 0, #183f49 100%);
  color: #f4f8f8;
  overflow: hidden;
  overflow-y: auto;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.admin-shell.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.brand {
  margin-bottom: 18px;
}

.brand .eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  opacity: 0.75;
}

.brand h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.brand p, .brand code {
  margin: 0;
  color: rgba(244, 248, 248, 0.8);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(560px, 780px) minmax(480px, 1fr);
  gap: 20px;
  padding: 20px;
}

.panel {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(17, 34, 44, 0.05);
}

.sidebar .panel {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
}

.small-note {
  margin: 0 0 10px;
  color: rgba(244, 248, 248, 0.8);
  line-height: 1.45;
}

.form-grid, .theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

textarea {
  resize: vertical;
}

.theme-grid input[type="color"] {
  min-height: 44px;
  padding: 4px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
}

button.secondary {
  background: var(--panel-soft);
  color: var(--accent-deep);
  border: 1px solid var(--line);
}

button.danger {
  background: #8a2d2d;
  color: #fff;
}

.danger-link {
  background: #8a2d2d;
  color: #fff;
}

.stack-list {
  display: grid;
  gap: 12px;
}

.item-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfc;
}

.empty-card {
  border-style: dashed;
  background: #f8fbfc;
  color: var(--muted);
}

.empty-card p {
  margin: 0;
}

.item-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.small-btn {
  width: auto;
  margin: 0;
  padding: 7px 10px;
  font-size: 12px;
}

.box-hint {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #edf4f3;
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
}

.preview-panel {
  position: sticky;
  top: 20px;
}

#cv-preview {
  width: 100%;
  height: calc(100vh - 120px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.sidebar-toggle {
  width: 48px;
  height: 48px;
  margin: 0;
  border-radius: 999px;
  background: #12333c;
  color: #fff;
  box-shadow: 0 10px 24px rgba(17, 34, 44, 0.18);
}

.floating-action {
  width: auto;
  min-width: 116px;
  height: 48px;
  margin: 0;
  padding: 0 18px;
  border-radius: 999px;
  background: #12333c;
  color: #fff;
  box-shadow: 0 10px 24px rgba(17, 34, 44, 0.18);
}

.floating-action.secondary-action {
  background: #ffffff;
  color: var(--accent-deep);
  border: 1px solid var(--line);
}

@media (max-width: 1200px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  #cv-preview {
    height: 720px;
  }
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
  }

  .form-grid, .theme-grid {
    grid-template-columns: 1fr;
  }
}
