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

:root {
  color-scheme: light dark;

  --bg: #f4f5f7;
  --bg-subtle: #ebecf0;
  --fg: #14151a;
  --fg-muted: #5b5e6b;
  --card: #ffffff;
  --border: #e3e4e9;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0fe;
  --on-primary: #ffffff;

  --success: #0f9d58;
  --success-soft: #e6f6ec;
  --warning: #b7791f;
  --warning-soft: #fdf3df;
  --danger: #d33636;
  --danger-soft: #fbe9e9;
  --neutral-soft: #eef0f3;

  --shadow-sm: 0 1px 2px rgba(20, 21, 26, 0.06);
  --shadow-md: 0 6px 20px rgba(20, 21, 26, 0.08);
  --radius: 10px;
  --radius-lg: 16px;
}

:root[data-theme="dark"] {
  --bg: #101114;
  --bg-subtle: #16171c;
  --fg: #eef0f4;
  --fg-muted: #9a9dab;
  --card: #191a20;
  --border: #2a2c34;

  --primary: #7c74f0;
  --primary-hover: #9089f5;
  --primary-soft: #23214a;
  --on-primary: #101114;

  --success: #3ecf8e;
  --success-soft: #123527;
  --warning: #e0ac4c;
  --warning-soft: #3a2c10;
  --danger: #f0716e;
  --danger-soft: #3a1717;
  --neutral-soft: #21232b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101114;
    --bg-subtle: #16171c;
    --fg: #eef0f4;
    --fg-muted: #9a9dab;
    --card: #191a20;
    --border: #2a2c34;

    --primary: #7c74f0;
    --primary-hover: #9089f5;
    --primary-soft: #23214a;
    --on-primary: #101114;

    --success: #3ecf8e;
    --success-soft: #123527;
    --warning: #e0ac4c;
    --warning-soft: #3a2c10;
    --danger: #f0716e;
    --danger-soft: #3a1717;
    --neutral-soft: #21232b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 1.75rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.5rem; }
p { line-height: 1.6; }
a { color: var(--primary); }

/* ---------- App shell ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.75rem;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand::before {
  content: "";
  width: 9px; height: 9px; border-radius: 3px;
  background: linear-gradient(135deg, var(--primary), #22d3ee);
  display: inline-block;
}

.content { padding: 2.5rem 1.75rem; max-width: 1040px; margin: 0 auto; }
.content-wide { max-width: 1200px; }
.content-full { padding: 0; max-width: none; margin: 0; }

nav { display: flex; align-items: center; gap: 1.5rem; }
nav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.15s ease;
}
nav a:hover { color: var(--fg); }
nav a.active { color: var(--primary); }

/* ---------- Buttons ---------- */

button, .btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
button:hover, .btn:hover { background: var(--primary-hover); }
button:active, .btn:active { transform: translateY(1px); }
button.secondary, .btn.secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
button.secondary:hover { background: var(--bg-subtle); }
button.danger { background: var(--danger); }
button.danger:hover { filter: brightness(1.08); }
nav form button {
  background: transparent; color: var(--fg-muted); border: 1px solid var(--border);
  font-weight: 500; padding: 0.4rem 0.85rem;
}
nav form button:hover { color: var(--fg); background: var(--bg-subtle); }

/* ---------- Cards ---------- */

.card, .auth-card, .stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card { padding: 1.5rem; }

.auth-card { max-width: 380px; margin: 4.5rem auto; padding: 2rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.auth-card form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.25rem; }
.auth-card label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; font-weight: 500; color: var(--fg-muted); }
.auth-card input {
  padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--fg); font-size: 0.95rem; font-family: inherit;
}
.auth-card input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.auth-card button { justify-content: center; margin-top: 0.25rem; }

.error {
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
}

/* ---------- Stat tiles ---------- */

