:root {
  --ink: #1b2a4a;
  --paper: #f7f5f2;
  --card: #ffffff;
  --accent: #c8532b;
  --accent-dark: #a3431f;
  --muted: #55607a;
  --border: #d8d3cc;
  --error: #a32020;
  --status-pending-bg: #fdf0e7;
  --status-shipped-bg: #e7effb;
  --status-delivered-bg: #e7f5ea;
  --font: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 0.9rem 1.25rem;
  background: var(--ink);
}
.brand {
  font-size: 1.15rem; font-weight: 700; color: #ffffff; margin: 0;
}
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.user-email { color: #d7dcea; font-size: 0.9rem; word-break: break-all; }

.container {
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
  max-width: 420px;
}

h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }

.muted { color: var(--muted); margin-top: 0; }

form { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 1rem; }

label { font-weight: 600; font-size: 0.9rem; }

input {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}
input:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary, .btn-secondary {
  font-family: inherit; font-size: 1rem;
  border-radius: 6px; cursor: pointer;
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
}
.btn-primary {
  margin-top: 0.75rem;
  background: var(--accent); color: #ffffff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-secondary {
  background: transparent; color: #ffffff; border-color: #6a7898;
}
.btn-secondary:hover { border-color: #ffffff; }

.error { color: var(--error); font-size: 0.9rem; margin: 0.5rem 0 0; }

#view-orders { width: 100%; }

.orders-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.orders-table th, .orders-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.orders-table thead th {
  background: #eceae6;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.orders-table tbody tr:last-child td { border-bottom: none; }
.orders-table .num { text-align: right; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-pending   { background: var(--status-pending-bg); color: #7a3a12; }
.badge-shipped   { background: var(--status-shipped-bg); color: #1f3a6e; }
.badge-delivered { background: var(--status-delivered-bg); color: #1d5c2c; }
.badge-other     { background: var(--paper); color: var(--ink); }

.empty-state { max-width: none; text-align: center; }
.empty-state h3 { margin: 0 0 0.25rem; }

@media (max-width: 560px) {
  .orders-table th, .orders-table td { padding: 0.55rem 0.6rem; }
  .card { padding: 1.25rem; }
  .container { margin-top: 1.25rem; }
}
