:root {
  --bg: #f8fafc;
  --bg-elev: #ffffff;
  --bg-muted: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: rgba(79, 70, 229, 0.12);
  --accent: #06b6d4;
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.14);
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 36px rgba(15, 23, 42, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-elev: #111827;
  --bg-muted: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #1f2937;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.18);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.main-content { flex: 1; padding: 28px 0 56px; }

/* Announcement Bar */
.announcement-bar {
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #0ea5e9);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  padding: 8px 16px;
}
.announcement-bar a { color: #fff; text-decoration: underline; }

/* Navbar */
.navbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 68px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.18rem; color: var(--text);
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 1rem;
}
.brand img { height: 34px; width: auto; border-radius: 6px; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  color: var(--text-muted); font-weight: 500; font-size: 0.93rem;
  padding: 7px 12px; border-radius: var(--radius-sm); transition: 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg-muted); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.mobile-toggle { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem;
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease;
  background: var(--bg-muted); color: var(--text); line-height: 1.2;
}
.btn:hover { opacity: 0.92; transform: translateY(-1px); color: var(--text); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; }
.btn-warning { background: var(--warning); color: #111827; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-muted); }
.btn-sm { padding: 6px 11px; font-size: 0.82rem; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 9px; position: relative; }

/* Cards & Grids */
.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.card-title { margin: 0; font-size: 1.08rem; font-weight: 700; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.flex-wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.76rem; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* Hero */
.hero {
  background: radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.18), transparent 45%),
              radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.15), transparent 45%),
              var(--bg-elev);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 54px 36px; text-align: center; box-shadow: var(--shadow-lg);
}
.hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.15; margin: 12px auto 16px; max-width: 820px; letter-spacing: -0.02em; }
.hero p { max-width: 680px; margin: 0 auto 26px; color: var(--text-muted); font-size: 1.08rem; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary-soft); color: var(--primary);
  padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 0.84rem;
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: #d97706; }
[data-theme="dark"] .badge-warning { color: #fbbf24; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--bg-muted); color: var(--text-muted); }

/* Alerts */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: 0.92rem; font-weight: 500; border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(16,185,129,0.28); }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(239,68,68,0.28); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: rgba(59,130,246,0.28); }
.alert-warning { background: var(--warning-soft); color: #b45309; border-color: rgba(245,158,11,0.3); }
[data-theme="dark"] .alert-warning { color: #fbbf24; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-weight: 600; font-size: 0.86rem; margin-bottom: 5px; color: var(--text); }
.form-control, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 0.92rem; font-family: inherit; transition: border-color 0.15s;
}
.form-control:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { min-height: 96px; resize: vertical; }
.form-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem; }
.form-check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 700; background: var(--bg-muted); }
tr:hover td { background: color-mix(in srgb, var(--bg-muted) 45%, transparent); }

/* Panel / Admin Sidebar Layout */
.dash-layout { display: grid; grid-template-columns: 255px minmax(0, 1fr); gap: 24px; align-items: start; }
.sidebar {
  position: sticky; top: 88px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.sidebar-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 10px 10px 6px; }
.side-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-muted);
  font-weight: 500; font-size: 0.9rem; margin-bottom: 2px;
}
.side-link:hover, .side-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* Stat Cards */
.stat-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 1.65rem; font-weight: 800; margin-top: 6px; letter-spacing: -0.02em; }

/* Software Card */
.sw-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.sw-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.sw-thumb {
  height: 175px; background: linear-gradient(135deg, #1e1b4b, #312e81, #0e7490);
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-weight: 800; font-size: 1.15rem; position: relative; overflow: hidden;
}
.sw-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sw-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.sw-title { margin: 6px 0 8px; font-size: 1.06rem; font-weight: 700; color: var(--text); }
.price-old { text-decoration: line-through; color: var(--text-muted); font-size: 0.85rem; margin-right: 6px; }
.price-now { font-size: 1.2rem; font-weight: 800; color: var(--primary); }

/* Progress Bar & Chat & Timeline */
.progress-wrap { width: 100%; height: 12px; background: var(--bg-muted); border-radius: 999px; overflow: hidden; }
.progress-bar {
  height: 100%; background: linear-gradient(90deg, #4f46e5, #06b6d4, #10b981);
  border-radius: 999px; transition: width 0.35s ease;
}
.chat-box { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 6px; }
.chat-msg { max-width: 82%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-muted); }
.chat-msg.mine { align-self: flex-end; background: var(--primary-soft); border-color: rgba(99,102,241,0.3); }
.chat-msg.internal { align-self: stretch; max-width: 100%; background: var(--warning-soft); border-color: rgba(245,158,11,0.4); }
.timeline { border-left: 2px solid var(--border); margin-left: 8px; padding-left: 18px; }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
  content: ""; position: absolute; left: -24px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); border: 2px solid var(--bg-elev);
}

/* Kanban */
.kanban-grid { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 16px; overflow-x: auto; }
.kanban-col { background: var(--bg-muted); border-radius: var(--radius); padding: 12px; min-height: 320px; }
.kanban-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow); }

/* Notification Dropdown */
.notif-wrap { position: relative; }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.7rem;
  font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.notif-panel {
  display: none; position: absolute; right: 0; top: 46px; width: 340px; max-width: 92vw;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 100; overflow: hidden;
}
.notif-panel.open { display: block; }
.notif-item { display: block; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 0.85rem; }
.notif-item:hover { background: var(--bg-muted); }
.notif-item.unread { background: var(--primary-soft); }

/* Google SERP Preview */
.serp-box { background: #fff; color: #202124; border: 1px solid #dadce0; border-radius: 10px; padding: 16px; font-family: Arial, sans-serif; }
.serp-url { font-size: 13px; color: #202124; margin-bottom: 3px; }
.serp-title { font-size: 19px; color: #1a0dab; font-weight: 500; margin-bottom: 4px; line-height: 1.3; }
.serp-desc { font-size: 13.5px; color: #4d5156; line-height: 1.45; }

/* Installer Wizard */
.wizard-steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 24px; }
.wizard-step {
  padding: 10px 8px; text-align: center; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-muted); font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
}
.wizard-step.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.wizard-step.done { background: var(--success-soft); color: var(--success); border-color: var(--success); }

/* Footer */
.footer { background: var(--bg-elev); border-top: 1px solid var(--border); padding: 40px 0 24px; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; }
.footer h4 { margin: 0 0 12px; font-size: 0.95rem; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 7px; font-size: 0.88rem; }
.footer li a { color: var(--text-muted); }
.footer li a:hover { color: var(--primary); }

/* Toast */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 0.88rem; max-width: 340px; }

/* Responsive */
@media (max-width: 980px) {
  .dash-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .wizard-steps { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
  .nav-links { display: none; position: absolute; left: 0; right: 0; top: 68px; background: var(--bg-elev); border-bottom: 1px solid var(--border); flex-direction: column; padding: 12px; }
  .nav-links.open { display: flex; }
  .mobile-toggle { display: inline-flex; }
  .grid-2, .grid-3, .grid-4, .footer-grid { grid-template-columns: 1fr; }
  .hero { padding: 34px 18px; }
}
