/* ============================================================================
   UAuth Design System — Atomic CSS (Light SaaS theme, indigo accent)
   TOKENS → ATOMS → MOLECULES → ORGANISMS → LAYOUTS
   ============================================================================ */

/* ============================ TOKENS ============================ */
:root {
  /* brand — indigo / violet */
  --brand: #6366f1;
  --brand-600: #5457e6;
  --brand-2: #8b5cf6;
  --brand-grad: linear-gradient(135deg, #6366f1, #8b5cf6);
  --brand-soft: #eef0ff;     /* active nav / hover bg */
  --brand-tint: #f5f4ff;

  /* surfaces */
  --app-bg: #fafafc;
  --surface: #ffffff;
  --surface-2: #f3f4f6;      /* inputs / search / segmented */
  --text: #1f2330;
  --text-2: #3b4252;
  --muted: #7a828f;
  --border: #ecedf1;
  --border-2: #e3e5ea;

  /* status */
  --ok: #15a34a;      --ok-bg: #e9f9ef;
  --danger: #e11d48;  --danger-bg: #fff0f3;
  --warn: #d97706;    --warn-bg: #fff5e6;

  /* type */
  --font: "IBM Plex Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-brand: "IBM Plex Sans Thai", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 19px; --fs-2xl: 24px;

  /* uniform control height (ปุ่ม/input/select เท่ากันหมด) */
  --control-h: 40px;

  /* spacing / radius / shadow */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-full: 999px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 4px 16px rgba(16,24,40,.08);
  --shadow-lg: 0 24px 48px rgba(16,24,40,.16);
  --t: .15s ease;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); background: var(--app-bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-size: var(--fs-md); font-weight: 400; line-height: 1.55; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
  background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.muted { color: var(--muted); }

/* ============================ ATOMS ============================ */

/* button — สูงเท่ากับ input/select (--control-h) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--control-h); padding: 0 16px; border: 1px solid var(--border-2); border-radius: var(--r-md);
  background: var(--surface); color: var(--text-2);
  font-family: inherit; font-size: var(--fs-md); font-weight: 500; line-height: 1; cursor: pointer;
  text-decoration: none; transition: var(--t); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn--block { width: 100%; }
.btn--primary { background: var(--brand); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand-600); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn--danger:hover { background: #c01840; }
.btn--sm { height: 32px; padding: 0 11px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn .ico { font-size: var(--fs-lg); line-height: 1; }

/* badge / pill */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge--ok, .badge--active { background: var(--ok-bg); color: var(--ok); }
.badge--danger, .badge--banned { background: var(--danger-bg); color: var(--danger); }
.badge--warn, .badge--disabled { background: var(--warn-bg); color: var(--warn); }

/* input / select — สูงเท่ากับปุ่ม (--control-h) */
.input, .select {
  width: 100%; height: var(--control-h); background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-md); color: var(--text); padding: 0 12px; font-size: var(--fs-md); font-family: inherit;
  transition: var(--t);
}
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input::placeholder { color: #aab0ba; }
.label { display: block; margin: var(--sp-4) 0 var(--sp-1); font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.input-copy { display: flex; gap: 8px; align-items: center; }
.input-copy .input { flex: 1; }
.input-copy .btn { padding: 0 13px; flex-shrink: 0; }
.input-copy .btn svg { width: 18px; height: 18px; }
.input-copy .input[readonly] { background: var(--surface-2); color: var(--text-2); }
.scope-item { display: flex; gap: 11px; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 8px; cursor: pointer; align-items: center; }
.scope-item:hover { background: var(--surface-2); }
.scope-item input[type=checkbox] { flex-shrink: 0; transform: none; }
.scope-item .s-name { font-weight: 600; }
.scope-item .s-name code { background: none; padding: 0; }
.scope-item .s-desc { color: var(--muted); font-size: 13px; margin-top: 1px; }
.hint { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-1); }

/* alert */
.alert { padding: 11px 14px; border-radius: var(--r-md); font-size: var(--fs-md); }
.alert--error { background: var(--danger-bg); color: var(--danger); }
.alert--info { background: var(--brand-tint); color: var(--brand-600); }
.secret { background: #0b1220; color: #86efac; padding: 12px; border-radius: var(--r-md);
  font-family: ui-monospace, monospace; word-break: break-all; margin-top: var(--sp-2); font-size: var(--fs-sm); }

/* custom select (แทน native <select>) */
.cselect { position: relative; display: inline-block; }
.cselect__btn { height: var(--control-h); width: 100%; display: inline-flex; align-items: center; gap: 8px;
  justify-content: space-between; padding: 0 12px; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-md);
  color: var(--text); font-family: inherit; font-size: var(--fs-md); font-weight: 500; cursor: pointer; transition: var(--t); }
.cselect__btn:hover { background: var(--surface-2); }
.cselect.open .cselect__btn { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cselect__btn svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; transition: transform var(--t); }
.cselect.open .cselect__btn svg { transform: rotate(180deg); }
.cselect__menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.cselect__menu[hidden] { display: none; }
.cselect__opt { padding: 9px 11px; border-radius: var(--r-sm); font-size: var(--fs-md); cursor: pointer;
  display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.cselect__opt:hover { background: var(--surface-2); }
.cselect__opt.sel { background: var(--brand); color: #fff; }
.cselect__opt .check { width: 14px; height: 14px; flex-shrink: 0; opacity: 0; }
.cselect__opt.sel .check { opacity: 1; }

/* segmented control (None / In App / Email ...) */
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-md); padding: 3px; gap: 3px; }
.seg button { padding: 6px 14px; border: none; background: transparent; border-radius: var(--r-sm);
  font-family: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); cursor: pointer; transition: var(--t); }
