:root {
  --bg: #0a0e14;
  --bg2: #0e141c;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-brd: rgba(255, 255, 255, 0.08);
  --txt: #e6edf3;
  --muted: #8b98a9;
  --accent: #34d399;
  --d13: #f59e0b;
  --d47: #3b82f6;
  --d8: #8b5cf6;
  --apto: #10b981;
  --danger: #ef4444;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(52, 211, 153, 0.08), transparent 60%),
              radial-gradient(900px 500px at 0% 100%, rgba(59, 130, 246, 0.06), transparent 55%),
              var(--bg);
  color: var(--txt);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* LOGIN */
.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
}
.login-card {
  background: var(--panel); backdrop-filter: blur(20px);
  border: 1px solid var(--panel-brd); border-radius: 20px;
  padding: 40px 34px; width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow);
  text-align: center;
}
.login-logo { font-size: 44px; }
.login-card h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.login-card input {
  background: rgba(0,0,0,0.25); border: 1px solid var(--panel-brd);
  border-radius: 12px; padding: 13px 15px; color: var(--txt); font-size: 14px; outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button, .modal button:not(.ghost) {
  background: linear-gradient(135deg, var(--accent), #10b981);
  color: #042418; font-weight: 700; border: none; border-radius: 12px;
  padding: 13px; font-size: 15px; cursor: pointer; transition: transform .1s, filter .15s;
}
.login-card button:hover { filter: brightness(1.08); }
.login-card button:active { transform: scale(.98); }
.login-err { color: var(--danger); font-size: 13px; min-height: 16px; }

/* TOPBAR */
.app { max-width: 1320px; margin: 0 auto; padding: 22px 26px 60px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.brand { display: flex; gap: 13px; align-items: center; }
.brand-mark { font-size: 30px; }
.brand-title { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.updated { font-size: 12px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.who { font-size: 13px; color: var(--muted); }
.ghost {
  background: var(--panel); border: 1px solid var(--panel-brd); color: var(--txt);
  border-radius: 10px; padding: 8px 13px; cursor: pointer; font-size: 13px; transition: background .15s;
}
.ghost:hover { background: rgba(255,255,255,0.09); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--panel); border: 1px solid var(--panel-brd); border-radius: 16px;
  padding: 18px 20px; position: relative; overflow: hidden;
}
.kpi .v { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .dot { position: absolute; top: 18px; right: 18px; width: 9px; height: 9px; border-radius: 50%; }
.kpi.ready .v { color: var(--apto); }
.kpi.warming .v { color: var(--d47); }

/* section title */
.section-title { font-size: 14px; font-weight: 700; margin: 6px 0 12px; text-transform: uppercase; letter-spacing: .06em; color: #aeb9c7; }
.section-title .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* jornada / esteira */
.journey { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; position: relative; }
.jstep { background: var(--panel); border: 1px solid var(--panel-brd); border-radius: 14px; padding: 14px; min-height: 90px; position: relative; }
.jstep::after { content: '→'; position: absolute; right: -11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; z-index: 2; }
.jstep:last-child::after { display: none; }
.jstep-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.jstep-label { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.jstep-label i { width: 10px; height: 10px; border-radius: 3px; }
.jstep-count { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.jstep-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.jchip { font-size: 10px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,0.06); color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.jchip.ready { background: rgba(16,185,129,0.15); color: var(--apto); }
.jstep.apto { border-color: rgba(16,185,129,0.3); }

/* legend */
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* manager block */
.mgr { margin-bottom: 30px; }
.mgr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.mgr-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; }
.mgr-meta { font-size: 12px; color: var(--muted); display: flex; gap: 14px; align-items: center; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.pill.on { background: rgba(16,185,129,0.15); color: var(--apto); }
.pill.off { background: rgba(239,68,68,0.13); color: var(--danger); }
.pill.warn { background: rgba(245,158,11,0.14); color: var(--d13); }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }

/* chip card = rampa */
.chip {
  background: var(--panel); border: 1px solid var(--panel-brd); border-radius: 16px;
  padding: 16px 17px; transition: border-color .2s, transform .12s;
}
.chip:hover { border-color: rgba(255,255,255,0.18); }
.chip.ready { border-color: rgba(16,185,129,0.35); background: rgba(16,185,129,0.05); }
.chip.paused { opacity: .6; }
.chip-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 13px; }
.chip-id { display: flex; align-items: center; gap: 8px; }
.conn { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.conn.up { background: var(--apto); box-shadow: 0 0 8px var(--apto); }
.conn.down { background: #4b5563; }
.chip-name { font-weight: 700; font-size: 14px; }
.chip-phone { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.stage-badge { font-size: 10px; font-weight: 700; padding: 4px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }

/* a rampa */
.ramp { margin: 6px 0 10px; }
.ramp-track {
  height: 8px; border-radius: 999px; background: rgba(255,255,255,0.07);
  position: relative; overflow: hidden;
}
.ramp-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.ramp-marks { display: flex; justify-content: space-between; margin-top: 5px; font-size: 9px; color: var(--muted); }
.ramp-info { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 7px; }
.ramp-info b { color: var(--txt); font-weight: 600; }

/* metas de hoje */
.today { margin-top: 11px; display: flex; gap: 10px; }
.today .m { flex: 1; }
.today .m .lab { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.today .m .bar { height: 5px; border-radius: 999px; background: rgba(255,255,255,0.07); margin-top: 4px; overflow: hidden; }
.today .m .bar > i { display: block; height: 100%; border-radius: 999px; }
.today .m .n { font-size: 11px; font-weight: 600; margin-top: 3px; }

.chip-actions { display: flex; gap: 7px; margin-top: 12px; }
.chip-actions button {
  flex: 1; background: rgba(255,255,255,0.05); border: 1px solid var(--panel-brd); color: var(--muted);
  border-radius: 9px; padding: 7px; font-size: 11px; cursor: pointer; transition: all .15s;
}
.chip-actions button:hover { color: var(--txt); background: rgba(255,255,255,0.1); }

.ready-badge { font-size: 10px; font-weight: 800; color: var(--apto); letter-spacing: .08em; }

.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--panel-brd); border-radius: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #10b981); color: #042418; font-weight: 700; border: none; border-radius: 10px; padding: 9px 15px; cursor: pointer; font-size: 13px; }

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 30px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: grid; place-items: center; z-index: 50; backdrop-filter: blur(4px); }
.modal-card { background: var(--bg2); border: 1px solid var(--panel-brd); border-radius: 18px; padding: 28px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.modal-card h3 { font-size: 17px; }
.modal-card input { background: rgba(0,0,0,0.25); border: 1px solid var(--panel-brd); border-radius: 10px; padding: 11px 13px; color: var(--txt); outline: none; }
.modal-card input:focus { border-color: var(--accent); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* modal largo + biblioteca de midia */
.modal-wide { max-width: 560px; }
.media-upload { display: flex; gap: 8px; align-items: center; }
.media-upload select, .media-upload input[type=file] { background: rgba(0,0,0,0.25); border: 1px solid var(--panel-brd); border-radius: 10px; padding: 9px 11px; color: var(--txt); font-size: 13px; }
.media-upload input[type=file] { flex: 1; }
.modal-card select { background: rgba(0,0,0,0.25); border: 1px solid var(--panel-brd); border-radius: 10px; padding: 11px 13px; color: var(--txt); outline: none; }
.media-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-height: 320px; overflow-y: auto; margin-top: 6px; }
.media-item { background: rgba(255,255,255,0.04); border: 1px solid var(--panel-brd); border-radius: 10px; padding: 8px; text-align: center; position: relative; }
.media-item .thumb { width: 100%; height: 64px; object-fit: cover; border-radius: 6px; background: rgba(0,0,0,0.3); display: grid; place-items: center; font-size: 26px; }
.media-item .mlabel { font-size: 10px; color: var(--muted); margin-top: 5px; word-break: break-word; }
.media-item .mdel { position: absolute; top: 4px; right: 4px; background: rgba(239,68,68,0.85); color: #fff; border: none; border-radius: 6px; width: 20px; height: 20px; cursor: pointer; font-size: 12px; line-height: 1; }
.media-empty { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 24px; font-size: 13px; }
.hold-tag { font-size: 10px; color: var(--d13); margin-top: 6px; display: block; }
.wait-tag { font-size: 10px; color: var(--muted); margin-top: 6px; display: block; }

@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .chips { grid-template-columns: 1fr; }
  .journey { grid-template-columns: repeat(2, 1fr); }
  .jstep::after { display: none; }
  .media-list { grid-template-columns: repeat(2, 1fr); }
}
