:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #14213d;
  --muted: #607089;
  --line: #e2e7f0;
  --brand: #0f766e;
  --brand-dark: #0b5d57;
  --accent: #f97316;
  --danger: #b42318;
  --ok: #0f7b4f;
  --warn: #9a6700;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: #eef2f7; border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; font-size: .86em; }

.topbar { background: #0b1b33; color: #fff; }
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 22px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #10b981);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff;
}
.brand-mark-lg { width: 46px; height: 46px; border-radius: 12px; font-size: 1.25rem; }
.brand-text { font-weight: 700; letter-spacing: .01em; display: flex; flex-direction: column; }
.brand-text small { font-weight: 500; font-size: .68rem; color: #9fb3cc; letter-spacing: .04em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: #c6d4e6; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: .9rem;
}
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav a.is-active { background: rgba(16,185,129,.16); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.tenant-chip {
  font-size: .82rem; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  padding: 5px 10px; border-radius: 999px; color: #e7eefb;
}
.tenant-chip small { color: #9fb3cc; }
.topbar .btn-ghost { color: #dbe6f5; border-color: rgba(255,255,255,.25); }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 22px 40px; flex: 1; }
.footer {
  max-width: 1180px; margin: 0 auto; padding: 16px 22px 22px; width: 100%;
  color: var(--muted); font-size: .74rem; display: flex; justify-content: space-between; gap: 12px;
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head-actions { display: flex; gap: 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .68rem; font-weight: 700; color: var(--brand); margin: 0 0 4px; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 1.55rem; letter-spacing: -.02em; }
.kpi-foot { color: var(--muted); font-size: .76rem; }

.grid-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-head p { margin: 2px 0 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th {
  text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.block { display: block; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; text-transform: lowercase; background: #eef2f7; color: #45536b;
  border: 1px solid var(--line); white-space: nowrap;
}
.pill-ativo, .pill-pago, .pill-registered { background: #e7f6ef; color: var(--ok); border-color: #bfe6d5; }
.pill-cancelado, .pill-vencida, .pill-failed { background: #fdecea; color: var(--danger); border-color: #f6c9c5; }
.pill-implementando, .pill-aberta, .pill-registering { background: #fff5e6; color: var(--warn); border-color: #f2ddb5; }
.pill-negociando { background: #eef2f7; color: #45536b; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

.badge {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  background: #eef2f7; border: 1px solid var(--line); color: #45536b; border-radius: 999px; padding: 3px 9px;
}
.badge-warn { background: #fff5e6; border-color: #f2ddb5; color: var(--warn); }

.alert { border-radius: 10px; padding: 11px 14px; font-size: .87rem; border: 1px solid; margin-bottom: 12px; }
.alert p { margin: 6px 0 0; }
.alert-info { background: #eef6ff; border-color: #cfe3f8; color: #1c4b7a; }
.alert-warn { background: #fff8e8; border-color: #f2ddb5; color: #7a5200; }
.alert-danger { background: #fdecea; border-color: #f6c9c5; color: #7d1a12; }
.alert-ok { background: #e9f8f0; border-color: #bfe6d5; color: #0d5c3b; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 650; font-size: .88rem; padding: 9px 14px; cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .05s ease;
}
.btn:hover { text-decoration: none; border-color: #c8d1df; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: transparent; }
.btn-soft { background: #eef2f7; border-color: #dde4ee; }
.btn-danger { color: var(--danger); border-color: #f0bdb8; background: #fff; }
.btn-sm { padding: 6px 11px; font-size: .8rem; }
.btn-block { width: 100%; margin-top: 6px; }
.btn-row { display: flex; gap: 8px; }

.form { display: flex; flex-direction: column; gap: 8px; }
.form label { font-size: .78rem; font-weight: 700; color: #33415c; }
input[type="text"], input[type="password"], input[type="tel"] {
  width: 100%; border: 1px solid #ccd5e2; border-radius: 9px; padding: 10px 12px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus { outline: 2px solid rgba(15,118,110,.25); border-color: var(--brand); }
.input-row { display: flex; gap: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.login-shell { min-height: 62vh; display: grid; place-items: center; padding: 24px 0; }
.login-card { width: min(420px, 100%); padding: 26px; }
.login-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.login-head h1 { font-size: 1.25rem; }
.login-head p { margin: 2px 0 0; }
.login-foot { margin: 16px 0 0; }
.micro { font-size: .76rem; }
.muted { color: var(--muted); }
.empty { color: var(--muted); font-size: .88rem; margin: 6px 0 0; }

.pabx-box { display: flex; flex-direction: column; gap: 9px; }
.pabx-line { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #e7ecf4; padding-bottom: 7px; }
.pabx-line .label { color: var(--muted); font-size: .78rem; font-weight: 600; }
.ellipsis { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pabx-grid { grid-template-columns: 1.1fr .9fr; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.key { flex-direction: column; gap: 0; padding: 8px; min-height: 44px; }
.key small { font-size: .58rem; color: var(--muted); letter-spacing: .1em; }
.call-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pabx-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.steps { margin: 0 0 12px; padding-left: 20px; font-size: .86rem; color: #33415c; }
.steps li { margin-bottom: 8px; }

@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .pabx-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar-inner { gap: 12px; }
  .nav { order: 3; }
  .cards { grid-template-columns: 1fr; }
  h1 { font-size: 1.3rem; }
}
