:root {
  --sp-blue: #209abc;
  --sp-blue-dark: #14657c;
  --sp-blue-light: #6ec4f5;
  --sp-ink: #17181b;
  --sp-panel: #17181b;
  --sp-panel-2: #1e2128;
  --sp-border: #e6e9ef;
  --sp-muted: #68758a;
  --sp-bg: #f4f6fa;
  --sp-green: #00d084;
  --sp-red: #e05252;
  --sp-amber: #f5a623;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--sp-bg);
  color: var(--sp-ink);
}

a { color: var(--sp-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--sp-ink);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
}
.topbar img { height: 44px; }
.topbar .brand { font-weight: 700; font-size: 1.15rem; letter-spacing: 0.02em; }
.topbar .brand span { color: var(--sp-blue-light); }
.topbar nav { margin-left: auto; display: flex; gap: 1.1rem; align-items: center; }
.topbar nav a { color: #cdd8ea; font-size: 0.95rem; }
.topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar form { margin: 0; }
.topbar button.linklike {
  background: none; border: 0; color: #cdd8ea; font: inherit; cursor: pointer; padding: 0;
}
.topbar button.linklike:hover { color: #fff; }

.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; }
.container.narrow { max-width: 640px; }

.card {
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

h1, h2, h3 { margin-top: 0; }
h1 { font-size: 1.5rem; }
.muted { color: var(--sp-muted); font-size: 0.9rem; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.stat { background: #fff; border: 1px solid var(--sp-border); border-left: 4px solid var(--sp-blue); border-radius: 8px; padding: 0.75rem 1rem; }
.stat .num { font-size: 1.6rem; font-weight: 700; }
.stat.crit { border-left-color: var(--sp-red); }
.stat.wait { border-left-color: var(--sp-amber); }
.stat.done { border-left-color: var(--sp-green); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; align-items: center; }
.filters select, .filters input[type="text"] {
  font: inherit; padding: 0.4rem 0.6rem; border: 1px solid var(--sp-border); border-radius: 6px; background: #fff;
}

/* Tables */
table.tickets { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--sp-border); border-radius: 10px; overflow: hidden; }
table.tickets th, table.tickets td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--sp-border); font-size: 0.95rem; }
table.tickets th { background: var(--sp-ink); color: #cdd8ea; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
table.tickets tr:last-child td { border-bottom: 0; }
table.tickets tr:hover td { background: #eef6fd; }

/* Badges */
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge.status-new { background: #e8f0ff; color: var(--sp-blue-dark); }
.badge.status-triaged { background: #e2f1ff; color: #0570ad; }
.badge.status-in_progress { background: #ede7ff; color: #6d5efc; }
.badge.status-waiting_user { background: #fff7ed; color: #b45309; }
.badge.status-resolved { background: #e7faf1; color: #067647; }
.badge.status-closed { background: #e6e9ef; color: var(--sp-muted); }
.badge.prio-low { background: #e6e9ef; color: var(--sp-muted); }
.badge.prio-medium { background: #e8f0ff; color: var(--sp-blue-dark); }
.badge.prio-high { background: #fff7ed; color: #b45309; }
.badge.prio-critical { background: #fff1f2; color: var(--sp-red); }
.badge.kind { background: #f3f0ff; color: #6d5efc; }

/* Forms */
form.stacked p { margin: 0 0 0.9rem; }
form.stacked label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.92rem; }
form.stacked input[type="text"], form.stacked input[type="email"], form.stacked input[type="password"],
form.stacked select, form.stacked textarea {
  width: 100%; font: inherit; padding: 0.55rem 0.7rem; border: 1px solid #cdd8ea; border-radius: 8px; background: #fff;
}
form.stacked textarea { resize: vertical; }
form.stacked input:focus, form.stacked select:focus, form.stacked textarea:focus {
  outline: 2px solid var(--sp-blue-light); border-color: var(--sp-blue);
}

.btn {
  display: inline-block; background: var(--sp-blue); color: #fff; border: 0; border-radius: 8px;
  padding: 0.55rem 1.2rem; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--sp-blue-dark); }
.btn.secondary { background: #fff; color: var(--sp-blue-dark); border: 1px solid #cdd8ea; }
.btn.secondary:hover { background: #eef6fd; }
.btn.small { padding: 0.35rem 0.8rem; font-size: 0.88rem; }

.errorlist { color: var(--sp-red); margin: 0.2rem 0 0; padding-left: 1.1rem; font-size: 0.88rem; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: 0.6rem 1rem; border-radius: 8px; margin-bottom: 0.5rem; background: #e7faf1; color: #067647; border: 1px solid #baf0d8; }
.messages li.error { background: #fff1f2; color: var(--sp-red); border-color: #f5c2c2; }

/* Ticket detail */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }
.meta-list { list-style: none; padding: 0; margin: 0; }
.meta-list li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.35rem 0; border-bottom: 1px dashed var(--sp-border); font-size: 0.92rem; }
.meta-list li:last-child { border-bottom: 0; }
.meta-list .k { color: var(--sp-muted); }

.comment { border: 1px solid var(--sp-border); border-radius: 8px; padding: 0.7rem 0.9rem; margin-bottom: 0.7rem; background: #fff; }
.comment.internal { background: #fffbeb; border-color: #f2e2b3; }
.comment .head { display: flex; gap: 0.6rem; align-items: baseline; margin-bottom: 0.3rem; }
.comment .head .who { font-weight: 600; }
.comment .body { white-space: pre-wrap; }

.timeline { list-style: none; padding: 0; margin: 0; font-size: 0.88rem; }
.timeline li { padding: 0.3rem 0 0.3rem 1rem; border-left: 2px solid var(--sp-blue-light); margin-left: 0.3rem; }

.inline-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.inline-controls form { display: flex; gap: 0.4rem; align-items: center; margin: 0; }
.inline-controls select { font: inherit; padding: 0.35rem 0.5rem; border: 1px solid #cdd8ea; border-radius: 6px; }

/* Public pages */
.hero { text-align: center; padding: 1.5rem 0 0.5rem; }
.hero img { height: 96px; }
.hero h1 { margin: 0.5rem 0 0.25rem; }

footer.site { text-align: center; color: var(--sp-muted); font-size: 0.85rem; padding: 2rem 0 1.5rem; }

h1, h2, h3, .brand { font-family: "Poppins", "Inter", sans-serif; }

/* Honeypot: visually removed, still in the DOM for bots */
.hp { position: absolute; left: -9999px; top: -9999px; height: 0; overflow: hidden; }

/* Landing */
.track-card { max-width: 640px; margin: 0 auto 1.5rem; }
.track-form { display: flex; gap: 0.5rem; }
.track-form input { flex: 1; font: inherit; padding: 0.55rem 0.7rem; border: 1px solid #cdd8ea; border-radius: 8px; }
.track-form input:focus { outline: 2px solid var(--sp-blue-light); border-color: var(--sp-blue); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
