:root {
  color-scheme: light;
  --ink:#233129; --muted:#55645a; --page:#f7f5ef; --paper:#fffefa;
  --line:#ddded3; --green:#244937; --soft:#e8eee4; --error:#9e3526;
  font-family: system-ui, -apple-system, sans-serif;
  color:var(--ink); background:var(--page);
}
*, *::before, *::after { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; min-width:300px; }
a { color:var(--green); text-underline-offset:3px; }
button, .button {
  font:600 .875rem/1.25 system-ui,sans-serif; min-height:42px; display:inline-flex;
  align-items:center; justify-content:center; text-decoration:none; background:var(--paper);
  color:var(--ink); border:1px solid var(--line); border-radius:8px; padding:9px 14px; cursor:pointer;
}
button:hover, .button:hover { background:var(--soft); }
button:disabled { opacity:.48; cursor:default; }
.primary, .primary:hover { background:var(--green); color:white; border-color:var(--green); }
.quiet { border-color:transparent; background:transparent; }
:focus-visible { outline:2px solid #b85d46; outline-offset:3px; }
h1,h2,h3,p { margin:0; }
h1 { font:400 clamp(2.3rem,5vw,4rem)/1.03 Georgia,serif; letter-spacing:-.06em; }
h2 { font-size:1.14rem; }
p { line-height:1.55; }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px max(20px,5vw); background:var(--paper); border-bottom:1px solid var(--line); }
.brand { display:flex; text-decoration:none; align-items:center; gap:9px; font-size:1.5rem; font-weight:750; letter-spacing:-.07em; }
.brand-name { white-space:nowrap; }
#app-version { margin-inline-start:.35em; color:var(--muted); font-size:.56em; font-weight:650; font-variant-numeric:tabular-nums; letter-spacing:0; line-height:0; }
.mark { display:grid; place-items:center; width:36px; height:36px; border-radius:9px; background:var(--green); color:#fff; line-height:1; padding-bottom:4px; }
.top-actions,.actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
main { max-width:1320px; margin:0 auto; }
#notice { margin:14px 18px 0; padding:11px 14px; border-radius:8px; background:var(--soft); overflow-wrap:anywhere; }
#notice.error { color:var(--error); background:#f8eae3; }
.guest { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(285px,1fr); gap:clamp(22px,5vw,76px); padding:clamp(22px,7vw,90px) max(16px,6vw); align-items:start; }
.guest h1 { font-size:clamp(2.6rem,7.8vw,6.8rem); }
.guest h1 em { color:var(--green); }
.guest p { margin-block:16px 22px; max-width:440px; color:var(--muted); }
.guest iframe { height:350px; }
.auth,.domain-card { background:var(--paper); border:1px solid var(--line); border-radius:14px; padding:clamp(16px,3vw,30px); min-width:0; }
.auth-choices { display:grid; gap:8px; margin-block:14px; }
.auth-choices .auth-availability { margin:0; font-size:.82rem; }
.email-option { margin-top:14px; border-top:1px solid var(--line); padding-top:12px; }
.email-option summary { cursor:pointer; font-weight:650; color:var(--green); }
.email-option form { margin-top:12px; }
.account-card { max-width:420px; margin-top:16px; }
.oauth-return { max-width:520px; padding:40px 20px; }
.oauth-return p { margin-block:16px; }
.auth form { display:grid; gap:13px; margin:18px 0 5px; }
label { display:grid; gap:6px; font-size:.9rem; font-weight:650; }
input,select,textarea { font:400 1rem/1.4 system-ui,sans-serif; color:var(--ink); width:100%; min-width:0; border:1px solid var(--line); border-radius:8px; background:var(--paper); padding:9px 11px; }
textarea { resize:vertical; }
.studio { display:grid; grid-template-columns:175px minmax(0,1fr); min-height:calc(100dvh - 67px); }
.navigation { display:flex; flex-direction:column; gap:6px; padding:20px 12px; border-right:1px solid var(--line); }
.navigation button { justify-content:flex-start; border-color:transparent; background:transparent; }
.navigation button[aria-pressed=true] { background:var(--soft); color:var(--green); }
.panel { min-width:0; padding:clamp(16px,4vw,42px); }
.panel-head { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:end; gap:12px; margin-bottom:22px; }
.eyebrow { color:var(--muted); font-weight:650; font-size:.85rem; margin-bottom:5px; }
.editor { display:grid; gap:clamp(18px,4vw,46px); grid-template-columns:minmax(240px,1fr) minmax(0,1.27fr); align-items:start; }
#profile-form { display:grid; gap:14px; }
.form-section { display:grid; gap:8px; justify-items:start; border-top:1px solid var(--line); padding-top:12px; }
.form-section > div { width:100%; display:grid; gap:8px; }
.entry { padding:10px; border:1px solid var(--line); border-radius:9px; display:grid; gap:8px; }
.entry button { justify-self:start; }
.preview { position:sticky; top:12px; min-width:0; }
.preview-head { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; align-items:center; margin-bottom:9px; }
.preview iframe { height:520px; }
iframe { width:100%; min-width:0; display:block; border:1px solid var(--line); border-radius:12px; background:var(--paper); }
.muted { color:var(--muted); }
.themes { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,235px),1fr)); gap:14px; margin-top:14px; }
.theme-card { border:1px solid var(--line); background:var(--paper); border-radius:12px; overflow:hidden; }
.theme-card .card-body { display:grid; gap:8px; padding:13px; }
.theme-card p { color:var(--muted); font-size:.875rem; }
.theme-card .art { aspect-ratio:2/.97; display:grid; align-content:center; padding:12px 9%; gap:5px; background:#e8deca; color:#2e4535; position:relative; isolation:isolate; overflow:hidden; }
.theme-card .art strong { font:400 clamp(1.45rem,4vw,2.75rem)/.92 Georgia,serif; letter-spacing:-.07em; }
.theme-card .art small { text-transform:uppercase; font-size:.62rem; letter-spacing:.1em; }
.theme-card .art::after { content:""; position:absolute; z-index:-1; width:32%; aspect-ratio:1; border-radius:50% 50% 6px 6px; right:6%; bottom:-9%; background:#bd624c; }
.theme-card .minimal { background:#f1efeb; justify-content:center; text-align:center; }
.theme-card .minimal::after { display:none; }
.theme-card .gallery { background:#1a3128; color:#fbf3e2; }
.theme-card .gallery::after {
  inset:0 0 0 53%; width:auto; aspect-ratio:auto; border-radius:0;
  background:center / cover no-repeat url("/gallery/moc-studio.jpg");
}
.theme-card .executive { background:#dce7e7; color:#173950; }
.theme-card .executive::after { background:#396279; border-radius:50%; }
.theme-card .monochrome { background:#252525; color:#fff; }
.theme-card .monochrome::after { background:#4a4a4a; border-radius:0; }
.domain-layout { display:grid; gap:14px; grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr)); }
.domain-card { display:grid; align-content:start; gap:11px; }
.domain-card form { display:grid; gap:10px; justify-items:start; }
.domain-card form label { width:100%; }
.domain-card dl { display:grid; gap:4px 10px; grid-template-columns:max-content 1fr; font-size:.9rem; }
.domain-card dd { margin:0; overflow-wrap:anywhere; }
#default-url { overflow-wrap:anywhere; }
@media(max-width:800px) {
  .studio { grid-template-columns:minmax(0,1fr); }
  .navigation { flex-direction:row; flex-wrap:wrap; border-right:0; border-bottom:1px solid var(--line); padding:8px max(12px,4vw); }
  .preview { position:static; }
}
@media(max-width:620px) {
  .guest,.editor { grid-template-columns:minmax(0,1fr); }
  .auth { grid-row:1; }
  .guest iframe { height:300px; }
  .preview iframe { height:390px; }
  .topbar { padding-inline:12px; }
  button,.button { min-height:44px; }
}

.namecard-form {
  display:grid;
  gap:12px;
  min-width:0;
  margin:0;
  padding:12px;
  border:1px solid var(--line);
  border-radius:10px;
}
.namecard-form legend { padding-inline:5px; font-weight:700; }
.namecard-photo { display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
.namecard-photo > div { flex:1 1 160px; min-width:0; }
#avatar-preview { width:68px; aspect-ratio:4/5; object-fit:cover; border-radius:4px; }
.namecard-inputs { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr)); gap:12px; }
.namecard-note { font-size:.85rem; }

/* Studio trên điện thoại */
.studio-mobile {
  --page:#f7f7f2;
  --paper:#fffefa;
  --line:#d9dfd5;
  --green:#224f3e;
  --soft:#e7f0e8;
}
.studio-mobile > .topbar { padding:9px 14px; min-height:52px; }
.studio-mobile .topbar .brand { font-size:1.22rem; }
.studio-mobile .topbar .mark { width:29px; height:29px; border-radius:8px; }
.studio-mobile .topbar .quiet { padding:6px 8px; font-size:.78rem; }
.studio-mobile .topbar .top-actions { gap:2px; }
.studio-mobile .studio { display:block; min-height:0; }
.studio-mobile.has-session > main { padding-bottom:calc(68px + env(safe-area-inset-bottom)); }
.studio-mobile .panel { padding:16px; }
.studio-mobile .panel h1 {
  font:700 clamp(1.5rem,7vw,1.85rem)/1.15 system-ui,sans-serif;
  letter-spacing:-.045em;
}
.studio-mobile .mobile-panel h1 { margin-bottom:14px; }
.studio-mobile .panel-head { margin-bottom:13px; }
.studio-mobile .eyebrow { display:none; }
.studio-mobile #notice { margin:9px 16px 0; font-size:.87rem; }
.studio-mobile .navigation {
  position:fixed; z-index:5; inset:auto 0 0;
  display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:2px;
  padding:6px max(7px,env(safe-area-inset-left)) max(8px,env(safe-area-inset-bottom));
  border:0; border-top:1px solid var(--line); background:var(--paper);
}
.studio-mobile .navigation button {
  min-height:47px; justify-content:center; padding:5px 2px;
  color:var(--muted); font-size:.75rem; text-align:center;
}
.studio-mobile .navigation button[aria-pressed=true] { color:var(--green); }
.studio-mobile .mobile-summary,.studio-mobile .mobile-shortcuts button {
  border:1px solid var(--line); border-radius:12px; background:var(--paper);
}
.studio-mobile .mobile-summary { display:grid; gap:10px; padding:12px; }
.studio-mobile .mobile-summary-head {
  display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:6px;
  color:var(--muted); font-size:.8rem;
}
.studio-mobile #mobile-live {
  color:var(--muted); background:var(--page); border-radius:7px;
  padding:3px 6px; font-size:.76rem;
}
.studio-mobile #mobile-live[data-live=true] { color:var(--green); background:var(--soft); }
.studio-mobile .mobile-identity {
  display:flex; align-items:center; gap:11px; min-width:0; overflow-wrap:anywhere;
}
.studio-mobile .mobile-identity img,.studio-mobile #mobile-initials {
  width:49px; height:58px; flex:none; border-radius:7px; object-fit:cover;
}
.studio-mobile #mobile-initials {
  display:grid; place-items:center; background:var(--soft); color:var(--green); font-weight:700;
}
.studio-mobile #mobile-name { font-size:1.28rem; }
.studio-mobile #mobile-role,.studio-mobile #mobile-address { font-size:.8rem; color:var(--muted); }
.studio-mobile #mobile-address { padding-top:7px; border-top:1px solid var(--line); overflow-wrap:anywhere; }
.studio-mobile #mobile-draft {
  margin:10px 0; padding:9px 11px; border-radius:8px;
  background:#f9eedb; color:#5e401b; font-size:.83rem;
}
.studio-mobile #mobile-draft[data-clean=true] { background:var(--soft); color:var(--green); }
.studio-mobile .mobile-actions { display:flex; flex-wrap:wrap; gap:8px; }
.studio-mobile .mobile-actions > button { flex:1 1 126px; }
.studio-mobile .mobile-shortcuts { display:grid; gap:6px; margin-top:12px; }
.studio-mobile .mobile-shortcuts button {
  width:100%; justify-content:space-between; min-height:52px; text-align:left;
  overflow-wrap:anywhere;
}
.studio-mobile .mobile-shortcuts button::after { content:""; width:6px; height:6px; border-top:1px solid; border-right:1px solid; rotate:45deg; margin:3px; }
.studio-mobile .mobile-shortcuts span { display:grid; min-width:0; }
.studio-mobile .mobile-shortcuts small,.studio-mobile .profile-group small { color:var(--muted); font-size:.78rem; }
.studio-mobile .desktop-profile-actions,.studio-mobile .desktop-theme-picker { display:none; }
.studio-mobile .editor { display:block; }
.studio-mobile #profile-form { gap:0; border-top:1px solid var(--line); }
.studio-mobile .profile-group { border-bottom:1px solid var(--line); }
.studio-mobile .profile-group > summary {
  display:block; position:relative; padding:10px 26px 10px 0;
  min-height:48px; list-style:none; cursor:pointer;
}
.studio-mobile .profile-group > summary::-webkit-details-marker { display:none; }
.studio-mobile .profile-group > summary::after {
  content:""; position:absolute; right:6px; top:20px; width:7px; height:7px;
  border-right:1px solid; border-bottom:1px solid; rotate:45deg;
}
.studio-mobile .profile-group[open] > summary::after { rotate:225deg; top:23px; }
.studio-mobile .profile-group > summary small { display:block; margin-top:1px; }
.studio-mobile .profile-group > :not(summary) { margin-bottom:12px; }
.studio-mobile .profile-group legend,.studio-mobile .profile-group > .form-section h2 { display:none; }
.studio-mobile .profile-group .namecard-form,.studio-mobile .profile-group .form-section { border:0; padding:0; }
.studio-mobile .mobile-edit-actions { margin-top:15px; }
.studio-mobile .mobile-review-head {
  display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap;
  color:var(--muted); font-size:.85rem; margin-bottom:9px;
}
.studio-mobile .mobile-review-actions { display:flex; gap:7px; flex-wrap:wrap; }
.studio-mobile #mobile-preview-content { margin-bottom:12px; }
.studio-mobile #mobile-preview-content .preview { position:static; }
.studio-mobile #mobile-preview-content .preview-head { display:none; }
.studio-mobile #mobile-preview-content iframe { height:clamp(340px,60dvh,540px); }
.studio-mobile #mobile-preview-content #unpublish { display:flex; margin-top:7px; }
.studio-mobile .themes { grid-template-columns:repeat(auto-fit,minmax(min(100%,138px),1fr)); }
.studio-mobile .domain-layout { grid-template-columns:minmax(0,1fr); }
body:not(.studio-mobile) .profile-group > summary { display:none; }

.mobile-tab-icon { display:none; }
.studio-mobile .navigation button {
  display:grid; justify-items:center; align-content:center; gap:4px;
}
.studio-mobile .mobile-tab-icon {
  display:block; position:relative; width:14px; height:14px;
}
.studio-mobile .mobile-tab-icon::before,.studio-mobile .mobile-tab-icon::after {
  content:""; position:absolute; display:block;
}
.studio-mobile [data-view=home] .mobile-tab-icon::before {
  inset:5px 2px 0; border:1.3px solid currentColor; border-top:0; border-radius:0 0 2px 2px;
}
.studio-mobile [data-view=home] .mobile-tab-icon::after {
  width:8px; height:8px; left:3px; top:1px; rotate:45deg;
  border-top:1.3px solid; border-left:1.3px solid; border-radius:1px 0 0;
}
.studio-mobile [data-view=profile] .mobile-tab-icon::before {
  inset:2px 2px 0 0; border:1.3px solid; border-radius:3px;
}
.studio-mobile [data-view=profile] .mobile-tab-icon::after {
  left:6px; top:4px; width:9px; height:2px; background:currentColor; border-radius:1px; rotate:-45deg;
}
.studio-mobile [data-view=themes] .mobile-tab-icon::before {
  inset:1px 6px 1px 1px; border:1.3px solid; border-radius:2px; rotate:-14deg;
}
.studio-mobile [data-view=themes] .mobile-tab-icon::after {
  inset:2px 1px 0 6px; border:1.3px solid; border-radius:2px; rotate:17deg;
}
.studio-mobile [data-view=domains] .mobile-tab-icon { border:1.3px solid; border-radius:50%; }
.studio-mobile [data-view=domains] .mobile-tab-icon::before {
  inset:-1px 3px; border:1px solid; border-radius:50%;
}
.studio-mobile [data-view=domains] .mobile-tab-icon::after {
  left:0; right:0; top:5px; border-top:1px solid;
}
