@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg-start: #f8faff;
  --bg-end: #eef4ff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --border: rgba(148, 163, 184, 0.26);
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.09);
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.2);
  --ok-bg: #dcfce7;
  --ok-text: #14532d;
  --err-bg: #fee2e2;
  --err-text: #991b1b;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 10% 10%, rgba(37, 99, 235, 0.08), transparent 30%),
    radial-gradient(circle at 90% 20%, rgba(14, 165, 233, 0.12), transparent 35%),
    linear-gradient(160deg, var(--bg-start), var(--bg-end));
  line-height: 1.45;
  animation: fadeIn 0.5s ease-out;
}

h1,
h2 {
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
}

h2 {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
}

p {
  color: var(--text-secondary);
}

.container {
  width: min(1620px, 100%);
  margin: 24px auto;
  padding: 0 18px;
  animation: slideUp 0.35s ease-out;
}

.container.small {
  max-width: 540px;
  margin-top: 10vh;
}

.container.small > * {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.container.small > * + * {
  margin-top: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--primary);
  background: linear-gradient(180deg, #3b82f6, var(--primary));
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}


.btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #2563eb, var(--primary-hover));
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn.btn-outline {
  background: rgba(255, 255, 255, 0.75);
  color: var(--primary);
  box-shadow: none;
}

.btn.btn-outline:hover {
  background: rgba(37, 99, 235, 0.08);
}

.btn.btn-small {
  padding: 7px 11px;
  font-size: 12px;
  border-radius: 9px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.grid-form .full {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(100, 116, 139, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.85);
  font: inherit;
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  background: var(--surface-strong);
}

.inline-form {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.stats > div {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-secondary);
}

.stats strong {
  color: var(--text-primary);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  text-align: left;
  padding: 10px 10px;
  font-size: 14px;
}

th {
  background: rgba(37, 99, 235, 0.08);
  color: #1e3a8a;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(59, 130, 246, 0.06);
}

tbody tr.row-order {
  background: rgba(248, 113, 113, 0.17);
}

tbody tr.row-payment {
  background: rgba(34, 197, 94, 0.17);
}

tbody tr.row-paid-order {
  background: rgba(251, 146, 60, 0.2);
}

tbody tr.row-order:hover {
  background: rgba(248, 113, 113, 0.24);
}

tbody tr.row-payment:hover {
  background: rgba(34, 197, 94, 0.24);
}

tbody tr.row-paid-order:hover {
  background: rgba(251, 146, 60, 0.28);
}

.muted {
  color: #64748b;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.tag.order {
  background: #fee2e2;
  color: #b91c1c;
}

.tag.payment {
  background: #dcfce7;
  color: #166534;
}

.tag.paid-order {
  background: #ffedd5;
  color: #9a3412;
}

.tag.accepted {
  background: #dbeafe;
  color: #1e40af;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.flash {
  padding: 11px 13px;
  border-radius: 10px;
  margin-bottom: 12px;
  border: 1px solid transparent;
  animation: slideIn 0.28s ease-out;
}

.flash.success {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: rgba(21, 128, 61, 0.2);
}

.flash.error {
  background: var(--err-bg);
  color: var(--err-text);
  border-color: rgba(185, 28, 28, 0.2);
}

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(820px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 28px 56px rgba(15, 23, 42, 0.26);
  animation: slideUp 0.22s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-form .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .container {
    margin: 18px auto;
    padding: 0 12px;
  }

  .topbar {
    padding: 10px 12px;
  }
}

@media (max-width: 640px) {
  .container.small {
    margin-top: 5vh;
  }

  .actions {
    width: 100%;
    justify-content: flex-end;
  }

  .btn {
    width: 100%;
  }

  .actions .btn {
    width: auto;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    border-radius: 12px;
    padding: 12px;
  }

  .modal-form .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-form .modal-actions .btn {
    width: 100%;
  }

  .inline-form {
    align-items: stretch;
  }

  .inline-form > * {
    width: 100%;
  }

  th,
  td {
    font-size: 13px;
    padding: 9px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
