
:root {
  --bg: #f3faf8;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbeafe;
  --accent: #0f766e;
  --accent2: #14b8a6;
  --danger: #b91c1c;
  --warn: #b45309;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(20,184,166,.16), transparent 22rem),
    linear-gradient(180deg, #f0fdfa, var(--bg));
}
a { color: inherit; text-decoration: none; }
button, .btn, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 38px;
  border: 0;
  border-radius: 13px;
  padding: .58rem .85rem;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(15,118,110,.14);
}
button.secondary, .btn.secondary { background: #eef2f7; color: #0f172a; box-shadow: none; }
button.danger { background: #fee2e2; color: var(--danger); box-shadow: none; }
button.warn { background: #fef3c7; color: var(--warn); box-shadow: none; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 13px;
  padding: .6rem .72rem;
  outline: none;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 4px rgba(20,184,166,.12);
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 1rem;
  background: #052e2b;
  color: #e6fffb;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.brand {
  padding: .9rem;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
}
.brand strong { display: block; font-size: 1.25rem; }
.brand span { color: #99f6e4; font-size: .88rem; }
.sidebar nav { display: grid; gap: .35rem; }
.sidebar nav a {
  padding: .75rem .85rem;
  border-radius: 14px;
  color: #d1fae5;
  font-weight: 700;
}
.sidebar nav a:hover { background: rgba(255,255,255,.1); }
.main {
  margin-left: 250px;
  padding: 1.25rem;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.eyebrow {
  margin: 0 0 .3rem;
  color: var(--accent);
  font-size: .78rem;
  text-transform: uppercase;
  font-weight: 950;
  letter-spacing: .12em;
}
.page-header h1 {
  margin: 0 0 .35rem;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: -.04em;
}
.page-header p { margin: 0; color: var(--muted); max-width: 780px; line-height: 1.55; }
.panel, .login-card {
  background: var(--panel);
  border: 1px solid rgba(20,184,166,.18);
  border-radius: 24px;
  padding: 1rem;
  box-shadow: 0 16px 40px rgba(15,23,42,.06);
}
.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: .8rem;
  margin-bottom: 1rem;
}
.stats div {
  background: #fff;
  border: 1px solid #ccfbf1;
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 12px 26px rgba(15,23,42,.05);
}
.stats span { display:block; color: var(--muted); font-size:.85rem; }
.stats strong { display:block; margin-top:.3rem; font-size:1.8rem; }
.flow { display:flex; flex-wrap:wrap; gap:.6rem; }
.flow div { padding:.7rem .85rem; background:#f0fdfa; border:1px solid #ccfbf1; border-radius:14px; font-weight:800; }
.toolbar {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: .6rem;
  margin-bottom: 1rem;
}
.table-wrap { overflow:auto; }
table { width:100%; border-collapse: collapse; min-width: 920px; }
th, td { padding: .75rem; border-bottom: 1px solid #e2e8f0; text-align:left; vertical-align: top; }
th { color:#475569; font-size:.78rem; text-transform:uppercase; letter-spacing:.06em; }
td small { display:block; color:var(--muted); margin-top:.2rem; }
.badge { display:inline-flex; border-radius:999px; padding:.28rem .55rem; font-size:.74rem; font-weight:900; }
.badge.active { background:#dcfce7; color:#047857; }
.badge.trial { background:#e0f2fe; color:#0369a1; }
.badge.expired, .badge.blocked { background:#fee2e2; color:#b91c1c; }
.badge.suspended { background:#fef3c7; color:#92400e; }
.actions { display:flex; flex-wrap:wrap; gap:.35rem; }
.actions button, .actions a { min-height:31px; padding:.38rem .58rem; border-radius:10px; font-size:.8rem; }
.grid-form {
  display:grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap:.8rem;
}
.grid-form label { display:grid; gap:.34rem; font-size:.85rem; font-weight:800; color:#334155; }
.full { grid-column: 1 / -1; }
.features {
  border:1px solid #e2e8f0;
  border-radius:16px;
  padding:.9rem;
  display:grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap:.45rem;
}
.features legend { font-weight:950; color:#0f172a; padding:0 .3rem; }
.features label { display:flex; align-items:center; gap:.45rem; font-weight:700; }
.features input { width:auto; min-height:auto; }
.login-wrap {
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:1rem;
}
.login-card { width:min(100%,420px); display:grid; gap:.8rem; }
.login-card h1 { margin:0; }
.login-card p { margin:0; color:var(--muted); }
.msg { margin-top:.6rem; font-weight:800; }
.msg.error { color:var(--danger); }
.msg.success { color:#047857; }
.client-detail {
  display:grid;
  grid-template-columns: minmax(0,1fr) minmax(280px,.65fr);
  gap:1rem;
}
.kv { display:grid; grid-template-columns: 180px 1fr; gap:.5rem; padding:.45rem 0; border-bottom:1px solid #edf2f7; }
.kv span { color:var(--muted); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.docs pre {
  padding:1rem;
  background:#0f172a;
  color:#d1fae5;
  border-radius:16px;
  overflow:auto;
}
@media (max-width: 960px) {
  .sidebar { position:static; width:auto; }
  .main { margin-left:0; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .toolbar, .grid-form, .client-detail { grid-template-columns:1fr; }
  .features { grid-template-columns:1fr; }
  .page-header { display:grid; }
}

/* v1_03 refinements */
.sidebar nav a { display:flex; align-items:center; justify-content:space-between; }
.sidebar nav a::after { content:'›'; opacity:.35; }
.panel h2, .soft-card h2 { margin:.1rem 0 .7rem; letter-spacing:-.03em; }
.muted { color: var(--muted); }
.mt { margin-top:1rem; }
.toolbar.right { display:flex; justify-content:flex-end; margin-top:-.4rem; }
.empty { text-align:center; color:var(--muted); padding:1.2rem; }
.detail-grid { display:grid; grid-template-columns: minmax(0,1fr) minmax(320px,.78fr); gap:1rem; }
.soft-card { background:#fff; border:1px solid #e2f5f1; border-radius:20px; padding:1rem; box-shadow:0 10px 26px rgba(15,23,42,.045); }
.flow.compact { gap:.35rem; }
.flow.compact .badge { padding:.35rem .55rem; }
.features label { border:1px solid #e2e8f0; border-radius:13px; padding:.52rem .6rem; background:#fff; }
.features label small { margin-left:auto; color:var(--muted); font-size:.7rem; font-weight:800; }
pre { white-space:pre-wrap; word-break:break-word; }
.toast { position:fixed; right:1rem; bottom:1rem; z-index:20; opacity:0; transform:translateY(8px); transition:.2s ease; background:#052e2b; color:#d1fae5; padding:.8rem 1rem; border-radius:14px; box-shadow:0 16px 40px rgba(15,23,42,.2); font-weight:900; }
.toast.show { opacity:1; transform:translateY(0); }
code { background:#f1f5f9; border:1px solid #e2e8f0; border-radius:8px; padding:.18rem .35rem; }
@media (max-width: 960px) { .detail-grid { grid-template-columns:1fr; } .toolbar.right { justify-content:stretch; } .toolbar.right .btn { width:100%; } }

/* v1_05 client activation flow */
.code-grid { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:1rem; }
.sim-result { margin-top:1rem; border:1px dashed #99f6e4; border-radius:16px; padding:1rem; background:#f8fffd; }
.sim-result pre { max-height:420px; overflow:auto; }
.kv code { font-size:.82rem; }
@media (max-width: 960px) { .code-grid { grid-template-columns:1fr; } }

/* v1_07 API tester and hardening */
.api-tester textarea { min-height: 150px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.badge.info { background:#e0f2fe; color:#0369a1; }
.badge.success { background:#dcfce7; color:#047857; }
.badge.warning { background:#fef3c7; color:#92400e; }
.badge.danger { background:#fee2e2; color:#b91c1c; }
#testerPayloadPreview, #testerCurlPreview, #apiTesterResult pre { max-height: 420px; overflow:auto; }

.hint {
  color:#64748b;
  font-size:.76rem;
  font-weight:600;
}
#invoiceClient {
  cursor:pointer;
  position:relative;
  z-index:2;
  appearance:auto;
}

.inline-form { display:inline-flex; gap:.35rem; align-items:center; flex-wrap:wrap; margin:0; }
.invoice-actions { display:flex; gap:.35rem; align-items:center; flex-wrap:wrap; }
.invoice-print { background:#fff; color:#0f172a; border:1px solid var(--border); border-radius:18px; padding:2rem; box-shadow:var(--shadow); max-width:980px; margin:0 auto; }
.invoice-head { display:flex; justify-content:space-between; gap:1rem; border-bottom:2px solid #e5e7eb; padding-bottom:1rem; margin-bottom:1.4rem; }
.invoice-head h1 { font-size:2.2rem; letter-spacing:.08em; margin:.2rem 0; }
.invoice-no { display:grid; gap:.35rem; text-align:right; min-width:220px; }
.invoice-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem; margin:1rem 0 1.5rem; }
.print-table { width:100%; border-collapse:collapse; margin:1rem 0; }
.print-table th, .print-table td { border:1px solid #e5e7eb; padding:.75rem; text-align:left; }
.print-table th { background:#f8fafc; }
.print-table tfoot td { background:#f8fafc; font-size:1.05rem; }
.right { text-align:right !important; }
.invoice-notes { margin-top:1.3rem; padding:1rem; background:#f8fafc; border-radius:14px; }
.invoice-sign { display:grid; grid-template-columns:1fr 1fr; gap:2rem; margin-top:2rem; text-align:center; }
@media print {
  body { background:#fff; }
  .sidebar, .topbar, .no-print, #toast { display:none !important; }
  .app-shell { display:block; }
  .main { padding:0; }
  .invoice-print { border:0; box-shadow:none; border-radius:0; max-width:none; padding:0; }
}

/* v1_11 monitoring */
.badge.online { background:#dcfce7; color:#047857; }
.badge.inactive { background:#fee2e2; color:#b91c1c; }
.badge.unknown { background:#f1f5f9; color:#475569; }
.danger-text { color:#b91c1c; font-weight:900; display:block; margin-top:.35rem; }
#monitoringTable td small { display:block; color:var(--muted); margin-top:.25rem; }

/* v1_13 maintenance */
.action-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.action-grid form { border:1px solid #e2f5f1; border-radius:18px; padding:1rem; background:#fff; box-shadow:0 10px 24px rgba(15,23,42,.04); }
.action-grid h3 { margin:.1rem 0 .35rem; }
.action-grid p { color:var(--muted); min-height:3.2rem; }
.stats.compact { grid-template-columns:repeat(5,minmax(0,1fr)); }
@media (max-width: 960px) { .action-grid, .stats.compact { grid-template-columns:1fr; } }
