/* VLM TV — painel (mesmo visual da VLM HUB) */
:root {
  --bg: #0d1117; --surface: #141b26; --surface2: #1b2433; --border: #243044;
  --text: #e6edf3; --muted: #8b98a9; --accent: #2563eb; --accent-h: #1d4ed8; --accent2: #60a5fa;
  --ok: #22c55e; --warn: #f59e0b; --danger: #dc2626; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 8px; }
a { color: var(--accent2); cursor: pointer; }

.brand { font-weight: 700; font-size: 20px; display: flex; gap: 8px; align-items: center; }
.brand .logo { color: var(--accent); }

.btn { font: inherit; font-weight: 600; border-radius: 10px; padding: 10px 16px; border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; }
.btn:hover { border-color: #33435d; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-h); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: #7f1d1d; color: #fca5a5; }
.btn.danger:hover { background: #7f1d1d; color: #fff; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.file input { display: none; }

input, select, textarea { font: inherit; width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; min-height: 42px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
label { display: block; color: var(--muted); font-size: 13px; margin: 10px 0; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--text); font-size: 15px; }
label.inline { display: flex; align-items: center; gap: 10px; }
label.inline select { width: auto; flex: 1; max-width: 260px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row > * { flex: 1; }
.row > .btn { flex: 0 0 auto; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.sticky { position: sticky; bottom: 0; z-index: 5; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 6px; margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface2); color: var(--text); border-radius: 999px; padding: 8px 14px; cursor: pointer; font: inherit; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; padding: 28px; }
.login-card .btn { width: 100%; margin-top: 10px; }

/* layout app */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 0; height: 100vh; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; }
.sidebar nav a b { font-weight: 600; }
.sidebar nav a.active, .sidebar nav a:hover { background: var(--surface2); color: var(--text); }
.sidebar nav a.active { box-shadow: inset 3px 0 0 var(--accent); }
.content { padding: 28px; max-width: 1000px; width: 100%; }
.view-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h1 { flex: 1; }
.tabbar { display: none; }

/* TVs */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tv-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: border-color .15s; }
.tv-card:hover { border-color: var(--accent); }
.tv-card .name { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.tv-card .meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* editor de cenas */
.scene { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 10px 0; background: var(--surface2); }
.scene .row { align-items: center; }
.zone-row { display: grid; grid-template-columns: 90px 1fr 100px; gap: 8px; align-items: center; margin-top: 8px; }
.zone-row .zl { color: var(--muted); font-size: 13px; }
.zone-row .extra { grid-column: 2 / 4; }
.zone-row input.secs { text-align: center; }
.sched { display: grid; grid-template-columns: 1fr 1fr 1.4fr auto; gap: 8px; align-items: center; margin: 8px 0; }
.days { display: flex; gap: 4px; grid-column: 1 / -1; flex-wrap: wrap; }
.days button { font: inherit; font-size: 12px; border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.days button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 6px; }
.icon-btn:hover { color: #fca5a5; }
.danger-zone { margin-top: 26px; }

/* avisos */
.seg { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: 10px 0 14px; }
.seg button { flex: 1; font: inherit; background: transparent; color: var(--muted); border: 0; padding: 10px; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button[data-level="urgente"].on { background: var(--danger); }
.list .item { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list .item:last-child { border-bottom: 0; }
.tag { font-size: 12px; border-radius: 6px; padding: 2px 8px; background: var(--surface2); color: var(--accent2); }
.tag.urgente { color: #fca5a5; } .tag.destaque { color: #fcd34d; }

/* fotos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 16/10; border-radius: 12px; overflow: hidden; background: var(--surface2); border: 1px solid var(--border); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo button { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.65); color: #fff; border: 0; border-radius: 8px; padding: 4px 8px; cursor: pointer; }

/* modal */
.modal { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 22px; width: min(420px, 92vw); }
.modal::backdrop { background: rgba(0,0,0,.6); }
.code-input { font-size: 32px !important; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }

/* toasts */
.toasts { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--surface2); border: 1px solid var(--border); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45); max-width: 340px; animation: tin .25s ease; }
.toast.ok { border-left-color: var(--ok); } .toast.err { border-left-color: var(--danger); }
@keyframes tin { from { transform: translateY(-8px); opacity: 0 } to { transform: none; opacity: 1 } }

/* contas da casa */
.small { font-size: 13px; }
.up { color: #f87171; } .down { color: #4ade80; }
.err-text { color: #fca5a5; }
code { background: var(--surface2); border-radius: 6px; padding: 1px 6px; font-size: 13px; word-break: break-all; color: var(--text); }
.monthnav { display: flex; align-items: center; gap: 8px; }
.monthnav b { min-width: 140px; text-align: center; }
.bill-sum .sum-total { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bill-row { padding: 14px 16px; margin-bottom: 10px; }
.bill-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 16px; }
.bill-in { display: flex; gap: 8px; margin-top: 8px; }
.bill-in input { flex: 1; font-size: 18px; font-variant-numeric: tabular-nums; }
.bill-in .btn { flex: 0 0 auto; }
.tag.ok { color: #4ade80; } .tag.soon { color: #fcd34d; } .tag.late { color: #fca5a5; }
.bill-add, .cal-add { display: grid; grid-template-columns: 1.4fr 1fr .7fr 1fr auto; gap: 8px; margin-top: 12px; align-items: center; }
.cal-add { grid-template-columns: 1fr 52px 2fr auto auto; }
.cal-add input[type=color], .cal input[type=color] { padding: 2px; width: 52px; min-height: 42px; }
.list .item.bm { display: grid; grid-template-columns: 1.4fr 1fr 64px 1fr auto auto; gap: 6px; }
.list .item.cal .grow { flex: 1; min-width: 0; }
label.check { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; color: var(--text); }
label.check input { width: auto; min-height: 0; margin: 0; }
.dotc { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
.item .btns { display: flex; gap: 6px; flex: 0 0 auto; }
/* mercado */
.shop-form { display: flex; gap: 8px; }
.shop-form input { flex: 1; font-size: 17px; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.shop-item:last-child { border-bottom: 0; }
.shop-check { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--muted); background: transparent; color: #fff; font-size: 18px; cursor: pointer; flex: 0 0 auto; }
.shop-item.done .shop-check { background: var(--ok); border-color: var(--ok); }
.shop-text { flex: 1; font-size: 17px; }
.shop-item.done .shop-text { text-decoration: line-through; color: var(--muted); }
.shop-text small { color: var(--muted); }

/* celular */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 16px 14px 96px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--muted); text-decoration: none; padding: 4px; border-radius: 10px; }
  .tabbar a span { font-size: 20px; }
  .tabbar a.active { color: var(--text); background: var(--surface2); }
  .toasts { left: 12px; right: 12px; top: 12px; }
  .toast { max-width: none; }
  .zone-row { grid-template-columns: 70px 1fr 80px; }
  .sched { grid-template-columns: 1fr 1fr; }
  .sched select { grid-column: 1 / 2; }
  .row { flex-wrap: wrap; }
  .sticky { bottom: 64px; }
  .tabbar a { font-size: 11px; padding: 4px 2px; }
  .bill-add { grid-template-columns: 1fr 1fr; }
  .bill-add .btn, .bill-add input[name=name] { grid-column: 1 / -1; }
  .cal-add { grid-template-columns: 1fr 52px; }
  .cal-add input[type=url], .cal-add .btn, .cal-add label.check { grid-column: 1 / -1; }
  .list .item.bm { grid-template-columns: 1fr 1fr auto; }
  .list .item.bm input[data-k=due_day], .list .item.bm input[data-k=fixed] { grid-column: auto; }
  .list .item.cal { flex-wrap: wrap; }
  .list .item.cal .grow { flex: 1 1 calc(100% - 70px); }
  .list .item.cal label.check { margin-left: 62px; }
  .list .item.bm .chip { padding: 6px 10px; font-size: 13px; }
}

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.tabbar .ic { width: 22px; height: 22px; margin-bottom: 2px; }
