:root {
  --bg: #0f1220;
  --surface: #171b2e;
  --surface-2: #1f2440;
  --border: #2a2f4d;
  --text: #e7e9f5;
  --text-muted: #9aa0c3;
  --accent: #6366f1;
  --accent-2: #22c55e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header h1 {
  font-size: 1.15rem;
  margin: 0;
}

.site-header nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 1.25rem;
  font-size: 0.95rem;
}

.site-header nav a:hover {
  color: var(--text);
}

.user-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.user-switcher select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.user-switcher button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}

.user-switcher button:hover {
  opacity: 0.9;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

main.full-width {
  max-width: none;
}

.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.filters input[type="text"],
.filters input[type="number"],
.filters select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.filters button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.filters button:hover {
  opacity: 0.9;
}

.filters details {
  margin-top: 0.75rem;
  color: var(--text-muted);
}

.filters summary {
  cursor: pointer;
  font-size: 0.85rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.filters-grid label {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--text-muted);
  gap: 0.25rem;
}

.checkbox {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.result-count,
.empty {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  padding: 0.5rem 0.7rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
}

tbody tr:hover {
  background: var(--surface-2);
}

.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.breakdown {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.breakdown li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.promo {
  color: var(--accent-2);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.total {
  font-size: 1.1rem;
  font-weight: 600;
}

.best-promo {
  background: rgba(34, 197, 94, 0.1);
}

.best-promo td:first-child {
  color: var(--accent-2);
}

.flashes {
  margin-bottom: 1.25rem;
}

.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}

.flash-success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.flash-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.admin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.admin-section h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.admin-section h3 {
  font-size: 0.95rem;
  color: var(--text-muted);
}

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

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.75rem;
}

.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="number"],
.admin-form input[type="date"],
.admin-form input[type="password"],
.admin-form select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.admin-form label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.admin-form button,
.table-wrap button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.admin-form button:hover,
.table-wrap button:hover {
  opacity: 0.9;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
}

.login-brand {
  text-align: center;
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 1.5rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field input[type="text"],
.field input[type="password"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  font-size: 0.9rem;
  width: 100%;
}

.password-wrap {
  position: relative;
  display: flex;
}

.password-wrap input {
  flex: 1;
  padding-right: 2.4rem !important;
}

.password-toggle {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.3rem;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.login-form button[type="submit"] {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.login-form button[type="submit"]:hover {
  opacity: 0.9;
}
