/* ============================================================================
   ServX Marketing Hub — Design System
   Brand: deep navy canvas + cyan gradient, lifted from dev.servx.mt
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  /* Brand */
  --navy-900:   #000C24;   /* canvas */
  --navy-850:   #050f2e;
  --slate-900:  #0F172A;   /* surfaces */
  --slate-800:  #1E293B;
  --slate-700:  #334155;
  --cyan:       #00D6D6;   /* primary accent */
  --cyan-600:   #00ABD6;
  --cyan-bright:#00DDFF;
  --grad:       linear-gradient(90deg, #00D6D6 0%, #00ABD6 100%);
  --grad-soft:  linear-gradient(135deg, rgba(0,214,214,.16), rgba(0,171,214,.05));

  /* Text */
  --txt:        #F8FAFC;
  --txt-mute:   #9CA3AF;
  --txt-dim:    #64748B;

  /* Feedback */
  --ok:   #10B981;
  --warn: #F59E0B;
  --err:  #EF4444;
  --info: #38BDF8;

  /* Lines & radius */
  --line:    rgba(148,163,184,.14);
  --line-cy: rgba(0,214,214,.28);
  --r:   14px;
  --r-sm: 9px;
  --r-lg: 20px;

  --sidebar: 252px;
  --shadow: 0 18px 40px -20px rgba(0,0,0,.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--navy-900);
  color: var(--txt);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /* ambient glow */
  background-image:
    radial-gradient(900px 500px at 80% -10%, rgba(0,214,214,.10), transparent 60%),
    radial-gradient(700px 500px at 0% 110%, rgba(0,171,214,.08), transparent 55%);
  background-attachment: fixed;
}

h1,h2,h3,h4 { font-family: 'Space Grotesk', 'Inter', sans-serif; letter-spacing: -.02em; }
a { color: inherit; text-decoration: none; }

/* ---------- App shell ----------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(15,23,42,.92), rgba(5,15,46,.92));
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--grad);
  display: grid; place-items: center; color: #00121a; font-weight: 700;
  font-family: 'Space Grotesk'; box-shadow: 0 6px 18px -6px rgba(0,214,214,.6);
}
.brand .name { font-family: 'Space Grotesk'; font-weight: 600; font-size: 16px; }
.brand .name span { color: var(--cyan); }

.nav-group { margin-top: 8px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--txt-dim); padding: 14px 10px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--txt-mute); font-weight: 500; font-size: 13.5px; margin-bottom: 2px;
  transition: background .15s, color .15s; cursor: pointer;
}
.nav-item:hover { background: rgba(148,163,184,.08); color: var(--txt); }
.nav-item.active { color: var(--txt); background: var(--grad-soft); box-shadow: inset 0 0 0 1px var(--line-cy); }
.nav-item.active svg { color: var(--cyan); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); }
.user-chip .av { width: 32px; height: 32px; border-radius: 50%; background: var(--grad);
  display: grid; place-items: center; color: #00121a; font-weight: 700; font-size: 13px; }
.user-chip .meta { overflow: hidden; }
.user-chip .meta b { display: block; font-size: 13px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.user-chip .meta small { color: var(--txt-dim); font-size: 11px; }

/* ---------- Main ---------------------------------------------------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 30px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(0,12,36,.72); backdrop-filter: blur(12px); z-index: 20;
}
.topbar h1 { font-size: 19px; font-weight: 600; }
.topbar .sub { color: var(--txt-mute); font-size: 12.5px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 26px 30px 60px; max-width: 1320px; width: 100%; }

.hamburger { display: none; background: none; border: 0; color: var(--txt); cursor: pointer; }

/* ---------- Buttons ------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--slate-800); color: var(--txt); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all .15s; font-family: inherit; white-space: nowrap;
}
.btn:hover { border-color: var(--line-cy); transform: translateY(-1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--grad); color: #00121a; border: 0; box-shadow: 0 8px 22px -10px rgba(0,214,214,.7); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: rgba(239,68,68,.4); color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,.12); border-color: var(--err); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; }

/* ---------- Cards --------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, rgba(30,41,59,.55), rgba(15,23,42,.55));
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .hint { color: var(--txt-dim); font-size: 12px; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.col-span-2 { grid-column: span 2; }

/* ---------- Stat cards ---------------------------------------------------- */
.stat {
  background: linear-gradient(180deg, rgba(30,41,59,.6), rgba(15,23,42,.5));
  border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px;
  position: relative; overflow: hidden;
}
.stat::after { content:''; position:absolute; right:-30px; top:-30px; width:120px; height:120px;
  background: var(--grad-soft); border-radius:50%; filter: blur(6px); }
