:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-sans: 'Inter', system-ui, sans-serif;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  --radius: 0.5rem;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --header-height: 4rem;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.site-header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 var(--spacing-md);
  justify-content: space-between;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-desktop {
  display: none;
  gap: var(--spacing-md);
  align-items: center;
  margin-right: 70px;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
}
.nav-link:hover { color: var(--primary); }

.menu-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* Submenu Dropdown logic in CSS/JS */
.has-submenu { position: relative; }
.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 200px;
  display: none;
  flex-direction: column;
  padding: 0.5rem 0;
}
.has-submenu:hover .submenu, .has-submenu:focus-within .submenu { display: flex; }
.submenu a {
  padding: 0.5rem 1rem;
  display: block;
}
.submenu a:hover { background: var(--bg); }

/* Layout */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg) var(--spacing-md);
}

.tool-grid {
  display: grid;
  gap: var(--spacing-lg);
  grid-template-columns: 1fr;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--spacing-lg);
}

.tool-header {
  margin-bottom: var(--spacing-lg);
  text-align: center;
}
.tool-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
}
.tool-desc { color: var(--text-muted); margin: 0; }

/* Forms */
.input-group {
  display: flex;
  gap: var(--spacing-sm);
  flex-direction: column;
  margin-bottom: var(--spacing-md);
}
.form-input, .form-select {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  width: 100%;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--border); }

/* Results */
.result-area {
  margin-top: var(--spacing-lg);
  display: none;
}
.result-area.active { display: block; }
.result-area.loading {
  display: block;
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}
.error-box {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #991b1b;
  padding: 1rem;
  border-radius: var(--radius);
  display: none;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  margin-top: 1rem;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th { background: var(--bg); font-weight: 600; }

/* Status Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.success { background: #dcfce7; color: #166534; }
.badge.warning { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.info { background: #e0f2fe; color: #075985; }

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--spacing-lg) var(--spacing-md);
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

@media (min-width: 768px) {
  .nav-desktop { display: flex; }
  .menu-toggle { display: none; }
  .input-group { flex-direction: row; }
}
