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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  background: radial-gradient(circle at top, #e0f2fe 0, #f4f4ff 35%, #f8fafc 100%);
  color: #0f172a;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.app-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #111827;
}

.brand-sub {
  font-weight: 400;
  opacity: 0.7;
}

.nav-links {
  display: flex;
  gap: 18px;
}

.nav-link {
  text-decoration: none;
  color: #475569;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: 999px;
  transition: 0.18s ease;
}

.nav-link:hover,
.nav-link:active {
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
  transform: translateY(-1px);
}

.app-main {
  display: flex;
  justify-content: center;
  padding: 32px 16px 48px;
}

.app-container {
  width: 100%;
  max-width: 1100px;
}

.page-card {
  background: #ffffff;
  padding: 24px 28px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.05);
}

.fade-in {
  opacity: 0;
  transform: translateY(14px);
  animation: fadeInUp 0.22s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-title {
  font-size: 1.8rem;
  margin-bottom: 4px;
  color: #0f172a;
}

.page-subtitle {
  color: #64748b;
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 16px;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.input {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.9rem;
  outline: none;
}

.input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.5);
  background: #ffffff;
}

.btn-main,
.btn-outline,
.btn-danger,
.btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 999px;
  transition: 0.15s ease;
  border: none;
  text-decoration: none;
}

.btn-main {
  background: linear-gradient(135deg, #2563eb, #22c55e);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}

.btn-main:hover,
.btn-main:active {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.45);
}

.btn-outline {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.9);
  color: #1f2937;
}

.btn-outline:hover {
  background: #eff6ff;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.btn-danger:hover {
  opacity: 0.95;
  transform: translateY(-0.5px);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.45);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 4px 12px;
  font-size: 0.78rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #374151;
  transition: 0.15s ease;
}

.btn-soft:hover {
  background: #e5e7eb;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.15);
  transform: translateY(-1px);
}

.table-card {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #ffffff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(226, 232, 240, 1);
  text-align: left;
}

.data-table thead {
  background: #f1f5f9;
}

.data-table th {
  background: transparent;
  color: #9ca3af;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.data-table th.col-actions,
.data-table td.col-actions,
.data-table th:last-child,
.data-table td:last-child {
  text-align: right;
}

.col-actions,
.data-table td:last-child {
  text-align: right;
}

.users-table .btn-edit,
.data-table .btn-edit {
  background: #e5e7eb !important;
  color: #374151 !important;
  opacity: 1 !important;
  cursor: pointer !important;
  border: 1px solid #d1d5db !important;
  padding: 4px 12px !important;
  border-radius: 6px !important;
  font-size: 0.8rem !important;
  transition: 0.2s ease;
}

.users-table .btn-edit:hover,
.data-table .btn-edit:hover {
  background: #d1d5db !important;
}

.empty-row,
.error-row {
  text-align: center;
  padding: 14px;
  color: #94a3b8;
}

.fade-row {
  animation: fadeInUp 0.35s ease;
}

.table-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.table-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
}

.home-hero {
  max-width: 880px;
  margin: 14px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: minmax(0, 1fr);
  }
}

.home-hero-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-badge {
  align-self: flex-start;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.5);
  background: linear-gradient(135deg, #dbeafe, #ecfeff);
  color: #1d4ed8;
}

.hero-title {
  font-size: 2.1rem;
  margin: 0;
  color: #0f172a;
}

.hero-subtitle {
  font-size: 0.98rem;
  color: #4b5563;
  line-height: 1.5;
}

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

.hero-note {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 4px;
}

.home-hero-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-card {
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(129, 140, 248, 0.2));
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.stat-hint {
  font-size: 0.8rem;
  color: #6b7280;
}

.home-metrics {
  margin: 20px auto 0;
  max-width: 1100px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
  .home-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .home-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}

