:root {
  --bg: #0b1120;
  --bg-2: #0f172a;
  --card: #111a2e;
  --card-2: #0d1526;
  --surface: #16223c;
  --surface-2: #1c2a48;
  --border: #233150;
  --border-2: #2c3b5e;
  --text: #e6ecf7;
  --text-dim: #9aa8c0;
  --text-mute: #6b7893;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --violet: #a78bfa;
  --ok: #34d399;
  --err: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1000px 500px at 85% -10%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(800px 500px at 0% 10%, rgba(167, 139, 250, 0.08), transparent 55%);
  background-attachment: fixed;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3 { font-family: "Sora", "Inter", sans-serif; letter-spacing: -0.02em; }

/* ===== Hero ===== */
.hero {
  position: relative;
  padding: 40px 0 34px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(20, 34, 62, 0.9), var(--bg-2));
}
.hero-bg {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(600px 200px at 50% 0%, var(--accent-glow), transparent 70%);
  opacity: 0.5;
}
.hero-glow {
  position: absolute; inset: 0;
  background: radial-gradient(700px 300px at 30% 120%, rgba(167, 139, 250, 0.12), transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 16px; }
.logo {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  font-family: "Sora"; font-weight: 800; font-size: 1.1rem;
  color: #04121f;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: 0 6px 20px var(--accent-glow);
}
.brand-text h1 { margin: 0; font-size: 1.7rem; font-weight: 800; }
.tagline { margin: 2px 0 0; color: var(--text-dim); font-size: 0.95rem; }

.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  display: flex; align-items: center; gap: 7px;
  background: var(--card-2); border: 1px solid var(--border);
  padding: 7px 13px; border-radius: 999px; font-size: 0.83rem; color: var(--text-dim);
}
.stat-icon { font-size: 0.9rem; }

