:root {
  --bg: #f4f5f7; --panel: #fff; --text: #1d2330; --muted: #667085; --line: #e3e6ec;
  --brand: #2457d6; --brand-ink: #fff; --ok: #14804a; --warn: #b26a00; --bad: #c0392b;
  --ok-bg: #e3f6ec; --warn-bg: #fff2d9; --bad-bg: #fde8e6; --gray-bg: #eceff3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c; --panel: #1b2029; --text: #e6e9ef; --muted: #98a2b3; --line: #2b3240;
    --brand: #6b95ff; --brand-ink: #0b1020; --ok: #4cd08a; --warn: #f0b24a; --bad: #ff8a7a;
    --ok-bg: #16321f; --warn-bg: #3a2c10; --bad-bg: #3d1a16; --gray-bg: #262d3a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 20px; margin: 0 0 14px; } h2 { font-size: 15px; margin: 0 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
label { display: block; margin: 10px 0 4px; font-size: 12px; color: var(--muted); }
button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--brand); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.danger { color: var(--bad); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.row > select { width: auto; min-width: 110px; }
.row > select.grow { min-width: 160px; }
.muted { color: var(--muted); }
.err { color: var(--bad); margin-top: 8px; min-height: 1.2em; }

.login { max-width: 340px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.login h1 { text-align: center; }
.login button { width: 100%; margin-top: 16px; padding: 10px; }

.shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.main { padding: 22px; overflow: auto; }
.brand { font-weight: 700; font-size: 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav a:hover { background: var(--gray-bg); }
.nav a.on { background: var(--brand); color: var(--brand-ink); }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel); }
.side .card { background: var(--bg); }
.user-name { font-weight: 600; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--gray-bg); color: var(--muted); }
.badge.available { background: var(--ok-bg); color: var(--ok); }
.badge.paused { background: var(--warn-bg); color: var(--warn); }
.badge.offline { background: var(--gray-bg); color: var(--muted); }
.badge.oncall { background: var(--bad-bg); color: var(--bad); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }

.phone-status { font-size: 12px; }
.dial { display: flex; gap: 6px; margin-top: 8px; }
.call-line { margin-top: 8px; font-weight: 600; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 20px; width: min(460px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.members { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.member { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member input[type=checkbox] { width: auto; }
.member input[type=number] { width: 70px; padding: 4px 6px; }
.secret { font-family: ui-monospace, monospace; background: var(--gray-bg); padding: 8px 10px; border-radius: 8px; user-select: all; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* fluxograma */
.fc-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .fc-wrap { grid-template-columns: 1fr; } }
.fc-canvas { position: relative; height: 620px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background-color: var(--panel);
  background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 20px 20px; }
.fc-inner { position: relative; }
.fc-svg { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.fc-edge { fill: none; stroke: var(--brand); stroke-width: 2; }
.fc-tmp { stroke-dasharray: 5 4; }
.fc-arrowhead { fill: var(--brand); }
.fc-node { position: absolute; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 1px 4px rgba(0,0,0,.12); user-select: none; padding-bottom: 4px; }
.fc-node.sel { outline: 2px solid var(--brand); }
.fc-node.warn { border-color: var(--warn); border-style: dashed; }
.fc-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px 9px 0 0; font-size: 12px; font-weight: 600; cursor: grab; touch-action: none; background: var(--gray-bg); }
.t-menu .fc-head { background: var(--warn-bg); color: var(--warn); }
.t-queue .fc-head { background: var(--ok-bg); color: var(--ok); }
.t-hangup .fc-head { background: var(--bad-bg); color: var(--bad); }
.t-hours .fc-head { background: var(--brand); color: var(--brand-ink); }
.fc-body { padding: 6px 10px; font-size: 13px; overflow-wrap: anywhere; }
.fc-in { position: absolute; left: -7px; top: 12px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid var(--panel); }
.fc-port-row { position: relative; display: flex; justify-content: flex-end; align-items: center; padding: 2px 14px 2px 10px; font-size: 12px; min-height: 20px; }
.fc-port { position: absolute; right: -7px; top: 50%; margin-top: -6px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--brand); background: var(--panel); cursor: crosshair; touch-action: none; }
.fc-port:hover { background: var(--brand); }
.fc-problems { margin-top: 10px; color: var(--warn); font-size: 13px; }
.fc-form .card { background: var(--panel); }

textarea { resize: vertical; font: inherit; }

.dtmf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.dtmf button { padding: 10px 0; font-size: 16px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand img { display: block; border-radius: 22%; }
.wordmark { font-weight: 700; font-size: 20px; letter-spacing: -.02em; color: var(--text); }
.wordmark b { color: var(--brand); font-weight: 700; }
.brand.big { flex-direction: column; gap: 10px; }
.brand.big .wordmark { font-size: 30px; }
.login-brand { text-align: center; margin-bottom: 18px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 10px 0; }
.tiles.big { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tile-v { font-size: 24px; font-weight: 700; }
.tile-l { font-size: 12px; }
.tile.ok .tile-v { color: var(--ok); } .tile.warn .tile-v { color: var(--warn); } .tile.bad .tile-v { color: var(--bad); }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.qcard.busy { border-color: var(--warn); } .qcard.late { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.qtoday { margin-top: 8px; font-size: 13px; }
.bar { background: var(--gray-bg); border-radius: 6px; height: 8px; } .bar span { display: block; height: 8px; border-radius: 6px; background: var(--brand); }

:root { --c-ura: #2fa36b; --c-wait: #e0a100; --c-talk: #2457d6; }
@media (prefers-color-scheme: dark) { :root { --c-ura: #4cd08a; --c-wait: #f0b24a; --c-talk: #6b95ff; } }
.tile.c-ura .tile-v { color: var(--c-ura); } .tile.c-talk .tile-v { color: var(--c-talk); }
.lchart { width: 100%; height: auto; display: block; }
.lgrid { stroke: var(--line); stroke-width: 1; } .laxis { fill: var(--muted); font-size: 11px; } .lcross { stroke: var(--muted); stroke-dasharray: 3 3; }
.llegend { display: flex; flex-wrap: wrap; gap: 16px; margin: 6px 0; font-size: 13px; }
.lkey i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.lnk { color: var(--brand); font-weight: 600; text-decoration: none; cursor: pointer; } .lnk:hover { text-decoration: underline; }
.chip { display: inline-block; background: var(--gray-bg); border-radius: 999px; padding: 2px 9px; margin: 1px 4px 1px 0; font-size: 12px; }
tr.busy td { background: var(--warn-bg); } tr.late td { background: var(--bad-bg); }

.main h2 { margin-top: 22px; }
#app .card + .card, .tiles + .card { margin-top: 14px; }

.trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.lcard { padding: 14px 16px 10px; }
.lc-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.lc-num { font-size: 46px; font-weight: 700; line-height: 1.05; margin: 6px 0 2px; letter-spacing: -.02em; }
.lc-hint { font-size: 12px; }
.spark { width: 100%; height: auto; display: block; }
.spark-base { stroke: var(--line); stroke-width: 1; } .spark-cross { stroke: var(--muted); stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.spark-dot { animation: pulse 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 0% { opacity: 1; transform: scale(1); } 70% { opacity: .35; transform: scale(1.7); } 100% { opacity: 1; transform: scale(1); } }
.tile.c-wait .tile-v { color: var(--c-wait); }

.trio .card { margin-top: 0 !important; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 50; max-width: 340px; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 14px; }
