:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1a2332;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #0f4c81;
  --primary-2: #1666ad;
  --accent: #c9a227;
  --success: #0d7a4f;
  --danger: #b42318;
  --warn: #b54708;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(15, 30, 60, .08);
  --font: "Sarabun", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: linear-gradient(180deg, #eef3f9 0%, var(--bg) 240px);
  color: var(--ink);
  min-height: 100vh;
}
body.nav-lock { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* —— Top navigation (responsive) —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(90deg, #0b3a63 0%, #145a96 60%, #0f5f8a 100%);
  color: #fff;
  box-shadow: 0 4px 18px rgba(8, 30, 55, .22);
}
.topbar a { color: #fff; text-decoration: none; }
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  min-height: 64px;
  padding: .55rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.brand { min-width: 0; flex: 1; }
.brand-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  text-decoration: none !important;
}
/* brand-mark (logo) ปิดใช้ — แสดงเฉพาะชื่อสาขา */
.brand-mark { display: none !important; }
.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-name {
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(52vw, 320px);
}
.brand-tag {
  font-size: .72rem;
  opacity: .82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: transform .2s, opacity .2s;
}
.topbar.is-nav-open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topbar.is-nav-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.topbar.is-nav-open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.userbox {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-shrink: 0;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  flex-shrink: 0;
}
.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.user-name {
  font-size: .9rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-id {
  font-size: .72rem;
  opacity: .8;
}

/* Desktop nav under brand row for large screens sits inline via absolute panel override */
.site-nav {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem .55rem;
}
.site-nav-panel { display: block; }
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  align-items: center;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: .5rem .75rem;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
}
.nav-link:hover,
.nav-link.is-active,
.nav-group.is-active > .nav-group-btn {
  background: rgba(255,255,255,.14);
}
.nav-ico { font-size: .95rem; line-height: 1; }
.nav-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255,255,255,.85);
  margin-left: .15rem;
  transition: transform .15s;
}
.nav-group.is-open > .nav-group-btn .nav-caret { transform: rotate(180deg); }

.nav-group { position: relative; }
.nav-sub {
  list-style: none;
  margin: 0;
  padding: .4rem;
  min-width: 230px;
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(10, 30, 60, .18);
  border: 1px solid #e6ebf2;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  display: none;
  z-index: 80;
}
.nav-group.is-open > .nav-sub { display: block; }
.nav-sub a {
  display: block;
  color: var(--ink);
  padding: .6rem .75rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none !important;
}
.nav-sub a:hover { background: #eef5fb; color: var(--primary); }

.nav-backdrop { display: none; }
.nav-mobile-actions { display: none; }
.userbox-mobile { display: none; }

/* Mobile / tablet drawer */
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .userbox-desktop .user-meta { display: none; }
  .userbox-desktop .btn,
  .userbox-desktop .btn-logout { display: none; }

  .site-nav {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(86vw, 340px);
    max-width: 100%;
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100dvh;
    background: transparent;
    transform: translateX(105%);
    transition: transform .22s ease;
    z-index: 120;
    pointer-events: none;
  }
  .topbar.is-nav-open .site-nav {
    transform: translateX(0);
    pointer-events: auto;
  }
  .site-nav-panel {
    height: 100%;
    background: linear-gradient(180deg, #0b3a63, #0f4c81 40%, #123d66);
    padding: 1rem .85rem 1.25rem;
    overflow-y: auto;
    box-shadow: -12px 0 40px rgba(0,0,0,.28);
  }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: .3rem;
  }
  .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: .8rem .85rem;
    border-radius: 12px;
    white-space: normal;
  }
  .nav-group-btn { width: 100%; }
  .nav-caret { margin-left: auto; }
  .nav-sub {
    position: static;
    display: none;
    min-width: 0;
    margin: .15rem 0 .35rem .45rem;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: none;
  }
  .nav-group.is-open > .nav-sub { display: block; }
  .nav-sub a {
    color: #fff;
    font-weight: 600;
  }
  .nav-sub a:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 18, 32, .45);
    z-index: 110;
    border: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  .topbar.is-nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .topbar.is-nav-open .nav-backdrop[hidden] {
    display: block;
  }

  .userbox-mobile {
    display: flex;
    gap: .7rem;
    padding: .75rem .85rem 1rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
  }
  .userbox-mobile .user-name { max-width: none; font-size: 1rem; }
  .nav-mobile-actions {
    display: block;
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(255,255,255,.12);
  }
  .nav-mobile-actions .btn-outline {
    border-color: rgba(255,255,255,.4);
    color: #fff;
    width: 100%;
  }
  .nav-mobile-actions .btn-logout {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .brand-tag { display: none; }
  .brand-name { max-width: 46vw; font-size: .95rem; }
  .topbar-inner { min-height: 58px; padding: .45rem .75rem; }
}

.container { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  padding: 1.5rem;
}

h1, h2, h3 { margin: 0 0 .75rem; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.25rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}

