/* Cloud SMS - sign-in pages and customer panel (loaded after site.css) */

/* Auth pages */
body.auth { background: var(--paper); min-height: 100vh; display: flex; flex-direction: column; }
.auth-top { padding: 20px 24px; }
.auth-top-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.auth-switch { font-weight: 500; font-size: 0.9rem; color: var(--ink); text-decoration: none; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 14px; }
.auth-switch:hover { border-color: var(--ink-2); color: var(--ink); }
.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 24px 20px 48px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; }
.auth-card-wide { max-width: 600px; }
.auth-card h1 { font-size: 1.6rem; letter-spacing: -0.02em; }
.auth-sub { margin: 8px 0 24px; font-size: 0.95rem; }
.auth-alt { margin-top: 20px; font-size: 0.92rem; }
.auth-note { margin-top: 18px; font-size: 0.85rem; color: var(--muted); }
.auth-foot { display: flex; justify-content: center; gap: 20px; padding: 20px; font-size: 0.85rem; }
.auth-foot a { color: var(--muted); text-decoration: none; }
.auth-foot a:hover { color: var(--ink); }

.btn-block { width: 100%; margin-top: 6px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 7px; }
.field .label-row label { margin: 0; }
.label-row a { font-size: 0.85rem; font-weight: 500; text-decoration: none; }
.label-row a:hover { text-decoration: underline; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 72px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; border-radius: 6px; padding: 6px 10px; font: 500 0.82rem var(--font); color: var(--blue); cursor: pointer; }
.pw-toggle:hover { background: var(--blue-50); }
.input-prefix { display: flex; }
.input-prefix span { display: flex; align-items: center; padding: 0 12px; background: var(--paper); border: 1px solid var(--line-2); border-right: 0; border-radius: 10px 0 0 10px; color: var(--muted); font-size: 0.95rem; }
.input-prefix .input { border-radius: 0 10px 10px 0; }
.input-code { font-size: 1.4rem; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.input-upper { text-transform: uppercase; }
.field-hint { font-size: 0.83rem; color: var(--muted); margin-top: 6px; }
.check-field { margin-top: 4px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; cursor: pointer; }
.field .check { font-weight: 400; color: var(--ink-2); margin: 0; }
.check input { margin-top: 4px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--blue); }
.resend-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; font-size: 0.9rem; color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; font: 500 0.9rem var(--font); color: var(--blue); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: var(--muted); cursor: default; text-decoration: none; }

/* Panel shell */
body.app { background: var(--paper); }
.app-shell { display: flex; min-height: 100vh; }
.app-side {
  width: 248px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid var(--line);
  padding: 18px 14px;
}
.app-side-brand { padding: 4px 8px 22px; }
.app-nav { display: flex; flex-direction: column; gap: 2px; }
.app-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-size: 0.93rem; font-weight: 500; }
.app-nav a:hover { background: var(--paper); color: var(--ink); }
.app-nav a[aria-current="page"] { background: var(--blue-50); color: var(--blue); }
.app-nav svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-side-user { margin-top: auto; padding: 16px 8px 4px; border-top: 1px solid var(--line); }
.app-user-name { font-weight: 600; font-size: 0.92rem; color: var(--ink); overflow-wrap: anywhere; }
.app-user-meta { font-size: 0.82rem; color: var(--muted); }
.app-logout { width: 100%; margin-top: 12px; background: #fff; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 12px; font: 500 0.85rem var(--font); color: var(--ink); cursor: pointer; }
.app-logout:hover { border-color: var(--ink-2); }
.app-main-wrap { flex: 1; min-width: 0; }
.app-topbar { display: none; }
.app-main { max-width: 1080px; padding: 40px 40px 64px; }
.app-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(15, 30, 54, 0.35); }

