/* LuxWeb Editor · shared styles (client editor + admin dashboard) */
:root {
  --ink: #15171c; --ink-2: #2a2e37; --muted: #6b7080; --faint: #9aa0ad;
  --paper: #f5f4f0; --card: #ffffff; --line: #e7e5df; --line-2: #efede8;
  --gold: #c9963b; --gold-soft: #fbf3e4; --gold-ink: #7a5414;
  --ok: #1f7a4d; --ok-soft: #e7f5ee; --bad: #b3261e; --bad-soft: #fbeceb;
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20,22,28,.04), 0 8px 24px -16px rgba(20,22,28,.18);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
a { color: var(--ink); }
button, input, textarea { font: inherit; }
.muted { color: var(--muted); }
.fine { color: var(--faint); font-size: .85rem; margin: 18px 0 0; text-align: center; }
.err { color: var(--bad); min-height: 1.3em; margin: 0; font-size: .92rem; }

/* logo */
.logo { width: 44px; height: 44px; border-radius: 13px; background: var(--ink); display: grid; place-items: center; flex: none; }
.logo span { color: var(--gold); font-weight: 800; font-size: 1.2rem; }
.logo--sm { width: 34px; height: 34px; border-radius: 10px; }
.logo--sm span { font-size: 1rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; background: #fff; color: var(--ink); transition: background .15s, border-color .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(201,150,59,.45); outline-offset: 2px; }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: var(--ink-2); }
.btn--primary:disabled { background: #c9ccd3; cursor: default; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: #fff; }
.btn--quiet { background: transparent; color: var(--muted); padding: 0 10px; }
.btn--quiet:hover { color: var(--ink); }
.btn--sm { min-height: 34px; padding: 0 14px; font-size: .88rem; }
.btn--block { width: 100%; }
.btn--danger { color: var(--bad); }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 500px at 50% -10%, #fff 0%, var(--paper) 60%); }
.auth__card { width: 100%; max-width: 400px; background: var(--card); border-radius: 22px; padding: 34px 28px 26px; box-shadow: var(--shadow); text-align: center; }
.auth__card .logo { margin: 0 auto 18px; }
.auth__card h1 { font-size: 1.5rem; margin-bottom: 8px; }
.auth__card p.muted { margin: 0 0 22px; font-size: .95rem; }
.stack { display: grid; gap: 14px; text-align: left; }
.field-lg { display: grid; gap: 6px; }
.field-lg span { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field-lg input { min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 1rem; }
.field-lg input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(201,150,59,.18); }

/* ---------- editor shell ---------- */
.bar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.bar__in { max-width: 1240px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.bar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bar__title { min-width: 0; display: grid; }
.bar__title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1rem; }
.bar__title a { font-size: .82rem; color: var(--muted); text-decoration: none; }
.bar__title a:hover { color: var(--ink); text-decoration: underline; }
.bar__act { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pill { font-size: .8rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); white-space: nowrap; }
.pill.is-dirty { background: var(--gold-soft); color: var(--gold-ink); }

.layout { max-width: 1240px; margin: 0 auto; padding: 24px 20px 130px; display: grid; gap: 24px; }
@media (min-width: 900px) { .layout { grid-template-columns: 250px minmax(0, 1fr); align-items: start; } .side { position: sticky; top: 96px; } }
.side { min-width: 0; }
.search { position: relative; display: block; margin-bottom: 12px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; min-height: 44px; padding: 0 14px 0 40px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,150,59,.18); }
.toc { display: flex; flex-direction: column; gap: 2px; }
.toc__page { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 14px 12px 6px; }
.toc a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-size: .94rem; }
.toc a:hover { background: #fff; }
.toc a.is-on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.toc .count { font-size: .75rem; color: var(--faint); }
.toc .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex: none; }

.content { min-width: 0; display: grid; gap: 18px; }
.intro { background: var(--card); border-radius: var(--radius); padding: 22px 22px 20px; box-shadow: var(--shadow); }
.intro h2 { font-size: 1.3rem; margin-bottom: 6px; }
.intro p { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.stat { background: var(--paper); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 2px; }
.stat span { font-size: 1.35rem; font-weight: 700; }
.stat small { color: var(--muted); font-size: .8rem; }
#statLast { font-size: .95rem; font-weight: 600; padding-top: 4px; }

.section { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 22px 10px; scroll-margin-top: 110px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 0 10px; }
.section__head h3 { font-size: 1.08rem; }
.section__head span { color: var(--faint); font-size: .85rem; white-space: nowrap; }

.field { padding: 14px 0; border-top: 1px solid var(--line-2); display: grid; gap: 8px; min-width: 0; }
.section__head + .field { border-top: 0; }
.field.is-changed { position: relative; }
.field.is-changed::before { content: ""; position: absolute; left: -22px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--gold); }
.field__meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.field__kind { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); background: var(--paper); padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.field__label { font-size: .84rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.field__reset { font-size: .8rem; color: var(--muted); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; flex: none; }
.field input[type=text], .field textarea, .rich { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); line-height: 1.5; }
.field input[type=text] { min-height: 46px; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .rich:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,150,59,.16); }
.rich { min-height: 52px; white-space: normal; }
.rich em, .rich i { font-style: italic; } .rich strong, .rich b { font-weight: 700; }
.rich span + span::before { content: " "; }
.richbar { display: flex; gap: 6px; }
.richbar button { min-width: 38px; min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; font-size: .9rem; }
.richbar button:hover { border-color: var(--ink); }

