:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #6c5ce7;
  --primary-2: #a29bfe;
  --grad: linear-gradient(135deg, #6c5ce7 0%, #0984e3 50%, #00b894 100%);
  --grad-hot: linear-gradient(135deg, #e17055 0%, #f39c12 100%);
  --success: #00b894;
  --danger: #e17055;
  --warn: #f39c12;
  --info: #0984e3;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(76, 60, 170, 0.08);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--text); }
.brand-badge {
  background: var(--grad);
  color: #fff;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 20px;
  box-shadow: var(--shadow);
}
.brand-name { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; gap: 6px; flex: 1; }
.nav-link {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav-link:hover { color: var(--primary); background: #eef2ff; }
.nav-link.active { color: var(--primary); background: #eef2ff; }
.nav-user { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  color: #fff;
  display: inline-grid; place-items: center;
  font-weight: 700;
}
.nav-user .nav-link { gap: 8px; }
.nav-user-name { display: flex; flex-direction: column; line-height: 1.15; }
.role-badge { font-size: 10px; font-weight: 700; color: #fff; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; display: inline-block; }

/* ---------- Layout ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
  flex: 1;
}
.footer {
  text-align: center;
  padding: 22px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: var(--card);
}
.footer div:first-child { font-weight: 700; color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(108,92,231,.35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(108,92,231,.45); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); background: #f8faff; }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card h2, .card h3 { font-size: 17px; margin-bottom: 14px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Stat cards ---------- */
.stat {
  padding: 20px;
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: '';
  position: absolute;
  right: -30px; top: -30px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
}
.stat-icon { font-size: 28px; }
.stat-num { font-size: 26px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 13px; opacity: .9; margin-top: 3px; }
.s-purple { background: linear-gradient(135deg,#6c5ce7,#a29bfe); }
.s-blue   { background: linear-gradient(135deg,#0984e3,#74b9ff); }
.s-green  { background: linear-gradient(135deg,#00b894,#55efc4); }
.s-orange { background: linear-gradient(135deg,#f39c12,#ffeaa7); }
.s-red    { background: linear-gradient(135deg,#e17055,#ff7675); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--border);
  background: #f8fafc;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f8faff; }

/* ---------- Badges & Pills ---------- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: .3px;
}
.b-new { background: #eef2ff; color: #4338ca; }
.b-open { background: #e0f2fe; color: #0369a1; }
.b-in_progress { background: #fef3c7; color: #b45309; }
.b-waiting { background: #f1f5f9; color: #475569; }
.b-resolved { background: #d1fae5; color: #047857; }
.b-closed { background: #e2e8f0; color: #334155; }
.p-low { background: #e2e8f0; color: #334155; }
.p-medium { background: #fef3c7; color: #b45309; }
.p-high { background: #ffe4e6; color: #be123c; }
.p-critical { background: #fee2e2; color: #b91c1c; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: #334155; }
.input, textarea.input, select.input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  font-size: 14px;
  font-family: inherit;
  transition: all .15s;
  background: #fff;
  color: var(--text);
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,92,231,.15); }
textarea.input { min-height: 130px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Flash ---------- */
.flash {
  padding: 13px 18px;
  border-radius: 11px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
}
.flash-success { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.flash-danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.flash-info { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }

/* ---------- Charts (CSS bars) ---------- */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bar {
  width: 100%;
  max-width: 56px;
  border-radius: 8px 8px 4px 4px;
  background: var(--grad);
  transition: height .4s ease;
  min-height: 6px;
  box-shadow: 0 4px 12px rgba(76,60,170,.25);
}
.chart-bar.peach { background: linear-gradient(180deg,#f39c12,#e17055); box-shadow: 0 4px 12px rgba(225,112,85,.3); }
.chart-label { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.chart-value { font-size: 13px; font-weight: 800; color: var(--text); }
.chart-h { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.chart-h .bar { height: 10px; border-radius: 99px; flex: 1; }
.donut { display: flex; flex-wrap: wrap; gap: 10px; }
.donut-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.donut-item b { margin-left: auto; font-weight: 800; }

/* ---------- Landing ---------- */
.landing { max-width: 1200px; margin: 0 auto; padding: 24px; flex: 1; width: 100%; }
.hero {
  background: var(--grad);
  border-radius: 24px;
  color: #fff;
  padding: 70px 50px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(108,92,231,.4);
}
.hero::before, .hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.hero::before { width: 340px; height: 340px; top: -140px; left: -100px; }
.hero::after { width: 280px; height: 280px; bottom: -120px; right: -80px; }
.hero * { position: relative; z-index: 1; }
.hero h1 { font-size: 52px; font-weight: 800; margin-bottom: 14px; letter-spacing: -1px; }
.hero p { font-size: 18px; opacity: .95; max-width: 640px; margin: 0 auto 28px; }
.hero .btn { background: #fff; color: var(--primary); font-weight: 800; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.hero .btn:hover { transform: translateY(-2px); }
.hero-badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 26px; }
.hero-badge { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); padding: 6px 14px; border-radius: 99px; font-size: 13px; font-weight: 700; backdrop-filter: blur(4px); }

.section-title { text-align: center; margin: 60px 0 30px; }
.section-title h2 { font-size: 32px; font-weight: 800; color: var(--text); }
.section-title p { color: var(--muted); margin-top: 6px; }

.feature {
  padding: 28px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all .2s;
}
.feature:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(76,60,170,.15); }
.feature .icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 24px;
  margin-bottom: 16px;
  color: #fff;
}
.feature h3 { font-size: 17px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 14px; line-height: 1.55; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; text-align: center; }
.step { padding: 26px; background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); }
.step-num {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  display: grid; place-items: center;
  margin: 0 auto 14px;
  box-shadow: var(--shadow);
}
@media (max-width: 700px) { .steps { grid-template-columns: 1fr; } .hero h1 { font-size: 34px; } }

.cta-band {
  margin-top: 60px;
  background: var(--grad-hot);
  color: #fff;
  border-radius: 20px;
  padding: 44px 30px;
  text-align: center;
  box-shadow: 0 16px 44px rgba(243,156,18,.35);
}
.cta-band h2 { font-size: 28px; margin-bottom: 8px; }
.cta-band .btn { background: #fff; color: #c0392b; font-weight: 800; }

/* ---------- Auth ---------- */
.auth-page { display: grid; place-items: center; background: var(--grad); min-height: 100vh; }
.auth-card {
  background: var(--card);
  padding: 40px;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
}
.auth-card h1 { font-size: 26px; margin: 14px 0 6px; font-weight: 800; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.auth-logo {
  background: var(--grad);
  width: 56px; height: 56px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 28px;
  box-shadow: var(--shadow);
}
.auth-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-alt a { font-weight: 700; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }

/* ---------- Ticket view ---------- */
.ticket-meta { display: flex; flex-wrap: wrap; gap: 14px; margin: 16px 0 20px; }
.ticket-meta .meta { font-size: 13px; color: var(--muted); }
.ticket-meta .meta b { color: var(--text); }
.comment {
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  margin-bottom: 12px;
}
.comment.internal { background: #fff8e6; border-color: #fde68a; }
.comment .head { font-size: 13px; font-weight: 700; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comment .time { color: var(--muted); font-weight: 500; font-size: 12px; }
.comment .body { font-size: 14px; color: var(--text); white-space: pre-wrap; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar select, .filter-bar input { width: auto; min-width: 130px; }
.search-input { flex: 1; min-width: 200px !important; }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 10px; }

.ticket-num { font-family: 'SFMono-Regular', Consolas, monospace; font-weight: 700; color: var(--primary); }