/* Visual lift: shared control polish. Same brand, same sidebar; better inputs, switches, cards, tables, drag handles. */
:root { --lift-ring: color-mix(in srgb, var(--brand) 28%, transparent); }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea {
  border-radius: 12px; border-color: color-mix(in srgb, var(--line) 85%, var(--ink) 15%);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .03) inset; transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input:hover:not(:focus):not([type=checkbox]):not([type=radio]), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: color-mix(in srgb, var(--line) 55%, var(--ink) 45%); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--lift-ring); }
button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--lift-ring); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; }
select[multiple] { background-image: none; padding-right: 12px; }
label { letter-spacing: .005em; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 18px; height: 18px; }
button, .btn { border-radius: 12px; transition: transform .08s, box-shadow .15s, background-color .15s, border-color .15s; }
button:not(:disabled):active { transform: translateY(1px); }
button:not(.secondary):not(.ghost):not(.danger):not(:disabled):hover { box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 28%, transparent); }
button.secondary:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.card { border-radius: 16px; transition: box-shadow .15s; }
table th { font-size: .74rem; letter-spacing: .04em; text-transform: none; font-weight: 600; color: var(--muted); }
table tbody tr { transition: background-color .12s; }
table tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }

/* switch: <label class="sw"><input type=checkbox><span></span>Text</label> */
.sw { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; margin: 6px 0; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw > span.tr { width: 40px; height: 24px; border-radius: 999px; background: #cbd5e1; position: relative; flex: 0 0 auto; transition: background-color .18s; }
.sw > span.tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .18s; }
.sw input:checked + span.tr { background: var(--brand); }
.sw input:checked + span.tr::after { transform: translateX(16px); }
.sw input:focus-visible + span.tr { box-shadow: 0 0 0 4px var(--lift-ring); }
.sw small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
html[data-theme=dark] .sw > span.tr { background: #4a4848; }

/* field with hint and counter */
.fld { margin: 14px 0 0; }
.fld > .fl { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.fld > .fl .ct { font-weight: 500; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.fld > .fl .ct.over { color: var(--bad, #dc2626); }
.fld > .hint { color: var(--muted); font-size: .8rem; margin-top: 5px; }

/* copy field */
.cpf { display: flex; align-items: stretch; border: 1px solid color-mix(in srgb, var(--line) 80%, var(--ink) 20%); border-radius: 12px; overflow: hidden; background: color-mix(in srgb, var(--surface) 92%, var(--ink) 8%); }
.cpf > input { border: 0; border-radius: 0; background: transparent; box-shadow: none; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; min-width: 0; }
.cpf > input:focus { box-shadow: none; }
.cpf > button { border: 0; border-left: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--brand); padding: 0 16px; }
.cpf > button:hover { box-shadow: none !important; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }

/* sticky save bar */
.savebar { position: sticky; bottom: 12px; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; margin-top: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(15, 23, 42, .14); }
.savebar .msg { font-size: .88rem; color: var(--muted); }
.savebar.dirty { border-color: var(--brand); }
.savebar.dirty .msg { color: var(--ink); font-weight: 600; }
.savebar.dirty .msg::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; margin-right: 8px; }

/* drag and drop */
.dnd-handle { cursor: grab; color: var(--muted); user-select: none; padding: 2px 4px; border-radius: 6px; display: inline-flex; touch-action: none; }
.dnd-handle:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
[draggable=true].dnd-item { transition: opacity .12s; }
.dnd-item.dragging { opacity: .35; }
.dnd-gap { position: relative; }
.dnd-gap.over::after, .dnd-item.over-top::before, .dnd-item.over-bottom::after { content: ""; display: block; height: 4px; border-radius: 2px; background: var(--brand); margin: 2px 0; }
.dnd-gap.over::after { margin: 0 auto; width: 70%; }
.dnd-item.over-top::before { margin-bottom: 6px; }
.dnd-item.over-bottom::after { margin-top: 6px; }
.dnd-empty.over { outline: 2px dashed var(--brand); outline-offset: -2px; }

/* palette chips */
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.palette .pchip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: grab; font-size: .88rem; font-weight: 500; user-select: none; }
.palette .pchip:hover { border-color: var(--brand); box-shadow: 0 2px 8px rgba(15, 23, 42, .1); }
.palette .pchip .material-symbols-outlined { font-size: 18px; color: var(--brand); }

/* phone preview */
.phone { width: 300px; max-width: 100%; margin: 0 auto; border: 8px solid #0f172a; border-radius: 34px; background: var(--surface); padding: 18px 14px; box-shadow: 0 18px 40px rgba(15, 23, 42, .22); }
.phone h4 { margin: 8px 0 4px; font-size: 1.05rem; line-height: 1.25; }
.phone .pv-in { height: 32px; border: 1px solid var(--line); border-radius: 9px; margin: 6px 0; padding: 7px 10px; font-size: .78rem; color: var(--muted); background: color-mix(in srgb, var(--surface) 94%, var(--ink) 6%); }
.phone .pv-btn { margin-top: 10px; text-align: center; background: var(--brand); color: var(--brand-ink); border-radius: 10px; padding: 9px; font-weight: 600; font-size: .85rem; }
.phone .pv-note { font-size: .66rem; color: var(--muted); line-height: 1.35; margin: 6px 0; }
.two-pane { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.two-pane > .sticky { position: sticky; top: 70px; }
@media (max-width: 980px) { .two-pane { grid-template-columns: minmax(0, 1fr); } .two-pane > .sticky { position: static; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
#sp label.sw, label.sw { display: inline-flex; font-weight: 500; margin: 6px 0; color: inherit; }

/* page headers and tab bars */
.pagehead h1 { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.02em; }
.pagehead .pagesub { margin: 2px 0 0; color: var(--muted); font-size: .9rem; max-width: 70ch; }
.tabbar { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; margin: 0 0 16px; background: color-mix(in srgb, var(--ink) 6%, var(--surface)); border-radius: 14px; max-width: 100%; }
.tabbar button, .tabbar button.secondary { background: transparent; border: 0; box-shadow: none !important; color: var(--muted); font-weight: 500; font-size: .9rem; padding: 7px 14px; border-radius: 10px; }
.tabbar button:hover:not(.on) { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.tabbar button.on { background: var(--surface); color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, .15) !important; }
html[data-theme=dark] .tabbar { background: #232120; }
html[data-theme=dark] .tabbar button.on { background: #1b1918; color: #cbc9c8; }
/* empty states */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); border: 1px dashed color-mix(in srgb, var(--line) 80%, var(--ink) 20%); border-radius: 16px; }

.two-pane > * { min-width: 0; }

/* Contact page: tidy tab bar with a More menu, and collapsible detail sections */
.tabs .tabmore { position: relative; flex: 0 0 auto; }
.tabs .tabmore > button { padding: 7px 11px; font-weight: 500; }
.tabs .tabmore > button.on { color: var(--brand); font-weight: 600; background: var(--surface); box-shadow: 0 1px 2px rgba(15,23,42,.12); }
#tabmorebox { position: absolute; left: 0; top: 36px; z-index: 20; min-width: 170px; padding: 6px; margin: 0; display: flex; flex-direction: column; }
#tabmorebox.hidden { display: none; }
#tabmorebox a { padding: 8px 10px; }
details.fold { padding: 0; }
details.fold > summary { cursor: pointer; padding: 14px 16px; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "Show"; color: var(--muted); font-size: .85rem; }
details.fold[open] > summary::after { content: "Hide"; }
details.fold > .foldbody { padding: 0 16px 16px; }
details.fold .foldbody > .card { box-shadow: none; border-left: 0; border-right: 0; border-radius: 0; margin: 0 -16px; }
.notelig { margin: 6px 0 0; }
