/* Fomio Studio: the configurator as a workspace — menu bar, library, 3D stage,
   inspector and status bar fill the window; same palette and typeface as the shop */

body.studio {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 52px 1fr 28px;
  font-size: 14px;
  line-height: 1.45;
  --pane: #fffdf9;
  --stage: #efe8dc;
  --hair: rgba(51, 40, 32, 0.12);
}
.studio svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- menu bar ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: var(--pane);
  border-bottom: 1px solid var(--hair);
}
.bar-brand { display: flex; align-items: center; text-decoration: none; }
/* the same word mark as in the welcome dialog, a size larger */
.bar-word { font-size: 14px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text); white-space: nowrap; }
.bar-word span { color: var(--accent); }
.bar-doc { display: flex; align-items: baseline; gap: 10px; min-width: 0; padding-left: 18px; border-left: 1px solid var(--hair); }
.bar-cat { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.bar-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-tools { margin-left: auto; display: flex; align-items: center; gap: 16px; }
/* shop: outlined pill in the accent colour, filled on hover */
.shop-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 14px 0 11px;
  border: 1px solid var(--accent); border-radius: 999px; color: var(--accent);
  font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.shop-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.shop-btn:hover { background: var(--accent); color: #fff; }
.shop-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* language: a small slider DE | EN, the thumb slides to the active language */
.bar-tools .lang-switch {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 2px;
  border-radius: 999px; background: var(--sand); border: 1px solid var(--hair);
}
.bar-tools .lang-switch::before {
  content: ''; position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px);
  border-radius: 999px; background: var(--pane); box-shadow: 0 1px 3px rgb(51 40 32 / 0.18);
  transition: transform 0.2s ease;
}
.bar-tools .lang-switch:has(button[data-lang='en'][aria-pressed='true'])::before { transform: translateX(100%); }
.bar-tools .lang-switch button {
  position: relative; z-index: 1; height: 24px; min-width: 34px; padding: 0 9px; margin: 0;
  border: 0; border-radius: 999px; background: none; font: inherit; font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.06em; color: var(--faint); cursor: pointer;
}
.bar-tools .lang-switch button[aria-pressed='true'] { color: var(--text); border: 0; }
.bar-tools .lang-switch button:hover { color: var(--text); }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius); background: none; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--sand); }

