/* FluxChat: compact, orange, Infobip-inspired */
:root {
  --bg: #f5f5f7; --card: #fff; --ink: #161b26; --text: #3a4252; --muted: #6b7385; --faint: #9aa1b0;
  --line: #ebedf1; --line-strong: #d9dde4;
  --brand: #f25c19; --brand-hover: #d9480a; --brand-2: #ff8a3d; --brand-soft: #fff1e8; --brand-ring: rgba(242, 92, 25, .16);
  --navy: #1f2a44; --ok: #16a34a; --ok-soft: #eaf8ef; --warn: #b45309; --warn-soft: #fff6e5; --bad: #dc2626; --bad-soft: #fdeded; --info: #2563eb; --info-soft: #eaf1ff;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(22, 27, 38, .04), 0 2px 10px rgba(22, 27, 38, .035);
  --side-w: 232px; --font: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #d9cfc8 transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 13.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; letter-spacing: -.01em; font-weight: 600; }
.ic { flex-shrink: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }
::selection { background: #ffd9c4; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ddd3cc; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-2); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- shell ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px; z-index: 40; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 14px; color: var(--ink); font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
.brand b { color: var(--brand); font-weight: 700; }
.brand small { font-size: 10.5px; font-weight: 600; color: #fff; background: var(--navy); border-radius: 6px; padding: 1px 6px; letter-spacing: .04em; margin-left: 2px; }
.brand:hover { text-decoration: none; }
.nav-group { font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin: 14px 10px 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--text); font-weight: 500; font-size: 13px; position: relative; }
.nav-link .ic { width: 17px; height: 17px; }
.nav-link:hover { background: var(--bg); text-decoration: none; color: var(--ink); }
.nav-link.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-link.on::before { content: ''; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.plan-card { background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 10px 11px; margin: 2px 0 8px; font-size: 12px; line-height: 1.45; }
.plan-card b { display: block; color: var(--ink); font-size: 12.5px; margin-bottom: 1px; }
.plan-card span { color: var(--muted); }
.plan-card.trial { border-color: #ffd5bd; background: var(--brand-soft); }
.plan-card.expired { border-color: #f6c4c4; background: var(--bad-soft); }
.main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; height: 58px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 24px; }
.top h1 { font-size: 15.5px; font-weight: 600; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-hover); display: grid; place-items: center; font-weight: 700; font-size: 12px; overflow: hidden; border: 1px solid #ffd9c4; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--text); cursor: pointer; }
.menu { display: none; }
.content { padding: 22px 24px 40px; width: 100%; max-width: 1200px; }
.scrim { display: none; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid #eceef2; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid, .section-title + .grid { margin-top: 14px; }
.card h2 { font-size: 18px; font-weight: 600; }
.card h3 { font-size: 14px; font-weight: 600; }
.card .sub { color: var(--muted); margin: 3px 0 0; font-size: 12.5px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-title { font-size: 14.5px; font-weight: 600; color: var(--ink); margin: 22px 0 10px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 14px 16px; }
.stat small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.stat strong { display: block; font-size: 21px; font-weight: 600; color: var(--ink); margin-top: 2px; letter-spacing: -.02em; }
.stat .hint { font-size: 11.5px; color: var(--faint); }
.stat.hot { background: linear-gradient(135deg, #ff8a3d, #e8470b); border: 0; color: #fff; }
.stat.hot small, .stat.hot .hint, .stat.hot strong { color: #fff; }
.pill-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 14px; }
.pill-tab { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: #fff; color: var(--ink); font-weight: 600; font-size: 13px; }
.pill-tab.on { border-color: var(--brand); }
.wa-dot { width: 19px; height: 19px; border-radius: 50%; background: #25d366; display: grid; place-items: center; color: #fff; }
.progress { height: 7px; background: #f0e9e4; border-radius: 99px; overflow: hidden; margin: 8px 0 2px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #ff8a3d, #f25c19); border-radius: 99px; }
.big-num { font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.shortcut { display: flex; gap: 12px; padding: 16px; }
.tile { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.tile.pink { background: #fde7f3; color: #be185d; } .tile.green { background: #dcfce7; color: #15803d; } .tile.orange { background: #ffedd5; color: #c2410c; } .tile.teal { background: var(--brand-soft); color: var(--brand); } .tile.blue { background: #e0ecff; color: #1d4ed8; } .tile.violet { background: #ede9fe; color: #6d28d9; } .tile.navy { background: #e8ebf3; color: var(--navy); }
.shortcut h3 { font-size: 13.5px; margin-bottom: 2px; }
.shortcut p { margin: 0 0 6px; color: var(--muted); font-size: 12.5px; }
.shortcut a.go { font-weight: 600; font-size: 12.5px; }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 120px; padding-top: 8px; }
.bars div { flex: 1; background: linear-gradient(180deg, #ff9a57, #f25c19); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; }
.bars div:hover::after { content: attr(data-v); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -4px); background: var(--ink); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 5px; white-space: nowrap; }
.bars-x { display: flex; gap: 5px; font-size: 10.5px; color: var(--faint); margin-top: 4px; }
.bars-x span { flex: 1; text-align: center; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1.5px solid transparent; border-radius: 9px; padding: 8px 15px; font: 600 13px var(--font); cursor: pointer; background: var(--brand); color: #fff; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--brand-hover); text-decoration: none; color: #fff; box-shadow: 0 4px 14px -4px rgba(242, 92, 25, .55); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-outline { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); box-shadow: none; }
.btn-dark { background: var(--navy); } .btn-dark:hover { background: #111a30; box-shadow: none; }
.btn-danger { background: #fff; color: var(--bad); border-color: #f2c2c2; }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-caps { text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink); }
.field .help { font-size: 11.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel], select, textarea {
  width: 100%; border: 1.5px solid var(--line-strong); border-radius: 9px; padding: 8px 11px; font: 13.5px var(--font); color: var(--ink); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
textarea { min-height: 100px; resize: vertical; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; font-size: 13px; }
.switch input[type=checkbox] { width: 36px; height: 20px; appearance: none; background: var(--line-strong); border-radius: 99px; position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.switch input[type=checkbox]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input[type=checkbox]:checked { background: var(--brand); }
.switch input[type=checkbox]:checked::after { transform: translateX(16px); }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { position: relative; border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 12.5px; min-width: 96px; }
.choice label b { display: block; color: var(--ink); font-size: 13.5px; }
.choice input { position: absolute; opacity: 0; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-ring); }

/* ---------- tables, badges, flash ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px -18px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 9px 20px; border-bottom: 1px solid var(--line); background: #fafafb; white-space: nowrap; }
.tbl td { padding: 9px 20px; border-bottom: 1px solid #f1f2f5; vertical-align: middle; }
.tbl tbody tr:hover td { background: #fffaf6; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.wrap { max-width: 340px; white-space: normal; word-break: break-word; }
.nowrap, .tbl .mono { white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.muted { background: #f1f2f5; color: var(--muted); } .badge.info { background: var(--info-soft); color: var(--info); } .badge.hot { background: var(--brand-soft); color: var(--brand-hover); }
.flash { display: flex; align-items: center; gap: 9px; padding: 10px 13px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; font-size: 13px; }
.flash.ok { background: var(--ok-soft); color: #166534; border: 1px solid #c6f0d4; }
.flash.bad { background: var(--bad-soft); color: #991b1b; border: 1px solid #f6caca; }
.flash.warn { background: var(--warn-soft); color: #92400e; border: 1px solid #fbe3a8; }
.empty { text-align: center; padding: 24px 14px; color: var(--muted); font-size: 13px; }
.empty .tile { margin: 0 auto 10px; width: 44px; height: 44px; border-radius: 13px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.keybox { display: flex; align-items: center; gap: 8px; background: #1b2130; color: #e2e8f0; border-radius: 10px; padding: 9px 11px; }
.keybox code { flex: 1; word-break: break-all; color: #ffc9a8; font-size: 12.5px; }
pre.code { background: #1b2130; color: #e2e8f0; border-radius: 11px; padding: 14px 16px; overflow-x: auto; font-size: 12px; line-height: 1.6; margin: 8px 0 0; }
pre.code .k { color: #7dd3fc; } pre.code .s { color: #fdba74; } pre.code .c { color: #6b7385; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(22, 27, 38, .5); display: none; align-items: center; justify-content: center; padding: 14px; z-index: 100; backdrop-filter: blur(2px); }
.modal.open { display: flex; }
.modal-card { background: #fff; border-radius: 18px; width: 100%; max-width: 460px; padding: 22px; box-shadow: 0 30px 80px -20px rgba(22, 27, 38, .45); position: relative; max-height: 92vh; overflow-y: auto; }
.modal-card h3 { font-size: 16px; margin-bottom: 4px; padding-right: 30px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.qr-box { display: grid; place-items: center; background: #fbfaf9; border: 1px dashed var(--line-strong); border-radius: 14px; min-height: 270px; margin: 14px 0; padding: 10px; }
.qr-box img { width: 250px; height: 250px; image-rendering: pixelated; }
.steps { margin: 0; padding-left: 18px; color: var(--text); font-size: 13px; }
.steps li { margin-bottom: 4px; }
.pair-code { font: 700 26px ui-monospace, Menlo, monospace; letter-spacing: .16em; color: var(--ink); }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #f2e7e1; border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: radial-gradient(700px 420px at 15% 0%, rgba(255, 138, 61, .55), transparent 60%), radial-gradient(600px 400px at 100% 100%, rgba(242, 92, 25, .35), transparent 60%), linear-gradient(160deg, #1b1210, #3a1608); color: #ffe9dc; padding: 44px; display: flex; flex-direction: column; }
.auth-art .brand { color: #fff; padding: 0; font-size: 20px; }
.auth-art .brand b { color: #ff9a57; }
.auth-art h2 { color: #fff; font-size: 30px; line-height: 1.18; margin-top: auto; font-weight: 700; letter-spacing: -.02em; }
.auth-art p { color: #ffd8c2; font-size: 14.5px; max-width: 420px; }
.auth-art ul { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; font-size: 13.5px; }
.auth-art li { display: flex; gap: 9px; align-items: center; color: #fff1e8; }
.auth-art li .ic { color: #ff9a57; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: #fff; }
.auth-box { width: 100%; max-width: 360px; }
.auth-box h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-box .sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.btn-google { width: 100%; background: #fff; color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn-google:hover { background: #fbfaf9; color: var(--ink); box-shadow: none; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.admin-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(800px 500px at 50% -10%, rgba(242, 92, 25, .18), transparent 60%), var(--bg); }
.admin-login .card { width: 100%; max-width: 380px; padding: 26px; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(22, 27, 38, .35); z-index: 35; }
  .main { margin-left: 0; }
  .menu { display: grid; }
  .top { padding: 0 14px; height: 54px; }
  .content { padding: 14px 12px 34px; }
  .card { padding: 15px; border-radius: 13px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none !important; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
/* Tables become stacked rows: "Label  full value" */
@media (max-width: 760px) {
  .table-wrap { margin: 0; overflow: visible; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr { display: block; width: 100%; }
  .tbl tr { border: 1px solid var(--line); border-radius: 11px; margin-bottom: 9px; padding: 4px 0; background: #fff; }
  .tbl tbody tr:hover td { background: none; }
  .tbl td { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 6px 12px; border: 0; text-align: right; max-width: none !important; }
  .tbl td::before { content: attr(data-label); font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); text-align: left; flex-shrink: 0; padding-top: 2px; }
  .tbl td[data-label=""]::before, .tbl td:not([data-label])::before { content: none; }
  .tbl td[data-label=""], .tbl td:not([data-label]) { justify-content: flex-end; }
  .tbl td > .tdv { min-width: 0; overflow-wrap: anywhere; }
  .tbl td .mono, .tbl td .nowrap { white-space: nowrap; }
}
@media (max-width: 560px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat strong { font-size: 18px; } }