.grid { display: grid; gap: 1rem; }
.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)); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.stat {
  background: linear-gradient(145deg, #fff, #f7fafc);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat .label { color: var(--muted); font-size: .9rem; }
.stat .value { font-size: 1.45rem; font-weight: 700; margin-top: .25rem; }
.stat.buy .value { color: var(--success); }
.stat.sale .value { color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border: 0;
  border-radius: 9px;
  padding: .55rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}
.btn:hover { background: var(--primary-2); text-decoration: none; }
.btn-sm { padding: .35rem .7rem; font-size: .9rem; }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,.55); color: #fff; }
.btn-outline-dark { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-accent { background: var(--accent); color: #1a1500; }
/* Logout — soft red pill, black text, door icon */
.btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  height: 34px;
  padding: 0 .85rem 0 .65rem;
  border-radius: 999px;
  border: 1px solid #f0c2c0;
  background: linear-gradient(180deg, #fff5f5 0%, #fde8e8 100%);
  color: #111;
  font: inherit;
  font-size: .86rem;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1;
  text-decoration: none !important;
  cursor: pointer;
  box-shadow:
    0 1px 2px rgba(180, 35, 24, .1),
    inset 0 1px 0 rgba(255, 255, 255, .85);
  transition: background .15s ease, box-shadow .15s ease, transform .1s ease, border-color .15s ease;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-logout-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f8d4d2;
  color: #111;
  flex-shrink: 0;
}
.btn-logout-ico svg {
  display: block;
}
.btn-logout-text {
  color: #111;
}
.btn-logout:hover {
  background: linear-gradient(180deg, #ffeaea 0%, #f9d4d2 100%);
  border-color: #e8a8a4;
  color: #000;
  box-shadow:
    0 2px 8px rgba(180, 35, 24, .16),
    inset 0 1px 0 rgba(255, 255, 255, .9);
  transform: translateY(-1px);
}
.btn-logout:hover .btn-logout-ico {
  background: #f0c2c0;
  color: #000;
}
.btn-logout:active {
  transform: translateY(0);
  background: #f5d0ce;
  box-shadow: inset 0 1px 2px rgba(180, 35, 24, .12);
}
.btn-logout-block {
  width: 100%;
  height: 44px;
  padding: 0 1rem;
  font-size: .95rem;
  gap: .55rem;
  box-sizing: border-box;
}
.btn-logout-block .btn-logout-ico {
  width: 26px;
  height: 26px;
}
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.form-row { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: .9rem; }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .9rem; color: var(--muted); font-weight: 600; }
.form-group input, .form-group select, .form-group textarea {
  border: 1px solid #cfd6e0;
  border-radius: 8px;
  padding: .55rem .7rem;
  font: inherit;
  background: #fff;
}
.form-group input:focus, .form-group select:focus {
  outline: 2px solid #9ec5e8;
  border-color: var(--primary);
}
.form-group input[readonly] { background: #f3f5f8; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--line);
  padding: .55rem .5rem;
  text-align: left;
  vertical-align: middle;
}
table.data th { background: #f0f4f8; font-weight: 700; white-space: nowrap; }
table.data tr:hover td { background: #f8fbff; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .actions { white-space: nowrap; }

.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a, .tabs button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: .45rem .9rem;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  text-decoration: none;
}
.tabs a.active, .tabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.currency-card {
  display: flex;
  gap: .75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem;
  background: #fff;
}
.currency-card img {
  width: 52px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line);
}
.currency-card .meta { flex: 1; }
.currency-card .code { font-weight: 700; }
.currency-card .rates { display: flex; gap: 1rem; font-size: .92rem; }
.currency-card .buy { color: var(--success); }
.currency-card .sale { color: var(--primary); }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at top right, rgba(20,90,150,.18), transparent 40%),
    radial-gradient(circle at bottom left, rgba(201,162,39,.15), transparent 35%),
    var(--bg);
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  border: 1px solid var(--line);
}
.login-card h1 { text-align: center; margin-bottom: .25rem; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 1.25rem; }

.alert {
  padding: .75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-success { background: #e8f7ef; border-color: #b7e4c7; color: #0d5c3a; }
.alert-error, .alert-danger { background: #fdecec; border-color: #f5c2c0; color: #8a1f16; }
.alert-info { background: #eaf3fb; border-color: #bfd8f0; color: #0f3e66; }

.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-bottom: 1rem; }
.toolbar .form-group { min-width: 140px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.total-box {
  background: #0f4c81;
  color: #fff;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.total-box .amount { font-size: 1.6rem; font-weight: 700; }

.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
}
.badge-b { background: #dff5ea; color: #0d5c3a; }
.badge-s { background: #e3eef9; color: #0f3e66; }

.slip {
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  border: 1px dashed #999;
  padding: 1rem 1.25rem;
  font-family: "Courier New", monospace;
}
.slip h2 { text-align: center; font-size: 1.1rem; }
.slip .line { display: flex; justify-content: space-between; margin: .2rem 0; }
.slip hr { border: 0; border-top: 1px dashed #999; margin: .6rem 0; }

/* —— Buy page (UI ใหม่) —— */
.buy-page { margin-bottom: 1rem; }
.buy-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: stretch;
  padding: 1.15rem 1.25rem;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,.18), transparent 40%),
    linear-gradient(120deg, #0b3a63 0%, #145a96 55%, #0f766e 100%);
  color: #fff;
  box-shadow: 0 12px 30px rgba(11, 58, 99, .22);
  margin-bottom: 1rem;
}
.buy-kicker {
  margin: 0 0 .25rem;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .8;
  font-weight: 700;
}
.buy-hero h1 { margin: 0 0 .35rem; font-size: 1.55rem; }
.buy-sub { margin: 0; opacity: .9; }
.buy-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-content: center;
}
.buy-chip {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  padding: .55rem .75rem;
  min-width: 120px;
}
.buy-chip .chip-label,
.chip-label {
  display: block;
  font-size: .75rem;
  opacity: .8;
  margin-bottom: .15rem;
}
.buy-chip strong { font-size: 1rem; }

.buy-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.buy-tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .65rem .95rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 2px 8px rgba(15,30,60,.04);
  transition: .15s ease;
}
.buy-tab:hover { border-color: #9ec5e8; transform: translateY(-1px); }
.buy-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15,76,129,.25);
}
.buy-tab-alt { background: #f8fafc; }
.buy-tab-icon { font-size: 1.05rem; }

.theme-jpy .buy-tab.active { background: #b42318; border-color: #b42318; }
.theme-usd .buy-tab.active { background: #0f4c81; border-color: #0f4c81; }
.theme-gbp .buy-tab.active { background: #5b21b6; border-color: #5b21b6; }
.theme-eur .buy-tab.active { background: #1d4ed8; border-color: #1d4ed8; }
.theme-oth .buy-tab.active { background: #0f766e; border-color: #0f766e; }

.buy-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 5.5rem;
}
.buy-panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--line);
}
.buy-panel-title {
  display: flex;
  gap: .85rem;
  align-items: center;
}
.buy-panel-title h2 {
  margin: 0 0 .2rem;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.buy-panel-title p { margin: 0; color: var(--muted); }
.badge-soft {
  display: inline-block;
  font-size: .72rem;
  font-weight: 800;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: #e8f7ef;
  color: #0d5c3a;
  letter-spacing: .02em;
}
.buy-flag {
  width: 72px;
  height: 50px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.buy-flag-placeholder {
  display: grid;
  place-items: center;
  background: #f0f7ff;
  font-size: 1.6rem;
}
.buy-banner {
  max-width: min(300px, 100%);
  max-height: 96px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fafafa;
  padding: 4px;
}

.buy-rate-strip,
.buy-other-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .85rem;
  margin-bottom: 1.1rem;
  padding: 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #f5f9ff, #fff8ee);
  border: 1px solid #e2ebf5;
}
.buy-field label {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: .35rem;
}
.buy-field.compact { margin-bottom: .55rem; }
.buy-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1.5px solid #c5cfdb;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.buy-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, .14);
}
.buy-input-wrap.is-readonly { background: #f3f6fa; }
.buy-input-wrap input,
.buy-input-wrap select {
  flex: 1;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
  padding: .7rem .85rem;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  min-width: 0;
  width: 100%;
  min-height: 48px;
}
.buy-input-wrap input { text-align: right; font-variant-numeric: tabular-nums; }
.buy-input-wrap select { text-align: left; font-weight: 700; font-size: 1rem; }
.buy-input-lg input { font-size: 1.35rem; min-height: 54px; }
/* Live baht total (other tab) — same feel as sticky ยอดบาท */
.buy-live-baht {
  min-height: 54px;
}
.buy-live-baht-value {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: .7rem .85rem;
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  color: var(--text, #1a2332);
  min-height: 54px;
}
.buy-live-baht-value.has-value {
  color: #0d7a4f;
}
.buy-affix {
  display: flex;
  align-items: center;
  padding: 0 .75rem;
  background: #eef3f8;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  border-left: 1px solid #e2e8f0;
  white-space: nowrap;
}

.buy-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.buy-note-grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
@media (max-width: 760px) {
  .buy-note-grid { grid-template-columns: 1fr; }
}
.buy-note {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 40, 80, .05);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.buy-note:focus-within,
.buy-note.has-qty {
  border-color: #86b7e0;
  box-shadow: 0 10px 24px rgba(15, 76, 129, .12);
}
.buy-note.has-qty { transform: translateY(-1px); }
.theme-jpy .buy-note.has-qty { border-color: #f0a8a2; box-shadow: 0 10px 24px rgba(180, 35, 24, .12); }

.buy-note-media {
  position: relative;
  height: 140px;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .4rem .5rem;
  overflow: hidden;
  background: linear-gradient(180deg, #f3f5f8, #e8edf3);
}
.theme-jpy .buy-note-media,
.theme-usd .buy-note-media,
.theme-gbp .buy-note-media,
.theme-eur .buy-note-media {
  height: 150px;
  min-height: 150px;
}
.buy-note-media img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 6px;
}
.buy-note-pill {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(11, 40, 70, .9);
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  padding: .35rem .75rem;
  border-radius: 999px;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.buy-note-fallback {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary);
}
.buy-note-body { padding: .95rem 1rem 1.05rem; }
.buy-note-title {
  font-size: 1.45rem;
  font-weight: 900;
  color: #0b3a63;
  margin-bottom: .7rem;
  line-height: 1.2;
}
.theme-jpy .buy-note-title { font-size: 1.6rem; }

/* Qty stepper (− / number / +) — soft light green capsule */
.buy-qty-row {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  gap: 0;
  align-items: stretch;
  margin: .15rem 0 .65rem;
  border: 2px solid #9fd4b5;
  border-radius: 999px;
  overflow: hidden;
  background: #eefaf3;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.buy-step {
  height: 52px;
  border: 0;
  border-radius: 0;
  background: #b8e4c9;
  font-size: 1.55rem;
  font-weight: 900;
  cursor: pointer;
  color: #1a5c38;
  line-height: 1;
  transition: background .12s, color .12s;
}
.buy-step:hover { background: #9fd4b5; color: #0f4a2c; }
.buy-step:active { background: #86c9a3; }
.buy-qty {
  border: 0 !important;
  border-left: 1px solid #c5e8d4 !important;
  border-right: 1px solid #c5e8d4 !important;
  border-radius: 0 !important;
  min-height: 52px;
  font: inherit;
  font-size: 1.65rem;
  font-weight: 900;
  text-align: center;
  width: 100%;
  font-variant-numeric: tabular-nums;
  background: #fff;
  color: #1a5c38;
  outline: none !important;
  box-shadow: none !important;
}
.buy-qty:focus {
  background: #f7fcf9;
  outline: none !important;
  border-color: transparent;
}
/* label hint above qty (optional spacing) */
.buy-note-body .buy-field.compact {
  margin-bottom: .45rem;
}
.buy-note-body .buy-qty-row::before {
  /* no pseudo content — visual only via border */
}
.buy-note-sum {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  font-size: 1rem;
  color: var(--muted);
}
.buy-note-sum strong {
  color: var(--ink);
  font-size: 1.1rem;
}

.buy-extra {
  margin-top: 1rem;
  max-width: 360px;
}
.buy-other-preview {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: .25rem 0 1rem;
  padding: .75rem 1rem;
  border-radius: 12px;
  background: #f5f9ff;
  border: 1px dashed #c5d8ef;
}
.buy-other-preview img {
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.buy-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center; /* ยอด + ปุ่ม อยู่กลางจอ บรรทัดเดียว */
  gap: .75rem 1.35rem;
  padding: .75rem 1.25rem;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 28px rgba(15, 30, 60, .1);
  text-align: center;
}
.buy-sticky-sums {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.75rem;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin: 0;
  min-width: 0;
  flex: 0 1 auto;
}
.buy-sticky-sums > div {
  min-width: 5.5rem;
  text-align: center;
}
.buy-sticky-sums .chip-label {
  opacity: 1;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  display: block;
  margin: 0 0 .1rem;
  font-size: .82rem;
}
.buy-sticky-sums strong {
  display: block;
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}
.buy-sticky-sums strong.em { color: var(--success); font-size: 1.5rem; }
.buy-sticky-sums small { font-size: .85rem; font-weight: 700; color: var(--muted); }
.buy-sticky-actions {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto;
  width: auto;
  margin: 0;
}
.btn-lg {
  padding: .75rem 1.25rem;
  font-size: 1.05rem;
}
body:has(.buy-sticky) .footer { padding-bottom: 5rem; }

/* —— Multi buy —— */
.multi-panel { padding-bottom: 6rem; }
.multi-lines-head {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 1fr 1fr 1fr 72px;
  gap: .65rem;
  padding: 0 .35rem .55rem;
  font-size: .82rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.multi-lines {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.multi-line {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 1fr 1fr 1fr 72px;
  gap: .65rem;
  align-items: center;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(15, 40, 80, .04);
  transition: border-color .15s, box-shadow .15s;
}
.multi-line.has-data {
  border-color: #86c5a8;
  box-shadow: 0 8px 20px rgba(13, 122, 79, .1);
}
.multi-cur {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
}
.multi-logo {
  width: 48px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f4f7fb;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.multi-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.multi-logo-fallback {
  font-size: .72rem;
  font-weight: 800;
  color: var(--primary);
}
.buy-select {
  width: 100%;
  min-width: 0;
  border: 1.5px solid #c5cfdb;
  border-radius: 12px;
  padding: .65rem .7rem;
  font: inherit;
  font-weight: 700;
  background: #fff;
  min-height: 48px;
}
.buy-select:focus {
  outline: 2px solid #9ec5e8;
  border-color: var(--primary);
}
.multi-field { min-width: 0; }
.multi-field .mobile-only { display: none; }
.multi-act {
  display: flex;
  justify-content: center;
}
.multi-hint {
  margin-top: 1rem;
  font-size: .92rem;
}
@media (max-width: 900px) {
  .multi-lines-head { display: none; }
  .multi-line {
    grid-template-columns: 1fr;
    gap: .7rem;
  }
  .multi-field .mobile-only {
    display: block;
    font-size: .85rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: .3rem;
  }
  .multi-act { justify-content: stretch; }
  .multi-act .btn { width: 100%; }
}

/* —— Currencies page —— */
.cur-page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.cur-page-head h1 { margin-bottom: .2rem; }
.cur-page-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
}
.cur-search {
  min-width: min(280px, 100%);
  border: 1px solid #cfd6e0;
  border-radius: 10px;
  padding: .65rem .85rem;
  font: inherit;
  background: #fff;
}
.cur-search:focus {
  outline: 2px solid #9ec5e8;
  border-color: var(--primary);
}

.cur-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 5.5rem;
}
.cur-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  transition: border-color .15s, box-shadow .15s;
}
.cur-card:focus-within {
  border-color: #9ec5e8;
  box-shadow: 0 10px 28px rgba(15, 76, 129, .12);
}
.cur-card.is-hidden {
  opacity: .72;
  background: #fafbfc;
}
.cur-card-top {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
}
.cur-id {
  display: flex;
  gap: .75rem;
  align-items: center;
  min-width: 0;
}
.cur-logo {
  width: 56px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f4f7fb;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.cur-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cur-logo-fallback {
  font-weight: 800;
  font-size: .85rem;
  color: var(--primary);
}
.cur-code {
  font-weight: 800;
  font-size: 1.05rem;
  color: #0b3a63;
}
.cur-name { font-weight: 700; }
.cur-country { font-size: .88rem; }

/* toggle show */
.cur-switch {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.cur-switch input { position: absolute; opacity: 0; pointer-events: none; }
.cur-switch-ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #c9d2de;
  position: relative;
  transition: background .15s;
  flex-shrink: 0;
}
.cur-switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .15s;
}
.cur-switch input:checked + .cur-switch-ui {
  background: var(--success);
}
.cur-switch input:checked + .cur-switch-ui::after {
  transform: translateX(18px);
}
.cur-switch-text {
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
}

.cur-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
}
@media (max-width: 420px) {
  .cur-fields { grid-template-columns: 1fr; }
}
.cur-field label {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  font-size: .9rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: .35rem;
}
.cur-field-tag {
  display: inline-block;
  width: fit-content;
  font-size: .68rem;
  letter-spacing: .04em;
  padding: .12rem .4rem;
  border-radius: 999px;
  font-weight: 800;
}
.cur-field.buy .cur-field-tag {
  background: #dff5ea;
  color: #0d5c3a;
}
.cur-field.sale .cur-field-tag {
  background: #e3eef9;
  color: #0f3e66;
}
.cur-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1.5px solid #c5cfdb;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.cur-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, .14);
}
.cur-field.buy .cur-input-wrap:focus-within {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(13, 122, 79, .14);
}
.cur-input {
  flex: 1;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
  padding: .75rem .85rem;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  text-align: right;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  font-variant-numeric: tabular-nums;
}
.cur-input.is-dirty {
  background: #fffbeb;
}
.cur-unit {
  display: flex;
  align-items: center;
  padding: 0 .75rem;
  background: #f3f6fa;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 700;
  border-left: 1px solid #e2e8f0;
  white-space: nowrap;
}
.cur-card-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: .15rem;
  border-top: 1px dashed var(--line);
}

/* ปุ่มบันทึกอัตราทั้งหมด — ตรึงล่างสุดของจอตลอด */
.cur-sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0;
  padding: .85rem 1.25rem calc(.85rem + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 28px rgba(15, 30, 60, .12);
}
.cur-sticky-bar .muted {
  font-weight: 600;
}
.cur-sticky-bar .btn {
  min-width: 12rem;
  font-weight: 800;
}
/* กันเนื้อหาถูกบังด้วยแถบปุ่มด้านล่าง */
body:has(.cur-sticky-bar) .container {
  padding-bottom: 5.5rem;
}
body:has(.cur-sticky-bar) .footer {
  padding-bottom: 5.5rem;
}
/* —— Add currency panel (clean layout) —— */
.cur-add-panel {
  margin: 1.25rem 0 2rem;
  padding: 1.25rem 1.35rem 1.35rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}
.cur-add-title-row {
  margin-bottom: 1rem;
}
.cur-add-title-row h2 {
  margin: 0 0 .25rem;
  font-size: 1.3rem;
}
.cur-add-title-row .muted {
  margin: 0;
}

/* preview strip */
.cur-add-preview {
  display: flex;
  align-items: center;
  gap: .9rem;
  flex-wrap: wrap;
  padding: .85rem 1rem;
  margin-bottom: 1.15rem;
  border-radius: 12px;
  border: 1px solid #dce8f4;
  background: linear-gradient(90deg, #f4f9ff, #f7fbf8);
}
.cur-add-preview-logo {
  width: 56px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.cur-add-preview-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cur-add-preview-logo span {
  font-weight: 800;
  font-size: .85rem;
  color: var(--primary);
}
.cur-add-preview-body {
  flex: 1 1 160px;
  min-width: 0;
}
.cur-add-preview-line1 {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  flex-wrap: wrap;
  font-size: 1rem;
}
.cur-add-preview-line1 strong {
  color: #0b3a63;
  font-size: 1.05rem;
}
.cur-add-preview-sep { color: #9aa8b8; }
.cur-add-preview-line2 {
  font-size: .88rem;
  margin-top: .15rem;
}
.cur-add-preview-rates {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-left: auto;
}
.cur-add-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  font-size: .88rem;
  border: 1px solid transparent;
}
.cur-add-pill span {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .04em;
}
.cur-add-pill strong {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.cur-add-pill.buy {
  background: #e8f8f0;
  border-color: #c6ecd8;
  color: #0d5c3a;
}
.cur-add-pill.sale {
  background: #eaf2fb;
  border-color: #c9dcf0;
  color: #0f3e66;
}

/* form blocks */
.cur-add-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.cur-add-block {
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid #e8eef5;
  background: #fbfcfe;
}
.cur-add-block-head {
  font-weight: 800;
  font-size: .95rem;
  color: #17324d;
  margin-bottom: .85rem;
  padding-bottom: .55rem;
  border-bottom: 1px dashed #dce4ee;
}
.cur-add-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem 1rem;
}
.cur-add-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
}
.cur-add-field label {
  display: block;
  font-size: .88rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0;
  line-height: 1.3;
}
.cur-add-field label .req,
.req {
  color: #c0392b;
  font-style: normal;
  font-weight: 800;
}
.cur-add-field > input {
  width: 100%;
  min-height: 44px;
  border: 1.5px solid #c5cfdb;
  border-radius: 10px;
  padding: .65rem .8rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  background: #fff;
  color: #1a2332;
  box-sizing: border-box;
}
.cur-add-field > input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, .14);
}
.cur-add-money {
  display: flex;
  align-items: stretch;
  border: 1.5px solid #c5cfdb;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  min-height: 44px;
}
.cur-add-money:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, .14);
}
.cur-add-money input {
  flex: 1;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
  padding: .65rem .8rem;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  min-width: 0;
  width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cur-add-money span {
  display: flex;
  align-items: center;
  padding: 0 .75rem;
  background: #eef3f8;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
  border-left: 1px solid #e2e8f0;
}

/* logo file upload */
.cur-add-upload {
  position: relative;
  border: 1.5px dashed #b7c6d8;
  border-radius: 12px;
  background: #f8fafc;
  padding: .9rem 1rem;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.cur-add-upload:hover,
.cur-add-upload.is-drag {
  border-color: var(--primary);
  background: #f0f7fc;
  box-shadow: 0 0 0 3px rgba(15, 76, 129, .1);
}
.cur-add-upload.has-file {
  border-style: solid;
  border-color: #9ec5e8;
  background: #fff;
}
.cur-add-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 1;
}
.cur-add-upload-ui {
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-wrap: wrap;
  pointer-events: none;
}
.cur-add-upload-ui .btn {
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
.cur-add-upload-thumb {
  width: 64px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}
.cur-add-upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cur-add-upload-text {
  flex: 1 1 180px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.cur-add-upload-text strong {
  font-size: .95rem;
  color: #17324d;
}
.cur-add-upload-text .muted {
  font-size: .82rem;
  line-height: 1.35;
}

.cur-add-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  padding-top: .35rem;
}
.cur-add-actions .btn {
  min-width: 8.5rem;
}

@media (max-width: 640px) {
  .cur-add-panel { padding: 1rem; }
  .cur-add-grid-2 { grid-template-columns: 1fr; }
  .cur-add-preview-rates { margin-left: 0; width: 100%; }
  .cur-add-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .cur-add-actions .btn { width: 100%; min-width: 0; }
}

.hidden-form { display: none; }

/* —— Help / User manual —— */
.help-page { margin-bottom: 2rem; }
.help-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}
.help-kicker {
  margin: 0 0 .2rem;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary);
}
.help-hero h1 {
  margin: 0 0 .3rem;
  font-size: clamp(1.3rem, 3.5vw, 1.7rem);
}
.help-toc h2 { margin-top: 0; }
.help-toc-list {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.85;
}
.help-toc-list a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.help-toc-list a:hover { text-decoration: underline; }
.help-sec {
  margin-bottom: 1rem;
  scroll-margin-top: 5rem;
}
.help-sec h2 {
  margin-top: 0;
  padding-bottom: .45rem;
  border-bottom: 2px solid #e6eef6;
  color: #0b3a63;
}
.help-sec h3 {
  margin: 1.1rem 0 .5rem;
  color: #17324d;
  font-size: 1.05rem;
}
.help-sec ul, .help-sec ol {
  line-height: 1.7;
  padding-left: 1.25rem;
}
.help-shot {
  margin: .9rem 0 1.1rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #f3f6fa;
  box-shadow: var(--shadow);
}
.help-shot img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  object-position: top center;
  background: #eef2f6;
}
.help-shot figcaption {
  padding: .55rem .85rem;
  font-size: .88rem;
  color: var(--muted);
  font-weight: 600;
  border-top: 1px solid var(--line);
  background: #fff;
}
.help-note {
  margin: .75rem 0;
  padding: .75rem .9rem;
  border-radius: 10px;
  background: #fff8e8;
  border: 1px solid #f0e0b0;
  line-height: 1.55;
}
.help-table { margin: .75rem 0 1rem; }
.help-table .em-green { color: #0d7a4f; font-weight: 800; }
.help-foot {
  text-align: center;
  margin: 1.5rem 0 .5rem;
  font-size: .88rem;
}
@media print {
  .help-toc { break-after: page; }
  .help-sec { break-inside: avoid; }
  .help-shot img { max-height: none; }
}
@media (max-width: 720px) {
  .help-shot img { max-height: 360px; }
}

/* —— SuperRich rates menu (เขียว · แยกเมนูหลัก) —— */
.topbar a.nav-link.nav-link-sr {
  color: #0d7a4f !important;
  font-weight: 800 !important;
  background: linear-gradient(180deg, #eefaf3, #e2f5ea) !important;
  border: 1px solid #b7e4c9;
  border-radius: 10px;
  padding-left: .7rem;
  padding-right: .7rem;
}
.topbar a.nav-link.nav-link-sr:hover,
.topbar a.nav-link.nav-link-sr.is-active {
  background: #d4f0e0 !important;
  color: #0a5c3a !important;
  border-color: #7dcf9f;
}
@media (max-width: 960px) {
  .topbar a.nav-link.nav-link-sr {
    background: rgba(46, 160, 100, .22) !important;
    border-color: rgba(160, 230, 190, .45);
    color: #b8f0d0 !important;
  }
  .topbar a.nav-link.nav-link-sr:hover,
  .topbar a.nav-link.nav-link-sr.is-active {
    background: rgba(46, 160, 100, .35) !important;
    color: #e8fff2 !important;
  }
}
.btn-sr {
  background: #1a9b5c;
  border-color: #1a9b5c;
  color: #fff !important;
  font-weight: 800;
}
.btn-sr:hover {
  background: #14824c;
  border-color: #14824c;
  color: #fff !important;
}

/* SuperRich rates page */
.sr-rates-page {
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.sr-rates-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}
.sr-rates-kicker {
  margin: 0 0 .2rem;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #1a9b5c;
}
.sr-rates-head h1 {
  margin: 0 0 .25rem;
  color: #0d5c3a;
  font-size: clamp(1.25rem, 4vw, 1.55rem);
  line-height: 1.25;
  word-break: break-word;
}
.sr-rates-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.sr-rates-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1rem;
  align-items: center;
  margin-bottom: .85rem;
}
.sr-badge {
  display: inline-block;
  font-size: .78rem;
  font-weight: 800;
  padding: .28rem .65rem;
  border-radius: 999px;
  background: #e5f7ed;
  color: #0d7a4f;
  border: 1px solid #b7e4c9;
}
.sr-desktop-only { display: block; }
.sr-mobile-only { display: none; }

.sr-rates-table-wrap {
  background: #fff;
  border: 1px solid #c8e8d5;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(13, 122, 79, .08);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.sr-rates-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.sr-rates-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #14824c, #1a9b5c);
  color: #fff;
  font-size: .92rem;
  font-weight: 800;
  text-align: left;
  padding: .85rem 1rem;
  white-space: nowrap;
}
.sr-rates-table thead th.num { text-align: right; }
.sr-rates-table tbody td {
  padding: .72rem 1rem;
  border-bottom: 1px solid #e6f4ec;
  vertical-align: middle;
}
.sr-rates-table tbody tr:nth-child(even) { background: #f5fbf7; }
.sr-rates-table tbody tr:hover { background: #eaf8f0; }
.sr-rates-table .col-flag { width: 64px; }
.sr-flag {
  width: 48px;
  height: 34px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #d5e8dc;
  display: block;
  background: #fff;
  flex-shrink: 0;
}
.sr-flag-fallback {
  display: grid;
  place-items: center;
  width: 48px;
  height: 34px;
  border-radius: 6px;
  background: #e8f6ee;
  border: 1px solid #c8e8d5;
  font-weight: 800;
  font-size: .75rem;
  color: #0d7a4f;
  flex-shrink: 0;
}
.sr-code { display: block; color: #0d5c3a; font-size: 1.02rem; }
.sr-denom { display: block; font-size: .8rem; margin-top: .1rem; }
.sr-country { color: #3d5a4a; font-weight: 600; font-size: .92rem; }
.sr-rates-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-val {
  display: inline-block;
  min-width: 5.2rem;
  font-size: 1.15rem;
  font-weight: 800;
  padding: .22rem .5rem;
  border-radius: 8px;
}
.sr-val.buy { color: #0d5c3a; background: #e0f5e9; }
.sr-val.sell { color: #14532d; background: #f0fdf4; border: 1px solid #bbf7d0; }
.sr-foot { margin-top: .85rem; font-size: .88rem; }
.sr-foot a { color: #0d7a4f; font-weight: 700; }

/* Mobile cards */
.sr-rates-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}
.sr-rate-card {
  background: #fff;
  border: 1px solid #c8e8d5;
  border-radius: 14px;
  padding: .85rem .9rem;
  box-shadow: 0 6px 18px rgba(13, 122, 79, .07);
}
.sr-rate-card-top {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .75rem;
}
.sr-rate-card-title { min-width: 0; flex: 1; }
.sr-rate-card-title .sr-code {
  font-size: 1.08rem;
  line-height: 1.25;
}
.sr-rate-card-rates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
}
.sr-rate-pill {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .55rem .65rem;
  border-radius: 10px;
  min-width: 0;
}
.sr-rate-pill .lbl {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .03em;
  opacity: .85;
}
.sr-rate-pill strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  word-break: break-all;
}
.sr-rate-pill.buy {
  background: #e0f5e9;
  color: #0d5c3a;
  border: 1px solid #b7e4c9;
}
.sr-rate-pill.sell {
  background: #f0fdf4;
  color: #14532d;
  border: 1px solid #bbf7d0;
}

@media (max-width: 720px) {
  .sr-desktop-only { display: none !important; }
  .sr-mobile-only { display: grid !important; }
  .sr-rates-head {
    flex-direction: column;
    align-items: stretch;
  }
  .sr-rates-actions {
    width: 100%;
  }
  .sr-rates-actions .btn {
    flex: 1 1 calc(50% - .5rem);
    min-width: 0;
    text-align: center;
    justify-content: center;
  }
  .sr-rates-actions .btn:first-child {
    flex: 1 1 100%;
  }
}
@media (max-width: 420px) {
  .sr-rate-card-rates { grid-template-columns: 1fr; }
  .sr-rates-actions .btn {
    flex: 1 1 100%;
  }
}

/* —— Rates board (แสดงอัตราแลกเปลี่ยน) —— */
.rates-board-page {
  margin-bottom: 1.5rem;
}
.rates-board-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}
.rates-board-kicker {
  margin: 0 0 .2rem;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
}
.rates-board-head h1 {
  margin: 0 0 .25rem;
}
.rates-board-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.rates-board-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  align-items: center;
  margin-bottom: .85rem;
  font-size: .92rem;
}
.rates-board-clock {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #0b3a63;
}
.rates-board-table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: auto;
}
.rates-board-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.rates-board-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #0f4c81, #1769a8);
  color: #fff;
  font-size: .92rem;
  font-weight: 800;
  text-align: left;
  padding: .85rem 1rem;
  white-space: nowrap;
}
.rates-board-table thead th.num { text-align: right; }
.rates-board-table tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #e8eef5;
  vertical-align: middle;
}
.rates-board-table tbody tr:nth-child(even) {
  background: #f7fafc;
}
.rates-board-table tbody tr:hover {
  background: #eef6ff;
}
.rates-board-table .col-flag {
  width: 64px;
  padding-right: .35rem;
}
.rates-flag {
  width: 52px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #d5dee8;
  display: block;
  background: #fff;
}
.rates-flag-fallback {
  display: grid;
  place-items: center;
  width: 52px;
  height: 36px;
  border-radius: 6px;
  background: #eef3f8;
  border: 1px solid #d5dee8;
  font-weight: 800;
  font-size: .78rem;
  color: var(--primary);
}
.rates-board-table .col-code strong {
  display: block;
  font-size: 1.05rem;
  color: #0b3a63;
}
.rates-cur-code {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: .1rem;
}
.rates-board-table .col-name {
  color: #3d4f63;
  font-weight: 600;
}
.rates-board-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rates-val {
  display: inline-block;
  min-width: 5.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  padding: .25rem .55rem;
  border-radius: 8px;
}
.rates-val.buy {
  color: #0d5c3a;
  background: #e8f8f0;
}
.rates-val.sell {
  color: #0f3e66;
  background: #eaf2fb;
}
.rates-board-foot {
  margin: .85rem 0 0;
  font-size: .88rem;
}
@media print {
  .rates-board-table-wrap {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  .rates-board-table thead th {
    background: #eee !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .rates-val {
    background: transparent !important;
    color: #000 !important;
  }
}
@media (max-width: 640px) {
  .rates-val { font-size: 1.05rem; min-width: 4.5rem; }
}

/* —— Sell multi lines —— */
.sell-add-row {
  display: flex;
  justify-content: flex-start;
  margin: .35rem 0 .85rem;
}
.sell-add-row .btn,
#add-row.btn,
#other-add-row.btn {
  min-width: 10rem;
  font-weight: 700;
  /* เขียวอ่อนจนเกือบขาว */
  color: #1a6b45;
  background: #f3faf6;
  border: 1.5px solid #cfe8d9;
  box-shadow: none;
}
.sell-add-row .btn:hover,
#add-row.btn:hover,
#other-add-row.btn:hover {
  color: #0d5c3a;
  background: #eaf6ef;
  border-color: #b7dcc6;
}
.sell-add-row .btn:active,
#add-row.btn:active,
#other-add-row.btn:active {
  background: #e2f2e8;
  border-color: #9fceb2;
}
.sell-pay-box {
  margin: 1rem 0 5.5rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid #e2ebf5;
  background: linear-gradient(135deg, #f7fbff, #fffaf3);
}
.sell-pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem 1rem;
  max-width: 720px;
}
@media (max-width: 640px) {
  .sell-pay-grid { grid-template-columns: 1fr; }
}

/* Print / Save as PDF — hide chrome & minimize browser header/footer */
@page {
  size: auto;
  margin: 12mm;
}
@media print {
  .topbar, .footer, .no-print, .nav-backdrop, .buy-sticky, .cur-sticky-bar {
    display: none !important;
  }
  html, body {
    background: #fff !important;
    color: #000 !important;
  }
  body {
    margin: 0 !important;
    padding: 0 !important;
  }
  .container {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .card {
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 0 8px !important;
  }
  .cur-grid { margin-bottom: 0; }
  a { color: #000 !important; text-decoration: none !important; }
  table.data th, table.data td {
    border-color: #ccc !important;
  }
}

.buy-qty-label {
  font-size: .88rem;
  font-weight: 800;
  color: #3d8f62;
  margin: .15rem 0 .35rem;
  letter-spacing: .02em;
}
.num-comma-input {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

/* —— Thai date picker (Flatpickr) —— */
.thai-date-input,
input.form-control.thai-date-input,
.flatpickr-input,
.flatpickr-alt-input {
  min-width: 11rem;
}
.flatpickr-calendar.flatpickr-th {
  font-family: inherit;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 40, 70, .18);
  border: 1px solid #d9e2ec;
}
.flatpickr-calendar.flatpickr-th .flatpickr-months .flatpickr-month {
  height: 44px;
}
.flatpickr-calendar.flatpickr-th .flatpickr-current-month {
  font-size: 1.05rem;
  font-weight: 800;
  padding-top: .35rem;
}
.flatpickr-calendar.flatpickr-th .flatpickr-current-month .cur-month {
  font-weight: 800;
  color: #0f4c81;
}
.flatpickr-calendar.flatpickr-th span.flatpickr-weekday {
  font-weight: 700;
  color: #5b6b7c;
}
.flatpickr-calendar.flatpickr-th .flatpickr-day.selected,
.flatpickr-calendar.flatpickr-th .flatpickr-day.startRange,
.flatpickr-calendar.flatpickr-th .flatpickr-day.endRange {
  background: #0f4c81;
  border-color: #0f4c81;
}
.flatpickr-calendar.flatpickr-th .flatpickr-day.today {
  border-color: #0d7a4f;
}
.flatpickr-calendar.flatpickr-th .flatpickr-day:hover {
  background: #e8f1fa;
  border-color: #e8f1fa;
}