.seg button:hover { color: var(--text-2); }
.seg button.on { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }

/* avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--fs-md); }

/* modal (confirm dialog) */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: uauth-fade .12s ease; }
.modal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 400px; padding: 26px; animation: uauth-pop .14s ease; }
.modal__title { font-weight: 700; font-size: var(--fs-lg); margin-bottom: 8px; }
.modal__body { font-size: var(--fs-md); color: var(--text-2); line-height: 1.55; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
@keyframes uauth-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes uauth-pop { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }

/* toast (แทน alert) */
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1f2330; color: #fff; padding: 12px 16px; border-radius: var(--r-md);
  font-size: var(--fs-sm); box-shadow: var(--shadow); max-width: 340px; animation: uauth-slide .16s ease; }
.toast--error { background: var(--danger); }
.toast--ok { background: var(--ok); }
@keyframes uauth-slide { from { opacity: 0; transform: translateX(24px) } to { opacity: 1; transform: none } }

/* icon button */
.iconbtn { width: 38px; height: 38px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }

/* ============================ MOLECULES ============================ */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: var(--sp-6); box-shadow: var(--shadow-sm); }
.card--danger { border-color: var(--danger); }
.card--danger .danger-title { color: var(--danger); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; }
.stat__n { font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
.stat__l { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-1); }

.page-head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.page-head h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.4px; }

.toolbar { display: flex; gap: var(--sp-3); margin-bottom: var(--sp-5); flex-wrap: wrap; align-items: center; }
.toolbar .input, .toolbar .select { width: auto; }

.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* setting row (รายการ + คำอธิบายซ้าย / control ขวา) */
.setting { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-5); align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: none; }
.setting__title { font-weight: 600; }
.setting__desc { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; max-width: 460px; }
.section-label { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin: var(--sp-6) 0 var(--sp-2); }

/* ============================ ORGANISMS ============================ */

/* auth card (login/consent/error) */
.auth-card { position: relative; margin: auto; width: 100%; max-width: 400px; background: var(--surface);
  border-radius: var(--r-xl); padding: 38px 32px; box-shadow: var(--shadow-lg); }
