@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  font-family: "DM Sans", "Noto Sans Thai", sans-serif;
  color: #24203a;
  background: #f7f4ff;
  --purple: #7654e8;
  --purple-dark: #6040ce;
  --muted: #827e91;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 12% 9%, rgba(201, 185, 255, .33), transparent 31rem),
    radial-gradient(ellipse at 88% 85%, rgba(255, 215, 232, .36), transparent 30rem),
    #f7f4ff;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
.admin-shell { width: min(100% - 36px, 1080px); min-height: 100vh; margin: auto; display: flex; flex-direction: column; }
.admin-topbar { position: sticky; top: 0; z-index: 20; min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(247, 244, 255, .92); backdrop-filter: blur(8px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: 15px; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; color: #fff; border-radius: 12px; background: linear-gradient(145deg, #a68aff, #704fe3); box-shadow: 0 5px 13px #8f70ed55; }
.brand strong { font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.admin-identity, .muted { color: var(--muted); font-size: 13px; }
.dashboard-heading { padding: 44px 0 20px; }
.eyebrow { color: var(--purple); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
h1 { margin: 9px 0 5px; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.04em; }
h2 { margin: 12px 0 6px; font-size: 18px; }
p { line-height: 1.65; }
.dashboard-heading p { margin: 0; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.status-card, .management-panel, .login-card { border: 1px solid rgba(255,255,255,.9); border-radius: 20px; background: rgba(255,255,255,.88); box-shadow: 0 15px 45px rgba(58,38,111,.08); }
.status-card { padding: 22px; min-height: 170px; }
.status-card .muted { margin: 4px 0 0; font-size: 12px; }
.card-icon { color: var(--purple); font-size: 22px; }
.status-value { margin: 8px 0 0; font-size: 25px; font-weight: 700; }
.management-panel { margin-top: 18px; padding: 25px; display: grid; grid-template-columns: 1fr auto; gap: 15px 20px; align-items: center; }
.management-panel h2 { margin-top: 7px; }
.management-panel p { margin: 6px 0 0; }
.management-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.secondary-button, .primary-button { min-height: 40px; padding: 10px 15px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #e8e3f2; border-radius: 11px; background: #fff; color: #473b6b; text-decoration: none; font-size: 13px; font-weight: 600; }
.secondary-button:hover { border-color: #b7a4f5; background: #faf8ff; }
.management-panel .notice { grid-column: 1 / -1; }
.settings-form { display: grid; gap: 8px; }
.settings-form label { margin-top: 5px; font-size: 13px; font-weight: 600; }
.settings-form input, .settings-form textarea, .settings-form select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #e8e3f2; border-radius: 10px; background: #fff; color: #24203a; font: inherit; }
.settings-form input:focus, .settings-form textarea:focus, .settings-form select:focus { outline: 2px solid #b7a4f5; border-color: #b7a4f5; }
.settings-form input[type="color"] { min-height: 42px; padding: 4px; }
.sheet-column-mapping { margin: 8px 0 2px; padding: 12px; border: 1px solid #e8e3f2; border-radius: 12px; }
.sheet-column-mapping legend { padding: 0 6px; font-size: 13px; font-weight: 700; }
.sheet-column-mapping > .muted { margin: 0 0 10px; font-size: 12px; }
.sheet-column-grid { display: grid; grid-template-columns: minmax(150px, 1fr) 100px; gap: 8px 12px; align-items: center; }
.sheet-column-grid label { margin: 0; font-size: 13px; }
.sheet-column-grid input { min-height: 36px; }
.sheet-preview-result { max-height: 360px; overflow: auto; margin: 4px 0 0; padding: 12px; border: 1px solid #e8e3f2; border-radius: 10px; background: #f8f6fc; color: #473b6b; font: 12px/1.5 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.widget-sites-panel { grid-template-columns: 1fr; align-items: start; }
.widget-sites-list { display: grid; gap: 12px; }
.widget-site-card { padding: 16px; border: 1px solid #e8e3f2; border-radius: 14px; background: #fff; }
.widget-site-card h3 { margin: 0 0 5px; font-size: 15px; }
.widget-site-card p { margin: 4px 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.widget-site-card textarea { width: 100%; min-height: 90px; margin-top: 10px; padding: 10px; border: 1px solid #e8e3f2; border-radius: 9px; font: 12px/1.5 Consolas, monospace; }
.widget-site-actions, .widget-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.widget-site-form { display: grid; grid-template-columns: 1fr; gap: 8px; padding-top: 18px; border-top: 1px solid #eeeaf5; }
.widget-site-form h3 { margin: 0; font-size: 16px; }
.widget-config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; align-items: center; }
.widget-form-actions .primary-button { width: auto; margin-top: 0; }
.widget-form-actions .secondary-button { cursor: pointer; }
.widget-site-card .primary-button { width: auto; min-height: 38px; margin: 0; }
.widget-site-card .secondary-button { min-height: 38px; cursor: pointer; }
.settings-form .muted { margin: 3px 0; font-size: 12px; }
.primary-button { min-height: 42px; padding: 10px 15px; border: 0; border-radius: 11px; background: var(--purple); color: #fff; font-size: 13px; font-weight: 600; }
.primary-button:hover:not(:disabled) { background: var(--purple-dark); }
.primary-button:disabled { cursor: not-allowed; opacity: .5; }
.secret-panel ol { margin: 0; padding-left: 22px; color: #625c70; font-size: 13px; line-height: 1.8; }
.secret-panel code { padding: 2px 5px; border-radius: 5px; background: #f0edf7; }
.notice { padding: 12px 14px; border: 1px solid #e9e5f1; border-radius: 12px; background: #f8f6fc; color: #625c70; font-size: 13px; line-height: 1.6; }
.notice-warning { border-color: #f2dfb6; background: #fff9eb; color: #775a20; }
.notice-error { border-color: #f0c9cd; background: #fff1f2; color: #8e3d45; }
.quick-links { display: flex; gap: 20px; padding: 23px 4px; font-size: 13px; }
.quick-links a, .back-link { color: var(--purple-dark); text-decoration: none; }
.quick-links a:hover, .back-link:hover { text-decoration: underline; }
footer { margin-top: auto; padding: 20px 0; color: #9691a4; text-align: center; font-size: 11px; }
.login-shell { align-items: center; }
.login-shell > .brand { align-self: flex-start; margin-top: 24px; }
.login-card { width: min(100%, 470px); margin: auto; padding: 38px; text-align: center; }
.login-card h1 { margin-top: 13px; font-size: 28px; }
.login-card > .muted { margin: 0 0 20px; }
.login-card .notice { margin: 13px 0; text-align: left; }
.primary-button { width: 100%; gap: 10px; min-height: 48px; margin-top: 17px; border: 0; background: var(--purple); color: #fff; }
.primary-button:hover { background: var(--purple-dark); }
.primary-button.disabled { pointer-events: none; opacity: .48; }
.google-mark { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #4285f4; font-weight: 700; }
.allowlist-note { margin: 14px 0 20px; color: var(--muted); font-size: 12px; }
.back-link { display: inline-block; font-size: 13px; }
.login-shell footer { width: 100%; }
.content-editor-panel { grid-template-columns: 1fr; align-items: start; }
.content-group { display: grid; gap: 8px; margin: 0; padding: 16px; border: 1px solid #e8e3f2; border-radius: 14px; }
.content-group legend { padding: 0 7px; font-size: 14px; font-weight: 700; }
.catalog-image-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.catalog-image-card { min-width: 0; overflow: hidden; border: 1px solid #e8e3f2; border-radius: 10px; background: #fff; }
.catalog-image-card img { width: 100%; aspect-ratio: 1; display: block; object-fit: cover; }
.catalog-image-card small { display: block; padding: 7px; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.content-group textarea { width: 100%; min-height: 84px; padding: 10px 11px; border: 1px solid #e8e3f2; border-radius: 10px; background: #fff; color: #24203a; font: inherit; resize: vertical; }
.content-record-list { display: grid; gap: 10px; }
.content-record { display: grid; gap: 8px; padding: 13px; border: 1px solid #eeeaf5; border-radius: 12px; background: #fff; }
.content-record legend { font-size: 12px; }
.content-record-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.content-record-grid .wide-field { grid-column: 1 / -1; }
.product-order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.product-order-actions .secondary-button { min-height: 34px; padding: 7px 11px; cursor: pointer; }
.product-order-actions .secondary-button:disabled { cursor: not-allowed; opacity: .45; }
.content-record label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; }
.content-record input, .content-record textarea { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid #e8e3f2; border-radius: 9px; font: inherit; }
.content-record textarea { min-height: 66px; }
.content-record .content-active { display: flex; align-items: center; gap: 8px; }
.content-record .content-active input { width: 18px; min-height: 18px; }
.content-remove-button, .content-add-button { width: fit-content; min-height: 36px; margin: 0; cursor: pointer; }
.content-remove-button { color: #9c3d4c; }
[hidden] { display: none !important; }

@media (max-width: 700px) {
  .status-grid { grid-template-columns: 1fr; }
  .status-card { min-height: 140px; }
  .management-panel { grid-template-columns: 1fr; padding: 20px; }
  .management-actions { grid-column: 1; }
  .widget-config-grid { grid-template-columns: 1fr; gap: 5px; }
}
@media (max-width: 520px) {
  .admin-topbar { align-items: flex-start; padding-top: 16px; flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .dashboard-heading { padding-top: 28px; }
  .login-card { padding: 29px 21px; }
}

/* Seller-center style console (scoped to the admin dashboard) */
body.admin-console { background: #f4f5f7; --accent: #0a9d78; }
.admin-console .console-topbar { position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #0f1115; color: #fff; }
.admin-console .console-brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-size: 14px; }
.admin-console .console-logo { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: #ec008c; font-weight: 700; }
.admin-console .console-divider { opacity: .4; }
.admin-console .console-actions { display: flex; align-items: center; gap: 10px; }
.admin-console .console-pill { padding: 7px 14px; border-radius: 999px; background: #ec008c; color: #fff; text-decoration: none; font-size: 12px; font-weight: 700; }
.admin-console .console-email { padding: 6px 12px; border: 1px solid #333844; border-radius: 8px; font-size: 12px; color: #cfd3dc; }
.admin-console .console-logout { padding: 7px 14px; border: 0; border-radius: 8px; background: #e4004f; color: #fff; font-size: 12px; font-weight: 700; }
.admin-console .admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.admin-console .admin-sidebar { position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); padding: 12px 10px; background: #fff; border-right: 1px solid #e6e8ec; overflow-y: auto; }
.admin-console .admin-sidebar nav { display: grid; gap: 2px; }
.admin-console .admin-sidebar a { padding: 10px 12px; border-radius: 9px; color: #333; text-decoration: none; font-size: 13px; font-weight: 600; }
.admin-console .admin-sidebar a:hover { background: #f3f4f6; }
.admin-console .admin-sidebar a.active { background: #e8f7f2; color: var(--accent); }
.admin-console .admin-sidebar hr { width: 100%; border: 0; border-top: 1px solid #e6e8ec; margin: 8px 0; }
.admin-console .admin-shell { width: auto; max-width: none; margin: 0; padding: 0 24px 24px; }
.admin-console .console-hero { margin: 0 -24px; padding: 34px 24px 70px; display: flex; justify-content: space-between; align-items: center; gap: 16px; background: #0f1115; color: #fff; }
.admin-console .console-hero h1 { margin: 0; font-size: 14px; letter-spacing: 0; }
.admin-console .console-live { font-size: 11px; color: #5ee0b5; }
.admin-console .kpi-strip { margin-top: -44px; display: grid; grid-template-columns: repeat(5, 1fr); background: #fff; border-radius: 14px; box-shadow: 0 6px 22px #0f111522; }
.admin-console .kpi-strip article { padding: 16px 18px; border-left: 1px solid #eceef1; display: grid; gap: 4px; }
.admin-console .kpi-strip article:first-child { border-left: 0; }
.admin-console .kpi-strip span { font-size: 12px; font-weight: 700; color: #333; }
.admin-console .kpi-strip strong { font-size: 26px; line-height: 1.1; }
.admin-console .kpi-strip small { font-size: 11px; color: #9aa0aa; }
.admin-console .dashboard-heading { padding: 28px 0 14px; }
.admin-console .dashboard-heading h1 { font-size: 20px; margin: 0 0 4px; }
.admin-console .status-card, .admin-console .management-panel { border: 1px solid #e6e8ec; border-radius: 14px; background: #fff; box-shadow: 0 2px 10px #0f11150a; }
.admin-console .management-panel { scroll-margin-top: 72px; }
.admin-console .eyebrow { color: var(--accent); }
.admin-console .primary-button { background: var(--accent); border-color: var(--accent); color: #fff; }
.admin-console .secondary-button:hover { border-color: var(--accent); background: #f3fbf8; }
@media (max-width: 900px) {
  .admin-console .admin-layout { grid-template-columns: 1fr; }
  .admin-console .admin-sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid #e6e8ec; }
  .admin-console .admin-sidebar nav { grid-auto-flow: column; overflow-x: auto; }
  .admin-console .admin-sidebar a { white-space: nowrap; }
  .admin-console .admin-sidebar hr { display: none; }
  .admin-console .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .admin-console .kpi-strip article:nth-child(odd) { border-left: 0; }
  .admin-console .console-email { display: none; }
}
.admin-console .status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.admin-console .status-card { min-height: 0; }
@media (max-width: 900px) { .admin-console .status-grid { grid-template-columns: repeat(2, 1fr); } }
