/* Admin panel — builds on style.css tokens */
.admin { min-height: 100dvh; }
.muted { color: var(--muted); }

.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--gutter); }
.login-card { width: min(420px, 100%); display: grid; gap: 16px; }
.login-logo { width: 52px; height: 52px; }
.login h1 { font-size: clamp(2.6rem, 10vw, 3.6rem); }
.mode { font: 500 0.8rem/1.4 var(--mono); color: var(--muted); }
.mode b { color: var(--accent); font-weight: 500; }
.back { color: var(--muted); justify-self: center; min-height: 44px; display: flex; align-items: center; }

.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) var(--gutter) 10px;
  background: rgba(12,11,10,.82); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line);
}
.bar .logo { margin-right: 0; }
.bar .logo span { font-size: 1rem; }
.seg { margin-left: auto; display: flex; padding: 4px; border-radius: 999px; background: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: none; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 0.9rem; transition: background-color 200ms, color 200ms; }
.seg button[aria-selected="true"] { background: var(--text); color: var(--ink); }
.seg sup { font: 500 0.65rem/1 var(--mono); color: var(--accent); }
.icon-btn { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; font-size: 1.2rem; display: grid; place-items: center; }
.icon-btn:hover { background: var(--ink-3); }
.banner { margin: 16px var(--gutter) 0; padding: 12px 16px; border-radius: 14px; background: rgba(255,91,46,.1); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(255,91,46,.35); text-transform: none; letter-spacing: 0; line-height: 1.5; }

.view { padding: 28px var(--gutter) calc(var(--safe-b) + 60px); max-width: 1100px; margin: 0 auto; }
.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.view-head h2 { font-size: clamp(2.2rem, 7vw, 3.4rem); }

.rows, .leads { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px; border-radius: 18px;
  background: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line);
}
@media (min-width: 720px) { .row { grid-template-columns: 120px minmax(0, 1fr) auto; } }
.thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--ink-3); }
.thumb img, .thumb .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb .cover-body b { font-size: 0.6rem; }
.thumb .cover-phone { border-radius: 6px; padding: 2px; gap: 2px; }
.row-info { display: grid; gap: 4px; min-width: 0; }
.row-info b { font: 800 1.15rem/1.1 var(--display); letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-info span { color: var(--muted); font-size: 0.85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 9px; border-radius: 999px; font: 500 0.65rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.chip.on { background: var(--accent); color: var(--ink); box-shadow: none; }
.chip.draft { background: var(--ink-3); color: #FFB627; }
.row-actions { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; }
@media (min-width: 720px) { .row-actions { grid-column: auto; } }
.row-actions button { min-width: 44px; height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--ink-3); cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: background-color 150ms, color 150ms; }
.row-actions button:hover { background: var(--text); color: var(--ink); }
.row-actions button.danger:hover { background: #FF3B3B; color: #fff; }
.row-actions button:disabled { opacity: 0.3; pointer-events: none; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); border-radius: 18px; box-shadow: inset 0 0 0 1px dashed var(--line); border: 1.5px dashed var(--line); }

.lead { padding: 18px; border-radius: 18px; background: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 10px; }
.lead-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.lead-top b { font: 800 1.2rem/1.1 var(--display); margin-right: auto; }
.lead-top time { font: 500 0.75rem/1 var(--mono); color: var(--muted); }
.lead-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.9rem; }
.lead-meta a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; min-height: 32px; display: inline-flex; align-items: center; overflow-wrap: anywhere; }
.lead p { color: rgba(242,238,230,.85); white-space: pre-wrap; }
.lead .quote { padding: 10px 12px; border-radius: 12px; background: rgba(255,91,46,.1); color: var(--accent); font-size: 0.9rem; }
.lead select { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--ink-3); color: var(--text); font: 500 0.85rem/1 var(--body); box-shadow: inset 0 0 0 1px var(--line); }
.lead[data-status="new"] { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* Editor sheet: bottom sheet on phones, centred panel on desktop */
.sheet { width: 100%; max-width: 760px; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 28px 28px 0 0; background: var(--ink-2); color: var(--text); overflow: hidden; }
@media (min-width: 800px) { .sheet { margin: auto; border-radius: 28px; max-height: calc(100dvh - 48px); } }
.sheet::backdrop { background: rgba(8,7,6,.75); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet[open] { animation: sheet-up 450ms var(--ease) both; }
@keyframes sheet-up { from { transform: translateY(60px); opacity: 0; } }
.sheet-in { display: grid; gap: 14px; padding: 20px var(--gutter) calc(var(--safe-b) + 20px); max-height: inherit; overflow: auto; overscroll-behavior: contain; }
@media (min-width: 800px) { .sheet-in { padding: 28px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet-head h2 { font-size: 2rem; }
.sheet-foot { position: sticky; bottom: calc(-1 * (var(--safe-b) + 20px)); display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0 0; margin-top: 6px; background: linear-gradient(transparent, var(--ink-2) 30%); }
.grid2 { display: grid; gap: 14px; }
@media (min-width: 600px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.img-box { display: grid; gap: 10px; }
.img-preview { position: relative; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: var(--ink-3); }
.img-preview img, .img-preview .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.img-preview.is-busy::after { content: "Uploading…"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(12,11,10,.7); font: 500 0.85rem/1 var(--mono); }
.img-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.img-actions .btn { min-height: 44px; padding: 0 16px; font-size: 0.875rem; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#img-note { text-transform: none; letter-spacing: 0; font-size: 0.75rem; }
.toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.color { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; font-weight: 500; }
.color input { width: 44px; height: 44px; border: 0; padding: 0; border-radius: 12px; background: none; cursor: pointer; }
.color input::-webkit-color-swatch-wrapper { padding: 0; }
.color input::-webkit-color-swatch { border: 0; border-radius: 12px; }
.admin .q-switch .sw { background: var(--ink-3); }
.admin .q-switch input:checked + .sw { background: var(--accent); }
.toggle-note { text-transform: none; letter-spacing: 0; font-size: 0.75rem; margin-top: -6px; }
.chip.bld { background: rgba(255,182,39,.14); color: #FFB627; box-shadow: none; }
.chip.w3 { background: rgba(123,97,255,.18); color: #B7A8FF; box-shadow: none; }
/* Keep the page behind the editor from scrolling (iOS especially) */
body.sheet-open { overflow: hidden; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
