:root {
  --ink: #18322b;
  --green: #244b3e;
  --cream: #f1eee6;
  --paper: #fff;
  --line: #d8d4ca;
  --selected: #8d9b83;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.account-bar {
  height: 64px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 80; background: #fff; border-bottom: 1px solid var(--line);
}
.account-brand b, .account-brand span { display: block; }
.account-brand b { font-size: 13px; letter-spacing: 1.4px; }
.account-brand span { margin-top: 2px; font-size: 7px; letter-spacing: 1.6px; }
.account-nav { display: flex; align-self: stretch; gap: 8px; }
.nav-button { padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; cursor: pointer; font-size: 10px; font-weight: 800; }
.nav-button.active { border-bottom-color: var(--green); }
.account-actions { display: flex; align-items: center; gap: 10px; }
.credit-pill { padding: 8px 11px; border-radius: 20px; background: #eef3ef; font-size: 10px; }
.credit-pill b { font-size: 13px; }
.account-button { padding: 9px 13px; border: 1px solid var(--green); background: white; cursor: pointer; font-size: 9px; font-weight: 800; }
.auth-gate { position: fixed; inset: 64px 0 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: #eeeae1; }
.auth-card { width: min(410px, 100%); padding: 34px; background: white; border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(24,50,43,.12); text-align: center; }
.auth-logo { width: 48px; height: 48px; margin: auto; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50%; font-weight: 900; }
.auth-card h1 { margin: 22px 0 8px; font-size: 27px; letter-spacing: -1.2px; }
.auth-card > p { margin: 0 0 24px; color: #707975; font-size: 12px; line-height: 1.6; }
.google-login, #emailForm button { width: 100%; height: 45px; border: 0; cursor: pointer; font-size: 11px; font-weight: 800; }
.google-login { border: 1px solid #d3d2cd; background: white; }
.google-login span { margin-right: 9px; color: #4285f4; font-size: 15px; }
.auth-divider { margin: 18px 0; border-top: 1px solid #e4e1da; }
.auth-divider span { position: relative; top: -8px; padding: 0 8px; background: white; color: #929894; font-size: 8px; }
#emailForm { display: grid; gap: 8px; }
#emailForm input { height: 45px; padding: 0 13px; border: 1px solid #d3d2cd; font-size: 11px; }
#emailForm button { background: var(--green); color: white; }
#authMessage { display: block; margin-top: 14px; color: #8b928f; font-size: 8px; line-height: 1.5; }
.dashboard-view { min-height: calc(100vh - 64px); padding: 48px 6vw; background: var(--cream); }
.dashboard-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 30px; }
.dashboard-heading small { font-size: 8px; letter-spacing: 1.8px; }
.dashboard-heading h1 { margin: 6px 0 0; font-size: 36px; }
.primary-small { padding: 11px 16px; border: 0; background: var(--green); color: white; cursor: pointer; font-size: 9px; font-weight: 800; }
.generation-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 18px; }
.generation-card { overflow: hidden; background: white; border: 1px solid var(--line); }
.generation-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #ddd; }
.generation-card div { padding: 14px; }
.generation-card small { color: #818985; font-size: 8px; }
.generation-card strong { display: block; margin-top: 4px; font-size: 11px; }
.empty-dashboard { grid-column: 1/-1; padding: 80px 20px; border: 1px dashed #bbbdb7; color: #7f8783; text-align: center; font-size: 11px; }
.stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 15px; margin-bottom: 22px; }
.stat-grid article { padding: 22px; background: white; border: 1px solid var(--line); }
.stat-grid small { color: #818985; font-size: 8px; letter-spacing: 1px; }
.stat-grid strong { display: block; margin-top: 8px; font-size: 25px; }
.admin-table-wrap { overflow: auto; background: white; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th, td { padding: 13px; border-bottom: 1px solid #ece9e2; text-align: left; white-space: nowrap; }
th { color: #7d8581; font-size: 8px; letter-spacing: .8px; }
.account-menu { position: fixed; z-index: 100; right: 27px; top: 57px; width: 230px; padding: 14px; background: white; border: 1px solid var(--line); box-shadow: 0 16px 35px rgba(0,0,0,.12); }
.account-menu strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.account-menu button { width: 100%; margin-top: 12px; padding: 9px; border: 1px solid #d0cec8; background: white; cursor: pointer; font-size: 9px; }
button, input { font: inherit; }
button { color: inherit; }

.studio {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: 390px 1fr;
}

.panel {
  min-height: calc(100vh - 64px);
  padding: 28px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 34px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1.5px solid var(--ink); border-radius: 50%;
  font-size: 12px; font-weight: 900; letter-spacing: -1px;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: 1.5px; }
.brand small { margin-top: 2px; font-size: 7px; letter-spacing: 1.7px; }

.control-block { padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid #e8e5de; }
.block-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.block-title > span {
  width: 25px; height: 25px; display: grid; place-items: center;
  border: 1px solid var(--ink); border-radius: 50%; font-size: 10px; font-weight: 800;
}
.block-title h2 { margin: 0; font-size: 13px; }

.upload {
  min-height: 115px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px dashed #a8aea9; background: #faf9f6; cursor: pointer; transition: .2s;
}
.upload:hover, .upload.dragover { border-color: var(--green); background: #f0f4f0; }
.upload input { display: none; }
.upload-symbol { font-size: 22px; font-weight: 300; }
.upload strong { margin-top: 6px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.upload small { margin-top: 4px; color: #8a928e; font-size: 9px; }

.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.model {
  height: 62px; padding: 8px; display: flex; align-items: center; gap: 10px;
  border: 1px solid #d6d3cc; background: white; cursor: pointer; font-size: 10px; font-weight: 700;
}
.model.selected { border: 1.5px solid var(--green); background: #f1f4f0; }
.door { width: 31px; height: 42px; flex: none; border: 1px solid #8f978f; background: #ebeae4; }
.door.shaker { box-shadow: inset 0 0 0 5px #ebeae4, inset 0 0 0 6px #8f978f; }
.door.classic { box-shadow: inset 0 0 0 4px #ebeae4, inset 0 0 0 5px #8f978f, inset 0 0 0 9px #ebeae4, inset 0 0 0 10px #8f978f; }
.door.slatted { background: repeating-linear-gradient(90deg, #e5e4de 0 3px, #929992 3px 4px); }

.colors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.color {
  aspect-ratio: 1; padding: 0; border: 4px solid white; border-radius: 50%;
  background: var(--swatch); box-shadow: 0 0 0 1px #c9c8c2; cursor: pointer;
}
.color.selected { box-shadow: 0 0 0 2px var(--green); }
.color.custom { display: grid; place-items: center; border: 1px dashed #999f9b; background: white; font-size: 17px; }
.choice { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 10px; }
.choice span { width: 10px; height: 10px; border-radius: 50%; background: var(--selected); }
.mask-help { margin: -2px 0 12px; color: #707a76; font-size: 10px; line-height: 1.5; }
.brush-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 7px; }
.brush-row label { display: flex; align-items: center; gap: 7px; font-size: 9px; font-weight: 700; }
.brush-row input { min-width: 0; width: 100%; accent-color: var(--green); }
.brush-row button { padding: 7px 8px; border: 1px solid #d0cec7; background: white; cursor: pointer; font-size: 8px; font-weight: 700; }
.pro-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.pro-options label > span { display: block; margin-bottom: 5px; color: #77817c; font-size: 8px; font-weight: 800; }
.pro-options select { width: 100%; padding: 8px; border: 1px solid #d0cec7; background: white; font-size: 9px; }
.color-lock { display: flex; align-items: center; gap: 7px; margin-top: 11px; font-size: 9px; font-weight: 700; }
.color-lock input { accent-color: var(--green); }
.prompt-panel { margin: -4px 0 18px; border: 1px solid #d9d6ce; background: #faf9f6; }
.prompt-panel summary {
  padding: 12px 13px; display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; list-style: none; font-size: 10px; font-weight: 800;
}
.prompt-panel summary::-webkit-details-marker { display: none; }
.prompt-panel[open] summary span { transform: rotate(180deg); }
.prompt-content { padding: 0 12px 12px; border-top: 1px solid #e2dfd7; }
.prompt-content label, .prompt-content label > span { display: block; }
.prompt-content label > span { margin: 11px 0 5px; color: #77817c; font-size: 7px; font-weight: 800; letter-spacing: 1px; }
.prompt-content textarea {
  width: 100%; min-height: 118px; padding: 9px; resize: vertical;
  border: 1px solid #d6d3cb; background: white; color: #31443e;
  font: 9px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}
#negativePromptPreview { min-height: 75px; }
#copyPrompt { width: 100%; margin-top: 9px; padding: 9px; border: 1px solid var(--green); background: white; cursor: pointer; font-size: 9px; font-weight: 800; }

.generate {
  width: 100%; min-height: 64px; padding: 12px 18px; display: flex; align-items: center; gap: 15px;
  border: 0; background: var(--green); color: white; text-align: left; cursor: pointer;
}
.generate > span { font-size: 20px; }
.generate strong, .generate small { display: block; }
.generate strong { font-size: 13px; }
.generate small { margin-top: 3px; color: #b9cac4; font-size: 9px; }
.generate:disabled { opacity: .45; cursor: not-allowed; }

.workspace { min-width: 0; min-height: calc(100vh - 64px); padding: 28px; display: flex; flex-direction: column; }
.workspace-head {
  height: 44px; display: flex; align-items: flex-start; justify-content: space-between;
  font-size: 11px;
}
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #b1b5b2; }
.status-dot.ready { background: #58a568; box-shadow: 0 0 0 4px rgba(88,165,104,.12); }
.workspace-head button { padding: 0; border: 0; background: transparent; color: #6f7975; cursor: pointer; font-size: 10px; }

.stage { position: relative; flex: 1; min-height: 530px; overflow: hidden; background: #dfdbd2; }
.empty-state {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #7f8884; background:
    linear-gradient(135deg, rgba(255,255,255,.3) 25%, transparent 25%) 0 0 / 30px 30px,
    #dfdbd2;
}
.empty-state span { font-size: 42px; font-weight: 200; }
.empty-state strong { margin-top: 10px; font-size: 12px; }
#beforeImage { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #202623; display: none; }
#maskCanvas { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; display: none; cursor: crosshair; touch-action: none; }
.after-layer { position: absolute; inset: 0 0 0 50%; overflow: hidden; display: none; }
#afterCanvas { position: absolute; top: 0; right: 0; width: var(--stage-width); height: var(--stage-height); object-fit: contain; background: #202623; }
.compare-line { position: absolute; z-index: 5; top: 0; bottom: 0; left: 50%; width: 2px; background: white; display: none; pointer-events: none; }
.compare-line span {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  background: white; color: var(--green); font-weight: 900; box-shadow: 0 5px 20px rgba(0,0,0,.25);
}
#compareSlider { position: absolute; z-index: 6; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; display: none; }
.tag {
  position: absolute; z-index: 4; top: 18px; padding: 7px 10px;
  background: rgba(18,31,27,.7); color: white; font-size: 8px; letter-spacing: 1.5px; display: none;
}
.before-tag { left: 18px; }
.after-tag { right: 18px; background: var(--green); }
.processing {
  position: absolute; z-index: 10; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(24,50,43,.9); color: white;
}
.processing.show { display: flex; }
.processing strong { margin-top: 15px; font-size: 14px; }
.spinner { width: 42px; height: 42px; border: 2px solid rgba(255,255,255,.2); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-bar {
  min-height: 72px; padding: 0 18px; display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 20px;
  border: 1px solid var(--line); border-top: 0; background: white;
}
.result-bar small, .result-bar strong { display: block; }
.result-bar small { margin-bottom: 4px; color: #8a928e; font-size: 8px; letter-spacing: 1.1px; }
.result-bar strong { font-size: 11px; }
.result-bar i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; background: var(--selected); vertical-align: -1px; }
.result-bar button { padding: 10px 14px; border: 1px solid #c8cbc7; background: white; cursor: pointer; font-size: 9px; font-weight: 800; }
.result-bar button:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 850px) {
  .studio { grid-template-columns: 330px 1fr; }
  .panel { padding: 20px; }
  .workspace { padding: 20px; }
}

@media (max-width: 680px) {
  .studio { display: block; }
  .panel { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin-bottom: 28px; }
  .workspace { min-height: 590px; padding: 14px; }
  .stage { min-height: 440px; }
  .result-bar { grid-template-columns: 1fr 1fr; }
  .result-bar button { grid-column: 1 / -1; margin-bottom: 12px; }
}
