/* ===== Theme ===== */
:root {
  --brand: #2563eb;
  --brand-2: #7c3aed;
  --brand-dark: #0f1f33;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --page: #f1f5f9;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

html { font-size: 15px; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
.min-w-0 { min-width: 0; }

/* ===== Buttons ===== */
.btn-brand {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  border: 0;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .25);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-brand:hover, .btn-brand:focus { color: #fff; filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37, 99, 235, .3); }
.btn:focus-visible, .form-control:focus { box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .25); border-color: var(--brand); }

.icon-btn {
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--muted);
  transition: all .15s ease;
}
.icon-btn:hover:not(:disabled) { color: var(--brand); border-color: var(--brand); background: #eff6ff; }
.icon-btn:disabled { opacity: .35; }
.icon-btn-danger:hover:not(:disabled) { color: #dc2626; border-color: #dc2626; background: #fef2f2; }

/* ===== App bar ===== */
.app-bar {
  background: linear-gradient(120deg, var(--brand-dark), #1e3a5f 60%, #312e81);
  box-shadow: 0 4px 20px rgba(15, 23, 42, .18);
  position: sticky; top: 0; z-index: 1030;
}
.app-bar .navbar { padding: .65rem 0; }
.app-bar .nav-link { color: rgba(255, 255, 255, .75); border-radius: 999px; padding: .4rem .9rem !important; font-weight: 500; }
.app-bar .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.app-bar .nav-link.active { color: #fff; background: rgba(255, 255, 255, .15); }
.user-chip { color: rgba(255, 255, 255, .8); font-size: .9rem; }

.brand-mark {
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 1.05rem;
}
.brand-mark-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.6rem; }

/* ===== Login ===== */
.login-body { background: var(--page); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .login-shell { grid-template-columns: 1.1fr 1fr; } }

.login-hero {
  position: relative; overflow: hidden;
  align-items: center; padding: 4rem;
  color: #fff;
  background:
    radial-gradient(circle at 15% 20%, rgba(124, 58, 237, .55), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(37, 99, 235, .6), transparent 45%),
    linear-gradient(135deg, #0b1324, #1e3a5f);
}
.login-hero > div { max-width: 480px; position: relative; }
.hero-points li { display: flex; align-items: center; gap: .75rem; margin-bottom: .9rem; font-weight: 500; }
.hero-points i {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border-radius: 10px; background: rgba(255, 255, 255, .12);
}

.login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(124, 58, 237, .08), transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(37, 99, 235, .08), transparent 40%),
    var(--page);
}
.login-card {
  width: 100%; max-width: 410px;
  background: var(--surface);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .12);
}
.login-card .form-control { border-radius: 12px; }
.password-toggle {
  position: absolute; right: .4rem; top: .55rem;
  color: var(--muted); text-decoration: none; z-index: 5;
}

/* ===== Resume (CV view) ===== */
.resume {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--surface);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
@media (min-width: 992px) { .resume { grid-template-columns: 320px 1fr; } }

.resume-side {
  background: linear-gradient(180deg, var(--brand-dark), #1e2f4d);
  color: #e2e8f0;
  padding: 2.25rem 1.75rem;
}
.avatar {
  width: 92px; height: 92px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 2rem; font-weight: 800; letter-spacing: 1px; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .08);
  margin-bottom: 1.25rem;
}
.avatar-sm { width: 52px; height: 52px; font-size: 1.1rem; margin: 0; flex-shrink: 0; box-shadow: none; }
.resume-name { font-size: 1.6rem; font-weight: 800; color: #fff; margin-bottom: .35rem; }
.resume-headline { color: #93c5fd; font-weight: 500; line-height: 1.45; }

.side-block { margin-top: 1.75rem; }
.side-title {
  font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: #94a3b8; margin-bottom: .85rem;
}
.side-muted { color: #94a3b8; }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { display: flex; gap: .7rem; align-items: center; margin-bottom: .6rem; word-break: break-word; }
.contact-list i {
  width: 30px; height: 30px; flex-shrink: 0;
  display: inline-grid; place-items: center;
  border-radius: 8px; background: rgba(255, 255, 255, .08); color: #93c5fd;
}
.contact-list a { color: #e2e8f0; text-decoration: none; }
.contact-list a:hover { color: #fff; text-decoration: underline; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.stats > div { background: rgba(255, 255, 255, .06); border-radius: 12px; padding: .7rem .4rem; text-align: center; }
.stats strong { display: block; font-size: 1.35rem; color: #fff; }
.stats span { font-size: .72rem; color: #94a3b8; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  font-size: .76rem; font-weight: 500;
  padding: .28rem .65rem; border-radius: 999px;
  background: #eef2ff; color: #3730a3;
}
.chip-dark { background: rgba(147, 197, 253, .12); color: #bfdbfe; }

.resume-main { padding: 2.25rem 2rem; }
@media (min-width: 992px) { .resume-main { padding: 2.75rem 3rem; } }
.resume-section + .resume-section { margin-top: 2.5rem; }
.section-title {
  display: flex; align-items: center; gap: .6rem;
  font-size: 1.1rem; font-weight: 800; margin-bottom: 1.25rem;
}
.section-title i {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border-radius: 10px; font-size: 1rem; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.resume-main p { line-height: 1.7; text-align: justify; }

.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(var(--brand), var(--brand-2));
  opacity: .25; border-radius: 2px;
}
.timeline-item { position: relative; padding-bottom: 1.6rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -1.6rem; top: .3rem;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--brand);
}
.role-title { font-size: 1.02rem; font-weight: 700; margin: 0; }
.company { color: var(--brand); font-weight: 600; font-size: .9rem; margin-top: .2rem; }
.period-badge {
  font-size: .78rem; font-weight: 600; white-space: nowrap;
  color: var(--muted); background: var(--page);
  border-radius: 999px; padding: .2rem .7rem; align-self: flex-start;
}
.bullets { margin: .7rem 0 0; padding-left: 1.1rem; color: #334155; }
.bullets li { margin-bottom: .35rem; line-height: 1.6; }
.bullets li::marker { color: var(--brand); }

.project-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 768px) { .project-grid { grid-template-columns: 1fr 1fr; } }
.project-card {
  border: 1px solid var(--line); border-radius: 16px;
  padding: 1.2rem 1.25rem;
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c7d2fe; }
.project-title { font-size: .98rem; font-weight: 700; margin-bottom: .5rem; }
.project-desc { font-size: .88rem; color: #475569; text-align: left !important; flex-grow: 1; }

/* ===== Editor ===== */
.stat-card {
  display: flex; align-items: center; gap: .9rem;
  background: var(--surface); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow); height: 100%;
}
.stat-card > i {
  width: 44px; height: 44px; flex-shrink: 0;
  display: inline-grid; place-items: center;
  border-radius: 12px; font-size: 1.2rem; color: var(--brand); background: #eff6ff;
}
.stat-card strong { display: block; font-size: 1.4rem; line-height: 1.1; }
.stat-card span { font-size: .8rem; color: var(--muted); }

.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 1rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: .5rem; }
.panel-head h2 i { color: var(--brand); }
.panel-body { padding: 1.25rem; }

.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 1.25rem; border-bottom: 1px solid var(--line);
}
.item-list li:last-child { border-bottom: 0; }
.item-list li:hover { background: #f8fafc; }
.item-main { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.item-title { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-main:hover .item-title { color: var(--brand); }
.item-sub { display: block; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-actions { display: flex; gap: .3rem; flex-shrink: 0; }
.item-empty { color: var(--muted); justify-content: center; }

.form-wrap { max-width: 860px; margin: 0 auto; }
.form-wrap .form-control, .form-wrap .input-group-text { border-radius: 12px; }
.form-wrap .input-group .form-control { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.form-wrap .input-group-text { border-top-right-radius: 0; border-bottom-right-radius: 0; background: var(--page); color: var(--muted); }
.form-icon {
  width: 48px; height: 48px; flex-shrink: 0;
  display: inline-grid; place-items: center;
  border-radius: 14px; font-size: 1.3rem; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

/* ===== Versions & AI ===== */
.text-brand { color: var(--brand) !important; }
.btn-ai {
  background: linear-gradient(135deg, #7c3aed, #db2777);
  color: #fff; border: 0;
  box-shadow: 0 6px 16px rgba(124, 58, 237, .28);
  transition: transform .15s ease, filter .15s ease;
}
.btn-ai:hover, .btn-ai:focus { color: #fff; filter: brightness(1.07); transform: translateY(-1px); }
.btn-ai:disabled { opacity: .7; }

.badge-original {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .15rem .5rem; border-radius: 999px;
  background: #dcfce7; color: #166534;
}

.version-picker .dropdown-menu { min-width: 280px; }
.version-picker .dropdown-item.active { background: #eef2ff; color: var(--brand); }

.ai-note {
  display: flex; gap: .85rem; align-items: flex-start;
  background: linear-gradient(135deg, #f5f3ff, #eff6ff);
  border: 1px solid #ddd6fe; border-radius: 16px; padding: .9rem 1.1rem;
}
.ai-note > i {
  width: 34px; height: 34px; flex-shrink: 0;
  display: inline-grid; place-items: center;
  border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, #7c3aed, #db2777);
}

.ai-panel { border: 1px solid #ddd6fe; }
.ai-panel .panel-head { background: linear-gradient(135deg, #f5f3ff, #fdf2f8); border-radius: var(--radius) var(--radius) 0 0; }
.ai-panel .panel-head h2 i { color: #7c3aed; }
.ai-panel .form-control, .ai-panel .form-select { border-radius: 12px; }
.chip-idea { border: 1px dashed #c4b5fd; background: #faf5ff; color: #6d28d9; cursor: pointer; }
.chip-idea:hover { background: #ede9fe; }

.version-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  display: inline-grid; place-items: center;
  border-radius: 12px; background: var(--page); color: var(--muted);
}
.version-icon.is-original { background: #dcfce7; color: #166534; }
.version-icon.is-ai { background: #f3e8ff; color: #7c3aed; }

.ai-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: grid; place-items: center; padding: 1rem;
  background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px);
}
.ai-overlay[hidden] { display: none; }
.ai-overlay-card { background: #fff; border-radius: 24px; padding: 2rem; max-width: 380px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.ai-spinner {
  width: 64px; height: 64px; margin: 0 auto 1rem;
  display: grid; place-items: center; border-radius: 50%;
  font-size: 1.6rem; color: #fff;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  animation: ai-pulse 1.4s ease-in-out infinite;
}
@keyframes ai-pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(124,58,237,.45); } 50% { transform: scale(1.06); box-shadow: 0 0 0 14px rgba(124,58,237,0); } }
@media (prefers-reduced-motion: reduce) { .ai-spinner { animation: none; } }

/* ===== My CVs list actions ===== */
.cv-actions { display: flex; flex-wrap: wrap; gap: .35rem; flex-shrink: 0; justify-content: flex-end; }
.cv-actions .act {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; font-weight: 600;
  padding: .38rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: #334155;
  text-decoration: none; transition: all .15s ease;
}
.cv-actions .act:hover { color: var(--brand); border-color: var(--brand); background: #eff6ff; }
.cv-actions .act-danger:hover { color: #dc2626; border-color: #dc2626; background: #fef2f2; }
.cv-actions .act-locked { color: #166534; background: #f0fdf4; border-color: #bbf7d0; cursor: default; }
.cv-actions .act-locked:hover { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
@media (max-width: 768px) {
  #v-list li, .item-list li:has(.cv-actions) { flex-wrap: wrap; }
  .item-list li:has(.cv-actions) .item-main { flex-basis: calc(100% - 50px); }
  .cv-actions { width: 100%; justify-content: flex-start; padding-left: 50px; }
}

/* ===== Master CV & QR ===== */
.badge-master {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .15rem .5rem; border-radius: 999px;
  background: #fef3c7; color: #92400e;
}
.master-panel { border: 1px solid #fde68a; }
.master-panel .panel-head { background: linear-gradient(135deg, #fffbeb, #fef3c7); border-radius: var(--radius) var(--radius) 0 0; }
.master-panel .panel-head h2 i { color: #d97706; }
.master-body { display: flex; gap: 1.5rem; align-items: flex-start; }
.qr-box {
  flex-shrink: 0; padding: .6rem; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.qr-box img { display: block; width: 180px; height: 180px; image-rendering: pixelated; }
.share-link { display: flex; align-items: center; gap: .5rem; max-width: 560px; }
.share-link > i { color: var(--brand); font-size: 1.2rem; }
.share-link .form-control { border-radius: 10px; background: var(--page); }
.share-link .btn { border-radius: 10px; white-space: nowrap; }
.cv-actions .act-master { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.cv-actions .act-master:hover { color: #78350f; border-color: #f59e0b; background: #fef3c7; }
@media (max-width: 768px) {
  .master-body { flex-direction: column; align-items: center; text-align: center; }
  .master-body .share-link, .master-body .d-flex { justify-content: center; margin-left: auto; margin-right: auto; }
}

/* ===== Public share page ===== */
.share-bar {
  position: sticky; top: 0; z-index: 1030; padding: .7rem 0;
  background: linear-gradient(120deg, var(--brand-dark), #1e3a5f 60%, #312e81);
  box-shadow: 0 4px 20px rgba(15, 23, 42, .18);
}
.share-sub { color: #93c5fd; font-size: .8rem; max-width: 60vw; }

/* ===== Phones ===== */
@media (max-width: 576px) {
  .resume-main, .resume-side { padding: 1.5rem 1.15rem; }
  .resume-main p { text-align: left; }
  .login-card { padding: 2rem 1.25rem; border-radius: 20px; }
  .item-list li { padding: .75rem 1rem; }
}

/* ===== Print ===== */
@media print {
  .no-print, .app-bar { display: none !important; }
  body { background: #fff; }
  main.container { max-width: none; padding: 0 !important; }
  .resume { box-shadow: none; border-radius: 0; grid-template-columns: 260px 1fr; }
  .resume-side, .section-title i, .avatar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .project-card { break-inside: avoid; }
  .timeline-item { break-inside: avoid; }
}
