
    :root {
      --bg: #0b0c0f;
      --panel: #111318;
      --muted: #9aa0a6;
      --text: #e9eef3;
      --accent: #4f8cff; /* overridable */
      --radius: 16px;
      --shadow: 0 10px 30px rgba(0,0,0,.35);
      --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
      --sans: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    }

    * { box-sizing: border-box; }
    body {
      margin: 0;
      background: linear-gradient(120deg, #0b0c0f 0%, #13151b 60%, #0b0c0f 100%);
      color: var(--text);
      font-family: var(--sans);
      min-height: 100svh;
      display: grid;
      grid-template-columns: 380px 1fr;
      gap: 22px;
      padding: 22px;
    }

    /* Sidebar (Builder) */
    .builder {
      background: var(--panel);
      border: 1px solid #1f232b;
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      padding: 18px 16px 22px;
      overflow: auto;
      max-height: calc(100svh - 44px);
    }

    .brand {
      display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
    }
    .logo {
      width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #9b6bff);
      display:flex; align-items:center; justify-content:center; font-weight:800; color:#fff;
    }
    .brand h1 { font-size: 16px; margin:0; }
    .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

    fieldset {
      border: 1px solid #242936; border-radius: 12px; padding: 12px; margin: 12px 0 14px;
    }
    legend { padding: 0 8px; color: #cbd5e1; font-weight: 600; }

    label { display:block; font-size: 12px; color:#cbd5e1; margin: 10px 0 6px; }
    input[type="text"], input[type="email"], input[type="url"], input[type="tel"], textarea, select {
      width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #2a3040; background: #0f1117; color: #e5e7eb;
      outline: none;
    }
    textarea { resize: vertical; min-height: 74px; }
    input[type="color"] { height: 38px; padding: 0; border-radius: 10px; border: 1px solid #2a3040; background:#0f1117; }

    .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

    .btns { display:flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
    .btn {
      appearance: none; border: 1px solid #2d3345; background: #11131a; color: #e5e7eb; padding: 10px 14px; border-radius: 12px; font-weight: 600; cursor: pointer;
    }
    .btn.primary { background: var(--accent); border-color: transparent; color:#081021; }
    .btn.ghost { background: transparent; }

    .tiny { font-size: 12px; color: var(--muted); }

    /* Preview Panel */
    .preview {
      background: #0d0f14;
      border: 1px solid #1b1f2e;
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      padding: 0;
      overflow: hidden;
      position: relative;
    }
    .preview-header {
      padding: 14px 16px; border-bottom: 1px solid #1b1f2e; background: #0d0f14; display:flex; align-items:center; gap:10px; justify-content: space-between;
    }
    .badge { padding: 6px 10px; border: 1px solid #2a3040; border-radius: 999px; font-size: 12px; color: var(--muted); }

    /* The actual portfolio canvas */
    .canvas { width: 100%; height: calc(100% - 48px); overflow:auto; background:#0b0c0f; }

    /* ====== THEMES for the exported site (and live preview) ====== */
    .portfolio { --accent: var(--accent); }

    .theme-minimal { --bgP: #f7f8fb; --textP: #1a202c; --mutedP: #4a5568; --cardP: #ffffff; }
    .theme-dark    { --bgP: #0c0e13; --textP: #e8eef5; --mutedP: #9aa0a6; --cardP: #121623; }
    .theme-modern  { --bgP: #0e1117; --textP: #e6eef6; --mutedP: #9ea7b3; --cardP: #0f1422; }

    .portfolio {
      background: var(--bgP);
      color: var(--textP);
      min-height: 100%;
      font-family: var(--sans);
    }
    .p-wrap {
      max-width: 1000px; margin: 0 auto; padding: 28px 26px 48px;
    }

    /* Header */
    .p-header { display:grid; grid-template-columns: 92px 1fr; gap: 18px; align-items: center; }
    .avatar {
      width: 92px; height: 92px; border-radius: 22px; background: #e2e8f0; overflow:hidden; border: 3px solid var(--accent);
    }
    .avatar img { width:100%; height:100%; object-fit: cover; display:block; }
    .title h1 { margin:0; font-size: 28px; }
    .title .role { color: var(--mutedP); margin-top: 6px; }

    .socials { display:flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
    .chip { display:flex; align-items:center; gap: 8px; padding: 6px 10px; border: 1px solid rgba(0,0,0,.08); background: var(--cardP); border-radius: 999px; font-size: 13px; color: var(--textP); text-decoration:none; }
    .chip svg { width: 16px; height: 16px; }

    /* Sections */
    .section { margin-top: 26px; }
    .section h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: .4px; }

    .about { line-height: 1.6; color: var(--textP); }

    .skills { display:flex; flex-wrap: wrap; gap: 8px; }
    .tag { background: var(--cardP); border: 1px solid rgba(0,0,0,.06); padding: 6px 10px; border-radius: 8px; font-size: 13px; }

    .grid { display:grid; gap: 12px; }
    .grid.cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
    .card { background: var(--cardP); padding: 16px; border-radius: 14px; border: 1px solid rgba(0,0,0,.08); }
    .card h3 { margin: 0 0 6px; font-size: 16px; }
    .card p { margin: 0 0 10px; color: var(--mutedP); }
    .link { display:inline-flex; gap:6px; align-items:center; text-decoration:none; color: var(--accent); font-weight: 600; }

    .edu, .exp { display:grid; gap: 10px; }
    .rowline { display:flex; align-items: baseline; gap: 10px; }
    .rowline .when { color: var(--mutedP); font-size: 13px; }

    /* Modern theme special header */
    .theme-modern .hero {
      background: radial-gradient(900px 280px at 10% -10%, rgba(79,140,255,.25), transparent 60%), radial-gradient(900px 280px at 80% -40%, rgba(155,107,255,.18), transparent 60%), linear-gradient(180deg, #0e1117, #0e1117);
      border-bottom: 1px solid rgba(255,255,255,.05);
      padding: 26px 0 18px;
      margin: -28px -26px 18px;
    }

    /* Minimal theme header line */
    .theme-minimal .p-header { border-bottom: 3px solid var(--accent); padding-bottom: 14px; }

    /* Print */
    @media print {
      body { display:block; padding:0; background: #fff; }
      .builder, .preview-header { display:none !important; }
      .preview { border:none; box-shadow:none; }
      .canvas { height: auto; }
    }

    /* Responsive for small screens */
    @media (max-width: 980px) {
      body { grid-template-columns: 1fr; }
      .builder { max-height: none; }
    }