.auth-langtoggle { position: absolute; top: 16px; right: 16px; }
.auth-logo { display: block; width: 60px; height: 60px; object-fit: contain; margin: 0 auto 0; }
.auth-brand { text-align: center; font-family: var(--font-brand); font-size: var(--fs-2xl); font-weight: 700;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.auth-sub { text-align: center; color: var(--muted); margin: var(--sp-2) 0 var(--sp-6); }
.auth-foot { text-align: center; color: var(--muted); font-size: var(--fs-xs); margin-top: var(--sp-5); }
.providers { display: flex; flex-direction: column; gap: var(--sp-3); }
.provider { justify-content: center; gap: 10px; padding: 12px 16px; }

/* signed-in profile card (login page when already authenticated) */
.auth-profile { text-align: center; margin: var(--sp-2) 0 var(--sp-5); }
.avatar--xl { display: flex; width: 72px; height: 72px; margin: 0 auto var(--sp-3); font-size: var(--fs-2xl); }
img.avatar { object-fit: cover; }
.auth-profile__name { font-weight: 600; font-size: var(--fs-lg); }
.auth-profile__email { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; word-break: break-all; }
.provider__icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.provider__icon svg { width: 20px; height: 20px; display: block; }

.consent-lead { font-size: var(--fs-sm); color: var(--text-2); margin-top: var(--sp-5); }
.scopes { list-style: none; padding: 0; margin: var(--sp-2) 0 0; }
.scopes li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: var(--sp-2); }
.scopes .scope-check { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--ok); }
.scopes .s-name { font-weight: 600; }
.scopes .s-desc { color: var(--muted); font-size: var(--fs-sm); margin-top: 1px; }

/* consent — email usage / purpose note (shown when email scope requested) */
.consent-note { display: flex; gap: 9px; align-items: flex-start; margin-top: var(--sp-4);
  padding: 11px 13px; border-radius: var(--r-md); background: var(--brand-tint); color: var(--brand-600);
  font-size: var(--fs-sm); line-height: 1.5; }
.consent-note svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.consent-note strong { font-weight: 600; }

/* consent action row — Deny / Allow side by side, equal width */
.consent-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); }
.consent-actions .btn { flex: 1; }
.consent-as { margin-top: var(--sp-4); }
.consent-as strong { color: var(--text-2); }

/* sidebar (light) */
.sidebar { width: 248px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-1);
  height: 100vh; overflow-y: auto; }
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 16px; font-family: var(--font-brand); font-weight: 700; font-size: var(--fs-lg); }
.sidebar__brand span { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar__logo { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }
.sidebar__new { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: var(--sp-3);
  border: 1px solid var(--border-2); border-radius: var(--r-md); font-weight: 500; color: var(--text-2); }
.sidebar__new:hover { background: var(--surface-2); text-decoration: none; }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-md); line-height: 1.3;
  color: var(--text-2); font-weight: 500; font-size: var(--fs-md); }
.sidebar__nav a svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.sidebar__nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar__nav a.active { background: var(--brand-soft); color: var(--brand-600); }
.sidebar__nav a.active svg { color: var(--brand-600); }
.sidebar__foot { margin-top: auto; }

/* topbar */
.appbar { height: 64px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; justify-content: flex-start; position: sticky; top: 0; z-index: 20; }
.appbar__inner { display: flex; align-items: center; gap: var(--sp-4);
  width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--sp-8); }
.appbar__right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }
.appbar__email { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.usermenu__id { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; line-height: 1.15; }
.usermenu__role { padding: 1px 8px; font-size: 11px; }

/* user menu (avatar + email → dropdown) */
.usermenu { position: relative; display: flex; align-items: center; gap: 10px;
  padding: 5px 10px 5px 5px; border-radius: var(--r-full); cursor: pointer; transition: var(--t);
  border: 1px solid transparent; }
.usermenu:hover { background: var(--surface-2); }
.usermenu.open { background: var(--surface-2); border-color: var(--border); }
.usermenu .chev { width: 16px; height: 16px; color: var(--muted); transition: transform var(--t); }
.usermenu.open .chev { transform: rotate(180deg); }
.usermenu__menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 6px; z-index: 60; }
.usermenu__menu[hidden] { display: none; }
.usermenu__item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: var(--fs-md); font-weight: 500; }
.usermenu__item:hover { background: var(--surface-2); text-decoration: none; }
.usermenu__item.danger { color: var(--danger); }
.usermenu__item.danger:hover { background: var(--danger-bg); }

/* table */
.table { width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.table th, .table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: var(--fs-md); }
.table th { color: var(--muted); font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .4px; background: var(--surface); }
.table tbody tr:hover { background: var(--brand-tint); }
.table tr:last-child td { border-bottom: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-4); }

/* tabs */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-6); }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand-600); border-bottom-color: var(--brand); }

/* ============================ LAYOUTS ============================ */

