/* =========================================================
   LPC TRADING – GIAO DIỆN
   Màu lấy từ logo: cam → hồng tím → tím
   ========================================================= */
:root {
  --bg: #07050d;
  --bg-2: #0c0816;
  --surface: #110c1c;
  --surface-2: #181126;
  --surface-3: #21182f;
  --border: rgba(168, 102, 255, 0.16);
  --border-strong: rgba(255, 138, 30, 0.35);
  --text: #f5f2fb;
  --text-2: #c9c1da;
  --muted: #9a91b0;
  --dim: #6c6482;

  --orange: #ff8a1e;
  --orange-deep: #fb5700;
  --amber: #ffb547;
  --magenta: #e04df5;
  --violet: #8b5cf6;
  --violet-deep: #6d28d9;
  --grad: linear-gradient(120deg, #ffb020 0%, #ff6a00 32%, #f108ff 70%, #7c3aed 100%);
  --grad-soft: linear-gradient(120deg, rgba(255, 138, 30, .16), rgba(224, 77, 245, .12) 60%, rgba(124, 58, 237, .16));

  --win: #34d399;
  --win-bg: rgba(52, 211, 153, .12);
  --loss: #fb7185;
  --loss-bg: rgba(251, 113, 133, .12);
  --be: #94a3b8;
  --be-bg: rgba(148, 163, 184, .12);
  --open: #38bdf8;
  --open-bg: rgba(56, 189, 248, .12);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Be Vietnam Pro", Inter, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(255, 106, 0, .13), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(124, 58, 237, .16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}
::selection { background: rgba(224, 77, 245, .35); color: #fff; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.tabnum, .trading-table td, .kpi-value, .sm-value { font-variant-numeric: tabular-nums; }
.accent { color: var(--amber); }
.win { color: var(--win); }
.loss { color: var(--loss); }
.muted-sm { color: var(--dim); font-size: 12px; }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- Banners ---------- */
.risk-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 16px; font-size: 12px; text-align: center;
  color: #ffd6a8; background: rgba(251, 87, 0, .1); border-bottom: 1px solid rgba(255, 138, 30, .2);
}
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--amber); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: #fff; }
.mode-banner {
  padding: 10px 16px; text-align: center; font-size: 13px; font-weight: 600;
  display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap;
}
.mode-banner.demo { background: repeating-linear-gradient(45deg, rgba(139, 92, 246, .22) 0 12px, rgba(139, 92, 246, .12) 12px 24px); color: #e9dcff; border-bottom: 1px solid rgba(139, 92, 246, .4); }
.mode-banner.draft { background: rgba(56, 189, 248, .12); color: #bfe8ff; border-bottom: 1px solid rgba(56, 189, 248, .35); }
.mode-banner.error { background: rgba(251, 113, 133, .12); color: #ffd0d8; border-bottom: 1px solid rgba(251, 113, 133, .35); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 5, 13, .85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; user-select: none; min-width: 0; }
.brand-row { display: flex; align-items: center; gap: 8px; }
.brand-name {
  margin: 0; font-size: 22px; font-weight: 900; letter-spacing: .06em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(241, 8, 255, .25));
}
.brand-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px;
  font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--amber);
  background: rgba(255, 138, 30, .1); border: 1px solid rgba(255, 138, 30, .3);
}
.brand-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); animation: pulse 1.6s infinite; }
.brand-tagline { margin: 2px 0 0; font-size: 11px; color: var(--muted); letter-spacing: .04em; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.sync-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  font-size: 11px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); white-space: nowrap;
}
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.sync-chip.live .sync-dot { background: var(--win); box-shadow: 0 0 8px var(--win); animation: pulse 2s infinite; }
.sync-chip.warn .sync-dot { background: var(--amber); }
.sync-chip.err .sync-dot { background: var(--loss); }
.sync-chip.demo .sync-dot { background: var(--violet); }

