/* X3 Tracking server – admin frame + pages. Style of docs/demo-da-duyet.html:
   light canvas, white rounded cards, thin display titles, pill buttons. X3SALES colours. */
:root {
	--x3s-bg: #F7F9FB;
	--x3s-surface: #ffffff;
	--x3s-surface-2: #f2f5f8;
	--x3s-line: #e2e7ee;
	--x3s-fg: #1B2633;
	--x3s-muted: #66727f;
	--x3s-accent: #0C6CB4;
	--x3s-accent-soft: #e3f0fa;
	--x3s-ink: #1B2633;
	--x3s-good: #16865c;
	--x3s-good-soft: #dff4ea;
	--x3s-warn: #a96300;
	--x3s-warn-soft: #fdf0d8;
	--x3s-bad: #cf3a2f;
	--x3s-bad-soft: #fde6e3;
	--x3s-r: 16px;
	--x3s-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--x3s-display: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
	--x3s-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.x3s { margin: 0; background: var(--x3s-bg); color: var(--x3s-fg); font-family: var(--x3s-font); font-size: 14px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
.x3s [hidden] { display: none !important; }
.x3s a { color: var(--x3s-accent); }
.x3s button, .x3s input, .x3s select, .x3s textarea { font: inherit; color: inherit; }
.x3s :focus-visible { outline: 2px solid var(--x3s-accent); outline-offset: 2px; }
.x3s h1, .x3s h2, .x3s h3 { margin: 0; line-height: 1.25; }

/* WordPress helper classes used by reused plugin pages */
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.x3s-skip:focus { position: fixed !important; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 100; background: #fff; padding: 8px 14px; border-radius: 99px; }
.x3s .wrap { margin: 0; }
.x3s hr.wp-header-end { display: none; }
.x3s .notice { background: var(--x3s-surface); border: 1px solid var(--x3s-line); border-left: 4px solid var(--x3s-accent); border-radius: 12px; padding: 2px 14px; margin: 0 0 14px; }
.x3s .notice p { margin: 9px 0; }
.x3s .notice-success { border-left-color: var(--x3s-good); background: var(--x3s-good-soft); }
.x3s .notice-error { border-left-color: var(--x3s-bad); background: var(--x3s-bad-soft); }
.x3s .notice-warning { border-left-color: var(--x3s-warn); background: var(--x3s-warn-soft); }
.x3s .notice-info { border-left-color: var(--x3s-accent); background: var(--x3s-accent-soft); }
.x3s .button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--x3s-line); background: var(--x3s-surface); color: var(--x3s-fg); padding: 6px 14px; border-radius: 99px; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; }
.x3s .button-primary { background: var(--x3s-ink); border-color: var(--x3s-ink); color: #fff; }

/* frame */
.x3s-in { max-width: 1320px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.x3s-top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--x3s-line); }
.x3s-top-in { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px; padding-top: 10px; padding-bottom: 10px; }
.x3s-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.x3s-brand img { display: block; height: 30px; width: auto; }
.x3s-brand-sub { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--x3s-muted); border-left: 1px solid var(--x3s-line); padding-left: 10px; }
.x3s-menu { display: flex; gap: 4px; flex-wrap: wrap; }
.x3s-menu a { padding: 7px 14px; border-radius: 99px; text-decoration: none; color: var(--x3s-muted); font-weight: 600; font-size: 13px; }
.x3s-menu a:hover { color: var(--x3s-fg); background: var(--x3s-surface-2); }
.x3s-menu a.is-active { background: var(--x3s-ink); color: #fff; }
.x3s-who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.x3s-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--x3s-accent-soft); color: var(--x3s-accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.x3s-who-t { display: grid; line-height: 1.2; min-width: 0; }
.x3s-who-t b { font-weight: 600; font-size: 13px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x3s-who-t small { color: var(--x3s-muted); font-size: 11.5px; }
.x3s-logout { margin: 0; }
.x3s-sitebar { background: var(--x3s-bg); border-bottom: 1px solid var(--x3s-line); }
.x3s-sitebar-in { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; padding-top: 12px; padding-bottom: 12px; }
.x3s-sitename { display: flex; align-items: center; gap: 8px; min-width: 0; }
.x3s-sitename b { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x3s-tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--x3s-surface); border: 1px solid var(--x3s-line); border-radius: 99px; padding: 4px; margin-left: auto; max-width: 100%; }
.x3s-tabs a { padding: 6px 14px; border-radius: 99px; text-decoration: none; color: var(--x3s-muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.x3s-tabs a:hover { color: var(--x3s-fg); background: var(--x3s-surface-2); }
.x3s-tabs a.is-active { background: var(--x3s-ink); color: #fff; }
.x3s-main { flex: 1; padding: 20px 0 56px; }
.x3s-foot { color: var(--x3s-muted); font-size: 12px; padding: 14px 0 22px; }
@media (max-width: 760px) {
	.x3s-who-t { display: none; }
	.x3s-menu { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
	.x3s-tabs { margin-left: 0; width: 100%; box-sizing: border-box; flex-wrap: wrap; border-radius: 16px; }
	.x3s-tabs a { flex: 1 1 auto; text-align: center; }
	.x3s-brand img { height: 26px; }
	.x3s-main { padding-top: 14px; }
}

/* text & small parts */
.x3s-display { font-family: var(--x3s-display); font-weight: 300; font-size: clamp(26px, 3.6vw, 38px); letter-spacing: -.02em; line-height: 1.1; }
.x3s-h { font-size: 18px; font-weight: 500; }
.x3s-muted { color: var(--x3s-muted); }
.x3s-help { font-size: 12.5px; color: var(--x3s-muted); line-height: 1.45; }
.x3s-lbl { font-size: 11px; font-weight: 600; color: var(--x3s-muted); letter-spacing: .07em; text-transform: uppercase; }
.x3s-err { font-size: 12.5px; color: var(--x3s-bad); font-weight: 600; }
.x3s-m0 { margin: 0; }
.x3s-center { text-align: center; }
.x3s-strong { font-weight: 600; color: var(--x3s-fg) !important; text-decoration: none; }
.x3s-strong:hover { color: var(--x3s-accent) !important; }
.x3s-block-text { display: block; }
.x3s-mono, .x3s-mono-in { font-family: var(--x3s-mono); font-size: 12.5px; }
.x3s-num { font-variant-numeric: tabular-nums; }
.x3s-r { text-align: right; }
.x3s-code-i { font-family: var(--x3s-mono); font-size: 12px; background: var(--x3s-surface-2); border: 1px solid var(--x3s-line); border-radius: 6px; padding: 0 5px; }
.x3s-code { font-family: var(--x3s-mono); font-size: 12px; background: var(--x3s-surface-2); border-radius: 10px; padding: 10px 12px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.x3s-url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; flex: 1; min-width: 0; }
.x3s-back { display: inline-block; font-size: 13px; text-decoration: none; color: var(--x3s-muted) !important; margin-bottom: 6px; }
.x3s-back:hover { color: var(--x3s-fg) !important; }
.x3s-hr { border: 0; border-top: 1px solid var(--x3s-line); margin: 2px 0; width: 100%; }
.x3s-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.x3s-pill.good { background: var(--x3s-good-soft); color: var(--x3s-good); }
.x3s-pill.warn { background: var(--x3s-warn-soft); color: var(--x3s-warn); }
.x3s-pill.bad { background: var(--x3s-bad-soft); color: var(--x3s-bad); }
.x3s-pill.neutral { background: var(--x3s-surface-2); color: var(--x3s-muted); }
.x3s-pill.info { background: var(--x3s-accent-soft); color: var(--x3s-accent); }
.x3s-ol { margin: 0; padding-left: 18px; display: grid; gap: 5px; font-size: 13px; }
.x3s-empty { border: 1px dashed var(--x3s-line); border-radius: 12px; padding: 22px 16px; text-align: center; color: var(--x3s-muted); }
.x3s-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0 0 12px; }
.x3s-dl dt { color: var(--x3s-muted); font-size: 13px; }
.x3s-dl dd { margin: 0; overflow-wrap: anywhere; }

/* layout */
.x3s-hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px 24px; margin: 4px 0 18px; }
.x3s-hero p { margin: 6px 0 0; }
.x3s-narrow { max-width: 760px; margin: 0 auto; display: grid; gap: 16px; }
.x3s-narrow > .x3s-hero { margin-bottom: 2px; }
.x3s-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .x3s-grid { grid-template-columns: minmax(0, 1fr); } }
.x3s-col { display: grid; gap: 16px; min-width: 0; }
.x3s-stack { display: grid; gap: 14px; }
.x3s-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.x3s-nowrap { flex-wrap: nowrap; }
/* Single-column grids must shrink with their card (long URLs / code would widen the implicit column). */
.x3s-card-b,
.x3s-col,
.x3s-stack,
.x3s-field { grid-template-columns: minmax(0, 1fr); }
.x3s-row,
.x3s-card-b > *,
.x3s-col > *,
.x3s-field > * { min-width: 0; }
.x3s-end { justify-content: flex-end; }
.x3s-row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.x3s-card { background: var(--x3s-surface); border: 1px solid var(--x3s-line); border-radius: var(--x3s-r); min-width: 0; }
.x3s-card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 16px 18px 4px; }
.x3s-card-h h2 { font-size: 14.5px; font-weight: 600; }
.x3s-card-b { padding: 12px 18px 18px; }
.x3s-explain { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.x3s-explain > div { background: var(--x3s-surface-2); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; align-content: start; }

/* buttons */
.x3s-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--x3s-line); background: var(--x3s-surface); color: var(--x3s-fg) !important; padding: 7px 15px; border-radius: 99px; font-weight: 600; font-size: 13px; line-height: 1.4; cursor: pointer; text-decoration: none; white-space: nowrap; }
.x3s-btn:hover { background: var(--x3s-surface-2); }
.x3s-btn.x3s-ink { background: var(--x3s-ink); border-color: var(--x3s-ink); color: #fff !important; }
.x3s-btn.x3s-ink:hover { background: #0d151f; }
.x3s-btn.x3s-sm { padding: 4px 12px; font-size: 12.5px; }
.x3s-btn.x3s-block { width: 100%; padding: 10px 15px; font-size: 14px; }

/* fields */
.x3s-field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.x3s-field input[type=text], .x3s-field input[type=email], .x3s-field input[type=password], .x3s-field input[type=url], .x3s-field input[type=number], .x3s-field select, .x3s-field textarea {
	width: 100%; background: var(--x3s-surface); border: 1px solid var(--x3s-line); border-radius: 10px; padding: 8px 11px; min-height: 38px; font-size: 14px;
}
.x3s-field textarea { resize: vertical; }
.x3s-field input:focus, .x3s-field textarea:focus, .x3s-field select:focus { border-color: var(--x3s-accent); box-shadow: 0 0 0 1px var(--x3s-accent); outline: none; }
.x3s-field [aria-invalid="true"] { border-color: var(--x3s-bad); }
.x3s-sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-size: 13.5px; }
.x3s-sw-t { display: grid; gap: 2px; }
.x3s-sw-t small { font-size: 12px; color: var(--x3s-muted); }
.x3s-sw input[type=checkbox] { -webkit-appearance: none; appearance: none; width: 34px; height: 20px; min-width: 34px; border-radius: 99px; background: #c3c8d0; position: relative; cursor: pointer; margin: 0; transition: background .2s; }
.x3s-sw input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.x3s-sw input[type=checkbox]:checked { background: var(--x3s-accent); }
.x3s-sw input[type=checkbox]:checked::after { transform: translateX(14px); }
.x3s-sw input[type=checkbox]:disabled { opacity: .6; cursor: not-allowed; }
.x3s-seg { display: flex; gap: 3px; background: var(--x3s-surface-2); border: 1px solid var(--x3s-line); padding: 3px; border-radius: 99px; width: fit-content; max-width: 100%; flex-wrap: wrap; }
.x3s-seg label { position: relative; margin: 0; }
.x3s-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.x3s-seg span { display: block; padding: 5px 14px; border-radius: 99px; cursor: pointer; font-weight: 500; color: var(--x3s-muted); white-space: nowrap; font-size: 13px; }
.x3s-seg input:checked + span { background: var(--x3s-surface); color: var(--x3s-fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.x3s-seg input:focus-visible + span { outline: 2px solid var(--x3s-accent); outline-offset: 1px; }
.x3s-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 6px 14px; }
.x3s-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; padding: 6px 8px; border-radius: 10px; }
.x3s-check:hover { background: var(--x3s-surface-2); }
.x3s-check input { margin: 3px 0 0; accent-color: var(--x3s-accent); }
.x3s-check small { display: block; font-size: 12px; }

/* tables (stacked cards on phones) */
.x3s-table-wrap { overflow-x: auto; position: relative; } /* keeps hidden screen-reader labels inside the scroll box */
.x3s-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.x3s-table th, .x3s-table td { padding: 11px 14px; border-bottom: 1px solid var(--x3s-line); text-align: left; vertical-align: middle; }
.x3s-table thead th { font-size: 11px; font-weight: 600; color: var(--x3s-muted); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.x3s-table .x3s-r { text-align: right; }
.x3s-table tbody tr:hover { background: #fafbfd; }
.x3s-table tbody tr.is-off { opacity: .65; }
.x3s-table tfoot th, .x3s-table tfoot td { font-weight: 600; border-bottom: 0; background: var(--x3s-surface-2); }
.x3s-table tbody tr:last-child td { border-bottom: 0; }
.x3s-table tfoot tr:first-child > * { border-top: 1px solid var(--x3s-line); }
.x3s-actions { white-space: nowrap; text-align: right; }
.x3s-actions .x3s-btn + .x3s-btn { margin-left: 4px; }
/* Wide data tables turn into cards up to tablet width (8+ columns do not fit below ~1024px). */
@media (max-width: 1024px) {
	.x3s-table-stack thead { display: none; }
	.x3s-table-stack, .x3s-table-stack tbody, .x3s-table-stack tfoot, .x3s-table-stack tr { display: block; width: 100%; }
	.x3s-table-stack tr { padding: 10px 14px; border-bottom: 1px solid var(--x3s-line); }
	.x3s-table-stack th, .x3s-table-stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
	.x3s-table-stack td:first-child, .x3s-table-stack th:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
	/* Label left, every value part grouped on the right (e.g. "2 / 4", "domain +1"). */
	.x3s-table-stack td[data-label]:not(:first-child) { justify-content: flex-start; gap: 4px; }
	.x3s-table-stack td[data-label]:not(:first-child)::before { content: attr(data-label); color: var(--x3s-muted); font-size: 12.5px; text-align: left; margin-right: auto; padding-right: 12px; }
	.x3s-table-stack td:empty { display: none; }
	.x3s-table-stack .x3s-actions { justify-content: flex-end; padding-top: 8px; }
	.x3s-table-stack tfoot tr { background: var(--x3s-surface-2); border-radius: 0 0 var(--x3s-r) var(--x3s-r); }
}

/* login */
.x3s-page-login .x3s-main { display: grid; place-items: center; padding: 24px 0; }
.x3s-login { width: 100%; max-width: 400px; margin: 0 auto; }
.x3s-login-card { padding: 28px 26px 22px; display: grid; gap: 16px; box-shadow: 0 10px 30px -12px rgba(27, 38, 51, .18); }
.x3s-login-brand { display: flex; align-items: center; gap: 10px; }
.x3s-login-brand img { height: 36px; width: auto; display: block; }
.x3s-login-title { font-size: 30px; }
.x3s-login .notice { margin: 0; }

/* reused plugin settings page inside the server frame */
.x3s-settings .x3ct-admin { --x3-bg: var(--x3s-bg); --x3-accent: var(--x3s-accent); --x3-accent-soft: var(--x3s-accent-soft); --x3-ink: var(--x3s-ink); --x3-fg: var(--x3s-fg); --x3-line: var(--x3s-line); --x3-surface-2: var(--x3s-surface-2); max-width: none; }
.x3s-settings .x3ct-admin > .x3-top { display: none; }
.x3s-settings .x3-tabs { margin-top: 0; }
.x3s-settings .x3-savebar { background: linear-gradient(to bottom, rgba(247, 249, 251, 0), var(--x3s-bg) 35%); }
@media (min-width: 1101px) { .x3s-settings .x3-sticky { top: 72px; } }
/* Small screens: tabs wrap onto several rows so every tab (and the active one) stays visible. */
@media (max-width: 760px) {
	.x3s-settings .x3-tabs { flex-wrap: wrap; overflow: visible; border-radius: 16px; width: 100%; box-sizing: border-box; }
	.x3s-settings .x3-tabs a { flex: 1 1 auto; text-align: center; padding: 7px 10px; }
}

@media (prefers-reduced-motion: reduce) { .x3s * { transition: none !important; } }
