/* Vestoday admin dashboard — desktop first, same tokens as the app (vt.css). */
html, body { margin: 0; height: 100%; }
body { background: #F6F5F3; }
@media (prefers-color-scheme: dark) { body { background: #121318; } }
#admin { min-height: 100vh; overflow: visible; }
.ad-boot { min-height: 100vh; display: grid; place-items: center; }

/* ---------- auth screens ---------- */
.ad-auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.ad-auth .box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.ad-brand { display: flex; align-items: center; gap: 12px; }
.ad-brand img { width: 40px; height: 40px; }
.ad-brand b { font-family: var(--font-display); letter-spacing: .18em; font-size: 15px; }
.ad-brand span { font-size: 13px; color: var(--text-secondary); }

/* ---------- layout ---------- */
.ad-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.ad-shell > * { min-width: 0; }
.ad-side { background: var(--bg-surface); border-inline-end: 1px solid var(--border-subtle); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.ad-nav { display: flex; flex-direction: column; gap: 2px; }
.ad-nav button { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; text-align: start; color: var(--text-secondary); font-size: 14px; }
.ad-nav button:hover { background: var(--bg-item-tile); color: var(--text-primary); }
.ad-nav button.on { background: var(--brand-subtle); color: var(--brand); font-weight: 600; }
.ad-nav .dot { width: 8px; height: 8px; border-radius: 99px; background: var(--danger); margin-inline-start: auto; }
.ad-side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.ad-main { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 20px; min-width: 0; max-width: 1280px; }
.ad-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ad-head h1 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 700; }
.ad-head p { margin: 2px 0 0; color: var(--text-secondary); font-size: 14px; }
@media (max-width: 900px) {
  .ad-shell { grid-template-columns: minmax(0, 1fr); }
  .ad-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 10px; }
  .ad-nav { flex-direction: row; overflow-x: auto; width: 100%; min-width: 0; scrollbar-width: none; }
  .ad-nav button { white-space: nowrap; height: 36px; }
  .ad-side .foot { margin: 0; flex-direction: row; align-items: center; }
  .ad-main { padding: 18px 16px 40px; }
}

/* ---------- blocks ---------- */
.ad-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ad-card h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ad-card .sub { color: var(--text-secondary); font-size: 13px; line-height: 20px; margin: 0; }
.ad-grid { display: grid; gap: 14px; }
.ad-kpis { grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); }
.ad-2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.ad-kpi { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.ad-kpi .l { font-size: 13px; color: var(--text-secondary); }
.ad-kpi .n { font-size: 28px; line-height: 36px; font-weight: 700; direction: ltr; text-align: start; }
.ad-kpi .s { font-size: 12px; color: var(--text-tertiary); }
.ad-alerts { display: flex; flex-direction: column; gap: 8px; }
.ad-alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 22px; }
.ad-alert.err { background: var(--danger-subtle); color: var(--danger); }
.ad-alert.warn { background: var(--warning-subtle); color: var(--warning); }
.ad-alert.ok { background: var(--success-subtle); color: var(--success); }

/* ---------- table ---------- */
.ad-table-wrap { overflow-x: auto; margin: 0 -4px; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.ad-table th { text-align: start; font-weight: 600; color: var(--text-secondary); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.ad-table td { padding: 10px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.ad-table tr:last-child td { border-bottom: 0; }
.ad-table .num { direction: ltr; text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ad-table .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.c2 { color: var(--text-secondary); } .c3 { color: var(--text-tertiary); }

/* ---------- small controls ---------- */
.ad-btn { height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-default); background: var(--bg-surface); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.ad-btn:hover { border-color: var(--border-strong); }
.ad-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.ad-btn.danger { color: var(--danger); border-color: var(--danger-subtle); }
.ad-btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.ad-btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.ad-btn[disabled] { opacity: .5; cursor: default; }
.ad-seg { display: inline-flex; background: var(--bg-item-tile); border-radius: 10px; padding: 3px; gap: 2px; }
.ad-seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.ad-seg button.on { background: var(--bg-surface); color: var(--text-primary); font-weight: 600; box-shadow: var(--elevation-1); }
.ad-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.ad-field label { font-weight: 600; font-size: 13px; }
.ad-input, .ad-select { height: 40px; border: 1px solid var(--border-default); border-radius: 10px; background: var(--bg-surface); padding: 0 12px; font: inherit; color: var(--text-primary); width: 100%; box-sizing: border-box; }
.ad-input:focus, .ad-select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.ad-code { font-size: 26px !important; letter-spacing: .3em; text-align: center; height: 56px; direction: ltr; }
.ad-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ad-row.between { justify-content: space-between; }
.ad-switch { width: 44px; height: 26px; border-radius: 999px; border: 0; background: var(--border-default); position: relative; cursor: pointer; flex-shrink: 0; }
.ad-switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 99px; background: #fff; box-shadow: var(--elevation-1); transition: inset-inline-start .15s; }
.ad-switch.on { background: var(--brand); }
.ad-switch.on::after { inset-inline-start: 21px; }
.chip-s { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-s::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.st-ok { background: var(--success-subtle); color: var(--success); }
.st-degraded { background: var(--warning-subtle); color: var(--warning); }
.st-down { background: var(--danger-subtle); color: var(--danger); }
.st-idle, .st-off { background: var(--bg-item-tile); color: var(--text-tertiary); }

/* ---------- charts ---------- */
.ad-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; direction: ltr; padding-top: 8px; }
.ad-bars .b { flex: 1; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: .85; }
.ad-bars .b:hover { opacity: 1; }
.ad-bars .b span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-secondary); padding-bottom: 2px; }
.ad-axis { display: flex; justify-content: space-between; direction: ltr; font-size: 11px; color: var(--text-tertiary); }
.ad-hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.ad-hbar .track { height: 10px; background: var(--bg-item-tile); border-radius: 99px; overflow: hidden; }
.ad-hbar .fill { height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- modal & toast ---------- */
.ad-modal { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; padding: 16px; z-index: 50; }
.ad-modal .box { background: var(--bg-surface); border-radius: 18px; padding: 22px; width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--elevation-3); max-height: 90vh; overflow: auto; }
.ad-modal h3 { margin: 0; font-size: 18px; }
.ad-toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); background: var(--bg-inverse); color: var(--text-inverse); padding: 10px 18px; border-radius: 12px; font-size: 14px; z-index: 60; box-shadow: var(--elevation-2); }
[dir=ltr] .ad-toast { transform: translateX(-50%); }
.ad-toast.err { background: var(--danger); color: #fff; }
.ad-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; padding: 14px; background: var(--bg-item-tile); border-radius: 12px; direction: ltr; font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
.ad-qr { align-self: center; }
.ad-empty { color: var(--text-tertiary); font-size: 14px; padding: 8px 0; }
.spin-s { width: 16px; height: 16px; border-radius: 99px; border: 2px solid var(--border-default); border-top-color: var(--brand); animation: adspin .8s linear infinite; display: inline-block; }
@keyframes adspin { to { transform: rotate(360deg); } }
pre.ad-pre { margin: 0; background: var(--bg-item-tile); border-radius: 10px; padding: 10px; font-size: 12px; line-height: 18px; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
.ad-table .ad-select { min-width: 150px; }
/* agent accounts (Codvero style) */
.ad-pchip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--bg-item-tile); color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.ad-acc-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.ad-acc-form .ad-select { min-width: 170px; }
.ad-accs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ad-acc { border: 1px solid var(--border-subtle); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ad-login { margin-top: 4px; padding: 14px; border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--bg-canvas); display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.ad-login ol { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.ad-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--border-subtle); border-radius: 8px; padding: 8px 10px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--brand); text-decoration: underline; background: var(--bg-surface); }
.ad-devcode { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand-subtle); }
.ad-devcode code { font-size: 20px; font-weight: 700; letter-spacing: .2em; user-select: all; }
.ad-switch[disabled] { opacity: .35; cursor: default; }
/* photo sources */
.ad-order { display: flex; flex-direction: column; gap: 4px; }
.ad-order .ad-btn { height: 24px; padding: 0 8px; font-size: 10px; }
.ad-try { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.ad-try a { display: flex; flex-direction: column; gap: 4px; font-size: 11px; line-height: 15px; color: var(--text-secondary); text-decoration: none; }
.ad-try img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--border-subtle); }
.ad-try span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* try-on provider choice */
.ad-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ad-opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: 10px; cursor: pointer; }
.ad-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-subtle); }
.ad-opt.off { opacity: .5; cursor: default; }
.ad-opt input { margin-top: 4px; accent-color: var(--brand); }
#tryonbody, #tout2 { display: flex; flex-direction: column; gap: 10px; }