.stat .label { color: var(--txt-mute); font-size: 12px; font-weight: 500; display:flex; align-items:center; gap:7px; }
.stat .label .dot { width:8px; height:8px; border-radius:50%; background: var(--cyan); box-shadow:0 0 10px var(--cyan); }
.stat .value { font-family: 'Space Grotesk'; font-size: 28px; font-weight: 700; margin: 10px 0 4px; letter-spacing:-.03em; }
.stat .delta { font-size: 12px; font-weight: 600; }
.stat .delta.up { color: var(--ok); }
.stat .delta.down { color: var(--err); }

/* ---------- Tables -------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; color: var(--txt-dim); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em; padding: 10px 14px; border-bottom: 1px solid var(--line);
}
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: rgba(148,163,184,.04); }
tbody tr:last-child td { border-bottom: 0; }
td .muted { color: var(--txt-mute); }

/* ---------- Badges & tags ------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); }
.badge.ok   { color: #6ee7b7; background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.3); }
.badge.warn { color: #fcd34d; background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); }
.badge.err  { color: #fca5a5; background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); }
.badge.mute { color: var(--txt-mute); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.tag-pill { display:inline-flex; align-items:center; gap:6px; padding:3px 9px; border-radius:7px;
  font-size:11.5px; font-weight:600; background: rgba(148,163,184,.08); }
.tag-pill .swatch { width:8px; height:8px; border-radius:3px; }

/* ---------- Forms --------------------------------------------------------- */
label.field { display:block; margin-bottom: 14px; }
label.field > span { display:block; font-size:12.5px; font-weight:600; color:var(--txt-mute); margin-bottom:6px; }
.input, textarea.input, select.input {
  width:100%; padding:10px 13px; background: rgba(2,6,23,.55); border:1px solid var(--line);
  border-radius: var(--r-sm); color: var(--txt); font-family: inherit; font-size:13.5px; transition: border .15s, box-shadow .15s;
}
.input:focus, textarea.input:focus, select.input:focus {
  outline:0; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,214,214,.15);
}
textarea.input { resize: vertical; min-height: 120px; line-height:1.55; }
.input::placeholder { color: var(--txt-dim); }
.help { font-size:11.5px; color: var(--txt-dim); margin-top:5px; }
.row { display:flex; gap:14px; } .row > * { flex:1; }

/* checkbox cards for platform selection */
.platform-pick { display:grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap:10px; }
.platform-pick label {
  display:flex; align-items:center; gap:10px; padding:12px; border:1px solid var(--line);
  border-radius:var(--r-sm); cursor:pointer; transition:all .15s; background: rgba(2,6,23,.4);
}
.platform-pick label:hover { border-color: var(--line-cy); }
.platform-pick input { accent-color: var(--cyan); width:16px; height:16px; }
.platform-pick .pf { width:26px; height:26px; border-radius:7px; display:grid; place-items:center; font-size:12px; font-weight:700; }

/* ---------- Connection rows ---------------------------------------------- */
.conn-card { display:flex; flex-direction:column; gap:14px; }
.conn-head { display:flex; align-items:center; gap:13px; }
.pf-logo { width:42px; height:42px; border-radius:11px; display:grid; place-items:center; font-weight:700; color:#fff; font-size:15px; flex-shrink:0; }
.conn-head .t { flex:1; }
.conn-head .t b { font-size:15px; }
.conn-head .t small { color:var(--txt-mute); display:block; }

/* ---------- Flash / toasts ----------------------------------------------- */
.flash-stack { position: fixed; top: 18px; right: 18px; z-index: 100; display:flex; flex-direction:column; gap:10px; }
.flash { display:flex; align-items:center; gap:10px; padding:12px 16px; border-radius:var(--r-sm);
  background: var(--slate-800); border:1px solid var(--line); box-shadow: var(--shadow);
  font-size:13px; font-weight:500; animation: slidein .3s ease; min-width: 260px; }
.flash.success { border-color: rgba(16,185,129,.4); }
.flash.error { border-color: rgba(239,68,68,.4); }
.flash .ic { width:18px; height:18px; }
.flash.success .ic { color: var(--ok); } .flash.error .ic { color: var(--err); }
@keyframes slidein { from { opacity:0; transform: translateX(20px);} to {opacity:1;transform:none;} }

/* ---------- Chart ---------------------------------------------------------*/
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 230px; }
.legend { display:flex; flex-wrap:wrap; gap:14px; margin-top:14px; }
.legend .li { display:flex; align-items:center; gap:7px; font-size:12px; color:var(--txt-mute); }
.legend .li .sw { width:10px; height:10px; border-radius:3px; }

