/* Unitrux admin look: slate-950 background, amber accent, Inter. */
:root {
  --bg: #020617;
  --panel: #0f172a;
  --panel-2: #111c33;
  --line: #1e293b;
  --line-2: #334155;
  --text: #e2e8f0;
  --strong: #f8fafc;
  --muted: #94a3b8;
  --dim: #64748b;
  --amber: #f59e0b;
  --amber-2: #fbbf24;
  --amber-soft: rgba(245, 158, 11, .1);
  --sky: #38bdf8;
  --green: #34d399;
  --red: #f87171;
  --violet: #a78bfa;
  --radius: 12px;
  color-scheme: dark;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { overflow-x: clip; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.locked { overflow: hidden; }
a { color: var(--amber-2); }
h1, h2, h3 { margin: 0; line-height: 1.3; color: var(--strong); }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 600; margin: 18px 0 6px; }
svg { width: 16px; height: 16px; flex: none; }
.hide { display: none !important; }
.muted, .hint { color: var(--muted); font-size: 13px; margin: 4px 0; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; }
.pre { white-space: pre-wrap; }
.empty { color: var(--dim); text-align: center; padding: 32px 12px; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--amber); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* brand */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 36px; height: 36px; flex: none; border-radius: 10px; background: linear-gradient(135deg, var(--amber-2), #f97316); display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 15px; box-shadow: 0 8px 20px rgba(245, 158, 11, .2); }
.brand b { display: block; color: var(--strong); font-size: 14px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand small { display: block; color: var(--dim); font-size: 10.5px; white-space: nowrap; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: #172036; border-color: #475569; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #1c1203; font-weight: 600; }
.btn.primary:hover { background: var(--amber-2); }
.btn.danger { color: var(--red); border-color: rgba(248, 113, 113, .35); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.file { position: relative; overflow: hidden; width: fit-content; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: #0b1324; min-height: 40px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(245, 158, 11, .5); outline-offset: 0; border-color: var(--amber); }
input:-webkit-autofill { -webkit-box-shadow: 0 0 0 30px #1e293b inset !important; -webkit-text-fill-color: var(--text) !important; }
label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
label.check input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--amber); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .full { grid-column: 1 / -1; }
.form .buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.form-msg { color: var(--red); min-height: 1.5em; margin: 0; font-size: 13px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(800px 400px at 50% -10%, rgba(245, 158, 11, .14), transparent), var(--bg); }
.login-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.login-card .brand { margin-bottom: 26px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card > p { color: var(--muted); margin: 0 0 20px; font-size: 13px; }
.login-card form { display: grid; gap: 14px; }
.login-card .btn { min-height: 42px; }
.login-card .back { display: block; margin-top: 18px; font-size: 13px; text-align: center; color: var(--muted); }

/* shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 256px; flex: none; background: var(--panel); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; transition: width .2s; }
.side .brand { padding: 18px 16px; border-bottom: 1px solid var(--line); }
.side nav { flex: 1; overflow-y: auto; padding: 16px 12px; display: grid; align-content: start; gap: 20px; }
.side .group p { margin: 0 0 6px; padding: 0 12px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.side .group a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.side .group a:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.side .group a.on { background: var(--amber-soft); color: var(--amber-2); }
.side .group a .count { margin-left: auto; background: var(--amber); color: #1c1203; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.side footer { padding: 12px; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.side footer button, .side footer a { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; border-radius: 8px; border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; text-decoration: none; text-align: left; }
.side footer button:hover, .side footer a:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.side footer #logout:hover { color: var(--red); }
.collapsed .side { width: 72px; }
.collapsed .side .brand > div, .collapsed .side .group p, .collapsed .side span, .collapsed .side .count { display: none; }
.collapsed .side .brand { justify-content: center; }
.collapsed .side .group a, .collapsed .side footer button, .collapsed .side footer a { justify-content: center; }
.collapsed #collapse svg { transform: rotate(180deg); }

.main { flex: 1; min-width: 0; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; padding: 0 24px; background: rgba(2, 6, 23, .8); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(30, 41, 59, .6); }
.top h1 { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .actions { display: flex; align-items: center; gap: 12px; }
.who { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.who div { text-align: right; }
.who b { display: block; font-size: 13px; font-weight: 500; color: var(--text); }
.who small { display: block; font-size: 11px; color: var(--dim); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--amber-2), #f97316); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.menu-btn { display: none; }
.content { padding: 24px; display: grid; gap: 18px; max-width: 1200px; }
.scrim { display: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head a { font-size: 13px; text-decoration: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* KPI */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: inherit; display: grid; gap: 6px; transition: border-color .15s; }
a.stat:hover { border-color: var(--line-2); }
.stat small { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.stat small svg { color: var(--dim); }
.stat b { font-size: 24px; color: var(--strong); font-weight: 700; letter-spacing: -.02em; }
.stat em { font-style: normal; font-size: 12px; color: var(--dim); }
.stat.hot { border-color: rgba(245, 158, 11, .45); background: linear-gradient(180deg, rgba(245, 158, 11, .08), var(--panel)); }
.stat.hot b { color: var(--amber-2); }

/* chart */
.chart { display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 6px; height: 180px; padding-top: 8px; }
.chart .day { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; min-width: 0; }
.chart .bar { display: flex; flex-direction: column-reverse; justify-content: flex-start; align-self: end; height: 100%; border-radius: 4px; overflow: hidden; }
.chart .bar i { display: block; width: 100%; }
.chart .day small { font-size: 10px; color: var(--dim); text-align: center; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.fill-vn { background: var(--amber); }
.fill-com { background: var(--sky); }
.fill-other { background: var(--dim); }
.fill-none { background: var(--line); }
.dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* site compare */
.sites { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.site { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 10px; background: var(--panel-2); }
.site header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.site header a { font-size: 13px; text-decoration: none; }
.site header b { color: var(--strong); font-weight: 600; }
.site dl { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 0; }
.site dt { font-size: 11px; color: var(--dim); }
.site dd { margin: 0; font-weight: 600; color: var(--strong); }
.site .links { display: flex; gap: 8px; flex-wrap: wrap; }

/* tables */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar select { width: auto; }
.chips { display: flex; min-width: 0; max-width: 100%; gap: 6px; overflow-x: auto; flex: 1 1 100%; scrollbar-width: none; }
.chip { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); text-decoration: none; color: var(--muted); font-size: 13px; white-space: nowrap; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--amber-soft); color: var(--amber-2); border-color: rgba(245, 158, 11, .35); }
.search { display: flex; gap: 8px; flex: 1 1 260px; min-width: 0; }
.search input { min-width: 0; }

.table { width: 100%; border-collapse: collapse; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .03); }
.table td small { display: block; color: var(--dim); font-size: 12px; }
.table .num { text-align: right; white-space: nowrap; }
.table img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; background: var(--line); display: block; }
.table tr.off { opacity: .5; }
.warn { color: var(--red) !important; font-weight: 600; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: rgba(148, 163, 184, .12); color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.st-new, .cs-new { background: rgba(245, 158, 11, .12); color: var(--amber-2); border-color: rgba(245, 158, 11, .25); }
.st-confirmed, .cs-contacted { background: rgba(56, 189, 248, .12); color: var(--sky); border-color: rgba(56, 189, 248, .25); }
.st-delivering { background: rgba(167, 139, 250, .12); color: var(--violet); border-color: rgba(167, 139, 250, .25); }
.st-completed, .cs-done, .up { background: rgba(52, 211, 153, .12); color: var(--green); border-color: rgba(52, 211, 153, .25); }
.st-cancelled, .cs-spam, .down { background: rgba(248, 113, 113, .12); color: var(--red); border-color: rgba(248, 113, 113, .25); }
.tag-vn { color: var(--amber-2); }
.tag-com { color: var(--sky); }

/* drawer */
.drawer-wrap { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); z-index: 60; display: flex; justify-content: flex-end; animation: fade .15s; }
.drawer { width: min(560px, 100%); height: 100%; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 26px 24px 40px; position: relative; animation: slide .2s ease-out; }
.drawer h2 { font-size: 20px; font-weight: 700; margin-top: 4px; }
.drawer .close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.drawer .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.drawer .grid2 p { margin: 0; }
.drawer .form { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.eyebrow { font-size: 11px; letter-spacing: .14em; font-weight: 700; color: var(--amber); text-transform: uppercase; }
.items { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.items li { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; }
.items img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--line); }
.items small { display: block; color: var(--dim); font-size: 12px; }
.total { display: flex; justify-content: space-between; border-top: 1px dashed var(--line-2); padding-top: 12px; margin-top: 12px; }
.total b { font-size: 18px; color: var(--amber-2); }
.attach { max-width: 100%; border-radius: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

/* product form */
.img-field { display: grid; grid-template-columns: 128px 1fr; gap: 16px; align-items: start; }
.img-field img { width: 128px; height: 128px; object-fit: cover; border-radius: 10px; background: var(--line); }
.img-field > div { display: grid; gap: 10px; }
.sale-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.sale-list li { display: grid; grid-template-columns: 40px 1fr 140px; gap: 10px; align-items: center; }
.sale-list img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.sale-list small { display: block; color: var(--dim); font-size: 12px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #1e293b; border: 1px solid var(--line-2); color: var(--strong); padding: 11px 16px; border-radius: 10px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: calc(100% - 32px); box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.ok { border-color: rgba(52, 211, 153, .4); }
#toast.err { border-color: rgba(248, 113, 113, .5); color: #fecaca; }

@media (max-width: 1000px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .side { position: fixed; inset: 0 auto 0 0; z-index: 70; transform: translateX(-100%); transition: transform .25s ease-out; width: 264px !important; }
  .collapsed .side .brand > div, .collapsed .side .group p, .collapsed .side span { display: revert; }
  .menu-open .side { transform: none; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
  #collapse { display: none !important; }
  .menu-btn { display: inline-flex; padding: 0; width: 36px; }
  .menu-btn svg { width: 20px; height: 20px; }
  .top { padding: 0 14px; }
  .top h1 { flex: 1; }
  .who div { display: none; }
  .content { padding: 14px 14px 40px; gap: 14px; }
  .stat b { font-size: 20px; }
  .sites { grid-template-columns: 1fr; }
  .chart { gap: 3px; height: 150px; }
  .chart .day small { font-size: 9px; }
  .hide-sm { display: none; }
  .table td, .table th { padding: 10px; }
  .form, .drawer .grid2 { grid-template-columns: 1fr; }
  .img-field { grid-template-columns: 88px 1fr; }
  .img-field img { width: 88px; height: 88px; }
  .sale-list li { grid-template-columns: 36px 1fr 110px; }
  .drawer { padding: 22px 16px 40px; }
}
.table b.mono { white-space: nowrap; }

/* article editor (SEO / AEO / GEO) */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.seo-panel { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow-y: auto; }
.seo-panel h3 { margin-top: 14px; }
.scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.score { border-radius: 10px; padding: 10px 4px; text-align: center; border: 1px solid transparent; }
.score b { display: block; font-size: 20px; }
.score small { font-size: 11px; opacity: .85; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.checks li.ok { color: var(--green); }
.group-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 12px; background: var(--panel-2); }
.group-box h3 { margin: 0; color: var(--amber-2); }
.group-box .card-head { margin: 0; flex-wrap: wrap; }
.serp { background: #fff; border-radius: 8px; padding: 12px 14px; color: #202124; font-family: Arial, sans-serif; }
.serp small { color: #4d5156; font-size: 12px; }
.serp b { display: block; color: #1a0dab; font-size: 18px; font-weight: 400; margin: 4px 0; }
.serp p { margin: 0; color: #4d5156; font-size: 13px; line-height: 1.5; }
.md-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.md-tools .btn { min-height: 32px; padding: 0 10px; font-size: 12.5px; }
#post-content { min-height: 380px; line-height: 1.6; font-size: 13px; }
.preview { background: #fbfaf6; color: #3d463b; border-radius: 8px; padding: 18px 22px; max-height: 70vh; overflow-y: auto; line-height: 1.75; }
.preview h2, .preview h3 { color: #173d2c; font-family: Georgia, serif; font-weight: 400; }
.preview a { color: #a86d00; }
.preview img { max-width: 100%; border-radius: 6px; }
.preview table { border-collapse: collapse; width: 100%; }
.preview th, .preview td { border-bottom: 1px solid #ddd6c4; padding: 6px 8px; text-align: left; }
.preview .toc { display: grid; gap: 2px; border-left: 3px solid #e3a21a; padding-left: 12px; margin-bottom: 16px; font-size: 13px; }
.faq-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.faq-row textarea { grid-column: 1; }
.faq-row button { grid-column: 2; grid-row: 1 / span 2; align-self: start; font-size: 18px; }
.card-head.spaced { margin-top: 18px; }
.chart.months { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .seo-panel { position: static; max-height: none; order: -1; }
}
