/* QuickBooks-inspired dashboard styling */

:root {
  --qb-green: #2ca01c;
  --qb-green-hover: #248a17;
  --red: #dc3545;
  --red-pill-bg: #f8d7da;
  --red-pill-text: #842029;
  --yellow: #ffc107;
  --yellow-pill-bg: #fff3cd;
  --yellow-pill-text: #664d03;
  --bg: #f4f5f8;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.site-header {
  background: var(--qb-green);
  color: #fff;
  padding: 1.5rem 1.75rem;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.header-text h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  opacity: 0.92;
}

.last-updated {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

.user-nav {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.user-nav a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 420px;
  margin: 0 auto;
}

.auth-card h2 {
  margin: 0 0 1.25rem;
  color: var(--qb-green);
}

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

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.auth-form input {
  padding: 0.65rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
}

.btn-primary {
  background: var(--qb-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--qb-green-hover);
}

.form-error {
  color: #842029;
  background: var(--red-pill-bg);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin: 0 0 1rem;
}

.form-success {
  color: #0f5132;
  background: #d1e7dd;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin: 0 0 1rem;
}

.form-note {
  color: var(--muted);
  margin: 0 0 1rem;
}

.auth-footer-link {
  margin: 1.25rem 0 0;
  text-align: center;
}

.auth-footer-link a {
  color: var(--qb-green);
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.user-table th,
.user-table td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.btn-refresh {
  display: inline-block;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-refresh:hover {
  opacity: 0.85;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.toggle-yellow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.toggle-yellow input {
  width: 1rem;
  height: 1rem;
  accent-color: #fff;
  cursor: pointer;
}

.btn-export {
  display: inline-block;
  background: #fff;
  color: var(--qb-green);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.15rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-export:hover {
  background: #f0fdf4;
  color: var(--qb-green-hover);
}

.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.75rem 3rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.filter-field select {
  min-width: 11rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: #fff;
}

.table-wrap {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem 1.25rem;
  overflow-x: auto;
}

.flags-table {
  width: 100% !important;
  border-collapse: collapse;
}

.flags-table thead th {
  text-align: left;
  border-bottom: 2px solid #e5e7eb;
  padding: 0.65rem 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.flags-table tbody td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid #f0f1f4;
  vertical-align: middle;
}

.flag-cell {
  font-weight: 650;
  text-transform: lowercase;
  width: 7rem;
}

.flag-cell.flag-red {
  color: var(--red-pill-text);
  background: var(--red-pill-bg);
}

.flag-cell.flag-yellow {
  color: var(--yellow-pill-text);
  background: var(--yellow-pill-bg);
}

/* Soften default DataTables chrome to fit the dashboard */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.empty-state {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 0.5rem;
  color: var(--qb-green);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.loading-card .spinner {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 1.25rem;
  border: 3px solid #e5e7eb;
  border-top-color: var(--qb-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 600px) {
  .site-header,
  .content {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  .header-text h1 {
    font-size: 1.25rem;
  }
}
