:root {
  --brand: #227f85; --brand-2: #1b6a6f; --side: #13383b; --side-2: #1a4a4e; --bg: #f4f6f6; --card: #fff;
  --text: #1c2526; --muted: #66757a; --line: #dfe5e6; --danger: #c0392b; --good: #1f9d55; --warn: #b7791f;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--brand); }
code { background: #eef3f3; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; background: var(--side); color: #dfeeee; display: flex; flex-direction: column; padding: 16px 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; margin: 0 6px 16px; }
.brand.dark { color: var(--text); margin: 0 0 18px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.tenant-box { background: var(--side-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.t-name { font-weight: 700; color: #fff; }
.t-domain { font-size: 12px; opacity: .75; word-break: break-all; }
.side nav { display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.side nav a { color: #dfeeee; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 14px; display: flex; gap: 8px; }
.side nav a:hover, .side nav a.on { background: var(--side-2); color: #fff; }
.ico { width: 18px; text-align: center; opacity: .8; }
.nav-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .55; margin: 14px 10px 4px; }
.side-foot { font-size: 13px; opacity: .8; padding: 10px 6px 0; border-top: 1px solid var(--side-2); }
.main { flex: 1; min-width: 0; padding: 24px 32px; max-width: 1200px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.card.narrow, .narrow { max-width: 560px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 26px; }
.stat span { color: var(--muted); font-size: 13px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 8px; padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-outline { color: var(--danger); }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }
.link.light { color: #bfe3e3; }
.inline { display: inline; }
.actions { display: flex; gap: 8px; }
.input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; background: #fff; color: var(--text); }
.input:focus { outline: 2px solid rgba(34, 127, 133, .25); border-color: var(--brand); }
textarea.input { resize: vertical; }
.field { display: block; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.field .input, .field select, .field input[type=file] { margin-top: 4px; font-weight: 400; }
.field .dest-kind { width: 62%; display: inline-block; }
.field .dest-number { width: 36%; display: inline-block; margin-left: 2%; }
.check { display: flex; gap: 8px; align-items: baseline; margin-bottom: 12px; font-size: 14px; flex-wrap: wrap; }
.help { display: block; width: 100%; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.err { color: var(--danger); font-size: 13px; margin: -8px 0 10px; }
.form { max-width: 720px; }
.form-acts { display: flex; gap: 8px; justify-content: space-between; margin-top: 8px; }
.search { margin-bottom: 12px; max-width: 360px; }
.search.row { display: flex; gap: 8px; max-width: 640px; }
table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfb; }
table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
.card table.list { border: 0; }
.row-acts { text-align: right; white-space: nowrap; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 30px; text-align: center; color: var(--muted); }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: #e6f4f1; border: 1px solid #b9e0d8; }
.flash.error { background: #fbeaea; border-color: #f0c2c2; }
.flash.warn, .flash.warning { background: #fdf5e6; border-color: #f2dcb0; }
.pill { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #eef3f3; }
.pill.onnet { background: #e2f0ff; } .pill.inbound { background: #e6f4ea; } .pill.outbound { background: #fdf2e3; }
.pill.emergency { background: #fbeaea; color: var(--danger); font-weight: 700; } .pill.shortcode { background: #efe8fb; }
.codes td { padding: 3px 10px 3px 0; font-size: 14px; }
.codes td:nth-child(odd) { font-weight: 700; white-space: nowrap; }
ul.plain { padding-left: 18px; margin: 0; }
ul.plain li { margin-bottom: 8px; }
.vm { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
audio { height: 32px; max-width: 260px; }
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--side); padding: 16px; }
.login-card { background: #fff; border-radius: 14px; padding: 28px; width: 100%; max-width: 380px; }
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: auto; }
  .main { padding: 16px; }
  table.list { display: block; overflow-x: auto; }
}
/* Texts */
.texts { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.thread { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.thread:hover, .thread.on { background: #eef3f3; }
.bubbles { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; margin-bottom: 12px; }
.bubble { max-width: 75%; padding: 8px 12px; border-radius: 14px; background: #eef3f3; }
.bubble.out { align-self: flex-end; background: #d8eeee; }
.compose { display: grid; gap: 8px; }
/* Phone */
.phone { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 16px; align-items: start; }
.dialer .number { font-size: 22px; text-align: center; letter-spacing: .05em; margin: 8px 0 12px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.key { font: inherit; font-size: 20px; padding: 12px 0; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.key:active { background: #eef3f3; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.big { font-size: 22px; font-weight: 700; }
.incoming, .in-call { text-align: center; padding: 8px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.incoming { animation: pulse 1.2s infinite alternate; }
@keyframes pulse { from { background: #fff; } to { background: #e6f4f1; } }
@media (max-width: 760px) { .texts, .phone { grid-template-columns: 1fr; } }