/* default personas: 12 cards × 3 slots */
.ad-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--danger); margin-inline-start: auto; }
.ad-dot[hidden] { display: none; }
.ps-meter { height: 8px; border-radius: 99px; background: var(--bg-item-tile, var(--border-subtle)); overflow: hidden; }
.ps-meter > div { height: 100%; background: var(--brand); border-radius: 99px; }
.ps-sec { margin: 6px 0 0; font-size: 18px; }
.ps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 16px; }
.ps-card h2 { margin: 0; font-size: 16px; }
.ps-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
@media (max-width: 520px) { .ps-slots { grid-template-columns: 1fr; } }
.ps-slot { display: flex; flex-direction: column; gap: 6px; min-width: 0; border-radius: 12px; }
.ps-slot.drag .ps-box { outline: 2px solid var(--brand); outline-offset: 2px; }
.ps-slot.err .ps-box { border-color: var(--danger); }
.ps-lab { display: flex; flex-direction: column; gap: 0; }
.ps-lab b { font-size: 14px; }
.ps-lab span { font-size: 12px; line-height: 16px; }
.ps-box { position: relative; width: 100%; aspect-ratio: 1 / 1; border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; background: var(--bg-item-tile, var(--bg-surface)); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ps-box:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* the picture keeps its own proportions inside the box (never stretched or cut) */
.ps-box img { width: 100%; height: 100%; object-fit: contain; }
.ps-box.empty { flex-direction: column; gap: 4px; border: 1.5px dashed var(--warning); color: var(--text-secondary); font-size: 12px; text-align: center; padding: 6px; }
.ps-box.busy img { opacity: .5; }
.ps-tag { position: absolute; top: 6px; inset-inline-start: 6px; background: var(--warning-subtle); color: var(--warning); font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; }
.ps-prog { position: absolute; inset-inline: 8px; bottom: 26px; height: 6px; border-radius: 99px; background: rgba(0,0,0,.18); overflow: hidden; }
.ps-prog > div { height: 100%; background: var(--brand); transition: width .2s; }
.ps-cap { position: absolute; bottom: 6px; inset-inline: 0; text-align: center; font-size: 12px; font-weight: 600; }
.ps-broken { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.ps-broken[hidden] { display: none; }
.ps-meta { font-size: 12px; line-height: 18px; }
.ps-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.ps-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.ps-acts .ad-btn { min-height: 44px; padding: 0 8px; font-size: 13px; flex: 1 1 auto; justify-content: center; }
.ps-slot .ad-alert { font-size: 12px; line-height: 18px; padding: 8px; }
.ps-view { position: relative; display: flex; justify-content: center; }
.ps-view img { max-width: 100%; max-height: 60vh; border-radius: 12px; object-fit: contain; }
.ad-alert[hidden] { display: none; }

/* Image-only public product catalogue; details stay in an accessible floating card. */
.catalog-toolbar { display:flex;flex-direction:column;gap:14px;margin-bottom:14px; }
.catalog-query { display:flex;gap:8px;max-width:580px; }
.catalog-query input { min-width:0;flex:1; }
.catalog-filters { display:flex;align-items:end;gap:12px;flex-wrap:wrap; }
.catalog-filter { display:flex;flex-direction:column;gap:6px;flex:1;min-width:140px;max-width:240px;font-size:13px;color:var(--text-secondary); }
.catalog-gallery { display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:16px; }
.catalog-tile { padding:0;aspect-ratio:1;border:1px solid var(--border-subtle);border-radius:18px;background:#fff;cursor:pointer;overflow:hidden;transition:transform .16s,box-shadow .16s; }
.catalog-tile img { display:block;width:100%;height:100%;object-fit:contain; }
.catalog-tile:hover { transform:translateY(-3px);box-shadow:var(--elevation-2); }
.catalog-tile:focus-visible { outline:3px solid var(--brand);outline-offset:3px; }
.catalog-pagination { justify-content:center;margin-top:24px; }
.catalog-empty { text-align:center; }
.catalog-modal { backdrop-filter:blur(5px); }
.catalog-modal .box { max-width:680px;box-sizing:border-box;overscroll-behavior:contain; }
.catalog-dialog-head { display:flex;align-items:center;justify-content:space-between;gap:12px; }
.catalog-dialog-head h3 { line-height:1.5;overflow-wrap:anywhere; }
.catalog-detail-image { width:100%;height:260px;object-fit:contain;background:#fff;border-radius:14px; }
.catalog-facts { margin:0; }
.catalog-fact { display:grid;grid-template-columns:110px minmax(0,1fr);gap:14px;padding:12px 0;border-bottom:1px solid var(--border-subtle);line-height:1.6; }
.catalog-fact dt { color:var(--text-secondary);font-size:13px; }
.catalog-fact dd { margin:0;overflow-wrap:anywhere; }
.catalog-detail-section h4 { margin:8px 0 12px;font-size:15px; }
.catalog-detail-section p { line-height:1.7; }
.catalog-detail-section a { display:block;margin:10px 0;overflow-wrap:anywhere; }
.catalog-care { display:flex;flex-wrap:wrap;gap:8px; }
.catalog-care span { background:var(--bg-item-tile);border:1px solid var(--border-subtle);border-radius:10px;padding:8px 10px;font-size:13px; }
.catalog-dialog-footer { display:flex;justify-content:space-between;gap:12px; }
@media(max-width:600px) { .catalog-gallery { grid-template-columns:repeat(2,minmax(0,1fr));gap:10px; }.catalog-filter { min-width:calc(50% - 12px);max-width:none; }.catalog-modal { padding:10px; }.catalog-modal .box { padding:16px;max-height:92dvh; }.catalog-detail-image { height:220px; } }
@media(prefers-reduced-motion:reduce) { .catalog-tile { transition:none; } }
.log-filters { margin:20px 0; }
.log-level { display:inline-block;padding:4px 9px;border-radius:8px;white-space:nowrap; }
.log-level.info { background:var(--bg-item-tile);color:var(--text-secondary); }
.log-level.warn { background:var(--warning-subtle);color:var(--warning); }
.log-level.error { background:var(--danger-subtle);color:var(--danger); }
.log-runs { display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:10px; }
.log-run { display:flex;flex-direction:column;align-items:start;text-align:start;gap:8px;height:auto;padding:12px; }
.log-meta { white-space:pre-wrap;overflow-wrap:anywhere;max-width:520px;font-size:12px; }
.logs-modal .box { max-width:1100px;box-sizing:border-box; }
.logs-modal .ad-table { font-size:12px; }

.ad-stylist-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:18px;margin-top:22px}.ad-stylist-photo{width:96px;height:96px;object-fit:cover;border-radius:25px;background:#f2edf0}.ad-stylist-form{display:flex;flex-direction:column;gap:15px}.ad-stylist-form fieldset{border:1px solid #96838e50;border-radius:15px;padding:14px}.ad-stylist-form .ad-row{gap:12px}.ad-stylist-grid article p{overflow-wrap:anywhere}.ad-stylist-form input[type=checkbox]{width:20px;height:20px}.ad-stylist-form textarea{resize:vertical}
.ad-legal-toolbar{display:flex;align-items:end;gap:12px;flex-wrap:wrap;position:sticky;top:0;background:var(--bg-canvas);z-index:2;padding:12px 0}.ad-legal-toolbar .ad-field{min-width:150px}.ad-legal-section{border:1px solid var(--border-default);border-radius:18px;padding:18px;margin:20px 0;display:flex;flex-direction:column;gap:10px}.ad-legal-section .ad-field{margin:0}.ad-legal-section textarea{width:100%;min-height:160px;resize:vertical;font-size:15px;line-height:1.8}.ad-legal-section .ad-input{width:100%}.ad-legal-section button{align-self:flex-end}.ad-legal-history{display:flex;gap:12px;align-items:center;flex-wrap:wrap;border-top:1px solid var(--border-default);padding:14px 0}.ad-legal-history>span:nth-child(2){flex:1;min-width:160px}.ad-legal-preview{max-height:65dvh;overflow:auto;font-size:15px;line-height:1.85}.ad-legal-preview p{white-space:pre-wrap;overflow-wrap:anywhere}.ad-legal-preview section{margin:20px 0}.ad-legal-editor>[data-draft-status]{min-height:24px}
#admin .ad-legal-editor textarea.ad-input{height:180px!important;min-height:160px!important;max-height:none;font-size:15px!important;line-height:1.8!important;overflow:auto;white-space:pre-wrap}#admin .ad-legal-toolbar{background:var(--bg-raised);border:1px solid var(--border-default);border-radius:16px;padding:12px}