/* centered (login/consent/error) */
/* margin:auto บน .auth-card จัดกึ่งกลางเมื่อมีที่ว่าง และเมื่อเนื้อหายาวเกินจอ
   จะ scroll ได้โดยพื้นม่วง (padding) ยังกรอบรอบการ์ดครบทุกด้าน ไม่โดนตัดหัว */
.layout-centered { min-height: 100vh; display: flex; padding: var(--sp-6); background: var(--brand-grad); }

/* admin shell: sidebar + (topbar + main) */
.layout-admin { display: flex; height: 100vh; overflow: hidden; }
.layout-admin .content { flex: 1; min-width: 0; height: 100vh; overflow-y: auto; }
.layout-admin .main { max-width: 1200px; margin: 0 auto; padding: var(--sp-8); }

/* dashboard charts */
.card__title { font-weight: 600; margin-bottom: 14px; }
.dash-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.dash-chart { padding: 18px 20px; }
.dash-chart--wide { grid-column: 1 / -1; }
.chartbox { position: relative; height: 240px; }
.chartbox--wide { height: 280px; }
@media (max-width: 760px) { .dash-charts { grid-template-columns: 1fr; } }

/* simple content page (privacy ฯลฯ) */
.page-doc { max-width: 720px; margin: 0 auto; padding: var(--sp-8) var(--sp-6) 80px; }
.page-doc h1 { font-family: var(--font-brand); font-size: var(--fs-2xl); margin: 0 0 var(--sp-2); }
.page-doc h2 { font-size: var(--fs-lg); margin: var(--sp-6) 0 var(--sp-2); }
.page-doc p, .page-doc li { color: var(--text-2); line-height: 1.75; }
.page-doc ul { padding-left: 20px; }