/* ---------- Login --------------------------------------------------------- */
.auth-wrap { min-height:100vh; display:grid; place-items:center; padding:24px; }
.auth-card { width:100%; max-width:400px; }
.auth-card .card { padding:32px; }
.auth-logo { display:flex; align-items:center; gap:11px; justify-content:center; margin-bottom:8px; }
.auth-logo .mark { width:38px; height:38px; border-radius:10px; background:var(--grad); display:grid; place-items:center; color:#00121a; font-weight:700; font-family:'Space Grotesk'; font-size:18px; }
.auth-card h2 { text-align:center; font-size:21px; margin-bottom:4px; }
.auth-card .lead { text-align:center; color:var(--txt-mute); font-size:13px; margin-bottom:24px; }
.demo-note { margin-top:18px; padding:11px 13px; border:1px dashed var(--line-cy); border-radius:var(--r-sm);
  font-size:11.5px; color:var(--txt-mute); background: rgba(0,214,214,.04); }

/* ---------- Misc ---------------------------------------------------------- */
.page-actions { display:flex; gap:10px; align-items:center; }
.empty { text-align:center; padding:46px 20px; color:var(--txt-mute); }
.empty svg { width:40px; height:40px; color:var(--txt-dim); margin-bottom:12px; }
.section-title { font-size:13px; text-transform:uppercase; letter-spacing:.08em; color:var(--txt-dim); font-weight:600; margin: 6px 0 14px; }
.divider { height:1px; background: var(--line); margin: 20px 0; }
.kpi-mini { display:flex; gap:8px; align-items:baseline; }
.kpi-mini b { font-family:'Space Grotesk'; font-size:18px; }
.progress { height:6px; background: rgba(2,6,23,.6); border-radius:99px; overflow:hidden; }
.progress > i { display:block; height:100%; background: var(--grad); border-radius:99px; }
.mt-3{margin-top:18px;} .mt-2{margin-top:12px;} .mb-2{margin-bottom:12px;}
.flex{display:flex;} .between{justify-content:space-between;} .center{align-items:center;} .gap{gap:10px;}

/* ---------- Modal --------------------------------------------------------- */
.modal-bg { position:fixed; inset:0; background:rgba(0,6,20,.7); backdrop-filter:blur(4px);
  z-index:90; display:none; place-items:center; padding:24px; }
.modal-bg.open { display:grid; }
.modal { width:100%; max-width:460px; max-height: 88vh; overflow-y:auto; animation: slidein .25s; }
.modal .card-head h3 { font-size:16px; }
.x-close { background:none; border:0; color:var(--txt-mute); cursor:pointer; font-size:20px; line-height:1; }

/* ---------- Responsive ---------------------------------------------------- */
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: auto; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left:0; top:0; z-index:60; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .hamburger { display:block; }
  .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 14px 18px; }
}

/* ---------- Print (Reports -> PDF) ---------------------------------------- */
@media print {
  body { background: #fff !important; color: #000; }
  .sidebar, .topbar, .topbar-actions, .hamburger, .flash-stack, .page-actions, .demo-note { display: none !important; }
  .main, .content { padding: 0 !important; max-width: 100% !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; background: #fff !important; page-break-inside: avoid; }
  .card-head h3, h1, h2, h3, b, td, th { color: #000 !important; }
  table { font-size: 11px; }
  thead th { color: #444 !important; }
  .chart-box { height: 240px; }
  a[href]:after { content: ""; }
  .print-header { display: block !important; margin-bottom: 16px; }
}
.print-header { display: none; }
