* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f1419; color: #e6e6e6;
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: #1a1f26; border-bottom: 1px solid #2a3340;
}
.brand { font-weight: 700; font-size: 16px; color: #e6e6e6; text-decoration: none; }
.topbar nav a { margin-left: 16px; color: #9aa4b2; text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: #e6e6e6; }
main { padding: 20px 24px; max-width: 1600px; margin: 0 auto; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
a { color: #7aa4d4; }
.muted { color: #6b7280; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }
code { background: #0a0d12; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

.flashes { padding: 0 24px; }
.flash { padding: 10px 14px; border-radius: 6px; margin: 8px 0; font-size: 14px; }
.flash-error { background: #5f1e1e; color: #ffae8a; }
.flash-success { background: #1e5f3a; color: #8affc6; }

.btn {
  display: inline-block; padding: 8px 14px; border-radius: 6px; border: none;
  background: #2563eb; color: #fff; font-weight: 600; cursor: pointer; font-size: 13px;
  text-decoration: none;
}
.btn:hover { background: #1d4ed8; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; border: 1px solid #2a3340; color: #9aa4b2; }
.btn-ghost:hover { background: #1a1f26; color: #e6e6e6; }
.btn-danger { background: #b91c1c; }
.btn-danger:hover { background: #991b1b; }

.ship-header { margin-bottom: 18px; }
.stats { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: #9aa4b2; margin: 6px 0; }
.stats b { color: #e6e6e6; }
.admin-bar { margin-top: 12px; padding: 10px 14px; background: #1a1f26; border-radius: 6px; }
.admin-bar .muted { margin-left: 12px; }

.ships { width: 100%; border-collapse: collapse; font-size: 13px; }
.ships th, .ships td { padding: 8px 10px; border-bottom: 1px solid #2a3340; text-align: left; }
.ships th { color: #9aa4b2; font-weight: 600; font-size: 11px; text-transform: uppercase; }
.ships tr:hover { background: #1a1f26; }

.card-section { background: #1a1f26; border: 1px solid #2a3340; border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.upload-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.upload-form input[type=text] { flex: 1; min-width: 240px; padding: 8px 10px; background: #0a0d12; border: 1px solid #2a3340; color: #e6e6e6; border-radius: 6px; }
.upload-form input[type=file] { color: #9aa4b2; }

.login-box { max-width: 340px; margin: 60px auto; background: #1a1f26; padding: 24px; border-radius: 8px; border: 1px solid #2a3340; }
.login-box form { display: flex; flex-direction: column; gap: 10px; }
.login-box input { padding: 9px 10px; background: #0a0d12; border: 1px solid #2a3340; color: #e6e6e6; border-radius: 6px; }

.form-vertical { display: flex; flex-direction: column; gap: 12px; max-width: 600px; }
.form-vertical label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #9aa4b2; }
.form-vertical input, .form-vertical textarea {
  padding: 9px 10px; background: #0a0d12; border: 1px solid #2a3340;
  color: #e6e6e6; border-radius: 6px; font-family: inherit; font-size: 13px;
}
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.preview { margin-top: 24px; }

.grid {
  display: grid; gap: 14px; padding: 4px 0;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  background: #1a1f26; border: 1px solid #2a3340; border-radius: 8px;
  overflow: hidden; display: flex; flex-direction: column;
}
.img-wrap { background: #0a0d12; aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center; }
.img-wrap a { display: block; width: 100%; height: 100%; }
.img-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.img-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; height: 100%; text-decoration: none; color: #6b7280; gap: 8px; padding: 10px;
}
.img-placeholder span { font-size: 36px; }
.img-placeholder small { font-size: 10px; text-align: center; color: #8a94a2; }
.body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.naziv { font-size: 12.5px; font-weight: 600; line-height: 1.3; color: #e6e6e6; min-height: 32px; }
.site-name { font-size: 11px; color: #7aa4d4; line-height: 1.3; }
.meta { font-size: 10.5px; color: #6b7280; }
.qty { font-size: 22px; font-weight: 700; color: #ffd84d; margin: 4px 0 2px; }
.price-row {
  display: flex; flex-direction: column; gap: 2px; padding-top: 6px;
  border-top: 1px solid #2a3340; font-size: 12px;
}
.prow { display: flex; justify-content: space-between; }
.prow .lbl { color: #8a94a2; }
.prow .val { font-variant-numeric: tabular-nums; }
.price-row.mismatch .val { color: #ff5252; font-weight: 700; }
.source {
  display: inline-block; align-self: flex-start;
  padding: 1px 7px; border-radius: 10px; font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.source.src-ba { background: #1e3a5f; color: #7aa4d4; }
.source.src-hr { background: #2e1e5f; color: #b08af0; }
.source.src-me { background: #1e5f4a; color: #8affc0; }
.source.src-si { background: #5f1e4a; color: #ff8ac0; }
.source.src-at { background: #5f3a1e; color: #ffb87a; }
.source.src-ch { background: #5f1e1e; color: #ff8a8a; }
.source.src-rs { background: #5f2a1e; color: #ffae8a; }
.source.src-other { background: #5f4a1e; color: #ffd48a; }
.napomena {
  font-size: 10.5px; line-height: 1.35; color: #ffd48a;
  padding: 6px 8px; background: rgba(255, 212, 138, 0.08);
  border-left: 2px solid #ffd48a; border-radius: 3px; margin-top: 2px;
}
.card.has-napomena { border-color: #5f4a1e; }

/* Home page */
.home-header { margin-bottom: 24px; }
.home-header h1 { font-size: 28px; margin: 0 0 8px; }
.home-sub { color: #9aa4b2; font-size: 14px; margin: 0; }
.empty-state {
  text-align: center; padding: 60px 20px; color: #6b7280;
  background: #1a1f26; border: 1px dashed #2a3340; border-radius: 8px;
}
.empty-state .btn { margin-top: 12px; }
.ship-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.ship-card {
  background: #1a1f26; border: 1px solid #2a3340; border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.ship-card:hover {
  transform: translateY(-2px);
  border-color: #3a4a5f;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}
.ship-preview {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  gap: 1px; background: #0a0d12; aspect-ratio: 2/1;
}
.ship-thumb {
  background-size: cover; background-position: center; background-repeat: no-repeat;
  background-color: #0a0d12;
}
.ship-thumb.empty {
  display: flex; align-items: center; justify-content: center;
  color: #2a3340; font-size: 20px;
}
.ship-body { padding: 14px 16px 16px; }
.ship-date {
  font-size: 11px; color: #6b7280; text-transform: uppercase;
  letter-spacing: 0.6px; font-weight: 600; margin-bottom: 4px;
}
.ship-name {
  font-size: 16px; font-weight: 600; color: #e6e6e6; margin-bottom: 12px;
  line-height: 1.25;
}
.ship-stats {
  display: flex; gap: 16px; font-size: 12px; padding-top: 10px;
  border-top: 1px solid #2a3340;
}
.ship-stats > div { display: flex; flex-direction: column; }
.ship-stats b { color: #e6e6e6; font-size: 15px; font-variant-numeric: tabular-nums; }
.ship-stats span { color: #6b7280; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }

@media (max-width: 600px) {
  main { padding: 14px 12px; }
  .topbar { padding: 10px 14px; }
  .ship-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 4px 0; }
  .home-header h1 { font-size: 22px; }
  .stats { gap: 12px; font-size: 12px; }
  .admin-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
}
