:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e5e7eb;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #16a34a;
  --accent-ink: #ffffff;
  --accent-soft: #dcfce7;
  --rail: #0f172a;
  --rail-ink: #94a3b8;
  --bubble-in: #ffffff;
  --bubble-out: #d9fdd3;
  --chat-bg: #efeae2;
  --danger: #dc2626;
  --warn: #d97706;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --panel: #111827; --panel-2: #0f172a; --line: #1f2937; --text: #e5e7eb; --muted: #94a3b8;
    --accent-soft: #14532d; --rail: #030712; --bubble-in: #1f2937; --bubble-out: #005c4b; --chat-bg: #0b141a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 20px; } h3 { font-size: 15px; }
a { color: var(--accent); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; }
.row { display: flex; align-items: center; } .between { justify-content: space-between; } .gap { gap: 8px; }

input, select, textarea { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { resize: vertical; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.icon { padding: 7px; border: none; background: transparent; color: var(--muted); border-radius: 50%; }
.btn.icon:hover { background: var(--panel-2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, #dcfce7, transparent 50%), var(--bg); }
.login-card { width: 100%; max-width: 340px; background: var(--panel); padding: 32px 28px; border-radius: 16px; box-shadow: var(--shadow); display: grid; gap: 12px; text-align: center; }
.login-card h1 { font-size: 22px; } .login-card p { margin: 0 0 8px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 18px; }
.brand-mark.big { width: 52px; height: 52px; font-size: 26px; margin: 0 auto 4px; border-radius: 14px; }

/* Layout */
.app { display: flex; height: 100vh; height: 100dvh; }
.rail { width: 76px; background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; flex: none; }
.rail .brand-mark { margin-bottom: 12px; }
.rail-btn { position: relative; width: 64px; padding: 8px 0 6px; border: none; background: transparent; color: var(--rail-ink); border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; font-size: 10.5px; }
.rail-btn:hover { color: #fff; background: rgba(255,255,255,.06); }
.rail-btn.active { color: #fff; background: rgba(255,255,255,.1); }
.rail-btn.active svg { color: #4ade80; }
.rail-spacer { flex: 1; }
.badge { position: absolute; top: 3px; right: 10px; background: #ef4444; color: #fff; font-style: normal; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; display: grid; place-items: center; }
.dot { position: absolute; top: 6px; right: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }

.view { display: none; flex: 1; min-width: 0; flex-direction: column; overflow: auto; }
.view.active { display: flex; }
.view-inbox.active { flex-direction: row; overflow: hidden; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 12px; flex-wrap: wrap; }
.page-note { margin: 0 24px 16px; max-width: 760px; }

/* Lista de conversaciones */
.convs { width: 360px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.convs-head { padding: 16px 14px 8px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; }
.search svg { width: 16px; height: 16px; color: var(--muted); }
.search input { border: none; background: transparent; padding: 8px 0; width: 100%; box-shadow: none; }
.search.small { min-width: 200px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap; color: var(--text); font-family: inherit; }
.chip.on { background: var(--text); color: var(--panel); border-color: var(--text); }
.chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.filters select { padding: 6px 8px; font-size: 13px; }
.seg { display: flex; background: var(--panel-2); border-radius: 8px; padding: 3px; border: 1px solid var(--line); }
.seg button { flex: 1; border: none; background: transparent; padding: 5px; border-radius: 6px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.conv-list { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--line); position: relative; }
.conv:hover { background: var(--panel-2); }
.conv.active { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.conv .body { flex: 1; min-width: 0; }
.conv .top { display: flex; justify-content: space-between; gap: 8px; }
.conv .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .time { font-size: 11.5px; color: var(--muted); flex: none; }
.conv.unread .time { color: var(--accent); font-weight: 600; }
.conv .preview { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.conv .bottom { display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.conv .count { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; }
.conv .meta { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.pill i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.pill.line { color: #fff; border: none; font-weight: 600; }
.pill.warn { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px; position: relative; }
.avatar .ring { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--panel); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* Chat */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chat-bg); position: relative; }
.chat-empty { margin: auto; text-align: center; padding: 20px; }
.empty-illus { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; color: var(--accent); box-shadow: var(--shadow); }
.empty-illus svg { width: 32px; height: 32px; }
.chat-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.chat-head .back { display: none; }
.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title small { color: var(--muted); display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; }
.chat-actions { display: flex; align-items: center; gap: 2px; }
.stage-select { font-size: 12.5px; padding: 5px 8px; border-radius: 99px; font-weight: 600; max-width: 150px; }
.messages { flex: 1; overflow-y: auto; padding: 16px 6%; display: flex; flex-direction: column; gap: 3px; }
.day { align-self: center; background: var(--panel); color: var(--muted); font-size: 12px; padding: 3px 10px; border-radius: 7px; margin: 10px 0 6px; box-shadow: var(--shadow); }
.msg { max-width: min(560px, 78%); padding: 6px 9px 4px; border-radius: 8px; background: var(--bubble-in); box-shadow: 0 1px 1px rgba(0,0,0,.08); align-self: flex-start; word-wrap: break-word; white-space: pre-wrap; position: relative; }
.msg.out { background: var(--bubble-out); align-self: flex-end; }
.msg .foot { display: flex; justify-content: flex-end; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); margin-top: 1px; float: right; margin-left: 10px; position: relative; top: 4px; }
.msg .foot svg { width: 15px; height: 15px; }
.msg .foot .read { color: #0ea5e9; }
.msg img.media, .msg video.media { display: block; max-width: 100%; max-height: 320px; border-radius: 6px; margin-bottom: 4px; cursor: zoom-in; }
.msg img.sticker { max-width: 140px; background: none; }
.msg audio { display: block; max-width: 260px; height: 40px; }
.msg .doc { display: flex; align-items: center; gap: 8px; padding: 8px; background: rgba(0,0,0,.05); border-radius: 6px; margin-bottom: 4px; color: inherit; text-decoration: none; }
.msg a { word-break: break-all; }
.load-more { align-self: center; margin-bottom: 8px; }
.composer { display: flex; align-items: flex-end; gap: 4px; padding: 8px 10px; background: var(--panel-2); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; max-height: 160px; border-radius: 20px; padding: 9px 14px; background: var(--panel); }
.composer .btn.icon { margin-bottom: 2px; }
.btn.send { background: var(--accent); color: #fff; border: none; border-radius: 50%; width: 40px; height: 40px; padding: 0; }
.line-off { padding: 10px; text-align: center; background: #fef3c7; color: #92400e; font-size: 13px; }
.qr-pop { position: absolute; left: 12px; right: 12px; bottom: 64px; max-width: 520px; max-height: 260px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 5; }
.qr-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.qr-item:hover, .qr-item.sel { background: var(--panel-2); }
.qr-item b { color: var(--accent); }
.qr-item div { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Panel lateral */
.side { width: 320px; flex: none; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.side-body { overflow-y: auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.side-hero { text-align: center; display: grid; gap: 4px; justify-items: center; }
.side-hero .avatar { width: 72px; height: 72px; font-size: 26px; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tag { background: var(--accent-soft); color: var(--text); font-size: 12px; padding: 2px 4px 2px 9px; border-radius: 99px; display: inline-flex; align-items: center; gap: 2px; }
.tag button { border: none; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 14px; line-height: 1; }
.tag-input { border: 1px dashed var(--line); border-radius: 99px; padding: 3px 10px; font-size: 12px; width: 110px; }
.saved-hint { font-size: 12px; color: var(--accent); height: 14px; text-align: right; }

/* Embudo */
.board { display: flex; gap: 12px; padding: 0 24px 24px; overflow-x: auto; flex: 1; align-items: flex-start; }
.col { width: 280px; flex: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; max-height: 100%; }
.col-head { padding: 12px 12px 8px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.col-head i { width: 10px; height: 10px; border-radius: 50%; }
.col-head .n { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 12px; }
.col-body { padding: 4px 8px 10px; display: grid; gap: 8px; overflow-y: auto; min-height: 60px; align-content: start; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-body > * { min-width: 0; }
.card-sm { overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card-sm:active { cursor: grabbing; }
.card-sm strong { display: block; }
.card-sm .preview { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 6px; }
.card-sm .meta { display: flex; gap: 4px; flex-wrap: wrap; }

/* Contactos */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 0 24px 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { font-size: 24px; display: block; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12.5px; }
.table-wrap { padding: 0 24px 24px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--panel-2); font-weight: 600; }
.table tr.click { cursor: pointer; } .table tr.click:hover td { background: var(--panel-2); }
.table td.nowrap { white-space: nowrap; }

/* Números */
.line-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 14px; padding: 0 24px 24px; }
.line-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; box-shadow: var(--shadow); border-top: 4px solid var(--c); }
.line-card .head { display: flex; align-items: center; gap: 10px; }
.line-card .head strong { font-size: 16px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.status i { width: 8px; height: 8px; border-radius: 50%; }
.status.connected { color: var(--accent); } .status.connected i { background: var(--accent); }
.status.qr, .status.connecting { color: var(--warn); } .status.qr i, .status.connecting i { background: var(--warn); animation: pulse 1.2s infinite; }
.status.disconnected { color: var(--muted); } .status.disconnected i { background: var(--muted); }
@keyframes pulse { 50% { opacity: .3; } }
.qr-box { display: grid; place-items: center; gap: 8px; background: #fff; border-radius: 10px; padding: 12px; border: 1px solid var(--line); color: #0f172a; text-align: center; }
.qr-box img { width: 240px; height: 240px; image-rendering: pixelated; }
.pair-code { font: 700 28px/1 ui-monospace, monospace; letter-spacing: .12em; padding: 8px 0; }
.line-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Ajustes */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; padding: 0 24px 24px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 10px; }
.card p { margin: 0; }
.qr-list { display: grid; gap: 6px; }
.qr-row { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; background: var(--panel-2); border-radius: 8px; }
.qr-row div { flex: 1; min-width: 0; white-space: pre-wrap; font-size: 13px; }
.qr-row b { color: var(--accent); display: block; }
.qr-form { display: grid; gap: 8px; }
.stage-list { display: grid; gap: 6px; }
.stage-row { display: flex; gap: 6px; align-items: center; }
.stage-row input[type=text] { flex: 1; }
.stage-row input[type=color] { width: 38px; height: 36px; padding: 2px; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }

/* Modal y toasts */
.modal { border: none; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal::backdrop { background: rgba(15, 23, 42, .5); }
.modal form { padding: 20px; display: grid; gap: 12px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.colors label { cursor: pointer; }
.colors input { display: none; }
.colors span { width: 28px; height: 28px; border-radius: 50%; display: block; border: 3px solid transparent; }
.colors input:checked + span { border-color: var(--text); }
.toasts { position: fixed; bottom: 16px; right: 16px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--text); color: var(--panel); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 340px; cursor: pointer; animation: slide .2s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 200; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 94vh; }

/* Responsive */
@media (max-width: 1100px) {
  .side { position: absolute; right: 0; top: 0; bottom: 0; z-index: 10; box-shadow: var(--shadow); }
  .view-inbox { position: relative; }
}
@media (max-width: 760px) {
  .app { flex-direction: column-reverse; }
  .rail { width: 100%; flex-direction: row; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 0; }
  .rail .brand-mark, .rail-spacer { display: none; }
  .rail-btn { width: auto; flex: 1; }
  .badge { right: calc(50% - 22px); }
  .dot { right: calc(50% - 16px); }
  .view { min-height: 0; }
  .convs { width: 100%; border-right: none; }
  .chat { position: absolute; inset: 0; z-index: 5; display: none; }
  .view-inbox.chat-open .chat { display: flex; }
  .chat-head .back { display: inline-flex; }
  .stage-select { max-width: 110px; }
  #unreadBtn { display: none; }
  .chat-title .ph { display: none; }
  .chat-head { gap: 6px; padding: 8px 6px; }
  .chat-head .avatar { width: 36px; height: 36px; font-size: 13px; }
  .side { width: 100%; z-index: 20; }
  .messages { padding: 12px 10px; }
  .msg { max-width: 88%; }
  .page-head { padding: 16px; }
  .page-note, .board, .stats, .table-wrap, .line-grid, .settings { padding-left: 16px; padding-right: 16px; }
  .page-note { margin-left: 0; margin-right: 0; }
  .settings { grid-template-columns: 1fr; }
  .line-grid { grid-template-columns: 1fr; }
  .table .hide-sm { display: none; }
  .toasts { left: 16px; right: 16px; bottom: 76px; }
}

/* Notificaciones / app instalable */
.push-banner { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 14px; background: #fef9c3; color: #713f12; font-size: 13px; border-bottom: 1px solid #fde68a; }
.push-banner span { flex: 1; }
.push-banner .btn.icon { color: #713f12; padding: 4px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.notice { margin: 0; padding: 10px 12px; border-radius: 8px; background: #fef3c7; color: #92400e; font-size: 13.5px; }
.ok-line { margin: 0; font-weight: 600; color: var(--accent); }
.wrap { flex-wrap: wrap; }
* { -webkit-tap-highlight-color: transparent; }
@media (prefers-color-scheme: dark) {
  .push-banner, .notice { background: #422006; color: #fde68a; border-color: #713f12; }
  .push-banner .btn.icon { color: #fde68a; }
}

/* Ajustes finos para celular */
@media (max-width: 760px) {
  input, select, textarea { font-size: 16px; } /* evita el zoom automático en iPhone */
  .filters select, .stage-select { font-size: 14px; }
  body.chat-open .rail { display: none; }
  .composer { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .chat-head { padding-top: calc(8px + env(safe-area-inset-top)); }
  .convs-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .conv { padding: 12px 14px; }
  .conv:active { background: var(--panel-2); }
  .btn.icon { padding: 9px; }
  .btn.send { width: 44px; height: 44px; }
  .composer textarea { padding: 10px 14px; }
  .msg { font-size: 15px; }
  .modal { width: calc(100vw - 24px); }
  .side-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .qr-pop { bottom: calc(70px + env(safe-area-inset-bottom)); }
}
.card, .card > * { min-width: 0; }
.stage-row input[type=text] { min-width: 0; width: 100%; }

/* Empleados */
body.is-staff .admin-only { display: none !important; }
.user-list { display: grid; gap: 6px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--panel-2); border-radius: 8px; flex-wrap: wrap; }
.user-row .who { flex: 1; min-width: 140px; }
.user-row .who small { color: var(--muted); display: block; }
.user-row.off .who { opacity: .55; }
.user-row .btn { padding: 5px 10px; font-size: 13px; }
.msg .by { font-size: 11.5px; font-weight: 700; color: var(--accent); margin-bottom: 1px; }

/* Turnos */
body:not(.is-staff) .staff-only { display: none !important; }
.shift-bar { display: flex; align-items: center; gap: 10px; }
.shift-bar .btn { flex: 1; justify-content: center; font-weight: 600; padding: 10px 14px; }
.btn.go { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.stop { background: #dc2626; border-color: #dc2626; color: #fff; }
.shift-info { font-size: 12.5px; color: var(--muted); line-height: 1.3; text-align: right; white-space: nowrap; }
.shift-info b { display: block; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.shift-bar.off .shift-info b { color: var(--muted); }
.dot.on { background: var(--accent); }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; padding: 0 24px 16px; }
.emp { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.emp.off { opacity: .6; }
.emp .head { display: flex; align-items: center; gap: 10px; }
.emp .head .avatar { width: 40px; height: 40px; font-size: 14px; }
.emp .head > div:not(.avatar) { flex: 1; min-width: 0; }
.emp .head .avatar { flex: none; }
.emp .head small { color: var(--muted); display: block; }
.emp .state { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.emp .state.on { background: var(--accent-soft); color: #15803d; }
.emp .state.on i { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; animation: pulse 1.4s infinite; }
.emp .hours { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.emp .hours div { background: var(--panel-2); border-radius: 8px; padding: 7px 8px; }
.emp .hours b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.emp .hours span { font-size: 11.5px; color: var(--muted); }
.emp .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.emp .actions .btn { padding: 5px 10px; font-size: 13px; }
.history { margin: 0 24px 24px; }
.history input[type=date], .history select { padding: 6px 8px; font-size: 13px; }
.hist-sum { display: flex; gap: 8px; flex-wrap: wrap; }
.hist-sum .pill { font-size: 12.5px; padding: 3px 10px; }
.table-wrap.flush { padding: 0; }
.table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 760px) {
  .team-grid { padding: 0 16px 16px; }
  .history { margin: 0 16px 16px; }
  .shift-bar .btn { padding: 12px 14px; }
}

/* Sección Yo */
.me-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 14px; padding: 0 24px 24px; align-items: start; }
.shift-big { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 8px 0; }
.shift-big .clock { font: 700 44px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.shift-big .since { color: var(--muted); font-size: 13.5px; }
.shift-big .btn { width: 100%; padding: 14px; font-size: 16px; font-weight: 700; }
.shift-big .state { font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 99px; background: var(--panel-2); color: var(--muted); }
.shift-big .state.on { background: var(--accent-soft); color: #15803d; }
.me-hours { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.me-hours div { background: var(--panel-2); border-radius: 10px; padding: 10px; }
.me-hours b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.me-hours span { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) { .me-grid { padding: 0 16px 16px; } .shift-big .clock { font-size: 40px; } }
.me-hours b { font-size: 15px; white-space: normal; }
#meShifts th, #meShifts td { padding: 8px 6px; font-size: 13px; }
@media (max-width: 760px) { .me-hours { gap: 6px; } .me-hours div { padding: 8px; } .me-hours b { font-size: 14px; } }