/* ---------- workspace ---------- */
.workspace { position: relative; display: grid; grid-template-columns: 272px minmax(0, 1fr) 340px; min-height: 0; }
.library, .inspector { display: flex; flex-direction: column; min-height: 0; background: var(--pane); }
.library { border-right: 1px solid var(--hair); }
.inspector { border-left: 1px solid var(--hair); }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.pane-title { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.pane-count { font-size: 12px; color: var(--faint); }

/* library */
.search { position: relative; margin: 0 16px 10px; color: var(--faint); }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; }
.search input {
  width: 100%; height: 36px; padding: 0 10px 0 34px;
  border: 1px solid var(--hair); border-radius: var(--radius); background: var(--bg);
  font: inherit; font-size: 14px; color: var(--text);
}
.search input:focus { outline: none; border-color: var(--faint); background: var(--pane); }
.lib-list { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.search { margin-bottom: 8px; }
.lib-list { border-top: 1px solid var(--hair); }
.lib-group { border-bottom: 1px solid var(--hair); }
.lib-group summary {
  display: flex; align-items: center; gap: 8px; padding: 10px 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  cursor: pointer; list-style: none; user-select: none; border-radius: var(--radius);
}
.lib-group summary::-webkit-details-marker { display: none; }
.lib-group summary::before {
  content: ''; width: 6px; height: 6px; flex: none; margin: 0 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s;
}
.lib-group[open] summary::before { transform: rotate(45deg); }
.lib-group summary:hover { color: var(--text); background: var(--bg); }
.lib-group summary small { margin-left: auto; padding: 0 7px; border-radius: 999px; background: var(--bg); font-size: 11px; font-weight: 600; letter-spacing: 0; color: var(--faint); }
.lib-group[open] { padding-bottom: 6px; }
.lib-item {
  display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center;
  margin-left: 14px; padding: 5px 8px; border-radius: var(--radius); text-decoration: none; color: var(--text);
}
.lib-item:hover { background: var(--bg); }
.lib-item[aria-current='page'] { background: var(--sand); box-shadow: inset 2px 0 0 var(--accent); }
.lib-item img { width: 40px; height: 40px; object-fit: contain; border-radius: 3px; background: var(--stage); }
.lib-item b { font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.lib-empty { margin: 12px 8px; font-size: 13px; color: var(--faint); }

/* ---------- stage ---------- */
.stage { position: relative; min-width: 0; overflow: hidden; background: var(--stage); }
.viewport { position: absolute; inset: 0; }
.viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.progress { position: absolute; z-index: 3; left: 0; right: 0; top: 0; height: 2px; overflow: hidden; background: rgba(181, 78, 53, 0.15); }
.progress::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 35%; background: var(--accent); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) { .progress::after { animation: none; width: 100%; } }

.view-tools {
  position: absolute; z-index: 2; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 4px;
  background: var(--pane); border: 1px solid var(--hair); border-radius: 8px; box-shadow: var(--shadow);
}
.view-tools button {
  display: grid; place-items: center; min-width: 34px; height: 30px; padding: 0 10px;
  border: 0; border-radius: 5px; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
}
.view-tools button:hover { color: var(--text); background: var(--bg); }
.view-tools button[aria-pressed='true'], .view-tools button.on { color: var(--text); background: var(--sand); }
.view-tools .sep { width: 1px; height: 18px; margin: 0 4px; background: var(--hair); }

.hud {
  position: absolute; z-index: 2; left: 14px; bottom: 14px;
  display: grid; gap: 2px; padding: 8px 12px;
  background: rgba(255, 253, 249, 0.92); border: 1px solid var(--hair); border-radius: 6px;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.hud div { display: flex; gap: 12px; justify-content: space-between; }
.hud-k { color: var(--faint); }
.hud .ok { color: #2f6b45; }
.hud .bad { color: var(--danger); }
.stage-hint {
  position: absolute; z-index: 2; left: 50%; bottom: 18px; transform: translateX(-50%); margin: 0;
  padding: 7px 14px; border-radius: 999px; background: var(--pane); box-shadow: var(--shadow);
  font-size: 13px; color: var(--muted); white-space: nowrap;
}

/* ---------- inspector ---------- */
.seg { display: flex; padding: 2px; border-radius: 6px; background: var(--bg); border: 1px solid var(--hair); }
.seg button { height: 26px; padding: 0 12px; border: 0; border-radius: 4px; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button[aria-selected='true'] { background: var(--pane); color: var(--text); box-shadow: 0 1px 2px rgb(51 40 32 / 0.12); }
.doc-desc { margin: 0; padding: 0 16px 12px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--hair); }
.props { flex: 1; overflow-y: auto; padding: 0 0 12px; }
.props details { border-bottom: 1px solid var(--hair); }
.props summary {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint);
  cursor: pointer; list-style: none;
}
.props summary::-webkit-details-marker { display: none; }
.props summary::after { content: ''; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-top: -4px; transition: transform 0.15s; }
.props details[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
.props .fields { padding: 0 16px 8px; }
.studio .field { margin: 0 0 14px; }
.studio .field .label { font-size: 13px; margin-bottom: 5px; }
.studio input[type='number'], .studio input[type='text'], .studio select { height: 34px; font-size: 14px; padding: 0 10px; }
.studio .range-row { grid-template-columns: 1fr 76px; gap: 10px; }
.studio .field.check .label { font-size: 13px; }
.studio .field.changed .label::after { content: '•'; margin-left: 6px; color: var(--accent); }

.dock { display: grid; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--hair); background: var(--pane); }
.auto { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.auto input { width: 16px; height: 16px; accent-color: var(--accent); }
.studio .btn { height: 40px; font-size: 14px; padding: 0 14px; }
.studio .btn-secondary { height: 36px; }
.studio .btn kbd { margin-left: 8px; padding: 0 5px; border: 1px solid rgba(248, 245, 239, 0.4); border-radius: 3px; font: inherit; font-size: 11px; opacity: 0.75; }
.export { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.link-btn { justify-self: center; border: 0; background: none; font: inherit; font-size: 12px; color: var(--faint); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--accent); }

/* ---------- status bar ---------- */
.statusbar {
  display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: var(--ink); color: rgba(248, 245, 239, 0.78); font-size: 12px; white-space: nowrap; overflow: hidden;
}
.statusbar a { color: rgba(248, 245, 239, 0.6); text-decoration: none; }
.statusbar a:hover { color: #fff; }
.statusbar .grow { flex: 1; }
.statusbar #status { overflow: hidden; text-overflow: ellipsis; }
.statusbar #status.error { color: #ffb4a3; }
.sb-k { color: rgba(248, 245, 239, 0.5); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #7fb08f; flex: none; }
.dot.busy { background: #e2a25c; animation: pulse 1s ease-in-out infinite; }
.dot.err { background: #e07b63; }
@keyframes pulse { 50% { opacity: 0.35; } }

.only-narrow { display: none; }
.scrim { position: fixed; inset: 52px 0 0; z-index: 20; background: rgba(51, 40, 32, 0.28); }

/* ---------- narrower windows: panels slide in ---------- */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; }
  .library { position: fixed; z-index: 21; top: 52px; bottom: 0; left: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: var(--shadow); }
  .library.open { transform: none; }
  .only-narrow { display: grid; }
  .only-narrow#open-inspector { display: none; }
}
@media (max-width: 760px) {
  body.studio { grid-template-rows: 52px 1fr 0; }
  .statusbar { display: none; }
  .bar { gap: 8px; padding: 0 8px; }
  .bar-word { font-size: 12.5px; letter-spacing: 0.14em; }
  .bar-cat { display: none; }
  .shop-btn span { display: none; }
  .shop-btn { width: 30px; padding: 0; justify-content: center; }
  .bar-doc { padding-left: 10px; }
  .bar-title { font-size: 14px; }
  .bar-tools { gap: 6px; }
  .workspace { grid-template-columns: 1fr; }
  .only-narrow#open-inspector { display: grid; }
  /* the inspector becomes a bottom sheet */
  .inspector { position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; height: min(78dvh, 640px); border: 0; border-radius: 12px 12px 0 0; transform: translateY(102%); transition: transform 0.2s ease; box-shadow: 0 -10px 30px rgb(51 40 32 / 0.15); }
  .inspector.open { transform: none; }
  .view-tools { top: 10px; }
  .hud { left: 10px; bottom: 10px; font-size: 12px; }
  .stage-hint { bottom: 64px; }
  .mobile-cta { display: flex !important; }
  .hide-narrow { display: none; }
}
.mobile-cta {
  display: none; position: absolute; z-index: 2; right: 10px; bottom: 10px; gap: 8px;
}
.mobile-cta .btn { height: 40px; box-shadow: var(--shadow); }

/* ---------- welcome dialog: compact, over the dimmed workspace ---------- */
.welcome-backdrop {
  position: absolute; inset: 0; z-index: 30;
  display: grid; place-items: center; padding: 24px;
  background: rgba(51, 40, 32, 0.32);
  backdrop-filter: blur(2px);
}
.welcome-backdrop[hidden] { display: none; }
.welcome {
  display: grid; grid-template-columns: 290px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  width: min(920px, 100%); height: min(580px, 100%);
  overflow: hidden; border-radius: 10px; background: var(--pane);
  box-shadow: 0 24px 60px rgb(51 40 32 / 0.28);
}
.w-side { display: flex; flex-direction: column; gap: 14px; padding: 22px 20px 16px; border-right: 1px solid var(--hair); background: var(--bg); overflow-y: auto; }
.w-brand { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; }
.w-brand span { color: var(--accent); }
.w-side h1 { margin: 4px 0 0; font-size: 22px; font-weight: 400; line-height: 1.2; }
.w-sub { margin: -8px 0 0; font-size: 13px; color: var(--muted); }
.w-search { margin: 0; }
.w-search input { height: 34px; background: var(--pane); }
.w-label { margin: 0 0 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
#recent-row { display: grid; gap: 2px; }
.rcard {
  display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: center;
  padding: 4px 6px; border: 0; border-radius: 5px; background: none;
  font: inherit; font-size: 13px; color: var(--text); text-align: left; cursor: pointer;
}
.rcard:hover { background: var(--sand); }
.rcard img { width: 30px; height: 30px; object-fit: contain; border-radius: 3px; background: var(--stage); }
#home-nav { display: grid; gap: 1px; }
#home-nav button {
  display: flex; justify-content: space-between; height: 28px; padding: 0 8px; border: 0; border-radius: 5px; background: none;
  font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
}
#home-nav button:hover { background: var(--sand); color: var(--text); }
#home-nav button[aria-current='true'] { background: var(--sand); color: var(--text); font-weight: 600; }
#home-nav small { color: var(--faint); font-weight: 400; }
.w-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--hair); }
.w-skip { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--faint); cursor: pointer; }
.w-skip input { width: 14px; height: 14px; accent-color: var(--accent); }

/* min-height 0: the grid scrolls inside the dialog instead of growing out of it */
.w-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.w-head { display: flex; align-items: flex-end; gap: 12px; padding: 20px 20px 12px; border-bottom: 1px solid var(--hair); }
.w-head h2 { margin: 0; font-size: 18px; font-weight: 400; }
.w-count { padding: 2px 8px; border-radius: 999px; background: var(--sand); font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.w-enter { margin-left: auto; height: 34px !important; font-size: 13px !important; flex: none; }
.w-grid { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 10px; padding: 14px 20px 20px; }
.tcard {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--hair); border-radius: 7px; background: var(--pane);
  font: inherit; color: var(--text); text-align: left; cursor: pointer; padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tcard:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgb(51 40 32 / 0.12); }
.tcard img { display: block; flex: none; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; background: var(--stage); padding: 8%; }
.tcard .tc-body { flex: none; padding: 7px 9px 9px; }
.tcard b { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.tcard .tc-cat { display: block; margin-top: 2px; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.tcard p { display: none; }
.tcard .badge { position: absolute; top: 7px; left: 7px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; }

@media (max-width: 760px) {
  .welcome-backdrop { padding: 10px; }
  .welcome { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: min(92%, 640px); }
  .w-side { border-right: 0; border-bottom: 1px solid var(--hair); gap: 10px; padding: 16px; }
  .w-recent, .w-cats, .w-foot { display: none; }
  .w-head { padding: 12px 16px; }
  .w-count { display: none; }
  .w-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 16px 16px; }
}

/* ---------- account: button in the menu bar, sign-in and user area ---------- */
.account-btn {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px 0 4px;
  border: 1px solid var(--hair); border-radius: 999px; background: var(--pane);
  font: inherit; font-size: 13px; color: var(--text); cursor: pointer;
}
.account-btn[hidden] { display: none; }
.account-btn:hover { border-color: var(--faint); }
.account-btn #account-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--sand); font-size: 11.5px; font-weight: 600; }
.avatar:empty { display: none; }
.account-btn:has(.avatar:empty) { padding-left: 12px; }
.plan { padding: 1px 7px; border-radius: 999px; background: var(--bg); font-size: 11px; font-weight: 600; color: var(--faint); }
.plan.pro { background: var(--accent); color: #fff; }
.dialog {
  display: grid; gap: 12px; width: min(400px, 100%); padding: 20px 22px 22px;
  border-radius: 10px; background: var(--pane); box-shadow: 0 24px 60px rgb(51 40 32 / 0.28);
}
.dialog.wide { width: min(760px, 100%); height: min(540px, 100%); grid-template-rows: auto minmax(0, 1fr); }
.dialog h2 { margin: 0; font-size: 20px; font-weight: 400; }
.dlg-head { display: flex; align-items: center; gap: 14px; }
.dlg-close { margin-left: auto; }
.dlg-sub, .dlg-hint, .dlg-msg { margin: 0; font-size: 13px; color: var(--muted); }
.dlg-msg:empty { display: none; }
#login-form { display: grid; gap: 8px; }
#login-form input { height: 36px; }
.dialog > .btn { justify-content: center; }
.dlg-or { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--faint); }
.dlg-or::before, .dlg-or::after { content: ''; flex: 1; height: 1px; background: var(--hair); }
.dlg-body { display: grid; gap: 2px; align-content: start; overflow-y: auto; min-height: 0; }
.link-btn.danger { color: var(--danger); }
.upsell { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.upsell[hidden] { display: none; }
.upsell a { color: var(--accent); }
#save-project[hidden] { display: none; }
@media (max-width: 640px) {
  .account-btn #account-label { display: none; }
}

/* ---------- consent dialog: bottom left card, both choices equally prominent ---------- */
.consent {
  position: fixed; z-index: 40; left: 16px; bottom: 44px; width: min(440px, calc(100% - 32px));
  display: grid; gap: 12px; padding: 20px 20px 16px; border-radius: 10px;
  background: var(--pane); border: 1px solid var(--hair); box-shadow: 0 18px 50px rgb(51 40 32 / 0.25);
}
.consent[hidden] { display: none; }
.consent h2 { margin: 0; font-size: 17px; font-weight: 600; }
.consent-text { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.consent-text a { color: var(--accent); }
.consent-cats { display: grid; gap: 8px; }
.consent-cats[hidden] { display: none; }
.consent-cat { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--hair); border-radius: 8px; font-size: 12.5px; line-height: 1.45; color: var(--muted); cursor: pointer; }
.consent-cat input { margin-top: 2px; accent-color: var(--ink); }
.consent-cat b { color: var(--text); font-size: 13px; }
.consent-cat small { margin-left: 4px; font-size: 11px; color: var(--faint); }
.consent-btns { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.consent-btns .link-btn { margin-right: auto; }
.consent-btns .btn { height: 34px; padding: 0 14px; font-size: 13px; }
.consent-btns [hidden] { display: none; }
.sb-link { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.sb-link:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 640px) {
  .consent { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .consent-btns .btn { flex: 1; }
}

/* ---------- user area: side (who, sections, Pro) + main (title, content) ---------- */
.dialog.area {
  display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 0; padding: 0; overflow: hidden;
  width: min(900px, 100%); height: min(600px, 100%);
}
.area-side { display: flex; flex-direction: column; gap: 18px; padding: 22px 16px 16px; background: var(--bg); border-right: 1px solid var(--hair); }
.area-side .w-brand { padding: 0 6px; }
.area-user { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
.avatar.big { width: 38px; height: 38px; font-size: 16px; flex: none; background: var(--sand); }
.area-who { display: grid; gap: 3px; min-width: 0; }
.area-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.area-who .plan { justify-self: start; }
.area-nav { display: grid; gap: 2px; }
.area-nav button {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: 6px;
  background: none; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; text-align: left;
}
.area-nav button svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.area-nav button small { margin-left: auto; font-size: 11.5px; color: var(--faint); }
.area-nav button:hover { background: var(--sand); color: var(--text); }
.area-nav button[aria-selected='true'] { background: var(--pane); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(51 40 32 / 0.1); }
.area-upsell { margin-top: auto; display: grid; gap: 3px; padding: 12px; border-radius: 8px; border: 1px solid var(--accent); text-decoration: none; color: var(--text); }
.area-upsell[hidden] { display: none; }
.area-upsell b { color: var(--accent); font-size: 13px; }
.area-upsell span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.area-upsell:hover { background: var(--pane); }
.area-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.area-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 14px; border-bottom: 1px solid var(--hair); }
.area-head > div { min-width: 0; }
.area-head h2 { margin: 0; font-size: 22px; font-weight: 400; }
.area-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.area-head .dlg-close { margin-left: auto; }
.area-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 24px 24px; }
/* projects: cards */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pcard { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--hair); border-radius: 10px; background: var(--pane); transition: box-shadow 0.15s, transform 0.15s; }
.pcard:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgb(51 40 32 / 0.12); }
.pcard-open { position: relative; display: block; padding: 0; border: 0; background: var(--stage); cursor: pointer; }
.pcard-open img { display: block; width: 100%; aspect-ratio: 16 / 11; object-fit: contain; padding: 10%; }
.pcard-cat { position: absolute; top: 10px; left: 10px; padding: 2px 8px; border-radius: 999px; background: rgb(255 253 249 / 0.85); font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pcard-body { display: grid; gap: 3px; padding: 12px 14px 4px; }
.pcard-body b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.pcard-model { font-size: 12.5px; color: var(--muted); }
.pcard-body small { font-size: 12px; color: var(--faint); }
.pcard-act { display: flex; align-items: center; gap: 6px; margin-top: auto; padding: 10px 14px 14px; }
.pcard-act .btn { flex: 1; height: 34px; padding: 0 14px; font-size: 13px; }
.pcard-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border: 1px solid var(--hair); border-radius: 6px; background: var(--pane); color: var(--muted); cursor: pointer; }
.pcard-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pcard-icon:hover { color: var(--text); border-color: var(--faint); }
.pcard-icon.danger:hover { color: var(--danger); border-color: var(--danger); }
/* downloads: rows */
.dlist { display: grid; gap: 6px; }
.drow { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--hair); border-radius: 8px; background: var(--pane); }
.drow img { width: 46px; height: 46px; object-fit: contain; border-radius: 5px; background: var(--stage); }
.drow-txt { display: grid; gap: 2px; min-width: 0; }
.drow-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.drow-txt small { font-size: 12px; color: var(--faint); }
.drow-chips { display: flex; gap: 6px; }
.chip { padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--hair); font-size: 11px; font-weight: 600; letter-spacing: 0.05em; color: var(--muted); }
.chip.pro { background: var(--accent); border-color: var(--accent); color: #fff; }
.drow-act { display: flex; align-items: center; gap: 10px; }
.drow-act .btn { height: 30px; padding: 0 12px; font-size: 12.5px; }
/* account: grouped settings */
.area-groups { display: grid; gap: 18px; }
.area-group { border: 1px solid var(--hair); border-radius: 8px; background: var(--pane); }
.area-group h3 { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--hair); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.area-group.danger { border-color: rgb(163 52 31 / 0.35); }
.area-group.danger h3 { color: var(--danger); }
.area-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.area-row + .area-row { border-top: 1px solid var(--hair); }
.area-row > div:first-child { display: grid; gap: 2px; min-width: 0; }
.area-k { font-size: 12px; color: var(--faint); }
.area-v { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.area-v .plan { margin-right: 4px; }
.area-act { margin-left: auto; display: flex; gap: 8px; flex: none; }
.area-act .btn { height: 32px; padding: 0 14px; font-size: 13px; }
.btn.btn-danger { background: none; border: 1px solid var(--danger); color: var(--danger); }
.btn.btn-danger:hover { background: var(--danger); color: #fff; }
/* empty states */
.area-empty { display: grid; justify-items: center; gap: 6px; padding: 48px 20px; text-align: center; color: var(--muted); }
.area-empty svg { width: 34px; height: 34px; fill: none; stroke: var(--faint); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.area-empty b { color: var(--text); font-size: 15px; }
.area-empty p { margin: 0; max-width: 340px; font-size: 13px; }
@media (max-width: 760px) {
  .dialog.area { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: min(92%, 680px); }
  .area-side { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; border-right: 0; border-bottom: 1px solid var(--hair); }
  .area-side .w-brand, .area-upsell { display: none; }
  .area-nav { grid-auto-flow: column; width: 100%; }
  .area-nav button { justify-content: center; padding: 0 6px; }
  .area-nav button small { display: none; }
  .area-head { padding: 14px 16px 10px; }
  .area-body { padding: 14px 16px 18px; }
  .drow { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .drow-act { grid-column: 2 / -1; }
  .area-row { flex-wrap: wrap; }
  .area-act { margin-left: 0; }
}

/* ---------- small dialog: names and confirmations ---------- */
.ask-backdrop { z-index: 50; }
.dialog.ask { width: min(400px, 100%); gap: 10px; padding: 24px 24px 20px; }
.ask-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--sand); color: var(--text); }
.ask-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ask-icon.danger { background: rgb(163 52 31 / 0.1); color: var(--danger); }
.dialog.ask h2 { margin: 4px 0 0; font-size: 19px; }
.ask-field { display: grid; gap: 6px; margin-top: 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.ask-field[hidden] { display: none; }
.ask-field input { height: 40px; padding: 0 12px; border: 1px solid var(--hair); border-radius: 6px; background: var(--bg); font: inherit; font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--text); }
.ask-field input:focus { outline: none; border-color: var(--ink); background: var(--pane); box-shadow: 0 0 0 3px rgb(51 40 32 / 0.08); }
.ask-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.ask-btns .btn { height: 36px; padding: 0 16px; font-size: 13.5px; }
.btn.btn-danger-solid { background: var(--danger); border: 1px solid var(--danger); color: #fff; }
.btn.btn-danger-solid:hover { filter: brightness(0.92); }
