:root {
  --primary: #6c5ce7;
  --primary-dark: #4c3bcf;
  --accent: #00cec9;
  --bg: #f5f6fb;
  --card-bg: #ffffff;
  --text: #2d3436;
  --muted: #636e72;
  --border: #e4e6ef;
  --success: #2ecc71;
  --warning: #fdcb6e;
  --danger: #ff7675;
  font-family: "Inter", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top right, rgba(108, 92, 231, 0.15), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

header {
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand span {
  display: inline-flex;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

nav {
  display: flex;
  gap: 20px;
  font-weight: 500;
}

nav a {
  padding: 10px 16px;
  border-radius: 12px;
  transition: background 0.2s ease, transform 0.2s ease;
  color: rgba(255, 255, 255, 0.85);
}

nav a.active,
nav a:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: translateY(-2px);
}

main {
  padding: 32px 40px 48px;
}

h1 {
  font-size: 32px;
  margin-bottom: 12px;
}

p.page-subtitle {
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 32px;
  max-width: 720px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 18px 40px rgba(108, 92, 231, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 18px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  font-size: 40px;
  font-weight: 700;
  color: var(--primary-dark);
}

.stat-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 24px rgba(108, 92, 231, 0.2);
}

.btn-secondary {
  background: rgba(108, 92, 231, 0.12);
  color: var(--primary-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-small {
  padding: 8px 12px;
  font-size: 14px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

thead {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
}

th,
td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

tbody tr:hover {
  background: rgba(108, 92, 231, 0.05);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.badge.success {
  background: rgba(46, 204, 113, 0.12);
  color: var(--success);
}

.badge.warning {
  background: rgba(253, 203, 110, 0.18);
  color: #b26a00;
}

.badge.neutral {
  background: rgba(108, 92, 231, 0.12);
  color: var(--primary-dark);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  background: var(--card-bg);
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.timeline-item span {
  color: var(--muted);
  font-size: 14px;
}

.form-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 15px;
  font-family: inherit;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle input {
  width: auto;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 48px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: rgba(108, 92, 231, 0.04);
}

.toast {
  position: fixed;
  right: 32px;
  bottom: 32px;
  background: var(--primary-dark);
  color: #fff;
  padding: 16px 20px;
  border-radius: 14px;
  box-shadow: 0 16px 32px rgba(76, 59, 207, 0.28);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Detect hint states (targets #detect-hint element used in markup) */
#detect-hint,
.detect-hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  display: block;
}

#detect-hint.warning,
.detect-hint.warning {
  color: #b26a00; /* amber */
}

#detect-hint.error,
.detect-hint.error {
  color: var(--danger); /* red */
}

/* Small icon before the hint text for warning/error */
#detect-hint.warning::before,
.detect-hint.warning::before {
  content: "⚠️";
  margin-right: 8px;
  display: inline-block;
}

#detect-hint.error::before,
.detect-hint.error::before {
  content: "⛔";
  margin-right: 8px;
  display: inline-block;
}

.footer {
  padding: 24px 40px 48px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 20px;
  }

  main {
    padding: 24px;
  }

  .brand span {
    width: 36px;
    height: 36px;
  }

  nav {
    width: 100%;
    overflow-x: auto;
  }
}
