:root {
  color-scheme: dark;
  --navy: #07102a;
  --panel: #0c1735;
  --panel-2: #101d40;
  --line: rgba(180, 205, 255, 0.14);
  --text: #f6f8ff;
  --muted: #9daacc;
  --cyan: #00c4ef;
  --violet: #6e3ff3;
  --pink: #ed4fb6;
  --gold: #e8a800;
  font-family: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--navy); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { font-family: Poppins, sans-serif; margin-top: 0; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 25% 20%, rgba(0,196,239,.12), transparent 30%), radial-gradient(circle at 75% 80%, rgba(110,63,243,.16), transparent 32%), var(--navy); }
.login-card { width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 24px; background: rgba(12,23,53,.88); box-shadow: 0 30px 80px rgba(0,0,0,.35); backdrop-filter: blur(20px); }
.login-logo { width: 155px; margin-bottom: 32px; }
.login-card h1 { margin-bottom: 10px; font-size: 28px; }
label { display: block; margin: 24px 0 8px; color: #c9d2ec; font-size: 13px; font-weight: 600; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #08132f; color: var(--text); outline: none; }
input, select { height: 44px; padding: 0 13px; }
textarea { resize: vertical; padding: 13px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,196,239,.1); }
.error-text { min-height: 20px; color: #ff8da7; font-size: 13px; }

.primary-button, .secondary-button, .deploy-button, .icon-button { border: 0; border-radius: 9px; font-weight: 700; transition: .2s ease; }
.primary-button { min-height: 42px; padding: 0 18px; background: linear-gradient(135deg, #0db6ff, #4f6dff); color: white; box-shadow: 0 8px 24px rgba(41,105,255,.2); }
.login-card .primary-button { width: 100%; margin-top: 20px; }
.secondary-button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); background: rgba(255,255,255,.045); color: var(--text); }
.deploy-button { min-height: 38px; padding: 0 18px; background: linear-gradient(135deg, var(--pink), var(--violet)); color: #fff; }
.primary-button:hover, .deploy-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
button:disabled { cursor: not-allowed; opacity: .45; transform: none !important; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.icon-button.active, .icon-button:hover { border-color: rgba(0,196,239,.5); color: var(--cyan); background: rgba(0,196,239,.08); }

.app-shell { min-height: 100vh; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(7,16,42,.92); }
.brand-lockup, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.brand-lockup img { width: 118px; }
.brand-lockup span { padding-left: 12px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 700; }
.status-pill, .route-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 700; }
.status-pill.ready { color: #63e6be; border-color: rgba(99,230,190,.3); }

.main-grid { display: grid; grid-template-columns: 230px minmax(0,1fr); height: calc(100vh - 64px); }
.project-sidebar { overflow-y: auto; border-right: 1px solid var(--line); background: #08122d; padding: 14px 10px; }
.sidebar-heading { display: flex; justify-content: space-between; padding: 8px 10px 14px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.count { color: var(--cyan); }
.project-list { display: grid; gap: 6px; }
.project-item { width: 100%; padding: 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); text-align: left; }
.project-item:hover, .project-item.active { border-color: var(--line); background: rgba(255,255,255,.045); }
.project-item strong, .project-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-item strong { font-size: 13px; }
.project-item span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.empty-state { display: grid; place-items: center; padding: 40px; text-align: center; background: radial-gradient(circle, rgba(110,63,243,.08), transparent 35%); }
.empty-state > div { max-width: 520px; }
.empty-state h2 { margin-bottom: 12px; font-size: 34px; }
.empty-state p:not(.eyebrow) { margin: 0 auto 24px; color: var(--muted); line-height: 1.7; }

.workspace { display: grid; grid-template-columns: minmax(330px, 36%) minmax(0, 64%); min-width: 0; overflow: hidden; }
.chat-panel, .preview-panel { min-width: 0; min-height: 0; }
.chat-panel { display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; border-right: 1px solid var(--line); background: var(--panel); }
.panel-header { min-height: 68px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.project-header { display: flex; align-items: center; justify-content: space-between; }
.project-header h2 { margin: 0; font-size: 17px; }
.project-header .eyebrow { margin-bottom: 3px; }
.upload-zone { padding: 14px 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.02); }
.upload-zone > div:first-child { display: inline-block; max-width: calc(100% - 100px); }
.upload-zone strong { font-size: 12px; }
.upload-zone p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.file-button { float: right; display: inline-grid; place-items: center; }
.file-button input { display: none; }
.asset-list { clear: both; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; }
.asset-chip { max-width: 180px; padding: 5px 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; color: #c5d0eb; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.messages { overflow-y: auto; padding: 18px; }
.message { max-width: 90%; margin-bottom: 14px; padding: 12px 14px; border-radius: 14px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.message.user { margin-left: auto; border-bottom-right-radius: 4px; background: linear-gradient(135deg, rgba(0,196,239,.18), rgba(79,109,255,.2)); }
.message.assistant { border: 1px solid var(--line); border-bottom-left-radius: 4px; background: var(--panel-2); }
.message small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.composer { padding: 14px; border-top: 1px solid var(--line); background: #08132e; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; min-height: 42px; font-size: 11px; }

.preview-panel { position: relative; display: grid; grid-template-rows: auto minmax(0,1fr) auto; background: #050b1c; }
.preview-toolbar { display: flex; align-items: center; gap: 9px; padding: 10px 13px; }
.tabs { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; }
.tab { min-height: 30px; padding: 0 11px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.tab.active { background: rgba(255,255,255,.08); color: var(--text); }
.preview-toolbar select { width: auto; min-width: 100px; height: 36px; margin-left: auto; font-size: 11px; }
.viewport-buttons { display: flex; gap: 4px; }
.no-preview { display: grid; place-content: center; text-align: center; color: var(--muted); }
.no-preview h3 { margin: 20px 0 7px; color: var(--text); }
.no-preview p { margin: 0; font-size: 13px; }
.preview-orbit { width: 72px; height: 72px; margin: auto; border: 1px solid rgba(0,196,239,.28); border-radius: 50%; box-shadow: inset 0 0 30px rgba(110,63,243,.25), 0 0 40px rgba(0,196,239,.1); }
.preview-stage { min-height: 0; overflow: auto; padding: 16px; background: #11182b; text-align: center; }
#preview-frame { width: 100%; height: 100%; min-height: 620px; border: 0; border-radius: 8px; background: white; transition: width .25s ease; }
.html-source { height: 100%; min-height: 620px; margin: 0; padding: 20px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #050a18; color: #b7c8f5; text-align: left; white-space: pre-wrap; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; }
.validation-bar { padding: 9px 16px; border-top: 1px solid rgba(99,230,190,.18); background: rgba(99,230,190,.07); color: #8cecc8; font-size: 11px; }

.dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.dialog::backdrop { background: rgba(2,6,18,.75); backdrop-filter: blur(5px); }
.dialog form { padding: 28px; }
.dialog h2 { margin-bottom: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.url-field { display: flex; align-items: center; gap: 8px; padding-left: 12px; border: 1px solid var(--line); border-radius: 10px; background: #08132f; color: var(--muted); }
.url-field input { min-width: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.url-field span:last-child { padding-right: 12px; }
.deploy-progress { margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: 420px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: #17254b; box-shadow: 0 18px 55px rgba(0,0,0,.4); font-size: 13px; }
.toast.error { border-color: rgba(255,89,125,.35); color: #ff9bb0; }

@media (max-width: 1050px) {
  .main-grid { grid-template-columns: 180px minmax(0,1fr); }
  .workspace { grid-template-columns: minmax(310px, 42%) minmax(0,58%); }
  .viewport-buttons, #copy-html { display: none; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 10px; }
  .brand-lockup span, #model-status { display: none; }
  .main-grid { display: block; height: auto; }
  .project-sidebar { display: none; }
  .workspace { display: block; overflow: visible; }
  .chat-panel { min-height: calc(100vh - 64px); }
  .preview-panel { min-height: 760px; }
  .preview-toolbar { position: sticky; top: 0; z-index: 4; background: var(--navy); }
}
