:root {
  --primary: #2d3e5f;
  --primary-hover: #1e2d48;
  --primary-light: #3d5a8a;
  --accent: #c8915a;
  --accent-hover: #b37d48;
  --bg: #eae6e0;
  --bg-subtle: #e0dbd4;
  --card-bg: #ffffff;
  --text: #1c1c1e;
  --text-muted: #6b6b6f;
  --border: #d5d0c8;
  --success: #3a7d44;
  --danger: #c0392b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Auth pages */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: linear-gradient(145deg, #2d3e5f 0%, #1e2d48 100%);
}
.auth-container {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}
.auth-container h1 {
  text-align: center;
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}
.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.auth-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.auth-link a {
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 600;
}
.auth-link a:hover {
  color: var(--accent);
}

/* Forms */
.form-group {
  margin-bottom: 1.2rem;
}
label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="color"], select, textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--card-bg);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(45,62,95,0.1);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-align: center;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #2e6936; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-hover); }

/* Error message */
.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.8rem;
  text-align: center;
  min-height: 1.2rem;
}

/* Dashboard layout */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  font-size: 1.5rem;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(0,0,0,0.04);
}
.card h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  color: var(--primary);
  letter-spacing: -0.01em;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 0.65rem 0.8rem;
  text-align: left;
  font-size: 0.9rem;
}
th {
  background: var(--bg-subtle);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
}
tr:not(:last-child) td {
  border-bottom: 1px solid var(--border);
}
tr:hover td {
  background: rgba(45,62,95,0.02);
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-draft { background: #f0ebe5; color: #8b7355; }
.badge-pending { background: #fdf0e2; color: #b5651d; }
.badge-sending { background: #e8edf5; color: #3d5a8a; }
.badge-active { background: #e3f0e8; color: #2d6a3f; }
.badge-sent { background: #e8edf5; color: #2d3e5f; }
.badge-captured { background: #e3f0e8; color: #2d6a3f; }
.badge-processed { background: #ece5f0; color: #5a3d7a; }
.badge-completed { background: #e3f0e8; color: #2d6a3f; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* Utilities */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
