:root {
  --bg: #0b1120;
  --bg-soft: #131c31;
  --card: #172136;
  --card-2: #1e2b45;
  --line: #24334f;
  --text: #e8eefc;
  --muted: #93a4c4;
  --brand: #6d8cff;
  --brand-2: #8b5cf6;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 600px at 10% -10%, #1b2a4d 0%, var(--bg) 55%) no-repeat, var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px;
  background: rgba(11, 17, 32, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: .2px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .dot { width: 11px; height: 11px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 0 12px var(--brand); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav a {
  padding: 7px 11px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--card-2); color: var(--text); }
.nav form { margin: 0; display: inline; }
.spacer { flex: 1 1 auto; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 18px 16px 64px; }

h1 { font-size: 22px; margin: 6px 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; letter-spacing: .3px; }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
p.sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }

.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0d1526; color: var(--text); font-size: 16px; font-family: inherit;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(109, 140, 255, .45); border-color: var(--brand); }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 16px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  font-size: 15px; font-weight: 600; font-family: inherit;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--bg-soft); }
.btn.danger { background: transparent; border-color: #7f1d1d; color: var(--err); }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--bg-soft); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: rgba(52, 211, 153, .4); }
.pill.warn { color: var(--warn); border-color: rgba(251, 191, 36, .4); }
.pill.err { color: var(--err); border-color: rgba(248, 113, 113, .4); }
.pill.live { color: var(--brand); border-color: rgba(109, 140, 255, .5); }

.flash { padding: 12px 14px; border-radius: 11px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.flash.ok { background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .35); color: #b9f5dd; }
.flash.err { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .35); color: #ffd7d7; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
tr:last-child td { border-bottom: none; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.digits { display: flex; flex-wrap: wrap; gap: 8px; min-height: 56px; align-items: center;
  background: #0d1526; border: 1px dashed var(--line); border-radius: 12px; padding: 10px; }
.digit { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 700; font-size: 18px; animation: pop .25s ease; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.log { max-height: 340px; overflow-y: auto; font-size: 13px; }
.log .item { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(36, 51, 79, .6); }
.log .t { color: var(--muted); font-family: ui-monospace, monospace; flex: 0 0 62px; }
.log .m { flex: 1; word-break: break-word; }
.log .item.dtmf .m { color: var(--brand); font-weight: 600; }
.log .item.error .m { color: var(--err); }

audio { width: 100%; margin-top: 8px; }

.accordion summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.accordion[open] summary { margin-bottom: 10px; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

@media (max-width: 640px) {
  .nav a { padding: 6px 9px; font-size: 13px; }
  .stat .n { font-size: 22px; }
  th:nth-child(4), td:nth-child(4) { display: none; }
}
