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

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

body {
  min-height: 100vh;
  background: #f4f6fa;
  font-family: "Lato", sans-serif;
  color: #222;
}

/* ── Header ─────────────────────────────────────────────────── */
header {
  background: linear-gradient(135deg, #345B9B, #2a4a80);
  color: #fff;
  padding: 0 40px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
header img#header-logo {
  max-height: 40px;
  max-width: 160px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
header .logo-placeholder-small {
  font: 700 1.1em "Lato", sans-serif;
  letter-spacing: 0.05em;
  opacity: 0.7;
}
header h1 {
  font: 700 1.2em "Lato", sans-serif;
  letter-spacing: 0.06em;
}
#back-link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font: 400 0.9em "Lato", sans-serif;
  transition: color 0.15s;
}
#back-link:hover { color: #fff; }

/* ── Main ───────────────────────────────────────────────────── */
main {
  max-width: 760px;
  margin: 40px auto;
  padding: 0 24px;
}

.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
  overflow: hidden;
  margin-bottom: 24px;
}
.card-header {
  padding: 20px 28px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2 {
  font: 700 1em "Lato", sans-serif;
  color: #333;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.card-header p {
  font: 400 0.85em "Lato", sans-serif;
  color: #999;
  margin-top: 3px;
}

/* ── Table ──────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
thead th {
  background: #f9fafb;
  padding: 10px 16px;
  text-align: left;
  font: 700 0.78em "Lato", sans-serif;
  color: #888;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid #eee;
}
tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
td { padding: 12px 16px; vertical-align: middle; }

.color-dot {
  display: inline-block;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.1);
  vertical-align: middle;
}

.input-label {
  width: 100%;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px 12px;
  font: 400 0.95em "Lato", sans-serif;
  color: #222;
  transition: border-color 0.15s;
  outline: none;
}
.input-label:focus { border-color: #345B9B; }

/* ── Qty ────────────────────────────────────────────────────── */
.qty-wrap { display: flex; align-items: center; gap: 8px; }

.btn-toggle-unlimited {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid #ddd;
  background: #fff;
  font-size: 1.1em;
  color: #bbb;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-toggle-unlimited.active {
  background: #579A59;
  border-color: #579A59;
  color: #fff;
}
.btn-toggle-unlimited:hover { opacity: 0.8; }

.input-qty {
  width: 70px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px 10px;
  font: 700 0.95em "Lato", sans-serif;
  color: #222;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
.input-qty:focus { border-color: #345B9B; }
.input-qty.hidden { visibility: hidden; }
.input-qty:disabled { background: #f5f5f5; color: #bbb; }

.btn-delete {
  width: 30px; height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #ccc;
  font-size: 0.85em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-delete:hover { background: #fde8e8; color: #c0392b; }

/* ── Actions ────────────────────────────────────────────────── */
.actions {
  padding: 20px 28px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid #eee;
  background: #fafafa;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  border-radius: 50px;
  padding: 11px 24px;
  font: 700 0.9em "Lato", sans-serif;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:hover { opacity: 0.88; transform: scale(1.02); }
.btn-primary { background: #345B9B; color: #fff; }
.btn-success { background: #579A59; color: #fff; }
.btn-ghost   { background: transparent; color: #999; border: 1.5px solid #ddd; }
.btn-ghost:hover { background: #f0f0f0; opacity: 1; }

/* ── Toast ──────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #222;
  color: #fff;
  border-radius: 50px;
  padding: 12px 28px;
  font: 400 0.9em "Lato", sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 200;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Info box ───────────────────────────────────────────────── */
.info-box {
  background: #eef3fb;
  border-left: 4px solid #345B9B;
  border-radius: 8px;
  padding: 14px 18px;
  font: 400 0.88em "Lato", sans-serif;
  color: #445;
  line-height: 1.6;
  margin-bottom: 24px;
}
.info-box strong { color: #345B9B; }

/* ── Tiles stepper ──────────────────────────────────────────── */
.tiles-wrap { display: flex; align-items: center; gap: 6px; }

.stepper-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid #ddd;
  background: #fff;
  font-size: 1.1em;
  color: #444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1;
  flex-shrink: 0;
}
.stepper-btn:hover { background: #eef3fb; border-color: #345B9B; color: #345B9B; }

.tiles-val {
  min-width: 26px;
  text-align: center;
  font: 700 1em "Lato", sans-serif;
  color: #222;
}
.tiles-chance {
  font: 400 0.8em "Lato", sans-serif;
  color: #999;
  min-width: 38px;
  text-align: right;
}

/* ── Drag & drop ────────────────────────────────────────────── */
.drag-handle {
  cursor: grab;
  color: #ccc;
  font-size: 1.2em;
  padding: 0 4px;
  user-select: none;
  display: inline-block;
  transition: color 0.15s;
}
.drag-handle:hover { color: #345B9B; }
.drag-handle:active { cursor: grabbing; }

tbody tr.dragging { opacity: 0.4; background: #f0f5ff; }
tbody tr.drag-over {
  background: #eef3fb;
  box-shadow: inset 0 2px 0 #345B9B;
}

/* ── Login overlay ──────────────────────────────────────────── */
#login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #1e2e50 0%, #2d4a2d 100%);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
}

#login-card {
  width: 90vw;
  max-width: 380px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  animation: cardPop 0.45s cubic-bezier(0.34,1.56,0.64,1) forwards;
  display: flex;
  flex-direction: column;
}
@keyframes cardPop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#login-card-header {
  background: #345B9B;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
#login-card-header::after {
  content: "";
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #579A59, #345B9B);
}
#login-logo {
  max-height: 46px;
  max-width: 200px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

#login-card-body {
  background: #fff;
  padding: 32px 36px 20px;
  text-align: center;
}
#login-card-body h2 {
  font: 700 1.3em "Lato", sans-serif;
  color: #222;
  margin-bottom: 6px;
}
#login-card-body p {
  font: 400 0.88em "Lato", sans-serif;
  color: #999;
  margin-bottom: 22px;
}
.login-field input {
  width: 100%;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 12px 16px;
  font: 400 1em "Lato", sans-serif;
  color: #222;
  outline: none;
  transition: border-color 0.15s;
  text-align: center;
  letter-spacing: 0.1em;
}
.login-field input:focus { border-color: #345B9B; }
.login-error {
  font: 400 0.85em "Lato", sans-serif;
  color: #c0392b;
  min-height: 18px;
  margin-top: 10px;
}

#login-card-footer {
  background: #f4f6fa;
  padding: 20px 36px;
  display: flex;
  justify-content: center;
  border-top: 1px solid #eee;
}
#login-submit {
  background: linear-gradient(135deg, #345B9B, #2a4a80);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 48px;
  font: 700 1em "Lato", sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(52,91,155,0.3);
  transition: opacity 0.15s, transform 0.1s;
}
#login-submit:hover { opacity: 0.88; transform: scale(1.03); }

/* ── Header actions ─────────────────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.btn-sm {
  padding: 7px 16px;
  font-size: 0.82em;
}

/* ── Security settings ──────────────────────────────────────── */
.settings-body {
  padding: 8px 28px 24px;
}
.setting-row {
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;
}
.setting-row:last-child { border-bottom: none; }
.setting-row label {
  display: block;
  font: 700 0.82em "Lato", sans-serif;
  color: #888;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.setting-input-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
}
.setting-input-wrap input {
  flex: 1;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 9px 12px;
  font: 400 0.95em "Lato", sans-serif;
  color: #222;
  outline: none;
  transition: border-color 0.15s;
}
.setting-input-wrap input:focus { border-color: #345B9B; }
.setting-hint {
  font: 400 0.82em "Lato", sans-serif;
  color: #aaa;
  margin-top: 7px;
}
.setting-hint strong { color: #345B9B; }
