:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --primary: #0f4c81;
  --primary-strong: #0a3a63;
  --accent: #19a974;
  --text: #1b2733;
  --muted: #5f6f82;
  --border: #dbe4ef;
  --radius: 8px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --shadow-1: 0 8px 20px rgba(16, 44, 80, 0.08);
  --shadow-2: 0 14px 28px rgba(16, 44, 80, 0.14);
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: radial-gradient(circle at 10% 10%, #dceaf8 0%, var(--bg) 45%, #eef3fa 100%);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.main-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: var(--space-5) 0;
}

.navbar {
  background: linear-gradient(90deg, var(--primary-strong), var(--primary));
  box-shadow: var(--shadow-1);
}

.navbar .nav-link,
.navbar .navbar-brand {
  color: #f2f6fb;
}

.navbar .nav-link:hover,
.navbar .navbar-brand:hover {
  color: #ffffff;
}

.footer-bar {
  border-top: 1px solid var(--border);
  background: #f9fcff;
}

.hero-panel,
.card.panel,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.hero-panel {
  padding: var(--space-6);
}

.hero-links .btn {
  width: 100%;
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}

.btn-primary-soft {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}

.btn-primary-soft:hover {
  background: var(--primary-strong);
  color: #fff;
}

.dashboard-header {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.sales-dashboard {
  width: min(100% - 1rem, 1440px);
  margin: 0 auto;
}

.sales-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.dashboard-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.dashboard-actions .btn {
  border-radius: var(--radius);
  white-space: nowrap;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: var(--space-4);
}

.kpi-label {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--space-1);
  text-transform: uppercase;
}

.kpi-value {
  color: var(--primary-strong);
  display: block;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.15;
}

.kpi-chip {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  min-width: 180px;
  box-shadow: var(--shadow-1);
}

.kpi-chip strong {
  display: block;
  font-size: 1.1rem;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: var(--space-4);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  width: 100%;
}

.sales-table {
  min-width: 560px;
}

.table thead th {
  background: #edf4fb;
  color: #29445e;
  border-bottom: 1px solid var(--border);
}

.table td:nth-child(2) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table td:last-child {
  white-space: nowrap;
}

.sales-table th:nth-child(2),
.sales-table th:nth-child(3),
.sales-table td:nth-child(2),
.sales-table td:nth-child(3) {
  white-space: nowrap;
}

.sales-table td:first-child {
  min-width: 160px;
}

.dataTables_wrapper .row {
  row-gap: var(--space-2);
}

.dataTables_filter {
  text-align: right;
}

.dataTables_filter input {
  max-width: 260px;
}

.page-title {
  margin: 0;
  font-size: 1.35rem;
  color: var(--primary-strong);
}

.page-subtitle {
  color: var(--muted);
}

.back-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.auth-card,
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}

.empty-state {
  background: #fff8ec;
  border: 1px solid #f5dfb3;
  border-radius: var(--radius);
  color: #7a5a17;
  padding: var(--space-4);
}

@media (max-width: 768px) {
  .main-content {
    padding: var(--space-4) 0;
  }

  .sales-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-actions .btn {
    width: 100%;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    padding: var(--space-3);
  }

  .kpi-value {
    font-size: 1.35rem;
  }

  .table-wrap {
    padding: var(--space-3);
  }

  .sales-table {
    border: 0;
    min-width: 0;
  }

  .sales-table thead {
    display: none;
  }

  .sales-table,
  .sales-table tbody,
  .sales-table tr,
  .sales-table td {
    display: block;
    width: 100%;
  }

  .sales-table tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    margin-bottom: var(--space-3);
    padding: var(--space-2);
  }

  .sales-table td {
    align-items: center;
    border: 0;
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    text-align: right;
    white-space: normal;
  }

  .sales-table td::before {
    color: var(--muted);
    content: attr(data-label);
    flex: 0 0 auto;
    font-weight: 600;
    text-align: left;
  }

  .sales-table td:first-child {
    min-width: 0;
    text-align: right;
  }

  .dataTables_filter {
    text-align: left;
  }

  .dataTables_filter label,
  .dataTables_filter input {
    width: 100%;
  }

  .dataTables_filter input {
    margin-left: 0;
    max-width: none;
  }

  .hero-panel {
    padding: var(--space-5);
  }

  .kpi-chip {
    width: 100%;
  }
}
