/* Dashboard-specific components: forms, login, lists, tabs, credentials, QR, live player tiles. */

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; color: var(--text); font-size: var(--fs-15); }
.field .hint { color: var(--text-3); font-size: var(--fs-13); margin: 0; }
.field .err, .form-error { color: var(--rec-text); font-size: var(--fs-13); margin: 0; font-weight: 500; }
.form-error:empty { display: none; }
.form-error { padding: 10px 12px; border-radius: var(--r-8); background: var(--rec-wash); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding-top: 4px; }
.form-actions.start { justify-content: flex-start; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap .input { padding-right: 52px; }
.pw-wrap .icon-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.inline-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }

/* ---------------------------------------------------------------- login and forced screens */
.center-page { min-height: 100%; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); }
.login { width: min(420px, 100%); }
.login .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--text); }
.login .brand .ico { width: 34px; height: 34px; color: var(--brand); }
.login .brand b { font-size: var(--fs-20); font-weight: 700; letter-spacing: -.01em; }
.login h1 { font-size: var(--fs-24); margin: 0 0 6px; color: var(--text); }
.login p.lead { margin: 0 0 20px; color: var(--text-2); }
.login .foot { margin-top: 18px; color: var(--text-3); font-size: var(--fs-13); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-8); background: var(--info-wash); color: var(--text-body); }
.notice .ico { color: var(--info); margin-top: 1px; }
.notice.warn { background: var(--warn-wash); } .notice.warn .ico { color: var(--warn); }
.notice.bad { background: var(--rec-wash); } .notice.bad .ico { color: var(--rec-text); }
.notice.ok { background: var(--ok-wash); } .notice.ok .ico { color: var(--ok); }
.notice p { margin: 0; }
.notice p + p { margin-top: 4px; }
.loading { display: grid; place-items: center; gap: 12px; min-height: 40vh; color: var(--text-3); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--brand); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------------------------------------------------------------- page head extras */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); text-decoration: none; margin: 0 0 10px -6px; min-height: 36px; padding: 0 8px 0 2px; border-radius: var(--r-6); }
.back:hover { color: var(--text); background: var(--field); }
.page-head .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.page-head .actions { margin-left: auto; }
.tabs { margin: 0 0 20px; }

/* ---------------------------------------------------------------- lists and cards */
.tile-link { display: grid; gap: 8px; align-content: start; padding: 16px; border-radius: var(--r-12); background: var(--card); color: inherit; text-decoration: none; box-shadow: 0 0 0 1px var(--card-edge); min-height: 120px; }
.tile-link:hover { background: var(--field); }
.tile-link h3 { margin: 0; font-size: var(--fs-17); color: var(--text); font-weight: 650; overflow-wrap: anywhere; }
.tile-link .sub { color: var(--text-2); font-size: var(--fs-13); }
.tile-link .pills { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { display: grid; justify-items: start; gap: 10px; padding: 24px; border-radius: var(--r-12); background: var(--card); border: 1px dashed var(--line-2); }
.empty h3 { margin: 0; color: var(--text); font-size: var(--fs-17); }
.empty p { margin: 0; color: var(--text-2); max-width: 60ch; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { max-width: 320px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- credentials, QR */
.cred { display: grid; gap: 12px; }
.cred-line { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; padding: 10px 12px; border-radius: var(--r-8); background: var(--field); }
.cred-line .k { grid-column: 1 / -1; color: var(--text-3); font-size: var(--fs-12); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.cred-line .v { font: 600 var(--fs-17)/1.3 var(--mono); color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.cred-line .v.small { font-size: var(--fs-13); font-weight: 500; }
.cred-line .btn-row { flex-wrap: nowrap; }
.qr-box { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.qr-box .qr { width: 168px; height: 168px; display: block; border-radius: var(--r-8); }
.qr-box p { margin: 0; color: var(--text-2); }
@media (max-width: 480px) { .qr-box { grid-template-columns: 1fr; justify-items: center; text-align: center; } .qr-box .qr { width: 220px; height: 220px; } }
.once { border-left: 3px solid var(--warn); }

/* ---------------------------------------------------------------- live player tiles */
.players { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.players.one { grid-template-columns: minmax(0, 1fr); }
.ptile { border-radius: var(--r-12); overflow: hidden; background: var(--card); box-shadow: 0 0 0 1px var(--card-edge); }
.pstage { position: relative; aspect-ratio: 16 / 9; background: #000; color: #fff; }
.pstage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.pstage:fullscreen { aspect-ratio: auto; }
.pmsg { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 16px; text-align: center; background: rgba(0,0,0,.55); }
.pmsg b { font-size: var(--fs-17); color: #fff; }
.pmsg span { color: #D1D1D6; max-width: 40ch; font-size: var(--fs-13); }
.pmsg .ico { width: 30px; height: 30px; color: #D1D1D6; }
.pbadge { position: absolute; left: 10px; top: 10px; }
.pbadge .pill { background: rgba(0,0,0,.6); color: #fff; }
.pbadge .pill.rec { background: rgba(255,69,58,.85); color: #fff; }
.punmute { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); background: rgba(0,0,0,.66); color: #fff; font-weight: 600; }
.pbar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; min-height: 52px; }
.pbar .lbl { flex: 1; min-width: 0; }
.pbar .lbl b { display: block; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbar .lbl small { display: block; color: var(--text-3); font-size: var(--fs-12); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbar .icon-btn { width: 44px; height: 44px; }

/* ---------------------------------------------------------------- audit */
.audit-row .when { color: var(--text-3); font-size: var(--fs-13); white-space: nowrap; font-variant-numeric: tabular-nums; }
.login .notice { margin-bottom: 14px; }
.danger-text { color: var(--rec-text) !important; }
.page-head h2 { margin: 0; font-size: var(--fs-17); color: var(--text); font-weight: 650; }
.section .page-head { margin-bottom: 12px; align-items: center; }
.row > .ico { color: var(--text-3); }
.row .ico + .lbl { margin-left: 0; }
.gap { height: 12px; }
.stack { display: grid; gap: 12px; }
.card h3 { margin: 0 0 4px; font-size: var(--fs-17); color: var(--text); }
.card > p.lead { margin: 0 0 14px; color: var(--text-2); }
.stream-edit { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px 10px; align-items: end; padding: 14px 16px; border-top: 1px solid var(--line); }
.stream-edit:first-child { border-top: 0; }
.stream-edit .slug { grid-column: 1 / -1; color: var(--text-3); font-size: var(--fs-12); margin-top: -4px; }
@media (max-width: 640px) { .stream-edit { grid-template-columns: 1fr 1fr; } .stream-edit .field:first-child { grid-column: 1 / -1; } .stream-edit .btn-row { grid-column: 1 / -1; } }
.card h3 { display: flex; align-items: center; gap: 8px; }
.input.code-input { font: 600 var(--fs-24)/1 var(--mono); letter-spacing: .12em; max-width: 280px; min-height: 56px; }
.choice .check .ico { width: 16px; height: 16px; opacity: 0; }
.choice:has(input:checked) .check .ico { opacity: 1; }
/* touch: every control reaches 44 px */
@media (pointer: coarse) { .seg > *, .back { min-height: var(--hit); } }
:root[data-input="touch"] .seg > *, :root[data-input="touch"] .back { min-height: var(--hit); }
