:root {
  --bg: #0f172a; --panel: #1e293b; --key: #273449; --text: #e2e8f0; --muted: #94a3b8;
  --green: #16a34a; --red: #dc2626; --amber: #f59e0b; --blue: #2563eb; --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button { font: inherit; color: inherit; border: 0; cursor: pointer; border-radius: var(--radius); background: var(--key); padding: .7rem 1rem; }
button:active { transform: scale(.97); }
input, textarea { font: inherit; width: 100%; padding: .65rem .8rem; border-radius: 10px; border: 1px solid #334155; background: #0b1220; color: var(--text); }
label { display: block; font-size: .85rem; color: var(--muted); margin: .6rem 0; }
label input, label textarea { margin-top: .25rem; }
hr { border: 0; border-top: 1px solid #334155; margin: 1.2rem 0; }

.phone { max-width: 420px; margin: 0 auto; min-height: 100%; padding: env(safe-area-inset-top) 1rem calc(1rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: .75rem; padding: .9rem 0; }
.top > div:first-child { flex: 1; min-width: 0; }
.brand { font-weight: 700; }
.account { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); }
.dot { width: .6rem; height: .6rem; border-radius: 50%; background: #64748b; }
.status.ok .dot { background: var(--green); } .status.warn .dot { background: var(--amber); } .status.err .dot { background: var(--red); }
.icon { background: transparent; font-size: 1.3rem; padding: .3rem .5rem; }

.view { flex: 1; display: flex; flex-direction: column; gap: .8rem; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .8rem; } .center { text-align: center; }
.row { display: flex; gap: .5rem; } .row > * { flex: 1; } .row input { flex: 3; }
.wide { width: 100%; }
.primary { background: var(--blue); } .danger { background: var(--red); } .ghost { background: transparent; border: 1px solid #334155; }
.msg { min-height: 1.2rem; font-size: .9rem; } .msg.err { color: #fca5a5; } .msg.ok { color: #86efac; }

#scanVideo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: #000; }

.display { display: flex; align-items: center; gap: .3rem; margin-top: .5rem; }
.display input { font-size: 1.8rem; text-align: center; border: 0; background: transparent; letter-spacing: .05em; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.pad button { font-size: 1.6rem; padding: .7rem 0; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.pad small, .actions small { font-size: .62rem; color: var(--muted); letter-spacing: .12em; }
.call, .reject { width: 4.4rem; height: 4.4rem; border-radius: 50%; font-size: 1.7rem; margin: .6rem auto; display: block; padding: 0; }
.call { background: var(--green); } .reject { background: var(--red); }

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; padding: .55rem .2rem; border-bottom: 1px solid #1e293b; cursor: pointer; font-size: .92rem; }
.history li span:last-child { color: var(--muted); font-size: .78rem; }

.peer { text-align: center; padding: 2rem 0 1rem; }
.avatar { width: 5.5rem; height: 5.5rem; border-radius: 50%; background: var(--panel); margin: 0 auto 1rem; display: grid; place-items: center; font-size: 2rem; font-weight: 700; }
.peerName { font-size: 1.5rem; font-weight: 600; word-break: break-all; }
.timer { font-variant-numeric: tabular-nums; margin-top: .4rem; font-size: 1.1rem; }
.incoming { display: flex; justify-content: space-around; margin-top: auto; }
.incoming button { margin: 0; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: 1rem 0; }
.actions button { display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: 1.3rem; padding: .7rem 0; }
.actions button.on { background: var(--text); color: var(--bg); }
.actions button.on small { color: var(--bg); }
#inCallActions { margin-top: auto; }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--panel); padding: .7rem 1.1rem; border-radius: 10px; box-shadow: 0 6px 24px #0008; max-width: 90vw; font-size: .9rem; }