.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat-tile { display: flex; flex-direction: column; gap: 0.35rem; min-width: 160px; padding: 1.25rem 1.4rem; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { font-size: 0.82rem; color: var(--fg-muted); font-weight: 500; }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1.5rem; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); font-weight: 600; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: var(--bg-subtle); }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ---------- Status badges ---------- */

.badge {
  display: inline-flex; align-items: center;
  font-size: 0.76rem; font-weight: 600;
  padding: 0.22rem 0.6rem; border-radius: 999px;
  text-transform: capitalize; white-space: nowrap;
}
.badge-active, .badge-paid, .badge-resolved, .badge-completed { background: var(--success-soft); color: var(--success); }
.badge-pending, .badge-sent, .badge-open, .badge-draft, .badge-in_progress { background: var(--warning-soft); color: var(--warning); }
.badge-overdue, .badge-cancelled, .badge-refunded, .badge-inactive, .badge-closed, .badge-high { background: var(--danger-soft); color: var(--danger); }
.badge-paused, .badge-normal, .badge-low { background: var(--neutral-soft); color: var(--fg-muted); }

/* ---------- Forms ---------- */

.stacked-form { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
.stacked-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; font-weight: 500; color: var(--fg-muted); }
.stacked-form input, .stacked-form select, .stacked-form textarea {
  padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--fg); font-size: 0.95rem; font-family: inherit;
}
.stacked-form input:focus, .stacked-form select:focus, .stacked-form textarea:focus {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
.stacked-form button { align-self: flex-start; }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 0.5rem !important; }
.checkbox-row input { width: auto; }

.inline-form { display: flex; gap: 0.6rem; align-items: center; margin: 0.5rem 0 1.5rem; }
.inline-form select {
  padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--fg);
}

.hint { font-size: 0.85rem; color: var(--fg-muted); margin-top: -0.5rem; }

/* ---------- Ticket thread ---------- */

.thread { display: flex; flex-direction: column; gap: 0.75rem; margin: 1.5rem 0; }
.message { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1.1rem; box-shadow: var(--shadow-sm); }
.message.internal-note { border-left: 3px solid var(--primary); background: var(--primary-soft); }
.message p { margin: 0.4rem 0 0; white-space: pre-wrap; }

/* ---------- Marketing / landing page ---------- */

.hero {
  padding: 5.5rem 1.75rem 4.5rem;
  text-align: center;
  background:
    radial-gradient(60% 60% at 50% 0%, var(--primary-soft), transparent 70%);
}
.hero h1 { font-size: clamp(2.1rem, 4vw, 3rem); max-width: 720px; margin: 0 auto 1rem; }
.hero p.lede { font-size: 1.15rem; color: var(--fg-muted); max-width: 560px; margin: 0 auto 2rem; }
.hero .cta-row { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }
.hero .cta-row .btn { padding: 0.75rem 1.5rem; font-size: 0.95rem; }

.section { max-width: 1100px; margin: 0 auto; padding: 3.5rem 1.75rem; }
.section-heading { text-align: center; max-width: 560px; margin: 0 auto 2.5rem; }
.section-heading h2 { font-size: 1.6rem; margin: 0 0 0.6rem; }
.section-heading p { color: var(--fg-muted); margin: 0; }

.grid { display: grid; gap: 1.25rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.service-card, .plan-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.6rem; box-shadow: var(--shadow-sm); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.service-card:hover, .plan-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.service-card .icon {
  width: 42px; height: 42px; border-radius: 10px; background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: 1rem;
}
.service-card h3 { margin-bottom: 0.4rem; }
.service-card p { color: var(--fg-muted); font-size: 0.92rem; margin: 0; }

.plan-card { text-align: center; display: flex; flex-direction: column; gap: 0.75rem; }
.plan-card .price { font-size: 2rem; font-weight: 800; }
.plan-card .price span { font-size: 0.9rem; font-weight: 500; color: var(--fg-muted); }
.plan-card.featured { border-color: var(--primary); box-shadow: var(--shadow-md); }

.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.75rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.88rem;
}
