:root {
  --bg: #f4f6f9; --card: #ffffff; --ink: #14212e; --muted: #6a7a8a; --line: #e2e8ef;
  --brand: #0b6e8f; --brand-ink: #ffffff; --brand-soft: #e3f2f7; --ok: #1f9d6a; --warn: #d98a00; --danger: #c8372d;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,33,46,.06), 0 4px 14px rgba(20,33,46,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg:#0f1720; --card:#17222e; --ink:#e8eef4; --muted:#93a4b5; --line:#263544; --brand:#2aa3c7; --brand-ink:#04222d; --brand-soft:#12303c; --shadow:none; }
}
:root[data-theme="dark"] { --bg:#0f1720; --card:#17222e; --ink:#e8eef4; --muted:#93a4b5; --line:#263544; --brand:#2aa3c7; --brand-ink:#04222d; --brand-soft:#12303c; --shadow:none; }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .2px; font-size: 18px; }
.brand span { color: var(--brand); }
.spacer { flex: 1; }

main { max-width: 900px; margin: 0 auto; padding: 16px; }
h2 { margin: 4px 0 12px; font-size: 20px; }
h3 { margin: 18px 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; }

.btn { border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.icon { padding: 6px 10px; }

input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label.f { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.f > :not(span) { margin-top: 4px; font-weight: 400; color: var(--ink); }
.daychecks { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.daychecks label { display: inline-flex; gap: 4px; align-items: center; border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--ink); }
.daychecks input { width: auto; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=date] { width: auto; }
.toolbar select { width: auto; max-width: 200px; }

.group { margin-bottom: 14px; }
.group-title { font-weight: 700; margin: 0 0 6px; }
.group-title small { color: var(--muted); font-weight: 500; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); margin-bottom: 6px; }
.task input[type=checkbox] { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--ok); flex: none; }
.task .body { flex: 1; min-width: 0; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.tag { background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; }
.tag.warn { background: #fff3d6; color: var(--warn); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 3px 4px 3px 11px; font-size: 13px; font-weight: 600; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 6px; font-size: 15px; }
.list-item { display: flex; gap: 10px; align-items: center; justify-content: space-between; cursor: pointer; }
.list-item .name { font-weight: 650; }

.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 6px 0 14px; }
.progress > i { display: block; height: 100%; background: var(--ok); transition: width .3s; }

.overlay { position: fixed; inset: 0; background: rgba(8,16,24,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 100; }
.modal { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 18px; }
@media (min-width: 600px) { .overlay { align-items: center; } .modal { border-radius: 18px; } }
.modal h2 { margin-top: 0; }

.tag.ok { background: #dcf5e9; color: var(--ok); }
.task-actions { margin-top: 8px; }
.multi-row { margin-bottom: 6px; flex-wrap: nowrap; }
.multi-row select { flex: 1; }
.multi { display: flex; flex-direction: column; align-items: flex-start; }
.multi .multi-row { width: 100%; }
.photo-preview { display: block; width: 100%; max-height: 260px; object-fit: contain; margin-top: 8px; border-radius: 10px; background: #000; }
.act-line { font-size: 13.5px; margin-top: 4px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumb { position: relative; display: block; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb span { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 6px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(0,0,0,.6); }
.login { max-width: 340px; margin: 14vh auto; padding: 0 16px; text-align: center; }
.login .brand { font-size: 30px; margin-bottom: 18px; }
.login input { margin-bottom: 10px; text-align: center; }

/* Marca e rodapé */
.login-logo { width: 96px; height: 96px; object-fit: contain; margin-bottom: 6px; }
.brand { display: inline-flex; align-items: center; }
.brand-ico { width: 26px; height: 26px; object-fit: contain; margin-right: 8px; }
.login .brand { font-size: 30px; margin-bottom: 18px; }
.login .brand { justify-content: center; }
.login .brand .brand-ico { width: 48px; height: 48px; margin-right: 10px; }
.bc-admin-footer {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 1.2rem 1rem; margin-top: 2rem; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.bc-admin-footer .plugin-name { display: flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ink); }
.bc-admin-footer .plugin-name img { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; }
.bc-admin-footer .footer-sep { opacity: .4; }

/* Arrastrar para actualizar */
html, body { overscroll-behavior-y: contain; }
.ptr { position: fixed; top: env(safe-area-inset-top, 0); left: 50%; margin-left: -20px; width: 40px; height: 40px; border-radius: 50%;
  background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: var(--muted); z-index: 80; pointer-events: none; }
.ptr.ready { color: var(--brand); }
.ptr.spin { animation: ptrspin .7s linear infinite; }
@keyframes ptrspin { to { rotate: 360deg; } }

/* Rodapé sempre no pé da página */
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#app.hidden { display: none !important; }
#app main { flex: 1 0 auto; width: 100%; }
#app .bc-admin-footer { margin-top: 1rem; padding: .6rem 1rem .3rem; }
#login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; margin: 0 auto; padding-top: 14vh; }
#login.hidden { display: none !important; }
#login form { width: 100%; }
#login .bc-admin-footer { margin-top: auto; width: 100%; }

/* Campana de notificaciones */
.bell { position: relative; }
.bell .badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.notif-list { display: flex; flex-direction: column; gap: 6px; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; opacity: .7; }
.notif-item.unread { opacity: 1; background: var(--brand-soft); border-color: transparent; }
.notif-item .dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: transparent; }
.notif-item.unread .dot { background: var(--brand); }
.notif-title { font-weight: 650; }

/* Toasts (estilo del panel Master de SharkBooking) */
#toast-container { position: fixed; right: 12px; left: 12px; bottom: calc(70px + var(--tab-pb)); margin-left: auto; max-width: 380px;
  display: flex; flex-direction: column-reverse; gap: 8px; z-index: 120; pointer-events: none; }
.toast-item { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  background: rgba(30,41,59,.95); border: 1px solid rgba(100,116,139,.4); border-left: 3px solid #f59e0b; border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,.35); animation: toastin .2s ease-out; }
.toast-item.ok { border-left-color: #22c55e; }
.toast-item.erro { border-left-color: #ef4444; }
.toast-item.brief { border-left-color: var(--brand); }
.toast-text { flex: 1; min-width: 0; cursor: default; }
.toast-item.persist .toast-text { cursor: pointer; }
.toast-title { font-size: 12px; font-weight: 700; color: #f1f5f9; margin-bottom: 2px; }
.toast-body { font-size: 11px; color: #94a3b8; word-break: break-word; }
.toast-item.brief .toast-body { font-size: 12.5px; color: #f1f5f9; }
.toast-x { flex: none; background: none; border: 0; color: #64748b; font-size: 14px; line-height: 1; cursor: pointer; padding: 4px 6px; margin: -4px -6px -4px 0; }
.toast-x:hover { color: #f1f5f9; }
#toast-close-all { pointer-events: auto; align-self: flex-end; }
#toast-close-all button { background: rgba(30,41,59,.92); border: 1px solid rgba(100,116,139,.4); border-radius: 8px; padding: 7px 14px;
  color: #f1f5f9; font-size: 11px; font-weight: 600; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Menú fijo inferior (igual que ProGol: en iPhone se recorta 30 px de la zona segura) */
:root { --safe-b: env(safe-area-inset-bottom, 0px); --tab-pb: max(4px, calc(6px + var(--safe-b) - 30px)); }
/* Menú fijo inferior con iconos y texto (como ProGol) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: repeat(var(--cols, 5), 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding: 4px 0 var(--tab-pb); }
.tabbar[hidden] { display: none; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); text-decoration: none;
  font-size: 11px; font-weight: 600; min-width: 0; }
.tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar .tab-ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--brand); }
.tabbar a.active .tab-ico { stroke-width: 2.2; }
#app { padding-bottom: calc(var(--tabbar-h, 62px) + 2px); }

/* Selector segmentado (idioma / apariencia) */
.seg { display: flex; gap: 4px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }
.langs { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.langs button { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.langs button.active { color: var(--brand); border-color: var(--brand); }
.tag.warn, .tag.ok { }
:root[data-theme="dark"] .tag.warn { background: #3a2f10; }
:root[data-theme="dark"] .tag.ok { background: #12332a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.warn { background: #3a2f10; } :root:not([data-theme="light"]) .tag.ok { background: #12332a; } }

/* Cartón resaltado al llegar desde un aviso */
.flash { animation: flash 2.8s ease-out; }
@keyframes flash { 0%, 35% { box-shadow: 0 0 0 3px var(--brand), 0 0 18px var(--brand); } 100% { box-shadow: none; } }
/* Visor de foto */
.photo-view { align-items: center; background: rgba(0,0,0,.88); z-index: 130; }
.photo-box { width: 100%; max-width: 760px; max-height: 94vh; padding: 12px; }
.photo-box img { display: block; width: 100%; max-height: 80vh; object-fit: contain; border-radius: 10px; }

/* Mini tareas */
.items-wrap{margin-top:8px}
.items-count{display:inline-block;font-size:.78rem;font-weight:650;color:var(--muted);margin-bottom:4px}
.items-count.all{color:var(--ok,#1a7f4b)}
.items{display:flex;flex-direction:column;gap:2px}
.item{display:flex;align-items:center;gap:10px;padding:7px 0;cursor:pointer;font-size:.95rem}
.item.ro{cursor:default}
.item input{width:20px;height:20px;flex:none;margin:0}

.items-head{display:flex;flex-wrap:wrap;gap:4px 12px;align-items:baseline;margin-bottom:2px}
.items-head .items-count{margin-bottom:0}
.items-total{font-size:.78rem;font-weight:650;color:var(--muted)}
.items-total.ok,.it-time.ok{color:var(--ok)}
.items-total.over,.it-time.over,.it-live.over{color:var(--danger)}
.it-text{flex:1;min-width:0}
.it-time{font-size:.78rem;font-weight:650;color:var(--muted);white-space:nowrap}
.it-live{font-size:.78rem;font-weight:700;color:var(--brand);font-variant-numeric:tabular-nums;margin-left:6px}
.item.done .it-time{opacity:1}
.item.done .it-text{text-decoration:line-through;opacity:.55}
.item.done span{text-decoration:none;opacity:1}
.report-form .row{gap:10px;flex-wrap:wrap}
.report-form label.field{display:block;flex:1;min-width:130px;margin-bottom:10px}
.report-form label.field>span{display:block;font-size:.82rem;margin-bottom:4px}
.tabbar.dense a span{font-size:.6rem;letter-spacing:-.1px}

/* Editor de mini tareas por área */
.ai-sec{border:1px solid var(--line);border-radius:10px;padding:10px;margin-top:8px;background:var(--bg)}
.ai-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:6px}
.ai-row{display:flex;gap:6px;margin-bottom:6px;align-items:center}
.ai-text{flex:1;min-width:0}
.ai-min{width:72px;flex:none}
.items-area{font-size:.78rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--brand);margin:8px 0 0}

/* Resumen de informes */
.sum-top{display:flex;gap:24px;flex-wrap:wrap;margin-bottom:8px}
.sum-big{font-size:1.5rem;font-weight:750;line-height:1.1}
.sum-clients{border-top:1px solid var(--line);margin-top:6px;padding-top:6px}
.sum-line{display:flex;justify-content:space-between;gap:8px;padding:3px 0;font-size:.9rem}
.sum-jobs{border-top:1px solid var(--line);margin-top:8px;padding-top:4px}
.sum-job{display:flex;gap:8px;padding:6px 0;border-bottom:1px solid var(--line);font-size:.88rem;align-items:baseline}
.sum-job.off{opacity:.65}
.sj-d{flex:none;width:44px;color:var(--muted)}
.sj-t{flex:1;min-width:0}
.sj-m{flex:none;font-weight:650;white-space:nowrap}

/* Notas de mini tareas + modo solo lectura (jefes) */
.item-row{display:flex;align-items:center;gap:4px}
.item-row .item{flex:1;min-width:0}
.item-dot::before{content:'•';color:var(--muted)}
.item.done .item-dot::before{content:'✓';color:var(--ok)}
.item-dot{width:20px;flex:none;text-align:center;font-weight:700}
.note-btn{flex:none;border:1px solid var(--line);background:var(--card,#fff);color:var(--muted);border-radius:8px;width:30px;height:30px;font-size:.95rem;line-height:1;cursor:pointer;padding:0}
.note-btn.has{color:var(--brand);border-color:var(--brand)}
.it-note{font-size:.8rem;font-style:italic;color:var(--muted);margin:0 0 4px 30px;white-space:pre-wrap;overflow-wrap:anywhere}
.it-note.editable{cursor:text}
.it-note-input{width:100%;font:inherit;font-size:.85rem;font-style:italic;padding:6px 8px;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--ink,inherit);resize:vertical;box-sizing:border-box}
.note-ok{margin-top:6px;font-style:normal}
.items-lock{font-size:.78rem;color:var(--warn);margin:0 0 4px}
.item input:disabled{opacity:.45;cursor:not-allowed}

html,body{touch-action:manipulation;-webkit-text-size-adjust:100%}
input,select,textarea{font-size:16px}

/* Varias personas: ayudantes (Iniciar/Stop), quién la hace */
.it-act{flex:none;min-width:84px;justify-content:center}
.it-act.stop{background:var(--danger);color:#fff;border-color:var(--danger)}
.it-who{font-size:.78rem;font-weight:650;color:var(--muted);white-space:nowrap}
.it-who.on{color:var(--brand)}
.item.running .it-text{font-weight:650}
.logo-prev{max-width:200px;max-height:80px;object-fit:contain;display:block;background:#fff;border:1px solid var(--line);border-radius:8px;padding:6px}
