*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f172a; --bg2: #1e293b; --bg3: #334155; --border: #334155;
  --text: #f1f5f9; --text2: #94a3b8;
  --primary: #1a56db; --primary2: #1d4ed8; --accent: #38bdf8;
  --success: #22c55e; --danger: #ef4444; --warn: #f59e0b;
  --lazada: #f57224; --shopee: #ee4d2d;
  --radius: 8px;
}
html { font-size: 15px; }
body { font-family: 'Sarabun', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
input, select, textarea { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 8px 12px; font-family: inherit; font-size: .9rem; width: 100%; transition: border-color .2s; }
input:focus, select:focus { outline: none; border-color: var(--primary); }

/* ── Navbar ── */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 200; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; height: 56px; background: rgba(15,23,42,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.brand-link { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 900; font-size: 1.1rem; }
.brand-sub  { color: var(--primary); }
.nav-links  { display: flex; align-items: center; gap: 16px; }
.nav-link   { color: var(--text2); font-size: .85rem; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius); font-family: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; border: none; transition: all .15s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary2); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: .82rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.hidden { display: none !important; }

/* ── App Shell ── */
.app-shell { display: flex; min-height: 100vh; padding-top: 56px; }
.sidebar { width: 220px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 56px; bottom: 0; left: 0; }
.sidebar-nav { padding: 12px 0; flex: 1; }
.sidebar-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 20px; background: none; border: none; cursor: pointer; color: var(--text2); font-family: inherit; font-size: .88rem; text-align: left; transition: all .15s; }
.sidebar-item:hover { background: var(--bg3); color: var(--text); }
.sidebar-item.active { background: rgba(26,86,219,.2); color: var(--primary); }
.si-icon { width: 20px; font-size: 1rem; }
.sidebar-user { padding: 14px 20px; border-top: 1px solid var(--border); font-size: .82rem; color: var(--text2); }
.sidebar-user img { width: 26px; height: 26px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.main-content { margin-left: 220px; flex: 1; padding: 28px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { font-size: 1.4rem; font-weight: 600; }

/* ── Forms ── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: .82rem; color: var(--text2); font-weight: 500; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ── Add card ── */
.add-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.step-label { font-size: .82rem; font-weight: 600; color: var(--accent); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .05em; }

/* ── Preview card ── */
.preview-card { display: flex; gap: 16px; background: var(--bg3); border-radius: var(--radius); padding: 14px; margin-top: 12px; align-items: flex-start; }
.preview-img { width: 80px; height: 80px; object-fit: contain; border-radius: 6px; background: #fff; flex-shrink: 0; }
.preview-img-placeholder { width: 80px; height: 80px; background: var(--bg); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 2rem; flex-shrink: 0; }
.preview-name { font-weight: 600; font-size: .95rem; margin-bottom: 4px; line-height: 1.3; }
.preview-price { font-size: 1.3rem; font-weight: 900; color: var(--success); }
.preview-no-price { color: var(--warn); font-size: .85rem; }
.badge-platform { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .72rem; font-weight: 600; margin-bottom: 6px; }
.badge-lazada { background: rgba(245,114,36,.2); color: var(--lazada); }
.badge-shopee { background: rgba(238,77,45,.2); color: var(--shopee); }
.badge-unknown { background: rgba(148,163,184,.2); color: var(--text2); }

/* ── Watch cards ── */
.watch-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; display: flex; gap: 14px; align-items: flex-start; }
.watch-card.alerted { border-color: var(--success); }
.watch-card.inactive { opacity: .55; }
.watch-img { width: 70px; height: 70px; object-fit: contain; border-radius: 6px; background: #fff; flex-shrink: 0; }
.watch-img-placeholder { width: 70px; height: 70px; background: var(--bg3); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; flex-shrink: 0; }
.watch-body { flex: 1; min-width: 0; }
.watch-name { font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.watch-prices { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 6px; }
.price-current { font-size: 1.1rem; font-weight: 900; color: var(--success); }
.price-target  { font-size: .9rem; color: var(--text2); }
.price-no-data { font-size: .85rem; color: var(--warn); }
.watch-meta    { font-size: .78rem; color: var(--text2); }
.watch-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.badge-alerted { background: rgba(34,197,94,.15); color: var(--success); font-size: .72rem; padding: 2px 8px; border-radius: 99px; }
.badge-waiting { background: rgba(56,189,248,.15); color: var(--accent); font-size: .72rem; padding: 2px 8px; border-radius: 99px; }
.badge-inactive { background: rgba(148,163,184,.15); color: var(--text2); font-size: .72rem; padding: 2px 8px; border-radius: 99px; }

/* ── Progress bar ── */
.price-progress { height: 5px; background: var(--bg3); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.price-progress-fill { height: 100%; background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e); border-radius: 99px; }

/* ── Empty ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-state p { margin-bottom: 12px; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 300; display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px 20px; overflow-y: auto; }
.modal-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 700px; padding: 28px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h2 { font-size: 1.1rem; font-weight: 600; margin: 0; }
.chart-wrap { background: var(--bg3); border-radius: 10px; padding: 16px; }

/* ── Landing ── */
.landing { padding-top: 80px; }
.hero { text-align: center; padding: 60px 20px 40px; max-width: 680px; margin: 0 auto; }
.hero-badge { display: inline-block; background: rgba(26,86,219,.2); color: var(--accent); font-size: .78rem; font-weight: 600; padding: 4px 14px; border-radius: 99px; margin-bottom: 18px; border: 1px solid rgba(26,86,219,.4); }
.hero-title { font-size: 2.4rem; font-weight: 900; line-height: 1.2; margin-bottom: 14px; }
.gradient-text { background: linear-gradient(135deg, #1a56db, #38bdf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-subtitle { color: var(--text2); font-size: 1rem; margin-bottom: 28px; line-height: 1.7; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; max-width: 960px; margin: 0 auto 80px; padding: 0 20px; }
.feature-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature-icon { font-size: 2rem; margin-bottom: 10px; }
.feature-card h3 { font-size: .95rem; font-weight: 600; margin-bottom: 6px; }
.feature-card p { color: var(--text2); font-size: .85rem; line-height: 1.6; }

@media (max-width: 700px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .watch-card { flex-wrap: wrap; }
  .hero-title { font-size: 1.8rem; }
}

/* ════════════ LIGHT THEME ════════════ */
:root {
  --bg: #ffffff; --bg2: #f8fafc; --bg3: #f1f5f9; --border: #e2e8f0;
  --text: #0f172a; --text2: #64748b;
  --primary: #1a56db; --primary2: #1d4ed8; --accent: #1a56db;
  --success: #16a34a; --warn: #d97706; --danger: #dc2626;
  --radius: 8px;
}
body { background: #fff; color: #0f172a; }
a { color: var(--primary); }
input, select, textarea { background: #fff; border-color: #e2e8f0; color: #0f172a; }
.navbar { background: rgba(255,255,255,.97); border-bottom: 1px solid #e2e8f0; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.brand-link { color: #0f172a; }
.nav-link { color: #64748b; }
.nav-link:hover { color: #0f172a; text-decoration: none; }
.sidebar { background: #f8fafc; border-color: #e2e8f0; }
.sidebar-item { color: #64748b; }
.sidebar-item:hover { background: #f1f5f9; color: #0f172a; }
.sidebar-item.active { background: rgba(26,86,219,.08); color: #1a56db; }
.sidebar-user { color: #64748b; border-color: #e2e8f0; }
.main-content { background: #fff; }
.card { background: #fff; border-color: #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.data-table { background: #fff; }
.data-table th { background: #f8fafc; color: #64748b; }
.data-table td { border-color: #e2e8f0; }
.data-table tr:hover td { background: rgba(0,0,0,.02); }
.stat-card { background: #fff; border-color: #e2e8f0; }
.stat-label { color: #64748b; }
.stat-value { color: #1a56db; }
.empty-state { color: #94a3b8; }
.hero-badge { background: rgba(26,86,219,.08); color: #1a56db; border-color: rgba(26,86,219,.25); }
.hero-title { color: #0f172a; }
.hero-subtitle { color: #64748b; }
.gradient-text { background: linear-gradient(135deg,#1a56db,#0ea5e9); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.feature-card { background: #fff; border-color: #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.feature-card p { color: #64748b; }
.btn-outline { color: #0f172a; border-color: #e2e8f0; }
.btn-outline:hover { border-color: #1a56db; color: #1a56db; background: rgba(26,86,219,.05); }
.modal-box { background: #fff; border-color: #e2e8f0; }

.th-flag {
  background: linear-gradient(90deg,
    #A51931 0%, #A51931 25%,
    #C0C0CC 25%, #C0C0CC 37.5%,
    #2E3192 37.5%, #2E3192 62.5%,
    #C0C0CC 62.5%, #C0C0CC 75%,
    #A51931 75%, #A51931 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 900;
  border: none;
  padding: 0;
  text-shadow: none;
  filter: none;
  display: inline;
}
