:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #20242e;
  --border: #2a2f3a;
  --text: #e7e9ee;
  --muted: #9aa3b2;
  --accent: #ff6a00;      /* TrueMoney-ish orange */
  --accent-2: #ff8a3d;
  --green: #2fbf71;
  --red: #e5484d;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Sarabun", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand a { color: var(--text); font-weight: 700; font-size: 18px; }
.topbar nav { display: flex; gap: 18px; }
.topbar nav a { color: var(--muted); font-weight: 500; }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); }

.container { max-width: 960px; margin: 0 auto; padding: 28px 24px 64px; }

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 28px 0 12px; }
.subtitle { color: var(--muted); margin: 0 0 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

/* Buttons */
.btn, .btn-sm {
  display: inline-block; cursor: pointer;
  background: var(--accent); color: #fff; border: none;
  padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  transition: background .15s;
}
.btn:hover, .btn-sm:hover { background: var(--accent-2); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #ff5c60; }
.btn-block { display: block; width: 100%; text-align: center; }

/* Forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.form-row { display: flex; gap: 16px; }
.form-row > div { flex: 1; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash-info { background: #1d2a3a; color: #9cc3ff; }
.flash-success { background: #11291d; color: #74e0a3; }
.flash-error { background: #2a1416; color: #ffa7a9; }

/* Account grid */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.acct-card { position: relative; }
.acct-card .label { font-size: 16px; font-weight: 700; }
.acct-card .msisdn { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.acct-card .balance { font-size: 28px; font-weight: 800; color: var(--accent-2); }
.acct-card .synced { font-size: 12px; color: var(--muted); margin-top: 4px; }
.acct-card .actions { display: flex; gap: 8px; margin-top: 16px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; }
.badge-on { background: #11291d; color: var(--green); }
.badge-off { background: #2a1416; color: var(--red); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }

.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* Auth screen */
.auth-wrap { max-width: 380px; margin: 8vh auto; }
.auth-wrap .card { padding: 28px; }
.auth-logo { text-align: center; font-size: 40px; margin-bottom: 8px; }

pre.raw { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; overflow: auto; font-size: 12px; color: var(--muted); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.row-actions { display: flex; gap: 8px; }

/* Function grid (account detail) */
.fn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.fn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.fn-wide { grid-column: 1 / -1; }
.fn-name {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-2);
}
.fn-desc { font-size: 12px; color: var(--muted); margin: 2px 0 6px; min-height: 2em; }
.fn label { margin-top: 8px; }
.fn .btn { margin-top: 12px; align-self: flex-start; }
.btn-warn { background: #d98300; }
.btn-warn:hover { background: #e59500; }

/* Sarabun weight tuning */
h1, h2, .brand a, .btn, .acct-card .balance { font-weight: 700; }
.acct-card .balance, .balance { font-weight: 800; }
