:root {
    --bg: #F4F5F3;
    --surface: #FFFFFF;
    --text: #1B2320;
    --text-muted: #5B6560;
    --border: #DDE2DE;
    --primary: #205C55;
    --primary-hover: #17433D;
    --accent: #C97A3D;
    --danger: #B3453B;
    --radius: 6px;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
  }

  /* --- Shared app chrome: dvoslojno zaglavlje --- */
  header {
    width: 100%;
}

.header-top {
    background: #12201D;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    /* Razdvaja navigaciju na levo i odjavu na desno */
    justify-content: space-between; 
}

.glavna-nav {
    display: flex;
    gap: 15px;
}

.glavna-nav a {
    color: #E4EFEC;
    text-decoration: none;
    font-size: 13px;
}

.glavna-nav a:hover {
    text-decoration: underline;
}

.meni {
    color: #E4EFEC;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.35);
    padding: 6px 10px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 6px;
    background: #d46600;
    transition: background 0.2s ease;
}
.meni:hover {
    background: var(--primary);
}
.odjava {
    color: #E4EFEC;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.35);
    padding: 6px 10px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 6px;
    background: #12201D;
    transition: background 0.2s ease;
}

.odjava:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-brand {
    background: var(--primary);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    transition: background-color 0.4s ease, color 0.4s ease;
    justify-content: space-between;
}

.header-brand.warn {
    background: var(--accent);
    color: #201A12;
}

.header-brand .naziv {
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.header-brand .naziv:hover { 
    opacity: 0.85; 
}

.header-brand .poruka {
    font-size: 14px;
    font-weight: 600;
}
  .header-brand .odjava {
    color: inherit;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid currentColor;
    opacity: 0.85;
    padding: 6px 10px;
    border-radius: var(--radius);
    white-space: nowrap;
  }
  .header-brand .odjava:hover { opacity: 1; }

  .container { max-width: 720px; margin: 0 auto; padding: 20px 16px 90px; }

  /* --- Login --- */
  .login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    width: 100%;
    max-width: 360px;
  }
  .login-card h1 {
    font-size: 19px;
    margin: 0 0 4px;
  }
  .login-card p.sub {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 24px;
  }
  label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
  }
  input, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    background: #fff;
    color: var(--text);
    margin-bottom: 16px;
    font-family: inherit;
  }
  input:focus, textarea:focus, button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
  }
  .btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }
  .btn:hover { background: var(--primary-hover); }
  .btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
  }
  .btn-secondary:hover { background: #EAF1EF; }

  .login-footer {
    text-align: center;
    padding: 20px;
    display: flex;
    gap: 18px;
    justify-content: center;
    flex-wrap: wrap;
  }
  .login-footer a {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
  }
  .login-footer a:hover { text-decoration: underline; }

  /* --- Lista auta --- */
  .search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
  }
  .search-row input { margin-bottom: 0; flex: 1; }
  .search-row button {
    flex-shrink: 0;
    padding: 0 16px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
  }

  .car-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
  }
  .car-card.clickable { cursor: pointer; }
  .car-card.clickable:hover { border-color: var(--primary); }
  .car-card .plate {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.3px;
  }
  .car-card .date {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
  }
  .car-card .desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 8px;
  }
  .car-card .kvar {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 3px;
    font-style: italic;
  }
  .car-card .thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    object-fit: cover;
    flex-shrink: 0;
    background: #E3E8E5;
  }
  .car-card .thumb-empty {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    flex-shrink: 0;
    background: #E3E8E5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #A8B3AE;
    font-size: 22px;
  }

  .fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
  }

  .section-title {
    font-size: 13px;
    color: var(--text-muted);
    margin: 24px 0 10px;
  }

  /* --- Forma unosa --- */
  .form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
  }
  .field-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
  }
  .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
  }
  .form-actions .btn { flex: 1; }

  @media (max-width: 480px) {
    .field-group { grid-template-columns: 1fr; }
    .container { padding: 16px 12px 90px; }
  }

/* --- Slike vozila (upload/galerija) --- */
.slike-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.slika-item {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #dfe6e2;
  position: relative;
}
.slika-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.slika-obrisi {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.slika-dodaj {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1.5px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}
.slika-dodaj input[type="file"] { display: none; }

/* --- Poruke greške/uspeha --- */
.poruka-greska {
  background: #FBEAE8;
  color: var(--danger);
  border: 1px solid #F0C9C5;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.poruka-uspeh {
  background: #E7F1EC;
  color: var(--primary-hover);
  border: 1px solid #C7DED4;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}