/* 3D logo */
.logo-3d { position: relative; width: 56px; height: 56px; flex-shrink: 0; perspective: 700px; }
.logo-glow { position: absolute; inset: -6px; border-radius: 50%; background: conic-gradient(from 0deg, #ff8a1e, #f108ff, #7c3aed, #ff8a1e); filter: blur(12px); opacity: .45; animation: spin 8s linear infinite; }
.logo-ring { position: absolute; inset: -2px; border-radius: 50%; background: conic-gradient(from 180deg, #ffb020, #ff6a00, #f108ff, #7c3aed, #ffb020); animation: spin 6s linear infinite; }
.logo-card {
  position: absolute; inset: 1px; border-radius: 50%; overflow: hidden; background: #000;
  transform: perspective(700px) rotateY(-3deg); transition: transform .15s ease-out, box-shadow .2s;
  animation: logoIdle 5s ease-in-out infinite; transform-style: preserve-3d;
}
.logo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.logo-sheen { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%); background-size: 250% 100%; animation: sheen 4.5s ease-in-out infinite; mix-blend-mode: screen; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes sheen { 0%, 60% { background-position: 150% 0; } 100% { background-position: -50% 0; } }
@keyframes logoIdle { 0%, 100% { transform: perspective(700px) rotateY(-6deg) rotateX(3deg); } 50% { transform: perspective(700px) rotateY(6deg) rotateX(-3deg) translateY(-1px); } }

/* ---------- Layout ---------- */
.main { padding-top: 24px; padding-bottom: 24px; display: flex; flex-direction: column; gap: 20px; }
.card {
  background: linear-gradient(180deg, rgba(24, 17, 38, .92), rgba(15, 11, 26, .92));
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  position: relative;
}
.command-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; background: linear-gradient(100deg, rgba(40, 20, 12, .8), rgba(24, 17, 38, .85) 45%, rgba(26, 14, 48, .85)); border-color: var(--border-strong); }
.title-row { display: flex; align-items: center; gap: 10px; }
.title-row.small { gap: 8px; }
.title-bar { width: 6px; height: 24px; border-radius: 6px; background: var(--grad); }
.page-title { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: .02em; }
.page-sub { margin: 6px 0 0 16px; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.sep { color: var(--dim); }
.period-picker { display: flex; align-items: center; gap: 10px; background: rgba(7, 5, 13, .8); border: 1px solid var(--border-strong); border-radius: 12px; padding: 8px 12px; }
.period-picker label { color: var(--amber); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.select-wrap { position: relative; flex: 1; }
select, input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="time"], input[type="password"] {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; outline: none; min-width: 0; width: 100%;
}
select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ffb547' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select:focus, input:focus { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(255, 138, 30, .2); }
#periodSelector { color: var(--amber); font-weight: 700; min-width: 260px; }
input[type="date"], input[type="time"] { color-scheme: dark; }
optgroup { color: var(--muted); background: var(--bg-2); }
option { color: var(--text); background: var(--bg-2); }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; overflow: hidden; }
.kpi-hero { border-color: var(--border-strong); background: linear-gradient(160deg, rgba(60, 26, 8, .75), rgba(24, 17, 38, .92) 55%, rgba(38, 18, 66, .85)); }
.kpi-icon { position: absolute; right: -6px; bottom: -10px; font-size: 56px; opacity: .1; pointer-events: none; }
.kpi-label { margin: 0 0 6px; font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .08em; }
.brand-label { color: var(--amber); }
.kpi-value-row { display: flex; align-items: baseline; gap: 6px; }
.kpi-value { font-size: 28px; font-weight: 900; line-height: 1.15; }
.kpi-value.big { font-size: 38px; }
.kpi-value.win { color: var(--win); text-shadow: 0 0 18px rgba(52, 211, 153, .3); }
.kpi-value.soft { color: #ffd9b0; }
.kpi-value.neg { color: var(--loss); -webkit-text-fill-color: var(--loss); background: none; }
.kpi-unit { font-size: 12px; font-weight: 800; color: var(--amber); }
.kpi-note { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.kpi-note.up { color: var(--win); }
.kpi-note.down { color: var(--loss); }

/* ---------- Analytics ---------- */
.analytics-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.chart-card, .risk-card { padding: 18px 20px; }
.section-head { display: flex; justify-content: space-between; gap: 12px; }
.section-title { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: .02em; }
.section-sub { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.chart-box { position: relative; height: 240px; margin-top: 12px; }
.empty-note { color: var(--dim); font-size: 13px; text-align: center; padding: 60px 0; margin: 0; }
.metric-list { margin: 12px 0 0; display: flex; flex-direction: column; }
.metric-list > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed rgba(168, 102, 255, .14); }
.metric-list > div:last-child { border-bottom: 0; }
.metric-list dt { color: var(--text-2); font-size: 13px; }
.metric-list dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; text-align: right; }
.hint { display: inline-flex; width: 16px; height: 16px; border-radius: 50%; align-items: center; justify-content: center; font-size: 10px; color: var(--muted); border: 1px solid var(--dim); cursor: help; margin-left: 4px; }

/* ---------- Table ---------- */
.table-card { padding: 20px; }
.table-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chip { white-space: nowrap; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.day-filter { display: flex; gap: 4px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.day-btn { white-space: nowrap; background: none; border: 1px solid transparent; color: var(--muted); padding: 5px 10px; border-radius: 7px; cursor: pointer; font-weight: 700; font-size: 12px; min-width: 34px; }
.day-btn:hover { color: #fff; }
.day-btn.active { background: rgba(255, 138, 30, .16); color: var(--amber); border-color: rgba(255, 138, 30, .45); }
.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-row select { width: auto; font-size: 12px; }
.search-wrap { position: relative; width: 190px; }
.search-wrap span { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); font-size: 11px; }
.search-wrap input { padding-left: 28px; font-size: 12px; }
.swipe-hint { display: none; }
.table-scroll { overflow-x: auto; margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; background: rgba(7, 5, 13, .5); -webkit-overflow-scrolling: touch; }
.trading-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.trading-table th { padding: 12px 8px; font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--amber); background: rgba(255, 138, 30, .06); border-bottom: 1px solid var(--border-strong); text-align: center; white-space: nowrap; }
.trading-table td { padding: 11px 8px; text-align: center; vertical-align: middle; border-bottom: 1px solid rgba(168, 102, 255, .08); font-size: 13px; }
.trading-table tbody tr:hover { background: rgba(224, 77, 245, .05); }
.trading-table tbody tr.row-loss { background: rgba(251, 113, 133, .035); }
.trading-table tbody tr.row-open { background: rgba(56, 189, 248, .04); }
.trading-table tfoot td { background: rgba(7, 5, 13, .9); border-top: 2px solid rgba(255, 138, 30, .45); padding: 14px 8px; }
.tfoot-label { text-align: right !important; font-weight: 900; color: var(--amber); letter-spacing: .05em; font-size: 13px; padding-right: 20px !important; }
.tfoot-count { color: var(--muted); font-size: 12px; font-weight: 600; }
.id-box { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 4px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--amber); font-weight: 800; font-size: 12px; }
.date-cell strong { display: block; font-size: 12.5px; white-space: nowrap; }
.date-cell small { color: var(--dim); font-size: 11px; }
.price { font-weight: 700; letter-spacing: .02em; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; white-space: nowrap; border: 1px solid transparent; }
.pill-pair { background: rgba(255, 138, 30, .1); color: #ffd3a1; border-color: rgba(255, 138, 30, .25); }
.pill-pair i { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
.pill-buy { background: var(--win-bg); color: var(--win); border-color: rgba(52, 211, 153, .3); }
.pill-sell { background: var(--loss-bg); color: var(--loss); border-color: rgba(251, 113, 133, .3); }
.pill-tp { background: var(--win-bg); color: var(--win); border-color: rgba(52, 211, 153, .3); }
.pill-sl { background: var(--loss-bg); color: var(--loss); border-color: rgba(251, 113, 133, .3); }
.pill-be { background: var(--be-bg); color: var(--be); border-color: rgba(148, 163, 184, .3); }
.pill-open { background: var(--open-bg); color: var(--open); border-color: rgba(56, 189, 248, .35); }
.pill-open::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--open); animation: pulse 1.4s infinite; }
.pill-note { background: var(--surface-2); color: var(--text-2); border-color: var(--border); font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.pill-total { font-size: 14px; padding: 6px 14px; background: var(--grad); color: #fff; box-shadow: 0 0 20px rgba(241, 8, 255, .25); }
.pill-total.neg { background: var(--loss); }
.warn-flag { color: var(--amber); cursor: help; margin-left: 3px; font-size: 11px; }
.empty-row td { padding: 44px 12px !important; color: var(--muted); }
.empty-row strong { color: var(--text); display: block; margin-bottom: 4px; font-size: 14px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.pager-info { font-size: 12.5px; color: var(--muted); }
.pager-info strong { color: var(--text); }
.pager-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pg-btn { min-width: 36px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-weight: 700; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
.pg-btn:hover:not(:disabled) { border-color: var(--orange); color: #fff; }
.pg-btn.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 14px -4px rgba(241, 8, 255, .45); }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-gap { color: var(--dim); padding: 0 2px; }
@media (max-width: 760px) { .pager { justify-content: center; } .pager-info { width: 100%; text-align: center; } .pg-btn { min-width: 34px; height: 34px; padding: 0 10px; } }
.tip { margin: 14px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Legal ---------- */
.legal-card { display: flex; gap: 16px; padding: 22px; border-color: var(--border-strong); }
.legal-icon { width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: rgba(255, 138, 30, .1); border: 1px solid rgba(255, 138, 30, .3); }
.legal-body h4 { margin: 0 0 8px; color: var(--amber); font-size: 14px; }
.legal-body p { margin: 0 0 8px; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.legal-body strong { color: var(--text-2); }

.site-footer { border-top: 1px solid var(--border); background: rgba(0, 0, 0, .6); padding: 28px 0; margin-top: 32px; text-align: center; color: var(--dim); font-size: 12px; }
.site-footer p { margin: 0 0 6px; }
.footer-brand { color: var(--text-2); font-weight: 700; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; padding: 9px 16px; font-weight: 700; cursor: pointer; border: 1px solid transparent; transition: filter .15s, background .15s, border-color .15s; white-space: nowrap; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-brand { background: var(--grad); color: #fff; box-shadow: 0 4px 18px -4px rgba(241, 8, 255, .45); }
.btn-brand:hover { filter: brightness(1.12); }
.btn-brand:disabled { opacity: .6; cursor: wait; }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--orange); color: #fff; }
.btn-danger { background: rgba(251, 113, 133, .1); border-color: rgba(251, 113, 133, .3); color: var(--loss); }
.btn-danger:hover { background: rgba(251, 113, 133, .2); }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { color: #fff; background: var(--surface-3); }
.icon-btn.corner { position: absolute; top: 10px; right: 10px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(3, 2, 8, .8); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { position: relative; width: 100%; max-height: 92vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; padding: 22px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9); }
.modal-sm { max-width: 400px; }
.modal-md { max-width: 620px; }
.modal-xl { max-width: 960px; }
.modal-box.center { text-align: center; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.modal-head h3, .modal-box h3 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.modal-box.center .modal-actions { justify-content: center; }
.lock-icon { width: 56px; height: 56px; margin: 4px auto 12px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 26px; background: var(--grad-soft); border: 1px solid var(--border-strong); }
.pin-input { text-align: center; font-size: 22px; letter-spacing: .4em; margin-top: 16px; padding: 12px !important; }
.pin-input.pw-input { font-size: 16px; letter-spacing: .08em; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.error-text { color: var(--loss); font-size: 12px; margin: 8px 0 0; }
.hash-out { margin-top: 12px; padding: 10px; border-radius: 8px; background: var(--bg-2); border: 1px dashed var(--border-strong); font-size: 12px; color: var(--text-2); word-break: break-all; }
.hash-out code { color: var(--amber); }

.legal-modal { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.legal-modal .modal-head { padding: 18px 22px; margin: 0; }
.legal-scroll { overflow-y: auto; padding: 4px 22px 16px; flex: 1; }
.legal-scroll h4 { color: var(--amber); margin: 16px 0 6px; font-size: 14px; }
.legal-scroll p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.7; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--bg-2); flex-wrap: wrap; }

/* Form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.form-grid .span-2 { grid-column: span 2; }
.field-hint { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.field-hint strong { color: var(--amber); }

/* Admin */
.admin-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.info-tile { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.info-tile span { display: block; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.info-tile strong { font-size: 13px; word-break: break-word; }
.admin-toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.btn-group { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-warn { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; background: rgba(255, 181, 71, .08); border: 1px solid rgba(255, 181, 71, .3); color: #ffe2b8; }
.admin-warn ul { margin: 6px 0 0; padding-left: 18px; }
.admin-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 48vh; overflow-y: auto; }
.admin-week { font-size: 12px; font-weight: 800; color: var(--amber); margin: 10px 0 2px; letter-spacing: .04em; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); font-size: 12px; }
.admin-row .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.admin-row .actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Toast */
.toast-action { margin-left: 12px; background: var(--grad); color: #fff; border: 0; border-radius: 8px; padding: 5px 12px; font-weight: 800; cursor: pointer; }
.confirm-text { margin: 4px 0 8px; font-size: 14px; line-height: 1.6; color: var(--text); }
#btnUndo:disabled { opacity: .45; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text); padding: 10px 18px; border-radius: 12px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }

/* ---------- Share card (html2canvas: tránh background-clip:text) ---------- */
.share-scroll { overflow-x: auto; display: flex; justify-content: center; padding: 4px 0 8px; }
.share-card {
  position: relative; width: 720px; flex-shrink: 0; border-radius: 20px; padding: 28px; overflow: hidden;
  background: linear-gradient(135deg, #0b0612 0%, #150b24 50%, #1c0a05 100%);
  border: 2px solid rgba(255, 138, 30, .55);
  font-family: "Be Vietnam Pro", sans-serif;
}
.share-card::before { content: ""; position: absolute; width: 360px; height: 360px; right: -120px; top: -140px; border-radius: 50%; background: radial-gradient(circle, rgba(241, 8, 255, .28), transparent 65%); }
.share-card::after { content: ""; position: absolute; width: 360px; height: 360px; left: -140px; bottom: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 106, 0, .28), transparent 65%); }
.share-card > * { position: relative; z-index: 1; }
.share-card.is-demo { padding-top: 54px; }
.share-demo { position: absolute; z-index: 3; top: 14px; left: 50%; transform: translateX(-50%); background: #8b5cf6; color: #fff; font-weight: 900; letter-spacing: .12em; font-size: 12px; padding: 4px 14px; border-radius: 6px; }
.share-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid rgba(255, 138, 30, .25); }
.share-brand { display: flex; align-items: center; gap: 14px; }
.share-brand img { width: 60px; height: 60px; border-radius: 50%; border: 2px solid rgba(255, 138, 30, .6); object-fit: cover; }
.share-brand h2 { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: .08em; color: #ffb547; }
.share-brand p { margin: 2px 0 0; font-size: 11px; font-weight: 700; color: #e9a6ff; letter-spacing: .05em; }
.share-period { text-align: right; }
.share-period span { display: inline-block; font-size: 10px; font-weight: 900; letter-spacing: .12em; padding: 3px 10px; border-radius: 999px; background: rgba(255, 138, 30, .15); color: #ffb547; border: 1px solid rgba(255, 138, 30, .4); }
.share-period p { margin: 6px 0 0; font-size: 14px; font-weight: 800; color: #fff; }
.share-metrics { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 14px; margin: 22px 0; align-items: stretch; }
.share-metric { background: rgba(255, 255, 255, .04); border: 1px solid rgba(168, 102, 255, .25); border-radius: 14px; padding: 18px 12px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 176px; }
.share-metric.main { border-color: rgba(255, 138, 30, .5); background: rgba(255, 138, 30, .07); }
.share-metric .sm-label { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; color: #b8aecd; margin-bottom: 4px; }
.sm-value { font-size: 36px; font-weight: 900; line-height: 1.1; margin: 2px 0 6px; white-space: nowrap; }
.share-metric.main .sm-value { font-size: 42px; display: flex; align-items: baseline; gap: 8px; }
.sm-value b { font-weight: 900; }
.sm-value em { font-style: normal; font-size: 18px; font-weight: 800; letter-spacing: .06em; }
.sm-value.orange { color: #ff9a2e; }
.sm-value.green { color: #34d399; }
.sm-value.violet { color: #d58bff; }
.sm-value.red { color: #fb7185; }
.share-metric small { font-size: 12px; color: #e4dcf2; font-weight: 700; white-space: nowrap; letter-spacing: .02em; }
.share-metric small.sm-sub { font-size: 11px; color: #a79fbb; font-weight: 600; }
.share-bottom { display: flex; gap: 16px; align-items: stretch; }
.share-contact { display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(168, 102, 255, .25); border-radius: 14px; padding: 12px; flex-shrink: 0; max-width: 300px; }
.qr { background: #fff; padding: 5px; border-radius: 8px; width: 90px; height: 90px; flex-shrink: 0; }
.qr img, .qr canvas { width: 80px !important; height: 80px !important; display: block; }
.cta { margin: 0; font-size: 13px; font-weight: 800; color: #fff; }
.contact-label { margin: 4px 0 0; font-size: 12px; font-weight: 700; color: #ffb547; word-break: break-all; }
.share-disclaimer { flex: 1; font-size: 10.5px; line-height: 1.6; color: #a79fbb; background: rgba(251, 87, 0, .06); border: 1px solid rgba(255, 138, 30, .2); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; }
.share-disclaimer strong { color: #ffc27a; margin: 0 4px; white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-hero { grid-column: span 2; }
  .analytics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .header-inner { height: 64px; }
  .logo-3d { width: 44px; height: 44px; }
  .brand-name { font-size: 18px; }
  .brand-badge { display: none; }
  .brand-tagline { font-size: 10px; }
  .sync-chip #syncText { display: none; }
  .command-bar { flex-direction: column; align-items: stretch; padding: 14px; }
  .page-title { font-size: 16px; }
  .page-sub { font-size: 11.5px; margin-left: 16px; }
  .page-sub .sep { display: none; }
  #periodSelector { min-width: 0; font-size: 13px; }
  .period-picker label { font-size: 11px; }
  .main { padding-top: 14px; gap: 14px; }
  .kpi-grid { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .kpi-value.big { font-size: 32px; }
  .kpi-label { font-size: 10px; }
  .chart-card, .risk-card, .table-card { padding: 14px; }
  .chart-box { height: 200px; }
  .filters, .filter-row { width: 100%; }
  .filter-row { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-row select { width: 100%; }
  .search-wrap { width: 100%; grid-column: span 2; }
  #btnShare { grid-column: span 2; }
  .day-filter { width: 100%; overflow-x: auto; }
  .day-btn { flex: 1; }
  .swipe-hint { display: flex; justify-content: space-between; margin-top: 10px; padding: 6px 10px; font-size: 11px; border-radius: 8px; color: #ffd3a1; background: rgba(255, 138, 30, .08); border: 1px solid rgba(255, 138, 30, .2); }
  .table-scroll { margin-top: 10px; }
  .legal-card { flex-direction: column; padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .modal { padding: 10px; align-items: flex-end; }
  .modal-box { padding: 16px; max-height: 94vh; }
  .admin-row { flex-direction: column; align-items: stretch; }
  .admin-row .actions { justify-content: flex-end; }
  .share-scroll { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
