:root {
  --primary: #0057b8;
  --primary-dark: #003d80;
  --accent: #ffd100;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #1a2233;
  --muted: #6b7589;
  --border: #e2e6ee;
  --danger: #d63031;
  --success: #18a96b;
  --radius: 8px;
  --shadow: 0 2px 10px rgba(0, 50, 120, 0.07);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }

[hidden] { display: none !important; }

#app-header {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}
#app-header .brand {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 1.15rem;
}
#app-header .logo {
  background: var(--accent); color: var(--primary-dark);
  width: 28px; height: 28px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800;
}
#app-header nav { display: flex; gap: 1rem; align-items: center; }
#app-header nav a {
  color: #fff; text-decoration: none; font-weight: 500;
  padding: 0.4rem 0.7rem; border-radius: 6px;
}
#app-header nav a:hover { background: rgba(255,255,255,0.12); }
.active-badge a {
  background: var(--success); padding: 0.3rem 0.6rem !important;
  border-radius: 999px !important; font-size: 0.85rem;
}

#app-root {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

h1 { margin-top: 0; }
h2 { color: var(--primary-dark); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.9rem;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="number"], input:not([type]), select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
  font-family: inherit;
  color: var(--text);
  height: 42px;
  box-sizing: border-box;
}
input:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,87,184,0.15);
}
input[type="checkbox"] { width: auto; height: auto; }
.error-msg {
  color: var(--danger); font-size: 0.85rem; margin-top: 0.25rem;
}

button, .btn {
  cursor: pointer; border: none; border-radius: 6px;
  padding: 0.6rem 1.1rem; font-size: 1rem; font-weight: 600;
  height: 42px;
  transition: background 0.15s;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary); color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost {
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
.btn-secondary { background: #eef1f7; color: var(--text); }

table {
  width: 100%; border-collapse: collapse;
  background: #fff; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
th, td {
  padding: 0.75rem 1rem; text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: #f0f4fb; font-weight: 600; cursor: pointer;
  user-select: none;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfd; }

.lot-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.lot-card {
  background: #fff; border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
  cursor: pointer; transition: transform 0.1s;
}
.lot-card:hover { transform: translateY(-2px); }
.lot-card h3 { margin: 0 0 0.5rem; color: var(--primary-dark); }
.lot-card .price { color: var(--success); font-weight: 700; font-size: 1.2rem; }
.lot-card .availability { font-size: 0.85rem; color: var(--muted); }
.lot-card .full { color: var(--danger); }

.pill {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 999px; font-size: 0.8rem; font-weight: 600;
}
.pill-success { background: #d6f4e6; color: var(--success); }
.pill-warning { background: #fff4d6; color: #b07d00; }
.pill-danger { background: #fbdcdc; color: var(--danger); }

.timer-display {
  font-size: 3rem; font-weight: 700; color: var(--primary);
  text-align: center; font-variant-numeric: tabular-nums;
  margin: 1.5rem 0;
}

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }

#toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%);
  background: var(--text); color: #fff;
  padding: 0.75rem 1.5rem; border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 100;
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal {
  background: #fff; border-radius: var(--radius);
  padding: 1.5rem; max-width: 500px; width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; }

.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--muted);
}

.search-bar {
  display: flex; gap: 0.5rem; margin-bottom: 0;
  align-items: center;
}
.search-bar input { flex: 2; min-width: 200px; }
.search-bar select { flex: 1; min-width: 160px; }

.login-wrap {
  max-width: 400px; margin: 4rem auto;
}
.login-wrap .card { padding: 2rem; }
.login-wrap h1 { text-align: center; color: var(--primary); }
.hint {
  background: #fff7d6; border-left: 3px solid var(--accent);
  padding: 0.6rem 0.8rem; border-radius: 4px; font-size: 0.85rem;
  margin-bottom: 1rem;
}

.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input { width: auto; }

.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }

@media (max-width: 600px) {
  #app-header nav a { padding: 0.3rem 0.5rem; font-size: 0.9rem; }
  .timer-display { font-size: 2rem; }
}
