:root {
  /* Default to Latte (Light) variables if no preference */
  --radius: 0.625rem;
  --background: 220 23.08% 94.9%; /* base */
  --foreground: 234 16.02% 35.49%; /* text */
  --card: 220 23.08% 94.9%; /* base */
  --card-foreground: 234 16.02% 35.49%; /* text */
  --popover: 220 23.08% 94.9%; /* base */
  --popover-foreground: 234 16.02% 35.49%; /* text */
  --primary: 316 73.42% 69.02%; /* accent - Pink */
  --primary-foreground: 220 23.08% 94.9%; /* base */
  --secondary: 223 15.91% 82.75%; /* surface0 */
  --secondary-foreground: 234 16.02% 35.49%; /* text */
  --muted: 223 15.91% 82.75%; /* surface0 */
  --muted-foreground: 233 12.8% 41.37%; /* subtext1 */
  --accent: 223 15.91% 82.75%; /* surface0 */
  --accent-foreground: 234 16.02% 35.49%; /* text */
  --destructive: 347 86.67% 44.12%; /* red */
  --border: 225 13.56% 76.86%; /* surface1 */
  --input: 225 13.56% 76.86%; /* surface1 */
  --ring: 234 16.02% 35.49%; /* text */
  --chart-1: 345 57.65% 74.12%; /* red */
  --chart-2: 185 37.25% 70.59%; /* teal */
  --chart-3: 219 81.96% 78.43%; /* blue */
  --chart-4: 35 61.18% 76.86%; /* yellow */
  --chart-5: 113 32.94% 73.33%; /* green */
  --sidebar: 218 25.1% 93.73%; /* mantle */
  --sidebar-foreground: 234 16.02% 35.49%; /* text */
  --sidebar-primary: 316 73.42% 69.02%; /* accent - Pink */
  --sidebar-primary-foreground: 220 23.08% 94.9%; /* base */
  --sidebar-accent: 220 23.08% 94.9%; /* surface0 */
  --sidebar-accent-foreground: 234 16.02% 35.49%; /* text */
  --sidebar-border: 225 13.56% 76.86%; /* surface1 */
  --sidebar-ring: 225 13.56% 76.86%; /* surface1 */
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Frappe (Dark) variables */
    --background: 229 18.64% 23.14%; /* base */
    --foreground: 227 70.15% 86.86%; /* text */
    --card: 229 18.64% 23.14%; /* base */
    --card-foreground: 227 70.15% 86.86%; /* text */
    --popover: 229 18.64% 23.14%; /* base */
    --popover-foreground: 227 70.15% 86.86%; /* text */
    --primary: 316 73.17% 83.92%; /* accent - Pink */
    --primary-foreground: 229 18.64% 23.14%; /* base */
    --secondary: 230 15.58% 30.2%; /* surface0 */
    --secondary-foreground: 227 70.15% 86.86%; /* text */
    --muted: 230 15.58% 30.2%; /* surface0 */
    --muted-foreground: 227 43.69% 79.8%; /* subtext1 */
    --accent: 230 15.58% 30.2%; /* surface0 */
    --accent-foreground: 227 70.15% 86.86%; /* text */
    --destructive: 359 67.79% 70.78%; /* red */
    --border: 227 14.74% 37.25%; /* surface1 */
    --input: 227 14.74% 37.25%; /* surface1 */
    --ring: 227 70.15% 86.86%; /* text */
    --chart-1: 341 18.43% 40%; /* red */
    --chart-2: 191 18.43% 39.22%; /* teal */
    --chart-3: 224 23.53% 43.53%; /* blue */
    --chart-4: 31 9.41% 43.53%; /* yellow */
    --chart-5: 126 9.41% 41.18%; /* green */
    --sidebar: 229 18.82% 21.96%; /* mantle */
    --sidebar-foreground: 227 70.15% 86.86%; /* text */
    --sidebar-primary: 316 73.17% 83.92%; /* accent - Pink */
    --sidebar-primary-foreground: 229 18.64% 23.14%; /* base */
    --sidebar-accent: 229 18.64% 23.14%; /* surface0 */
    --sidebar-accent-foreground: 227 70.15% 86.86%; /* text */
    --sidebar-border: 227 14.74% 37.25%; /* surface1 */
    --sidebar-ring: 227 14.74% 37.25%; /* surface1 */
  }
}

/* Explicit class overrides */
.light {
  --background: 220 23.08% 94.9%;
  --foreground: 234 16.02% 35.49%;
  --card: 220 23.08% 94.9%;
  --card-foreground: 234 16.02% 35.49%;
  --popover: 220 23.08% 94.9%;
  --popover-foreground: 234 16.02% 35.49%;
  --primary: 316 73.42% 69.02%;
  --primary-foreground: 220 23.08% 94.9%;
  --secondary: 223 15.91% 82.75%;
  --secondary-foreground: 234 16.02% 35.49%;
  --muted: 223 15.91% 82.75%;
  --muted-foreground: 233 12.8% 41.37%;
  --accent: 223 15.91% 82.75%;
  --accent-foreground: 234 16.02% 35.49%;
  --destructive: 347 86.67% 44.12%;
  --border: 225 13.56% 76.86%;
  --input: 225 13.56% 76.86%;
  --ring: 234 16.02% 35.49%;
  --chart-1: 345 57.65% 74.12%;
  --chart-2: 185 37.25% 70.59%;
  --chart-3: 219 81.96% 78.43%;
  --chart-4: 35 61.18% 76.86%;
  --chart-5: 113 32.94% 73.33%;
  --sidebar: 218 25.1% 93.73%;
  --sidebar-foreground: 234 16.02% 35.49%;
  --sidebar-primary: 316 73.42% 69.02%;
  --sidebar-primary-foreground: 220 23.08% 94.9%;
  --sidebar-accent: 220 23.08% 94.9%;
  --sidebar-accent-foreground: 234 16.02% 35.49%;
  --sidebar-border: 225 13.56% 76.86%;
  --sidebar-ring: 225 13.56% 76.86%;
}

