/* SMS Panel — clean responsive admin theme.
   Brand colors come from --brand-primary / --brand-accent (white-label). */
:root {
  --brand-primary: #1a56db;
  --brand-accent: #0e9f6e;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #6b768d;
  --border: #e3e8f0;
  --danger: #d64545;
  --warn: #c07f1a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex-shrink: 0; background: #101828; color: #dbe2f0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 12px 20px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 20px; margin: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.content { padding: 20px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.brand-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; }
.brand-logo-lg { width: 56px; height: 56px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; }
.brand-text span { font-size: 12px; color: var(--muted); }
.sidebar .brand-text span { color: #8b96b0; }
.brand-center { justify-content: center; padding: 0 0 14px; }

/* ---------- nav ---------- */
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; flex: 1; overflow-y: auto; }
.nav a {
  color: #c4cde0; padding: 10px 12px; border-radius: 8px;
  display: flex; align-items: center; gap: 10px; font-size: 14px;
}
.nav a i { font-style: normal; width: 20px; text-align: center; }
.nav a:hover { background: #1c2942; text-decoration: none; color: #fff; }
.nav a.active { background: var(--brand-primary); color: #fff; }
.side-foot { padding: 14px; border-top: 1px solid #1e2a44; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-chip > div:last-child { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-chip strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip span { font-size: 12px; color: #8b96b0; text-transform: capitalize; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-accent); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.hamburger { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 18px; cursor: pointer; }

/* ---------- cards / stats ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 16px; }
.stat .num { font-size: 28px; font-weight: 800; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.stat .sub { font-size: 12px; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* ---------- forms / buttons ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input, select, textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-primary); outline-offset: -1px; border-color: var(--brand-primary); }
textarea { min-height: 110px; resize: vertical; }
.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: 10px 16px; border-radius: 8px; border: 1px solid transparent;
  background: #eef1f6; color: var(--text); text-align: center;
}
.btn:hover { filter: brightness(.96); text-decoration: none; }
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-accent { background: var(--brand-accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); }
.sidebar .btn-ghost { color: #c4cde0; border-color: #2a3a5c; width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.logout-form { margin: 0; }

/* ---------- badges / alerts ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; text-transform: capitalize;
}
.b-green { background: #def7ec; color: #03543f; }
.b-red { background: #fde8e8; color: #9b1c1c; }
.b-yellow { background: #fef3c7; color: #92400e; }
.b-blue { background: #e1effe; color: #1e429f; }
.b-gray { background: #eef1f6; color: #4b5563; }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.alert-error { background: #fde8e8; color: #9b1c1c; border: 1px solid #f5c2c2; }
.alert-ok { background: #def7ec; color: #03543f; border: 1px solid #b8e6cf; }
.alert-info { background: #e1effe; color: #1e429f; border: 1px solid #c3ddfd; }

.balance-pill { background: #eef1f6; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.tenant-pill { background: #e1effe; color: #1e429f; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(10, 15, 30, .5); z-index: 100;
  display: none; align-items: flex-start; justify-content: center; padding: 40px 16px;
}
.modal-back.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); padding: 22px; width: 100%; max-width: 520px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 14px; }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #101828; color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); max-width: 340px; }
.toast.ok { background: #046c4e; }
.toast.err { background: #9b1c1c; }

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent)); }
.login-card { background: #fff; border-radius: 16px; padding: 32px; width: 100%; max-width: 400px; box-shadow: 0 16px 50px rgba(0,0,0,.25); }

/* ---------- misc ---------- */
.char-count { font-size: 12px; color: var(--muted); text-align: right; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 8px 16px; cursor: pointer; font: inherit; font-size: 14px; }
.tabs button.active { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 90; transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: none; }
  .hamburger { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .kv { grid-template-columns: 1fr; }
}