.photo { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; align-items: center; }
.photo__frame { width: 132px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--line-2); }
.photo__frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__info { display: grid; gap: 8px; min-width: 0; }
.photo__alt { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.photo__note { font-size: .82rem; color: var(--ok); min-height: 1.2em; }
.photo input[type=file] { display: none; }
.upload { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--ink); font-weight: 600; font-size: .9rem; cursor: pointer; justify-self: start; }
.upload:hover { background: var(--ink); color: #fff; }

.empty { color: var(--muted); text-align: center; padding: 30px 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 0; }

.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; }
.dock__in { pointer-events: auto; max-width: 720px; margin: 0 auto; background: var(--ink); color: #fff; border-radius: 999px; padding: 8px 8px 8px 22px; display: flex; align-items: center; gap: 14px; box-shadow: 0 18px 40px -16px rgba(0,0,0,.5); }
.dock__text { flex: 1; font-size: .95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock .btn--primary { background: var(--gold); color: var(--ink); min-height: 44px; }
.dock .btn--primary:hover { background: #d8a64f; }
.dock .btn--primary:disabled { background: #3a3f4a; color: #9aa0ad; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: 0 14px 36px -12px rgba(0,0,0,.4); max-width: calc(100vw - 32px); z-index: 40; font-size: .95rem; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); }

@media (max-width: 719px) {
  .bar__in { padding: 10px 14px; }
  .bar__act .btn--quiet { display: none; }
  .layout { padding: 16px 14px 130px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat span { font-size: 1.1rem; }
  .section { padding: 4px 16px 8px; }
  .field.is-changed::before { left: -16px; }
  .photo { grid-template-columns: 1fr; }
  .photo__frame { width: 100%; }
  .dock { padding-left: 10px; padding-right: 10px; }
  .dock__in { padding-left: 16px; }
  .toast { bottom: 88px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ============ admin dashboard ============ */
.adm { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; display: grid; gap: 22px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: grid; gap: 4px; }
.kpi b { font-size: 1.8rem; letter-spacing: -.02em; }
.kpi small { color: var(--muted); font-size: .85rem; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel__head h2 { font-size: 1.05rem; }
.panel__body { padding: 18px 20px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid2 .full { grid-column: 1 / -1; }
.lab { display: grid; gap: 5px; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.lab input, .lab select { min-height: 42px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 11px; font-weight: 400; font-size: .95rem; background: #fff; }
.lab input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,150,59,.16); }
.site-list { display: grid; }
.site { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 20px; border-top: 1px solid var(--line-2); }
.site:first-child { border-top: 0; }
.site__name { font-weight: 700; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site__url { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; text-decoration: none; }
.site__url:hover { text-decoration: underline; color: var(--ink); }
.site__meta { font-size: .8rem; color: var(--faint); margin-top: 4px; }
.cred { display: grid; gap: 6px; }
.cred__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cred__k { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); width: 74px; flex: none; }
.cred code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; background: var(--paper); padding: 4px 8px; border-radius: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cred button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 3px 9px; font-size: .78rem; cursor: pointer; flex: none; }
.cred button:hover { border-color: var(--ink); }
.site__act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.tag--warn { background: var(--gold-soft); color: var(--gold-ink); }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 11px 20px; border-top: 1px solid var(--line-2); font-size: .9rem; }
.log li:first-child { border-top: 0; }
.log time { color: var(--faint); font-size: .8rem; white-space: nowrap; }
.log .who { font-weight: 600; }
.log .what { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .who.is-client { color: var(--gold-ink); }
.adm-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 50% -10%, #fff 0%, var(--paper) 60%); }
.adm-login .auth__card { max-width: 380px; }
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site { grid-template-columns: 1fr; gap: 10px; }
  .site__act { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .adm { padding: 16px 14px 40px; }
  .grid2 { grid-template-columns: 1fr; }
  .log li { grid-template-columns: 1fr; gap: 2px; }
  .log .what { white-space: normal; }
}

.search-mini { min-height: 40px; min-width: 220px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.search-mini:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,150,59,.16); }

/* admin: lead emails dialog */
.mail-dlg { border: 0; border-radius: 16px; padding: 22px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.mail-dlg::backdrop { background: rgba(15,17,22,.5); }
.mail-dlg h2 { margin: 0; font-size: 1.15rem; }
.mail-dlg select { width: 100%; }

.chks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 42vh; overflow: auto; }
.chks:empty { display: none; }
.chk { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 10px; align-items: start; padding: 10px 12px; border-radius: 10px; background: #f6f6f4; font-size: .86rem; }
.chk b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; color: #fff; background: #8a8f98; }
.chk strong { display: block; font-weight: 600; }
.chk small { display: block; margin-top: 3px; color: var(--ink-2); line-height: 1.45; overflow-wrap: anywhere; user-select: all; }
.chk--ok b { background: #2e7d4f; } .chk--warn b { background: #c58a1c; } .chk--bad b { background: #c0392b; } .chk--bad { background: #fdf0ee; } .chk--warn { background: #fdf7ea; }

/* admin: site report */
.rep-dlg { width: min(720px, calc(100vw - 32px)); }
.rep-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rep-kpis div { background: #f6f6f4; border-radius: 12px; padding: 12px; }
.rep-kpis b { display: block; font-size: 1.6rem; line-height: 1.1; }
.rep-kpis small { color: var(--ink-2); font-size: .8rem; }
.rep-spark { display: flex; align-items: flex-end; gap: 2px; height: 70px; margin-top: 14px; }
.rep-spark i { flex: 1; background: #c9963b; border-radius: 2px 2px 0 0; }
.rep-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 14px; font-size: .88rem; }
.rep-cols td { padding: 4px 0; border-bottom: 1px solid #eee; }
@media (max-width: 600px) { .rep-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rep-cols { grid-template-columns: 1fr; } }