.metric-card {
  border-radius: 18px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.metric-primary {
  background: linear-gradient(135deg, #facc15, #f97316);
  color: #111827;
}

.metric-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

.metric-value {
  margin-top: 8px;
  font-size: 1.6rem;
  font-weight: 700;
}

.home-preview {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

@media (max-width: 900px) {
  .home-preview {
    grid-template-columns: minmax(0, 1fr);
  }
}

.preview-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-title {
  font-size: 1.1rem;
}

.preview-subtitle {
  font-size: 0.85rem;
  color: #64748b;
}

.preview-list {
  list-style: none;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #ffffff;
  padding: 10px 0;
  max-height: 260px;
  overflow: hidden;
}

.preview-item {
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(226, 232, 240, 1);
}

.preview-item:last-child {
  border-bottom: none;
}

.preview-main {
  font-weight: 500;
  color: #0f172a;
}

.preview-meta {
  color: #6b7280;
}

.preview-empty {
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #94a3b8;
}

.preview-column-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.preview-block {
  padding-top: 4px;
  border-top: 1px solid #eef2ff;
}

.preview-block:first-child {
  border-top: none;
}

@media (max-width: 960px) {
  .preview-column-stack {
    gap: 16px;
  }
}

.analytics-section {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

@media (max-width: 900px) {
  .analytics-section {
    grid-template-columns: minmax(0, 1fr);
  }
}

.analytics-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analytics-title {
  font-size: 1.1rem;
}

.analytics-subtitle {
  font-size: 0.85rem;
  color: #64748b;
}

.analytics-list {
  list-style: none;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #ffffff;
  padding: 8px 0;
}

.analytics-item {
  padding: 8px 14px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 1);
  font-size: 0.85rem;
}

.analytics-item:last-child {
  border-bottom: none;
}

.analytics-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.analytics-label {
  font-weight: 500;
  color: #0f172a;
}

.analytics-value {
  font-weight: 600;
  color: #2563eb;
}

.analytics-meta {
  margin-top: 2px;
  color: #6b7280;
  font-size: 0.78rem;
}

.analytics-bar {
  margin-top: 6px;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.analytics-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #22d3ee);
}

.analytics-bar-alt span {
  background: linear-gradient(90deg, #6366f1, #f97316);
}

.transaction-metrics {
  margin-top: 12px;
}

.transaction-new {
  margin-top: 18px;
}

.transaction-items {
  margin-top: 24px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.items-header {
  margin-bottom: 8px;
}

.items-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

#items-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.tx-item-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) 0.7fr 0.9fr 1.1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.item-price,
.item-subtotal {
  padding: 8px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.7);
  font-size: 0.9rem;
}

.transaction-summary {
  margin: 14px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.7);
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #0f172a;
}

.transaction-list {
  margin-top: 18px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.modal-card {
  width: 520px;
  max-width: 95%;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(226, 232, 240, 1);
}

.modal-body {
  padding: 10px 0 14px;
  max-height: 360px;
  overflow: auto;
}

.modal-table th,
.modal-table td {
  font-size: 0.85rem;
}

.hidden {
  display: none;
}

#transactions-table {
  table-layout: fixed;
  width: 100%;
}

#transactions-table th,
#transactions-table td {
  padding-left: 16px;
  padding-right: 16px;
}

#transactions-table th:nth-child(1),
#transactions-table td:nth-child(1),
#transactions-table th:nth-child(4),
#transactions-table td:nth-child(4),
#transactions-table th:nth-child(5),
#transactions-table td:nth-child(5),
#transactions-table th:nth-child(7),
#transactions-table td:nth-child(7) {
  text-align: center;
}

#transactions-table th:nth-child(2),
#transactions-table td:nth-child(2),
#transactions-table th:nth-child(3),
#transactions-table td:nth-child(3),
#transactions-table th:nth-child(6),
#transactions-table td:nth-child(6) {
  text-align: left;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-role {
  background: rgba(59, 130, 246, 0.16);
  color: #1e40af;
  border-color: rgba(59, 130, 246, 0.7);
}

.badge-success {
  background: rgba(22, 163, 74, 0.24);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.7);
}

.badge-muted {
  background: rgba(148, 163, 184, 0.2);
  color: #475569;
  border-color: rgba(148, 163, 184, 0.7);
}