*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #0a0a0f;
  --bg2:     #111118;
  --bg3:     #1a1a24;
  --border:  #2a2a38;
  --text:    #e8e8f0;
  --text2:   #7a7a9a;
  --accent:  #7c6af7;
  --accent2: #a78bfa;
  --green:   #22c55e;
  --radius:  10px;
}

html, body { height: 100%; font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* ---- Auth ---- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 100; }
.auth-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 380px; }
.logo-text { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.auth-sub { color: var(--text2); font-size: 13px; margin-top: 4px; margin-bottom: 24px; }
.auth-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 10px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text2); cursor: pointer; font-size: 14px; transition: color 0.15s; }
.auth-tab.active { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; outline: none; }
.auth-form input:focus { border-color: var(--accent); }
.auth-msg { margin-top: 12px; font-size: 13px; min-height: 18px; text-align: center; color: var(--text2); }
.auth-msg.error { color: #f87171; }
.auth-msg.success { color: var(--green); }

/* ---- App layout ---- */
#app-screen { display: flex; height: 100vh; overflow: hidden; }

/* Left panel */
#left-panel { width: 340px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }

#generate-section { padding: 20px; border-bottom: 1px solid var(--border); }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
textarea { width: 100%; background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; resize: vertical; outline: none; font-family: inherit; line-height: 1.5; }
textarea:focus { border-color: var(--accent); }

/* Page info */
#page-info { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.info-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.info-label { font-size: 11px; color: var(--text2); text-transform: uppercase; font-weight: 600; }
code { font-size: 12px; color: var(--accent2); background: var(--bg3); padding: 2px 8px; border-radius: 4px; }
.action-row { display: flex; gap: 8px; align-items: center; }
.deploy-label { display: block; font-size: 11px; color: var(--text2); margin-top: 10px; margin-bottom: 4px; }
.deploy-link { font-size: 13px; color: var(--accent2); text-decoration: none; word-break: break-all; }
.deploy-link:hover { text-decoration: underline; }

/* Pages list */
#pages-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.section-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
#pages-list { flex: 1; overflow-y: auto; }
.page-item { padding: 12px 20px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
.page-item:hover { background: var(--bg3); }
.page-item.active { background: var(--bg3); border-left: 3px solid var(--accent); }
.page-title { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-meta { font-size: 11px; color: var(--text2); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.badge-deployed { background: #14532d; color: var(--green); font-size: 10px; padding: 1px 6px; border-radius: 4px; font-weight: 600; }

/* Preview panel */
#preview-panel { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f1f5f9; position: relative; overflow: hidden; }
#preview-empty { text-align: center; color: #94a3b8; }
#preview-empty .empty-icon { font-size: 48px; margin-bottom: 16px; }
#preview-empty h2 { font-size: 20px; color: #475569; font-weight: 600; margin-bottom: 8px; }
#preview-empty p { font-size: 14px; color: #94a3b8; max-width: 300px; }
#preview-frame { width: 100%; height: 100%; border: none; }
#preview-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(241, 245, 249, 0.9); gap: 16px; color: #475569; font-size: 14px; }
.loader { width: 40px; height: 40px; border: 3px solid #cbd5e1; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn-primary { background: var(--accent); color: #fff; border: none; border-radius: var(--radius); padding: 11px 20px; font-size: 14px; font-weight: 600; cursor: pointer; transition: filter 0.15s; width: auto; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.15); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; margin-top: 10px; }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--text2); border-radius: var(--radius); padding: 6px 12px; font-size: 12px; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-deploy { background: var(--green); color: #fff; border: none; border-radius: var(--radius); padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; transition: filter 0.15s; flex: 1; }
.btn-deploy:hover:not(:disabled) { filter: brightness(1.1); }
.btn-deploy:disabled { opacity: 0.5; cursor: not-allowed; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--bg2); border: 1px solid var(--border); color: var(--text); padding: 10px 20px; border-radius: 8px; font-size: 13px; z-index: 9999; transition: opacity 0.2s; white-space: nowrap; }
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.error { border-color: #f87171; color: #f87171; }
.toast.success { border-color: var(--green); color: var(--green); }

/* Utility */
.hidden { display: none !important; }

/* Plan banner */
.plan-banner { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--bg3); }
.plan-info { flex: 1; display: flex; align-items: center; gap: 6px; }
.plan-label { font-size: 11px; color: var(--text2); text-transform: uppercase; font-weight: 600; }
.plan-name { font-size: 12px; font-weight: 700; color: var(--accent2); background: rgba(124,106,247,.15); padding: 2px 8px; border-radius: 4px; }
.btn-upgrade { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border: none; border-radius: var(--radius); padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-upgrade:hover { filter: brightness(1.15); }

/* Upgrade modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 720px; position: relative; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; color: var(--text2); font-size: 18px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.modal-sub { color: var(--text2); font-size: 13px; margin-bottom: 28px; }
.modal-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.m-plan { background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 20px; position: relative; }
.m-plan.featured { border-color: var(--accent); }
.badge-pop { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 10px; border-radius: 20px; white-space: nowrap; }
.m-plan-name { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.m-plan-price { font-size: 26px; font-weight: 800; color: var(--accent2); margin-bottom: 14px; }
.m-plan-price small { font-size: 13px; font-weight: 400; color: var(--text2); }
.m-plan ul { list-style: none; margin-bottom: 18px; display: flex; flex-direction: column; gap: 6px; }
.m-plan ul li { font-size: 12px; color: var(--text2); }
.btn-choose { font-size: 13px; padding: 9px 16px; }