.dark {
  --background: 229 18.64% 23.14%;
  --foreground: 227 70.15% 86.86%;
  --card: 229 18.64% 23.14%;
  --card-foreground: 227 70.15% 86.86%;
  --popover: 229 18.64% 23.14%;
  --popover-foreground: 227 70.15% 86.86%;
  --primary: 316 73.17% 83.92%;
  --primary-foreground: 229 18.64% 23.14%;
  --secondary: 230 15.58% 30.2%;
  --secondary-foreground: 227 70.15% 86.86%;
  --muted: 230 15.58% 30.2%;
  --muted-foreground: 227 43.69% 79.8%;
  --accent: 230 15.58% 30.2%;
  --accent-foreground: 227 70.15% 86.86%;
  --destructive: 359 67.79% 70.78%;
  --border: 227 14.74% 37.25%;
  --input: 227 14.74% 37.25%;
  --ring: 227 70.15% 86.86%;
  --chart-1: 341 18.43% 40%;
  --chart-2: 191 18.43% 39.22%;
  --chart-3: 224 23.53% 43.53%;
  --chart-4: 31 9.41% 43.53%;
  --chart-5: 126 9.41% 41.18%;
  --sidebar: 229 18.82% 21.96%;
  --sidebar-foreground: 227 70.15% 86.86%;
  --sidebar-primary: 316 73.17% 83.92%;
  --sidebar-primary-foreground: 229 18.64% 23.14%;
  --sidebar-accent: 229 18.64% 23.14%;
  --sidebar-accent-foreground: 227 70.15% 86.86%;
  --sidebar-border: 227 14.74% 37.25%;
  --sidebar-ring: 227 14.74% 37.25%;
}

/* --- GLOBAL & RESET STYLES --- */
*,
*:after,
*:before {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

body {
  background-color: hsl(var(--background));
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
  color: hsl(var(--foreground));
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition:
    background-color 0.3s,
    color 0.3s;
}

/* --- NAVBAR --- */
.navbar {
  width: 100%;
  height: 64px;
  background-color: hsl(var(--sidebar) / 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--sidebar-border));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: hsl(var(--sidebar-foreground));
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none !important;
  height: 5rem;
}

.nav-brand svg {
  width: 24px;
  height: 24px;
  color: hsl(var(--primary));
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: hsl(var(--sidebar-foreground));
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: hsl(var(--primary));
}

.theme-toggle {
  background: transparent;
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* --- MAIN CONTAINER --- */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2rem;
  padding: 2rem 1rem;
  width: 100%;
}

/* --- CARD STRUCTURE --- */
.card {
  width: 100%;
  max-width: 1100px;
  min-width: 300px;
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  overflow: hidden;
}

.card .content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- HEADER STYLES --- */
.heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: monospace;
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

.heading svg {
  width: 18px;
  height: 18px;
  color: hsl(var(--primary));
}

.badge {
  margin-left: auto;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-radius: 9999px;
  padding: 2px 10px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.badge svg {
  width: 12px;
  height: 12px;
  color: currentColor;
}

.subtitle {
  color: hsl(var(--muted-foreground));
  font-size: 0.95rem;
  line-height: 1.6;
}

/* --- INFO LIST (DL) STYLES --- */
dl {
  display: grid;
  grid-template-columns: minmax(min-content, max(120px, 25%)) 1fr;
  gap: 1.5rem 2rem;
  margin: 0;
  font-size: 0.95rem;
}

dt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}

dt svg {
  width: 16px;
  height: 16px;
  color: hsl(var(--primary));
  opacity: 0.8;
}

dd {
  margin: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

dd a {
  color: hsl(var(--primary));
  text-decoration: none;
  font-weight: 500;
}

dd a:hover {
  text-decoration: underline;
}

code {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
  border: 1px solid hsl(var(--border));
}

.prepaid.shell {
  display: block;
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.9em;
  border: 1px solid hsl(var(--border));
  margin-top: 0.5rem;
}

@media (max-width: 640px) {
  dl {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  dt {
    margin-top: 1rem;
  }

  .navbar {
    padding: 0 1rem;
  }

  .nav-links {
    display: none; /* simple hiding for mobile for now, can be improved */
  }
}

/* --- TEST-SPECIFIC STYLES --- */
.test-result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.test-result:last-child {
  margin-bottom: 0;
}

.test-result svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.test-passed {
  color: #a6d189; /* Green from Catppuccin */
  border-left: 4px solid #a6d189;
}

.test-failed {
  color: #e78284; /* Red from Catppuccin */
  border-left: 4px solid #e78284;
}

.test-warning {
  color: #e5c890; /* Yellow from Catppuccin */
  border-left: 4px solid #e5c890;
}

.test-error {
  color: #ef9f76; /* Orange from Catppuccin */
  border-left: 4px solid #ef9f76;
}
