/* VMH Looper Admin — builds on the player's styles (/looper/styles.css). */
html, body { overflow: auto; }
body { user-select: auto; }
#app { min-height: 100%; }
.view.admin { min-height: 100%; height: auto; }
.admin .topbar { position: sticky; top: 0; z-index: 50; }
.admin .brand { text-decoration: none; color: inherit; }
a { color: var(--brand-primary); }
a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--foreground);
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
a.button.small { padding: 5px 10px; font-size: 12px; }
a.button:hover { background: var(--brand-accent); }

.admin-main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 120px; }
.admin-section { margin-bottom: 34px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 20px; }
.section-head h3, .card h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.section-head h3 { margin-bottom: 0; }
.card.pad { padding: 18px 20px; }
.pad-x { padding: 0 16px 14px; margin: 0; }
.usage { text-align: center; }
.alert { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn); padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; }
.empty { text-align: center; padding: 30px 20px; color: var(--muted); }
.empty.wide { grid-column: 1 / -1; }
.empty p { margin: 0 0 12px; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: min(380px, 100%); padding: 32px 28px; display: flex; flex-direction: column; gap: 12px; text-align: center; border-top: 4px solid var(--brand-primary); }
.login-card h1 { font-size: 22px; }
.login-card input { padding: 11px 12px; font-size: 15px; }
.login-card button { padding: 11px; font-size: 15px; }
.login-mark { width: 56px; height: 56px; border-radius: 6px; margin: 0 auto; }
.login-error { color: var(--danger-text); min-height: 1em; margin: 0; font-size: 13px; }

/* lists */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-2); }
.lr-main { flex: 1; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; min-width: 0; }
.chev { font-size: 22px; color: var(--muted); }

/* screens */
.screen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.screen-card { padding: 16px 18px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 6px; transition: border-color .12s; }
.screen-card:hover { border-color: var(--brand-primary); }
.sc-top { display: flex; align-items: center; gap: 8px; }
.sc-top strong { flex: 1; font-size: 15px; }
.sc-now { font-size: 13px; color: var(--text-2); }
.sc-dirty { font-size: 12px; font-weight: 600; color: var(--brand-primary); }
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.on { background: rgba(22,163,74,.12); color: #16a34a; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.busy { background: rgba(37,99,235,.12); color: #2563eb; }
.pill.off { background: var(--badge-bg); color: var(--muted); }

/* client page */
.crumb-title { margin-bottom: 18px; }
.client-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.client-title h1 { font-size: 26px; margin-right: 6px; }
.client-title .back { font-size: 13px; text-decoration: none; width: 100%; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--foreground); border-bottom-color: var(--brand-primary); }
.media-card { overflow: visible; }
.media-card.dragging { border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-tint); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 14px 16px; }
.media-tile { position: relative; }
.tile-meta { font-size: 11px; color: var(--muted); text-align: center; margin-top: 2px; }
.tile-actions { position: absolute; top: 8px; right: 8px; display: none; gap: 2px; background: var(--surface); border-radius: 6px; box-shadow: var(--shadow); }
.media-tile:hover .tile-actions { display: flex; }
.tile-actions .icon { font-size: 14px; }

/* screen page */
.screen-layout { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.7fr); gap: 16px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.status-card .kv, .settings .kv { font-size: 13px; border-top: 1px dashed var(--border); padding: 7px 0; }
.status-card .kv > span:last-child { text-align: right; }
.kv.warn > span:last-child { color: var(--warn); }
.row-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.shot { width: 100%; border-radius: 8px; border: 1px solid var(--border); background: #000; display: block; margin-top: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.code-input { font-size: 22px !important; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; text-align: center; }
.rules-head { display: flex; align-items: baseline; gap: 10px; margin: 16px 0 8px; flex-wrap: wrap; }
.rules { display: flex; flex-direction: column; gap: 8px; }
.rule { border: 1px solid var(--border); border-left: 4px solid var(--rule-color, var(--border)); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.rule.dated { background: var(--brand-accent); }
.rule-top, .rule-when { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-when { margin-top: 8px; gap: 14px; }
.rule-kind { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); width: 72px; }
.rule-label { width: 170px; }
.rw { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.days { display: inline-flex; gap: 3px; }
.day { width: 28px; height: 28px; padding: 0; border-radius: 50%; font-size: 11px; }
.day.on { background: var(--active-bg); color: var(--active-text); border-color: var(--active-bg); }
.now-next { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 12px; }
.now-next > div { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.week { display: flex; flex-direction: column; gap: 4px; }
.week-row { display: flex; align-items: center; gap: 8px; }
.week-label { width: 92px; flex: none; font-size: 11px; color: var(--muted); text-align: right; }
.week-bar { position: relative; flex: 1; height: 18px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.seg { position: absolute; top: 0; bottom: 0; opacity: .85; }
.now-line { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--foreground); }
.week-axis { flex: 1; display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.publish-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; align-items: center; gap: 12px;
  padding: 12px max(20px, calc((100vw - 1180px) / 2 + 20px)); background: var(--topbar); border-top: 1px solid var(--border); backdrop-filter: blur(8px);
}
.pb-text { flex: 1; font-size: 14px; }

/* upload tray */
.upload-tray { position: fixed; right: 16px; bottom: 76px; z-index: 400; display: flex; flex-direction: column; gap: 6px; width: min(360px, calc(100vw - 32px)); }
.ut-row { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; box-shadow: var(--shadow-lg); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 12px; align-items: center; }
.ut-name { grid-column: 1 / -1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ut-size { font-weight: 400; color: var(--muted); margin-left: 6px; }
.ut-track { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.ut-bar { height: 100%; width: 0; background: var(--brand-primary); transition: width .2s; }
.ut-pct { font-variant-numeric: tabular-nums; color: var(--muted); }
.ut-row.done .ut-bar { background: #16a34a; }
.ut-row.failed { border-color: var(--danger-border); color: var(--danger-text); }

/* editor inside the admin: shorter topbar offset */
.view.editor { height: 100vh; }
.source-label { flex: 1; font-weight: 600; font-size: 13px; }

@media (max-width: 860px) {
  .screen-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .client-title h1 { font-size: 22px; }
  .rule-label { width: 100%; }
  .publish-bar { flex-wrap: wrap; }
  .pb-text .hint { display: none; }
}

/* ---------- accounts ---------- */
.login-card .field { text-align: left; margin: 0; }
.login-card .field input { padding: 10px 12px; font-size: 15px; }
.account-grid { display: grid; gap: 16px; max-width: 760px; }
.account-grid form.card .row-buttons { margin-top: 14px; }
.team-list { margin: 10px 0 14px; }
.team-add { display: grid; grid-template-columns: 1fr 1.3fr 1.2fr auto; gap: 8px; }
@media (max-width: 700px) { .team-add { grid-template-columns: 1fr; } }
.local-note { background: rgba(37,99,235,.1); color: #2563eb; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 8px 0 0; }
.kv.local > span:last-child { color: #2563eb; font-weight: 600; }
.control-card select { max-width: 190px; }