/* landing */
.layout-landing { position: relative; min-height: 100vh; background: var(--app-bg); }
.land-langtoggle { position: absolute; top: 18px; right: 18px; z-index: 5; }
.land-langtoggle.seg { background: rgba(255,255,255,.18); }
.land-langtoggle.seg button { color: #e9d5ff; }
.land-langtoggle.seg button.on { background: #fff; color: var(--brand-600); }

.land-hero { background: var(--brand-grad); color: #fff; text-align: center; padding: 88px 24px 76px; }
.land-logo { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 18px; padding: 9px; box-shadow: var(--shadow); }
.land-brand { font-family: var(--font-brand); font-size: 42px; font-weight: 700; margin: 16px 0 4px; }
.land-tagline { font-size: var(--fs-xl); font-weight: 500; margin: 0; opacity: .96; }
.land-lead { max-width: 620px; margin: 16px auto 30px; line-height: 1.65; opacity: .9; }
.land-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.land-cta .btn--primary { background: #fff; color: var(--brand-600); border-color: transparent; }
.land-cta .btn--primary:hover { background: #f0f0f5; }
.land-btn-ghost { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.35); }
.land-btn-ghost:hover { background: rgba(255,255,255,.26); color: #fff; }

.land-features { max-width: 1000px; margin: -42px auto 0; padding: 0 24px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.land-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 24px; box-shadow: var(--shadow); }
.land-card__icon { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-tint);
  color: var(--brand-600); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.land-card__icon svg { width: 22px; height: 22px; }
.land-card__title { font-weight: 600; font-size: var(--fs-lg); margin-bottom: 6px; }
.land-card__desc { color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }
.land-foot { text-align: center; color: var(--muted); font-size: var(--fs-xs); padding: 40px 16px 32px; }

/* providers strip */
.land-providers { max-width: 900px; margin: 56px auto 0; padding: 0 24px; text-align: center; }
.land-providers__title { color: var(--muted); font-size: var(--fs-sm); margin-bottom: 18px; }
.land-providers__row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.land-prov { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-full); box-shadow: var(--shadow-sm); }

/* generic landing section */
.land-section { max-width: 1000px; margin: 64px auto 0; padding: 0 24px; }
.land-h2 { font-family: var(--font-brand); font-size: var(--fs-2xl); font-weight: 700; text-align: center; margin: 0 0 var(--sp-6); }

/* how it works */
.land-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.land-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; }
.land-step__n { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 14px; }
.land-step__t { font-weight: 600; font-size: var(--fs-lg); margin-bottom: 6px; }
.land-step__d { color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }

/* quickstart */
.land-quickstart { display: grid; grid-template-columns: 1fr 1.1fr; gap: 36px; align-items: center; }
.land-quickstart .land-h2 { text-align: left; }
.land-quickstart__desc { color: var(--muted); line-height: 1.6; margin: 0 0 22px; }
.land-code { background: #0b1220; color: #e6edf3; border-radius: var(--r-lg); padding: 22px 24px; margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-sm); line-height: 1.7;
  overflow-x: auto; box-shadow: var(--shadow); }
.land-code .c-key { color: #7ee787; }
.land-code .c-str { color: #a5d6ff; }
.land-code .c-var { color: #ffa657; }

/* bottom CTA band */
.land-band { background: var(--brand-grad); color: #fff; text-align: center; margin-top: 72px; padding: 56px 24px; }
.land-band__title { font-family: var(--font-brand); font-size: var(--fs-2xl); font-weight: 700; margin: 0 0 8px; }
.land-band__desc { opacity: .92; margin: 0 0 24px; }
.land-band .land-cta { margin-top: 0; }

@media (max-width: 720px) {
  .land-hero { padding: 64px 20px 64px; }
  .land-brand { font-size: 34px; }
  .land-features { grid-template-columns: 1fr; margin-top: -28px; }
  .land-steps { grid-template-columns: 1fr; }
  .land-quickstart { grid-template-columns: 1fr; gap: 22px; }
  .land-quickstart .land-h2 { text-align: center; }
}

/* docs */
.layout-docs { background: var(--app-bg); min-height: 100vh; }
.docs-top { position: sticky; top: 0; z-index: 10; background: var(--brand-grad); color: #fff;
  padding: 14px 24px; font-weight: 700; font-size: var(--fs-lg); display: flex; gap: var(--sp-4); align-items: center; }
.docs-top img { width: 28px; height: 28px; object-fit: contain; }
.docs-top__brand { font-family: var(--font-brand); }
.docs-top a { color: #e9d5ff; font-weight: 500; font-size: var(--fs-md); }
.docs-top a:hover { color: #fff; }
.docs-top__spacer { flex: 1; }
.docs-top .seg { background: rgba(255,255,255,.18); }
.docs-top .seg button { color: #e9d5ff; }
.docs-top .seg button.on { background: #fff; color: var(--brand-600); }

/* docs shell: TOC sidebar + content */
.docs-shell { display: flex; gap: var(--sp-8); max-width: 1140px; margin: 0 auto;
  padding: var(--sp-8) var(--sp-6) 80px; align-items: flex-start; }
.docs-main { flex: 1; min-width: 0; }

.docs-toc { position: sticky; top: 84px; width: 230px; flex-shrink: 0;
  max-height: calc(100vh - 110px); overflow-y: auto; }
.docs-toc__title { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted); margin: 0 0 var(--sp-2) 12px; }
.docs-toc nav { display: flex; flex-direction: column; border-left: 2px solid var(--border); }
.docs-toc a { display: block; padding: 5px 12px; margin-left: -2px; border-left: 2px solid transparent;
  color: var(--muted); font-size: var(--fs-sm); line-height: 1.4; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-toc a:hover { color: var(--text-2); text-decoration: none; }
.docs-toc a.toc-h3 { padding-left: 24px; font-size: var(--fs-xs); }
.docs-toc a.active { color: var(--brand-600); border-left-color: var(--brand); font-weight: 600; }

/* docs content (markdown) — สไตล์เอง แทน github-markdown-css */
.markdown-body { max-width: 760px; line-height: 1.72; font-size: 15.5px; color: var(--text-2); }
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body h1 { font-family: var(--font-brand); font-weight: 700; font-size: 33px; line-height: 1.18;
  color: var(--text); margin: 0 0 10px; letter-spacing: -.01em; }
.markdown-body h2 { font-family: var(--font-brand); font-weight: 600; font-size: 22px; color: var(--text);
  margin: 58px 0 16px; scroll-margin-top: 84px; }
.markdown-body h3 { font-family: var(--font-brand); font-weight: 600; font-size: 16.5px; color: var(--text);
  margin: 32px 0 10px; scroll-margin-top: 84px; }
.markdown-body p { margin: 14px 0; }
.markdown-body a { color: var(--brand-600); }
.markdown-body strong { color: var(--text); font-weight: 600; }
.markdown-body hr { display: none; }
.markdown-body ul, .markdown-body ol { margin: 14px 0; padding-left: 22px; }
.markdown-body li { margin: 6px 0; }
.markdown-body li::marker { color: var(--muted); }
.markdown-body :not(pre) > code { font-family: var(--mono); font-size: .85em; background: var(--brand-tint);
  color: var(--brand-600); padding: 2px 6px; border-radius: 6px; border: 1px solid #ebe9ff; }
.markdown-body pre { position: relative; background: #f1f3f7; color: #2b3040; border: 1px solid #e1e4ec;
  border-radius: 12px; padding: 16px 18px; overflow: auto; margin: 18px 0; font-size: 13px; line-height: 1.62; }
.markdown-body pre code { font-family: var(--mono); background: none; border: 0; color: inherit; padding: 0; font-size: inherit; }
.markdown-body pre .copy { position: absolute; top: 8px; right: 8px; border: 1px solid var(--border-2); background: #fff;
  color: var(--muted); font: inherit; font-size: 11px; padding: 4px 9px; border-radius: 6px; cursor: pointer; opacity: 0; transition: .15s; }
.markdown-body pre:hover .copy { opacity: 1; }
.markdown-body pre .copy:hover { background: var(--surface-2); color: var(--text-2); }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14.5px; }
.markdown-body th { text-align: left; font-weight: 600; color: var(--text); padding: 9px 12px; border-bottom: 2px solid var(--border-2); }
.markdown-body td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.markdown-body tr:last-child td { border-bottom: 0; }
.markdown-body tbody tr:hover { background: var(--surface-2); }
.markdown-body blockquote { margin: 18px 0; padding: 13px 16px; background: var(--brand-tint);
  border: 1px solid #e7e5ff; border-left: 3px solid var(--brand); border-radius: 8px; color: var(--text-2); }
.markdown-body blockquote > :first-child { margin-top: 0; }
.markdown-body blockquote > :last-child { margin-bottom: 0; }
/* custom checkbox — ใช้ทั้งเว็บ (ฟอร์ม admin, scopes, providers, docs task list) */
input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; margin: 0; vertical-align: -0.18em;
  border: 1.5px solid var(--border-2); border-radius: 5px; background: var(--surface);
  position: relative; flex-shrink: 0; cursor: pointer; transition: border-color .12s, background .12s;
  transform: translateY(-1px);
}
input[type=checkbox]:hover { border-color: var(--brand); }
input[type=checkbox]:checked { background: var(--brand); border-color: var(--brand); }
input[type=checkbox]:checked::after {
  content: ""; position: absolute; left: 5.5px; top: 2px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
input[type=checkbox]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type=checkbox]:disabled { cursor: default; opacity: .85; }

/* docs task list (- [ ] / - [x]) — ตัด bullet + เว้นระยะกับข้อความ */
.markdown-body ul:has(> li > input[type=checkbox]) { list-style: none; padding-left: 2px; }
.markdown-body li:has(> input[type=checkbox]) { margin-left: 0; }
.markdown-body input[type=checkbox] { margin-right: 9px; cursor: default; }

@media (max-width: 860px) {
  .docs-toc { display: none; }
  .docs-shell { padding: var(--sp-5) var(--sp-4) 60px; }
  .markdown-body { max-width: none; }
}

@media (max-width: 820px) {
  .sidebar { width: 68px; padding: var(--sp-3) var(--sp-2); }
  .sidebar__brand span, .sidebar__new span, .sidebar__nav a span, .appbar__email { display: none; }
  .sidebar__new, .sidebar__nav a { justify-content: center; }
  .layout-admin .main { padding: var(--sp-5); }
}

/* auth pages on small screens (login / consent / error) */
@media (max-width: 480px) {
  .layout-centered { padding: var(--sp-4) var(--sp-3); }
  .auth-card { max-width: 100%; padding: 26px 20px; border-radius: var(--r-lg); }
  .auth-langtoggle { top: 12px; right: 12px; }
  .auth-langtoggle.seg button { padding: 5px 11px; }
  .auth-logo { width: 52px; height: 52px; }
  .scopes { margin-top: var(--sp-3); }
  .scopes li { padding: 10px 12px; }
}