/* Panel content */
.page-title { margin-bottom: 28px; }
.page-title h1 { font-size: 1.7rem; letter-spacing: -0.02em; }
.page-title p { margin-top: 8px; max-width: 62ch; }
.page-title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.panel h2 { font-size: 1.08rem; margin-bottom: 14px; }
.panel > p { font-size: 0.93rem; margin-bottom: 16px; }
.stat-grid + .panel, .alert + .panel { margin-top: 20px; }
.next-steps { margin: 0; padding-left: 1.2em; display: grid; gap: 12px; font-size: 0.93rem; }
.next-steps strong { color: var(--ink); font-weight: 500; }
.kv { margin: 0 0 16px; }
.kv div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.kv-tight { margin-bottom: 4px; }
.tag { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 500; vertical-align: 1px; }
.tag-ok { background: var(--green-50); color: #0B7A55; }
.help-line { margin-top: 24px; font-size: 0.92rem; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; }
.stat-label { font-size: 0.85rem; color: var(--muted); }
.stat-value { margin-top: 6px; font-size: 1.65rem; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat-foot { margin-top: 2px; font-size: 0.8rem; color: var(--muted); }

/* Shared tables and chips (also used by the admin panel) */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-weight: 500; font-size: 0.8rem; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); background: #FAFCFE; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table a { font-weight: 500; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table-compact td { padding: 8px 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sub { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.sub-inline { font-size: 0.82rem; color: var(--muted); font-weight: 400; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 500; white-space: nowrap; vertical-align: 2px; }
.chip-ok { background: var(--green-50); color: #0B7A55; }
.chip-warn { background: #FFF4E0; color: #8A5208; }
.chip-bad { background: var(--red-50); color: #9B2C22; }
.chip-mute { background: #EEF2F7; color: var(--muted); }
h1 .chip { font-size: 0.8rem; margin-left: 6px; vertical-align: 6px; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line-2); border-radius: 12px; }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.input-sm { width: auto; max-width: 220px; padding: 7px 10px; font-size: 0.9rem; }
select.input { padding-right: 10px; }
.unit { font-size: 0.85rem; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.88rem; }
.text-bad { color: var(--red); }
.section-gap { margin-top: 32px; }
.section-gap h2 { font-size: 1.25rem; }
.section-gap + .table-wrap { margin-top: 14px; }

/* Add balance */
.topup-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 20px; align-items: start; }
.calc-mini { margin: 4px 0 20px; padding: 4px 16px; background: var(--paper); border-radius: 10px; }
.calc-mini div:last-child { border-bottom: 0; }
.input-file { padding: 9px 12px; font-size: 0.9rem; }
.pay-to h2 { font-size: 1.08rem; margin-bottom: 14px; }
.pay-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.pay-card + .pay-card { margin-top: 14px; }
.pay-card-head { font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.pay-qr { display: block; width: 200px; height: 200px; margin: 12px auto 4px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; object-fit: contain; }
.pay-dyn { text-align: center; }
.pay-dyn .pay-qr svg { display: block; width: 100%; height: 100%; }
.pay-cap { margin-top: 6px; font-size: 0.85rem; color: var(--muted); }
.pay-app { margin-top: 10px; }
@media (hover: hover) and (pointer: fine) { .pay-app { display: none; } }
[data-copy] { cursor: copy; }
[data-copy].is-copied::after { content: " Copied"; color: var(--green); font-family: var(--font); font-size: 0.78rem; font-weight: 500; }


/* DLT, send, reports */
.stat-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-grid + .panel, .panel + .panel { margin-top: 20px; }
.panel-grid > .panel { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.crumb { margin-bottom: 6px; font-size: 0.88rem; }
.crumb a { text-decoration: none; }
.crumb a::before { content: "\2039\00a0"; }
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--ink-2); text-decoration: none; font-size: 0.9rem; font-weight: 500; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--blue); border-bottom-color: var(--blue); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.toolbar .input { flex: 1; max-width: 440px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 16px; font-size: 0.88rem; color: var(--muted); }
.pager span { margin-right: auto; }
.h-sub { font-size: 0.98rem; margin-bottom: 14px; }
.stack .field { margin-bottom: 16px; }
.sep { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.link-danger { color: var(--red); }
.plain-list { list-style: none; margin: 14px 0 0; padding: 0; }
.plain-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list .inline-form { margin-left: auto; }
.tpl-text { max-width: 46ch; color: var(--ink); white-space: normal; overflow-wrap: anywhere; font-size: 0.9rem; }
.dlt-steps { display: flex; gap: 8px; list-style: none; margin: 0 0 20px; padding: 0; counter-reset: dstep; flex-wrap: wrap; }
.dlt-steps li { counter-increment: dstep; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 0.88rem; color: var(--muted); }
.dlt-steps li::before { content: counter(dstep); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); font-weight: 600; font-size: 0.78rem; }
.dlt-steps li.now { color: var(--ink); border-color: var(--blue); }
.dlt-steps li.now::before { background: var(--blue); color: #fff; }
.dlt-steps li.done::before { content: "\2713"; background: var(--green-50); color: var(--green); }
.send-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr); gap: 20px; align-items: start; }
.send-main .panel + .panel { margin-top: 20px; }
.send-side .sticky { position: sticky; top: 24px; }
.vars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.seg { display: inline-flex; margin-bottom: 16px; padding: 3px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 7px 14px; border-radius: 8px; font-size: 0.88rem; font-weight: 500; color: var(--ink-2); }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 30, 54, 0.12); }
.seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 1px; }
.var-src { margin: 4px 0 0; padding: 0; border: 0; display: grid; gap: 10px; }
.var-src legend { margin-bottom: 8px; font-weight: 500; font-size: 0.92rem; color: var(--ink); }
.input-dt { max-width: 280px; }
.phone-msg { padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.phone-text { margin-top: 6px; font-size: 0.92rem; line-height: 1.55; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.btn-block + .field-hint { margin-top: 10px; }
.kv-inline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
.kv-inline.kv-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kv-inline div { flex-direction: column; gap: 4px; border: 0; padding: 0; }
.kv-inline dd { text-align: left; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.key-reveal { margin: 4px 0 16px; padding: 14px 16px; background: var(--green-50); border: 1px solid #BFE6D5; border-radius: 10px; }
.key-reveal p { margin: 0 0 10px; color: #0B6B4B; }
.key-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.key-box code { flex: 1; min-width: 0; padding: 9px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; user-select: all; }
.raw summary { cursor: pointer; font-weight: 500; color: var(--ink); }
.raw-pre { margin: 8px 0 0; padding: 12px 14px; background: var(--code-bg); color: var(--code-ink); border-radius: 10px; font: 400 0.8rem/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }

@media (max-width: 900px) {
  .app-side { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform 0.2s ease; }
  .app-side.is-open { transform: none; }
  .app-topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40; height: 60px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); }
  .app-menu { display: inline-flex; background: none; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px; color: var(--ink); cursor: pointer; }
  .app-main { padding: 24px 18px 48px; }
  .panel-grid, .stat-grid, .topup-grid, .send-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vars { grid-template-columns: minmax(0, 1fr); }
  .kv-inline, .kv-inline.kv-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
}
@media (max-width: 600px) {
  .auth-card { padding: 24px 20px; }
  .auth-card .form-row { grid-template-columns: minmax(0, 1fr); }
}
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: 0.85rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.panel-verify { margin-bottom: 20px; border-color: #BBD0F7; background: #F7FAFF; }
.input-code-sm { width: 180px; font-size: 1.15rem; letter-spacing: 0.3em; padding: 9px 12px; }
