/* guide-admin module: back office of the AR museum guide (prefix .gad-). Builds on business.css (.biz-*) and app.css tokens. */

/* Desktop: use the full width for plans, lists and QR sheets */
@media (min-width: 1200px) { body[data-page="guide-admin"] main { max-width: 1180px; } }

.gad-title { font: 650 clamp(26px, 6.5vw, 34px)/1.1 var(--display); margin: 4px 0 8px; }
.gad-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.gad-tabs::-webkit-scrollbar { display: none; }
.gad-body { padding-top: 10px; }
.gad-mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.gad-status { display: block; min-height: 1.2em; font-size: 13px; color: var(--ink-2); font-weight: 650; }
.gad-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.gad-tips { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); display: grid; gap: 6px; }

/* Museum list */
.gad-museum-card { align-items: center; text-decoration: none; color: inherit; }
.gad-museum-card .biz-org-copy { display: grid; gap: 4px; }
.gad-museum-card small { color: var(--muted); font-size: 13px; }
.gad-museum-thumb { width: 64px; height: 64px; border-radius: var(--r-md); overflow: hidden; flex: none; display: grid; place-items: center; font-size: 28px; background: var(--surface-2); }
.gad-museum-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Overview */
.gad-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 720px) { .gad-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.gad-kpi { display: grid; gap: 2px; padding: 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.gad-kpi strong { font: 650 26px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.gad-kpi span { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.gad-grid { display: grid; gap: 12px; }
@media (min-width: 900px) { .gad-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.gad-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gad-checklist li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.gad-checklist li > span { width: 20px; flex: none; text-align: center; font-weight: 800; color: var(--muted); }
.gad-checklist li.is-done > span { color: var(--ok); }
.gad-checklist a { color: inherit; }
.gad-days { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding: 6px 0; }
.gad-days span { flex: 1; min-width: 3px; border-radius: 3px 3px 0 0; background: var(--sea); opacity: .85; }
.gad-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gad-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; font-size: 13.5px; }
.gad-bars li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gad-bars li .gad-bar { grid-column: 1 / -1; grid-row: 2; }
.gad-bars li strong { font-variant-numeric: tabular-nums; }
.gad-bars li.is-match { color: var(--ok); font-weight: 800; }
.gad-bar { display: block; height: 6px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.gad-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.gad-bars li.is-match .gad-bar i { background: var(--ok); }

/* Rooms and floor plan */
.gad-floor-chips { margin-bottom: 10px; }
.gad-plan-panel .biz-section-head { margin-top: 0; }
.gad-plan { display: block; width: 100%; height: auto; max-height: 70vh; background: var(--bg-elev); border-radius: var(--r-md); touch-action: none; user-select: none; }
.gad-plan-floor { fill: var(--surface); stroke: var(--line-strong); stroke-width: .25; }
.gad-plan-grid line { stroke: var(--line); stroke-width: .08; }
.gad-room { cursor: grab; outline: none; }
.gad-room rect { fill: color-mix(in srgb, var(--sea) 18%, transparent); stroke: var(--sea); stroke-width: .18; transition: fill .15s; }
.gad-room text { fill: var(--ink); font-weight: 800; pointer-events: none; font-family: var(--font); }
.gad-room:hover rect, .gad-room:focus rect { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); }
.gad-room.is-dragging { cursor: grabbing; }
.gad-room.is-dragging rect { fill: color-mix(in srgb, var(--accent) 35%, transparent); stroke: var(--accent-deep); stroke-dasharray: .6 .4; }
.gad-entrance circle { fill: var(--ok); }
.gad-lift rect { fill: var(--navy); }
.gad-entrance text, .gad-lift text { fill: #fff; font-weight: 800; font-family: var(--font); pointer-events: none; }
.gad-code { min-width: 40px; height: 32px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--sea-soft); color: var(--sea); flex: none; }

/* Items */
.gad-thumb-empty { width: 48px; height: 48px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: none; font-size: 22px; }
.gad-ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 12px 0; }
.gad-ref-grid figure { position: relative; margin: 0; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); }
.gad-ref-grid img { width: 100%; height: 100%; object-fit: cover; }
.gad-ref-empty { display: grid; place-items: center; height: 100%; padding: 6px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.gad-ref-del { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; min-height: 0; border-radius: 50%; background: rgba(11, 27, 32, .72); color: #fff; }
.gad-ref-del .tg-i { width: 15px; height: 15px; }
.gad-train-count { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.gad-camera { position: relative; margin: 12px 0; border-radius: var(--r-md); overflow: hidden; background: #0b1b20; display: grid; }
.gad-camera video { width: 100%; max-height: 52vh; object-fit: cover; display: block; }
.gad-camera .button { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); }
.gad-viewfinder { position: absolute; left: 50%; top: 50%; width: min(70%, 70vh); aspect-ratio: 1; max-height: 70%; transform: translate(-50%, -50%); border: 2px solid rgba(255, 255, 255, .85); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .18); pointer-events: none; }
.gad-live-out { min-height: 96px; }

/* Treasures */
.gad-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--accent-soft); flex: none; }
.gad-clue { font-style: italic; }
.gad-icons { border: 0; padding: 0; margin: 10px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.gad-icons legend { font-size: 13px; font-weight: 750; color: var(--ink-2); margin-bottom: 6px; }
.gad-icons label { position: relative; display: grid; place-items: center; height: 46px; border-radius: 12px; background: var(--surface-2); font-size: 22px; cursor: pointer; }
.gad-icons input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.gad-icons label:has(input:checked) { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.gad-icons label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Forms */
.gad-cols { display: grid; gap: 0 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.gad-cols-4 { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.gad-uuid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.gad-uuid .button { margin-bottom: 10px; }
.gad-cover-preview img { width: 120px; height: 90px; object-fit: cover; border-radius: var(--r-sm); margin: 6px 0; }
.gad-check { align-items: flex-start; margin: 10px 0; }
.gad-check span { display: grid; gap: 2px; }
.gad-check small { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.gad-explain p { font-size: 14px; color: var(--ink-2); }

/* QR sheet (A4) */
.gad-qr-controls { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 12px; }
.gad-qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.gad-qr-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); background: #fff; color: #0b1b20; break-inside: avoid; }
.gad-qr-card .biz-qr-svg { width: 96px; height: 96px; display: block; }
.gad-qr-card strong { display: block; font-size: 13.5px; line-height: 1.25; }
.gad-qr-card small { display: block; font-size: 11px; color: #4a5a5e; margin-top: 3px; }
.gad-qr-hint { font-weight: 700; }

@media print {
  @page { size: A4; margin: 10mm; }
  body[data-page="guide-admin"] { background: #fff !important; }
  body[data-page="guide-admin"] .app-header, body[data-page="guide-admin"] .app-bottom-nav, body[data-page="guide-admin"] .app-footer,
  body[data-page="guide-admin"] .skip-link, body[data-page="guide-admin"] #toast, body[data-page="guide-admin"] .personal-tracking-banner,
  body[data-page="guide-admin"] .gad-noprint { display: none !important; }
  body[data-page="guide-admin"] .workspace { padding: 0 !important; }
  body[data-page="guide-admin"] main { max-width: none !important; padding: 0 !important; animation: none !important; }
  .gad-qr-sheet { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .gad-qr-card { grid-template-columns: 30mm 1fr; min-height: 36mm; padding: 3mm; border: .3mm dashed #999; }
  .gad-qr-card .biz-qr-svg { width: 30mm; height: 30mm; }
}

.gad-video { display: grid; gap: 8px; margin: 12px 0; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); }
.gad-video-preview video { display: block; max-height: 320px; max-width: 100%; border-radius: 12px; background: #000; }
.gad-video-progress { color: var(--accent-deep); font-weight: 700; }