/* ===== Layout ===== */
.layout { display: grid; grid-template-columns: 1fr; gap: 24px; padding: 28px 0; }
@media (min-width: 900px) {
  .layout { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* ===== Panel ===== */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.4s ease both;
}
.panel:nth-child(2) { animation-delay: 0.08s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.panel-head {
  padding: 18px 22px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.panel-title { display: flex; align-items: center; gap: 13px; }
.panel-icon {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.05rem;
  background: var(--surface); border: 1px solid var(--border-2);
}
.panel-title h2 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.panel-title .sub { color: var(--text-dim); font-size: 0.8rem; }

.badge {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase;
  background: var(--surface); color: var(--text-mute); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.accent { background: rgba(56, 189, 248, 0.12); color: var(--accent); border-color: rgba(56, 189, 248, 0.3); }
.badge.saved { background: rgba(52, 211, 153, 0.12); color: var(--ok); border-color: rgba(52, 211, 153, 0.3); }

.panel-body { padding: 22px; }

/* ===== Fields ===== */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; letter-spacing: 0.01em; }
.hint { color: var(--text-mute); font-weight: 400; margin-left: 6px; }
label code, .field label code { font-family: "JetBrains Mono", monospace; font-size: 0.72rem; color: var(--accent); background: rgba(56,189,248,0.09); padding: 1px 5px; border-radius: 5px; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 480px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

input[type=text], textarea {
  width: 100%;
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font: inherit;
  font-size: 0.92rem;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
textarea { line-height: 1.55; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-mute); }

/* collapsibles */
.collapsible { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 14px; background: var(--card-2); overflow: hidden; }
.collapsible summary {
  cursor: pointer; list-style: none;
  padding: 13px 16px; font-weight: 600; font-size: 0.9rem; color: var(--text-dim);
  user-select: none; display: flex; align-items: center; gap: 8px; transition: color 0.15s;
}
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary::before { content: "▸"; color: var(--accent); font-size: 0.8rem; transition: transform 0.18s; }
.collapsible[open] summary::before { transform: rotate(90deg); }
.collapsible summary:hover { color: var(--text); }
.collapsible > .field { padding: 0 16px 16px; margin: 0; }

/* job desc area */
.job-wrap { position: relative; }
.char-count { position: absolute; right: 12px; bottom: 10px; font-size: 0.7rem; color: var(--text-mute); background: var(--card-2); padding: 2px 7px; border-radius: 6px; }

/* ===== Tags ===== */
.tags {
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 11px; min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tags:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-glow); }
.tags input {
  flex: 1; min-width: 130px; background: transparent; border: none; color: var(--text);
  font: inherit; font-size: 0.92rem; padding: 3px 0;
}
.tags input:focus { outline: none; }
.tags input::placeholder { color: var(--text-mute); }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(56, 189, 248, 0.12); color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 4px 8px 4px 11px; border-radius: 999px; font-size: 0.82rem; font-weight: 500;
}
.tag-x {
  background: transparent; border: none; color: inherit; cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 0 2px; opacity: 0.7;
}
.tag-x:hover { opacity: 1; }

/* ===== Build list ===== */
.build-list { display: flex; flex-direction: column; gap: 11px; }
.cards { display: flex; flex-direction: column; gap: 8px; }

/* ===== Cards (reusable for exp/proj/edu) ===== */
.card {
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 14px;
  transition: border-color 0.15s;
}
.card:focus-within { border-color: var(--accent-2); }
.card-head { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 10px; }
.card-grip { color: var(--text-mute); cursor: grab; font-size: 0.85rem; padding-top: 8px; }
.card-grid { flex: 1; display: grid; grid-template-columns: 1fr; gap: 7px; }
@media (min-width: 480px) {
  .card-grid { grid-template-columns: 1.3fr 1fr 0.9fr; }
  .proj-grid { grid-template-columns: 1fr 1fr; }
}
.proj-grid { flex: 1; display: grid; grid-template-columns: 1fr; gap: 7px; }

.card input {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px;
  font: inherit; font-size: 0.88rem;
}
.card input:focus { outline: none; border-color: var(--accent-2); }

/* bullets */
.bullets { display: flex; flex-direction: column; gap: 7px; margin-bottom: 9px; }
.bullet-row { display: flex; align-items: center; gap: 7px; }
.bullet-row input { flex: 1; }

/* ===== icon buttons ===== */
.icon-btn {
  background: transparent; border: none; color: var(--text-mute); cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 6px 7px; border-radius: 6px; flex-shrink: 0;
  transition: all 0.12s;
}
.icon-btn:hover { color: var(--err); background: rgba(248, 113, 113, 0.12); }
.bullet-remove { font-size: 0.85rem; align-self: center; }

/* ===== small add buttons ===== */
.btn-add {
  width: 100%; justify-content: center; margin-top: 4px;
  background: transparent; border: 1px dashed var(--border-2); color: var(--text-dim);
  padding: 9px; font-size: 0.85rem;
}
.btn-add:hover { border-color: var(--accent-2); color: var(--accent); background: rgba(56, 189, 248, 0.05); transform: none; }
.plus { font-size: 1rem; font-weight: 700; }
.card .btn-add { border-style: dashed; }

/* row-value (education / certs) */
.row-value { display: flex; align-items: center; gap: 7px; }
.row-value input { flex: 1; }

input, textarea { font-family: inherit; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--accent-2); background: var(--surface-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), #0284c7); border-color: transparent; color: #04121f; box-shadow: 0 6px 18px var(--accent-glow); }
.btn-primary:hover { background: linear-gradient(135deg, var(--accent), var(--accent-2)); filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: var(--border-2); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent-2); }

.btn-label { position: relative; z-index: 1; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(4, 18, 31, 0.35); border-top-color: #04121f;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== footer / actions ===== */
.panel-foot {
  display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.status { color: var(--text-mute); font-size: 0.83rem; }
.saved { color: var(--ok); font-size: 0.83rem; }

/* ===== toast ===== */
.toast { margin: 18px 0 0; display: none; }
.toast.show { display: block; }
.toast.error { color: var(--err); }
.toast.success { color: var(--ok); }
.toast { font-size: 0.9rem; font-weight: 500; }

/* ===== CV output ===== */
.cv-output {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f4f7fb;
  color: #1a2233;
  animation: rise 0.35s ease both;
}
.cv-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 13px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  color: var(--text);
}
.cv-title { display: flex; align-items: center; gap: 9px; }
.cv-title h3 { margin: 0; font-size: 0.95rem; }
.cv-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2); }
.cv-actions { display: flex; gap: 8px; }

.cv-body {
  padding: 26px 30px;
  max-height: 620px; overflow-y: auto;
  font-family: "Inter", sans-serif;
  font-size: 0.9rem; line-height: 1.62;
  white-space: pre-wrap; word-break: break-word;
}
.cv-body::-webkit-scrollbar { width: 10px; }
.cv-body::-webkit-scrollbar-track { background: #e8eef6; }
.cv-body::-webkit-scrollbar-thumb { background: #bcc8d9; border-radius: 6px; }

/* ===== footer ===== */
.footer { padding: 28px 0 40px; color: var(--text-mute); font-size: 0.8rem; text-align: center; border-top: 1px solid var(--border); margin-top: 16px; }

/* responsive */
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 30px 0 26px; }
  .brand-text h1 { font-size: 1.35rem; }
  .hero-stats { display: none; }
  .panel-body { padding: 18px; }
}
