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

body {
  font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: #f0f2f5;
  color: #111827;
  min-height: 100vh;
}

/* ---- Header / Nav ---- */
.site-header {
  background: #1e3a5f;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}
.brand {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: .02em;
}
nav { display: flex; gap: 4px; align-items: center; }
.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: #bfdbfe;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 4px;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.15); color: #fff; }
.nav-logout { color: #93c5fd; }

/* ---- Layout ---- */
.main-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

/* ---- Flash messages ---- */
.flash {
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 16px;
  border-left: 3px solid;
}
.flash-success { background: #f0fdf4; color: #166534; border-color: #22c55e; }
.flash-error   { background: #fef2f2; color: #991b1b; border-color: #ef4444; }

/* ---- Page header ---- */
.page-header {
  background: #1e3a5f;
  color: #fff;
  padding: 18px 22px;
  border-radius: 5px 5px 0 0;
  margin-bottom: 0;
}
.page-header h1 { font-size: 15px; font-weight: 700; line-height: 1.4; margin-bottom: 3px; }
.page-header .sub { font-size: 12px; color: #93c5fd; }
.page-header .tag {
  display: inline-block;
  margin-top: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  padding: 2px 9px;
  border-radius: 3px;
  font-size: 11px;
  color: #bfdbfe;
}

/* ---- Card ---- */
.card {
  background: #fff;
  border: 1px solid #d1d5db;
  border-top: none;
  padding: 20px 24px;
}
.card:last-of-type,
.card.card-standalone { border-radius: 0 0 5px 5px; }
.card.card-standalone { border-top: 1px solid #d1d5db; }

/* ---- Section title ---- */
.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

/* ---- Form fields ---- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field input[type="datetime-local"],
.field textarea,
.field select {
  width: 100%;
  padding: 8px 11px;
  font-size: 14px;
  color: #111827;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: #1e3a5f;
  box-shadow: 0 0 0 2px rgba(30,58,95,.1);
}
.field input::placeholder,
.field textarea::placeholder { color: #9ca3af; }
.field .note { font-size: 11px; color: #6b7280; margin-top: 4px; }
.field textarea { resize: vertical; min-height: 64px; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background .15s;
  font-family: inherit;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-full { display: block; width: 100%; margin-top: 6px; }
.btn-primary { background: #1e3a5f; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #172e4d; }
.btn-success { background: #15622a; color: #fff; }
.btn-success:hover:not(:disabled) { background: #104d21; }
.btn-danger  { background: #9b1c1c; color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #7f1d1d; }
.btn-ghost   { background: #e5e7eb; color: #374151; }
.btn-ghost:hover:not(:disabled)   { background: #d1d5db; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---- Notices ---- */
.notice {
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 14px;
  border-left: 3px solid;
}
.notice-info    { background: #eff6ff; color: #1e40af; border-color: #3b82f6; }
.notice-success { background: #f0fdf4; color: #166534; border-color: #22c55e; }
.notice-warning { background: #fffbeb; color: #92400e; border-color: #f59e0b; }
.notice-error   { background: #fef2f2; color: #991b1b; border-color: #ef4444; }

/* ---- Status badges ---- */
.status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.status-open     { background: #dcfce7; color: #15803d; }
.status-closed   { background: #fef9c3; color: #854d0e; }
.status-revealed { background: #dbeafe; color: #1d4ed8; }

/* ---- Tables ---- */
.tbl-wrap { border: 1px solid #e5e7eb; border-radius: 4px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 8px 12px;
  background: #f9fafb;
  font-size: 11px;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid #f3f4f6; color: #1f2937; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafafa; }
td.num   { text-align: right; font-variant-numeric: tabular-nums; }
td.muted { color: #9ca3af; font-style: italic; font-size: 12px; }
tr.rank-1 td { background: #f0fdf4; }
tr.rank-2 td { background: #fefce8; }

/* ---- Market list cards ---- */
.market-list { display: flex; flex-direction: column; gap: 12px; }
.market-item {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.market-item:hover { border-color: #9ca3af; }
.market-item-left { flex: 1; min-width: 0; }
.market-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.market-item-meta { font-size: 12px; color: #6b7280; }
.market-item-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---- Winner card ---- */
.winner-card {
  background: #15622a;
  color: #fff;
  padding: 16px 20px;
  border-radius: 4px;
  margin-bottom: 14px;
}
.winner-card h2  { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.winner-card .sub { font-size: 12px; color: #86efac; }

.prix-reel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #4b5563;
}
.prix-reel strong { font-size: 18px; font-weight: 700; color: #1e3a5f; margin-left: 6px; }

/* ---- Countdown ---- */
.countdown-bar {
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  padding: 6px 10px;
  border-radius: 4px;
  border-left: 3px solid #f59e0b;
  margin-bottom: 14px;
}

/* ---- Login ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-box {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  width: 100%;
  max-width: 380px;
  overflow: hidden;
}
.login-header {
  background: #1e3a5f;
  color: #fff;
  padding: 20px 24px;
}
.login-header h1 { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.login-header p  { font-size: 12px; color: #93c5fd; }
.login-body { padding: 24px; }

/* ---- Empty state ---- */
.empty-msg {
  padding: 32px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

/* ---- Admin section separator ---- */
.admin-market {
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  margin-bottom: 14px;
  overflow: hidden;
}
.admin-market-head {
  background: #f9fafb;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e5e7eb;
}
.admin-market-head-left { flex: 1; min-width: 0; }
.admin-market-title { font-size: 13px; font-weight: 600; color: #111827; }
.admin-market-meta  { font-size: 12px; color: #6b7280; margin-top: 2px; }
.admin-market-body  { padding: 14px 16px; }
.admin-reveal-form  { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.admin-reveal-form .field { margin-bottom: 0; flex: 1; min-width: 160px; }

/* ---- Footer ---- */
.footer { margin-top: 14px; text-align: center; font-size: 11px; color: #9ca3af; }

/* ---- Misc ---- */
.text-muted { color: #6b7280; font-size: 12px; }
.mt-4  { margin-top: 16px; }
.mb-0  { margin-bottom: 0; }

@media (max-width: 520px) {
  .card, .login-body { padding: 16px; }
  .page-header { padding: 14px 16px; }
  .market-item { flex-direction: column; align-items: flex-start; }
  .market-item-right { width: 100%; justify-content: flex-start; }
  .admin-market-head { flex-direction: column; align-items: flex-start; }
  .btn-row { flex-direction: column; }
}
