:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #687386;
  --line: #dce1e8;
  --blue: #255f9f;
  --green: #177245;
  --red: #b42318;
  --amber: #9a6700;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

/* ── Login ───────────────────────────────────────────────── */

.loginBody {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loginShell {
  width: 100%;
  max-width: 380px;
}

.loginPanel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px 28px 28px;
  box-shadow: 0 4px 24px rgba(24, 32, 42, 0.08);
}

.loginPanel h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
  margin: 0 0 28px;
}

.loginForm {
  display: grid;
  gap: 16px;
}

.loginForm label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}

.loginForm input {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font: 15px "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: #fff;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.loginForm input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 95, 159, 0.15);
}

.loginForm button {
  height: 46px;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font: 600 15px "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s;
}

.loginForm button:disabled { opacity: 0.6; }

.loginError {
  color: var(--red);
  background: #fff0ee;
  border: 1px solid #f5c6c2;
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 13px;
}

/* ── App shell ───────────────────────────────────────────── */

.appShell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ── Top bar ─────────────────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.logoutBtn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 13px;
  font: 13px "Segoe UI", Arial, sans-serif;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

/* ── Date navigation ─────────────────────────────────────── */

.dateNav {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  gap: 8px;
}

.dateNavBtn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 22px;
  line-height: 1;
  color: var(--blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.12s;
}

.dateNavBtn:active { background: #eef3fb; }

.dateDisplay {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

/* ── Summary ─────────────────────────────────────────────── */

.summaryBar {
  display: flex;
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.summaryStat {
  flex: 1;
  background: var(--panel);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summaryValue {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.5px;
}

.summaryLabel {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

/* ── Order list ──────────────────────────────────────────── */

.orderList {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.orderCard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: background 0.12s;
}

.orderCard:active { background: #eef3fb; }

/* Row 1: marketplace badge + country */
.cardTopRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.orderMarketplace {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #eef3fb;
  color: var(--blue);
  border-radius: 5px;
  padding: 3px 8px;
}

.orderCountry {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.5px;
}

/* Row 2: order number (prominent) */
.orderNumber {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Row 3: datetime + amount */
.cardBottomRow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.orderDatetime {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.orderAmount {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.emptyState {
  text-align: center;
  color: var(--muted);
  padding: 64px 20px;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Spinner ─────────────────────────────────────────────── */

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 48px auto;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.6s; }
}

/* ── Error ───────────────────────────────────────────────── */

.errorMsg {
  color: var(--red);
  background: #fff0ee;
  border: 1px solid #f5c6c2;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.5;
  margin: 16px 0;
}

/* ── Detail view (slides in from right) ──────────────────── */

.detailView {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.detailView.open {
  transform: translateX(0);
}

.detailTopbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  min-height: 54px;
}

.backBtn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font: 15px "Segoe UI", Arial, sans-serif;
  color: var(--blue);
  cursor: pointer;
  padding: 4px 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.detailTitle {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detailBody {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

/* Detail meta card */

.detailMeta {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.detailMetaRow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.detailMetaRow:last-child { border-bottom: none; }

.detailMetaLabel {
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
}

.detailMetaValue {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

/* Article list section */

.detailSection h2 {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px;
}

.itemList {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.itemRow {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.itemRow:last-child { border-bottom: none; }

.itemName {
  flex: 1;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.itemQtyBadge {
  display: inline-block;
  font-weight: 700;
  color: var(--blue);
  margin-right: 4px;
  white-space: nowrap;
}

.itemPrice {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 1px;
}
