:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --gray-100: #f8fafc;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #374151;
  --success: #16a34a;
  --danger: #dc2626;
  --sidebar-bg: #334155;
  --sidebar-hover: #475569;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--gray-100);
  color: var(--gray-700);
  -webkit-tap-highlight-color: transparent;
}

.app-body { display: flex; min-height: 100vh; }

.app-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.main-sidebar {
  width: 180px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-wrap {
  display: flex;
  justify-content: left;
  padding: 20px;
  margin-top: -20px;
}

.sidebar-logo-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(255,255,255,0.1);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.sidebar-logo-btn:hover {
  background: rgba(255,255,255,0.15);
}

.sidebar-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
}

.sidebar-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--sidebar-hover); color: #fff; }

.sidebar-header { display: none; }

.btn-menu-toggle {
  display: none !important;
}

.btn-icon-header {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-header:hover { color: var(--primary); }

.logout-form { display: inline-flex; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--gray-300);
  min-height: 56px;
  gap: 0.75rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.header-logo {
  color: var(--gray-700);
  display: flex;
  align-items: center;
}

.header-logo:hover { color: var(--primary); }

.header-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-user-name { font-weight: 600; font-size: 0.95rem; }
.header-user-icon { color: var(--gray-500); }
.header-dropdown { color: var(--gray-500); cursor: pointer; }

.btn-link {
  background: none; border: none; color: var(--primary);
  cursor: pointer; font-size: 0.9rem;
}

.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  padding: 1.5rem;
  min-width: 0;
}

/* Tablet - hamburger menu sa desne strane */
@media (max-width: 1024px) {
  .btn-menu-toggle {
    display: flex !important;
    min-width: 44px;
    min-height: 44px;
  }

  .btn-icon-header { min-width: 44px; min-height: 44px; }

  .main-sidebar {
    position: fixed;
    right: 0;
    left: auto;
    top: 0;
    bottom: 0;
    width: 240px;
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    box-shadow: -4px 0 12px rgba(0,0,0,0.15);
  }

  .main-sidebar.is-open { transform: translateX(0); }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
  }

  .sidebar-header {
    display: flex !important;
    justify-content: flex-end;
    padding: 0;
    border: none;
  }

  .sidebar-logo-wrap {
    margin-top: 0;
    padding: 0;
    border: none;
  }

  .btn-sidebar-close {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .btn-sidebar-close:hover { color: #fff; }

  .sidebar-nav { padding: 1.5rem 0; }
  .sidebar-link { padding: 0.75rem 1.25rem; font-size: 0.95rem; text-align: left; }

  .app-content { margin-left: 0; }

  .app-main { grid-template-columns: 1fr; padding: 1rem; }
  .appointments-panel { max-height: 350px; }
}

@media (max-width: 960px) {
  .app-main { grid-template-columns: 1fr; }
  .appointments-panel { max-height: none; overflow: visible; flex: none; min-height: 0; }
  .day-appointments { overflow-y: visible; flex: none; min-height: 0; }
}

/* Mobile */
@media (max-width: 768px) {
  .app-content { overflow: visible; }
  .app-main { flex: none; overflow: visible; min-height: 0; }

  .app-header {
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }

  .header-logo { display: flex; }
  .header-user-name { font-size: 0.85rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .app-main { padding: 0.5rem; gap: 0.75rem; }

  .calendar-section { padding: 10px; height: auto !important; overflow: hidden; }
  .calendar-header { gap: 0.35rem; margin-bottom: 0.5rem; }
  .calendar-title { font-size: 1.1rem; min-width: 130px; }
  .calendar-grid { gap: 2px; row-gap: 2px; min-height: 430px !important; grid-template-rows: repeat(6, minmax(67px, 67px)) !important; align-content: start; }
  .calendar-day { min-height: 67px !important; aspect-ratio: auto; }
  .calendar-weekdays { gap: 0.15rem; }
  .calendar-day { font-size: 0.9rem; padding: 0.1rem; }
  .cal-day-num { color: #374151 !important; font-size: 0.8rem !important; }
  .calendar-count { font-size: 0.7rem !important; min-width: 16px !important; height: 16px !important; }

  .appointments-panel { padding: 0.5rem; max-height: none; overflow: visible; flex: none; min-height: 0; height: auto; }
  .day-appointments { overflow: visible !important; overflow-y: visible; flex: none; min-height: 0; gap: 0.35rem; }
  .panel-title { font-size: 0.85rem; }
  .appointment-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 0.1rem;
    padding: 0.28rem 0.4rem;
  }
  .appointment-meta { font-size: 0.65rem; }
  .appointment-time { font-size: 0.78rem; }
  .appointment-client { font-size: 0.8rem; }
  .appointment-details { font-size: 0.72rem; }
  .appointment-icons {
    grid-column: 1;
    grid-row: auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.15rem;
    margin-top: 0.2rem;
  }
  .btn-icon-action { min-width: 26px; min-height: 26px; width: 26px; height: 26px; font-size: 0.8rem; }

  .modal-content {
    width: 95vw;
    max-height: 85vh;
    padding: 1rem;
    margin: 1rem;
    margin-left: max(1rem, env(safe-area-inset-left));
    margin-right: max(1rem, env(safe-area-inset-right));
  }
  .form-grid { grid-template-columns: 1fr; }
  .modal-actions { flex-wrap: wrap; }

  .toast {
    top: max(1rem, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    bottom: auto;
    width: fit-content;
    height: auto;
    max-width: calc(100vw - 2rem);
    display: inline-block;
  }
}

@media (max-width: 480px) {
  .app-header { min-height: 48px; }
  .header-user-name { max-width: 90px; }
  .app-main { padding: 0.4rem; gap: 0.5rem; }
  .calendar-section { padding: 0.4rem; }
  .calendar-header { gap: 0.3rem; margin-bottom: 0.4rem; }
  .calendar-grid { gap: 2px; row-gap: 2px; min-height: 450px !important; grid-template-rows: repeat(6, minmax(67px, 67px)) !important; align-content: start; }
  .calendar-weekdays { gap: 0.12rem; }
  .calendar-day { font-size: 0.85rem; padding: 0.08rem; min-height: 67px !important; aspect-ratio: auto; }
  .cal-day-num { color: #374151 !important; font-size: 0.75rem !important; }
  .calendar-count { font-size: 0.65rem !important; min-width: 14px !important; height: 14px !important; }
  .btn-icon, .btn-add { min-width: 44px; min-height: 44px; }
  .appointment-card { padding: 0.22rem 0.35rem; gap: 0.08rem; }
  .appointment-meta { font-size: 0.62rem; }
  .appointment-time { font-size: 0.74rem; }
  .appointment-client { font-size: 0.76rem; }
  .appointment-details { font-size: 0.68rem; }
  .client-search-dropdown { max-height: 180px; }
  .modal-content input,
  .modal-content textarea,
  .modal-content .client-search-input {
    font-size: 1.125rem;
  }
}

.calendar-section {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 1.5rem;
  min-width: 0;
  height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}

.calendar-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.calendar-title { margin: 0; font-size: 1.25rem; font-weight: 600; min-width: 180px; text-align: center; }

.btn-icon {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 1rem;
}

.btn-icon:hover { background: var(--gray-300); }

.btn-icon-blue {
  background: #2676C7;
  color: #fff;
  border-color: #2676C7;
}

.btn-icon-blue:hover { background: #1e5fa8; }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.cal-wd {
  font-size: 1.0625rem;
  font-weight: 600;
  text-align: center;
  color: var(--gray-700);
}

.cal-wd-weekend { color: var(--danger); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 0.35rem;
  flex: 1;
  min-height: 200px;
}

.calendar-day {
  width: 100%;
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  align-content: flex-start;
  padding: clamp(0.15rem, 1vw, 0.5rem);
  background: #fff;
  cursor: pointer;
  font-size: 1.5rem;
  transition: border-color 0.15s, background 0.15s;
}

.calendar-day:hover { border-color: var(--primary); background: var(--gray-100); }
.calendar-day.is-outside { opacity: 0.35; color: var(--gray-500); }
.calendar-day.is-weekend { background: rgba(37, 99, 235, 0.08); }
.calendar-day.is-weekend:hover { background: rgba(37, 99, 235, 0.12); }
.calendar-day.is-today { border-color: var(--primary); }
.calendar-day.is-selected {
  border: 2px solid var(--danger);
  background: #fff;
  color: inherit;
  font-weight: 600;
}

.calendar-day.is-selected.is-weekend {
  background: rgba(37, 99, 235, 0.1);
}

.calendar-day.is-neradni {
  background: rgba(220, 53, 69, 0.18);
}
.calendar-day.is-neradni:hover {
  background: rgba(220, 53, 69, 0.25);
}
.calendar-day.is-neradni.is-selected {
  background: rgba(220, 53, 69, 0.22);
}

.cal-day-num { line-height: 1.2; font-size: 0.95rem; color: #374151; }

.calendar-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(18px, 3vw, 24px);
  height: clamp(18px, 3vw, 24px);
  padding: 0.1em 0.2em;
  background: #2676C7;
  color: #fff;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Sedmica (week) view */
.app-main.app-main-week {
  grid-template-columns: 1fr;
}

.app-main-week {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
  min-height: 0;
}

.week-section {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 120px);
}

.week-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.week-header .btn-icon {
  text-decoration: none;
  color: inherit;
}

.week-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}

.week-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.75rem;
  flex: 1;
  min-height: 200px;
  overflow: auto;
}

.week-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  background: #fff;
}

.week-column.is-weekend { background: rgba(37, 99, 235, 0.06); }
.week-column.is-today { border-color: var(--primary); border-width: 2px; }

.week-column-header {
  padding: 0.5rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  flex-shrink: 0;
}

.week-day-name { display: block; font-size: 0.9rem; color: var(--gray-600); }
.week-day-date { display: block; font-size: 1rem; }

.week-column-body {
  padding: 0.35rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.week-appointment-card {
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 8px !important;
  gap: 0.1rem;
  line-height: 1.2;
}
.week-appointment-card .appointment-time,
.week-appointment-card .appointment-client {
  font-size: 0.75rem;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .app-main-week { flex: none; min-height: auto; }
  .week-section {
    padding: 1rem;
    height: auto;
    min-height: 0;
    flex: none;
  }
  .week-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    flex: none;
    min-height: 0;
    overflow: visible;
  }
  .week-column { min-height: 0; }
  .week-column-body {
    overflow: visible;
    flex: none;
    min-height: 0;
  }
  .week-column-header { padding: 0.35rem 0.5rem; }
  .week-day-name { font-size: 0.8rem; }
  .week-day-date { font-size: 0.9rem; }
  .week-appointment-card .appointment-icons { flex-direction: row; }
}

.appointments-panel {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.panel-title { margin: 0; font-size: 0.95rem; font-weight: 600; }

.panel-actions { display: flex; gap: 0.5rem; }

.panel-actions-three {
  flex-wrap: wrap;
  gap: 0.35rem;
}
.panel-actions-three .btn-panel {
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1rem;
}
.panel-actions-three .btn-add.btn-panel {
  width: 32px;
  height: 32px;
  font-size: 1.15rem;
}
.panel-actions-three .btn-neradni {
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #334155;
  border: 1px solid #334155;
  color: #e2e8f0;
}
.panel-actions-three .btn-neradni .neradni-icon {
  display: block;
}
.panel-actions-three .btn-neradni:hover {
  background: #475569;
  border-color: #475569;
}
.panel-actions-three .btn-neradni.is-neradni {
  background: rgba(220, 53, 69, 0.2);
  border-color: rgba(220, 53, 69, 0.5);
  color: #b02a37;
}
.panel-actions-three .btn-neradni.is-neradni:hover {
  background: rgba(220, 53, 69, 0.3);
}

.btn-add {
  width: 36px;
  height: 36px;
  background: #2676C7;
  color: #fff;
  border: none;
  border-radius: 0.35rem;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-add:hover { background: #1e5fa8; }

.day-appointments {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow-y: auto;
  flex: 1;
}

.empty-state { color: var(--gray-500); font-style: italic; padding: 1.25rem 0; }

.appointment-card {
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 0.4rem;
  padding: 0.55rem 0.7rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto auto;
  gap: 0.15rem 0.6rem;
}
.appointment-card:has(.btn-icon-done.is-done) {
  background: #f4f4f5;
}

.appointment-meta { grid-column: 1; font-size: 0.72rem; color: var(--gray-500); line-height: 1.25; }
.appointment-time { grid-column: 1; font-weight: 600; font-size: 0.88rem; line-height: 1.25; }
.appointment-client { grid-column: 1; font-size: 0.9rem; line-height: 1.25; }
.appointment-details { grid-column: 1; font-size: 0.8rem; color: var(--gray-500); line-height: 1.25; }
.appointment-cijena { color: #000; font-weight: 600; }
.appointment-detail { margin-left: 0.35rem; }

.appointment-icons {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-self: center;
}

.btn-icon-action {
  width: 26px;
  height: 26px;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-action:hover { background: var(--gray-300); }
.btn-icon-action.is-done { background: var(--success); color: #fff; border-color: var(--success); }
.btn-icon-action.is-done:hover { background: #15803d; }
.btn-icon-action.is-pending { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-icon-action.is-pending:hover { background: #b91c1c; }

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.5rem;
  width: min(720px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.btn-icon-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-500);
}

.modal-body { display: flex; flex-direction: column; gap: 1rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.client-search-wrap { position: relative; margin-bottom: 1rem; }
.search-label { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.5rem; display: block; }
.client-search-input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  font-size: 1rem;
}
.client-search-input:focus { outline: none; border-color: var(--primary); }
.client-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10;
}
.client-search-item {
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.95rem;
}
.client-search-item:hover { background: var(--gray-100); }
.client-search-item:last-child { border-bottom: none; }
.client-search-item strong { color: var(--gray-700); }

.form-grid label, label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; }

.form-field { display: flex; flex-direction: column; gap: 0.5rem; }
.form-label { font-weight: 600; }

.time-picker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.time-picker .time-select {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  font-size: 1.0625rem;
  background: #fff;
  min-width: 4rem;
}
.time-sep { font-weight: 600; color: var(--gray-700); }
.radio-group { display: flex; gap: 1.5rem; }
.radio-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; cursor: pointer; }

input, textarea {
  padding: 0.6rem 0.75rem;
  border-radius: 0.35rem;
  border: 1px solid var(--gray-300);
}

.modal-content input,
.modal-content textarea,
.modal-content .client-search-input {
  font-size: 1.0625rem;
}

textarea { font-family: inherit; }

.checkbox { flex-direction: row !important; }

.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }

.btn {
  padding: 0.5rem 1rem;
  border-radius: 0.35rem;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: #fff; border: 1px solid var(--gray-300); }
.btn-light:hover { background: var(--gray-100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--danger);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 120;
}

.toast.show { opacity: 1; }
.toast.success { background: var(--success); }

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--sidebar-bg);
}

.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  padding: 2rem;
}

.auth-title {
  margin: 0 0 1.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--sidebar-bg);
  text-align: center;
}

.auth-form label {
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}

.password-wrap {
  position: relative;
  display: flex;
}
.password-wrap input {
  flex: 1;
  padding-right: 2.75rem;
}
.password-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--gray-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
}
.password-toggle:hover {
  color: var(--gray-700);
}
.password-toggle .icon-eye-off {
  display: none;
}
.password-toggle .icon-eye-off.visible {
  display: block;
}
.password-toggle .icon-eye.hidden {
  display: none;
}

.auth-form .password-wrap input {
  padding-right: 2.75rem;
}
.auth-form input {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  font-size: 1rem;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--sidebar-bg);
}

.auth-form .btn-primary {
  background: var(--sidebar-bg);
  margin-top: 0.5rem;
}

.auth-form .btn-primary:hover {
  background: var(--sidebar-hover);
}

@media (max-width: 480px) {
  .auth-wrapper { padding: 1rem; }
  .auth-card { padding: 1.5rem; }
  .auth-title { font-size: 1.2rem; }
}

.auth-forgot {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.9rem;
}
.auth-forgot a {
  color: var(--primary);
  text-decoration: none;
}
.auth-forgot a:hover {
  text-decoration: underline;
}

.auth-desc {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--gray-500);
}
.auth-back {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.9rem;
}
.auth-back a {
  color: var(--primary);
  text-decoration: none;
}
.auth-back a:hover {
  text-decoration: underline;
}
.alert-success {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
}

.auth-form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.alert { padding: 0.75rem; border-radius: 0.35rem; margin-bottom: 1rem; }
.alert-error { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

/* Historija */
.historija-main {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  gap: 1rem;
}

.historija-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.historija-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-700);
}

.historija-actions {
  display: flex;
  gap: 0.5rem;
}

.historija-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border-radius: 0.5rem;
  border: 1px solid var(--gray-300);
  align-self: flex-start;
}

.historija-stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.historija-stat-label {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.historija-stat-value {
  font-size: 1rem;
  font-weight: 600;
}

.historija-stat-money,
.historija-stat-total {
  color: var(--danger);
}

.historija-stat-total {
  font-weight: 700;
}

.historija-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.input-search {
  min-width: 180px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  font-size: 0.95rem;
}

.input-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  font-size: 0.95rem;
  background: #fff;
}

.historija-table-wrap {
  overflow-x: auto;
  background: #fff;
  border-radius: 0.5rem;
  border: 1px solid var(--gray-300);
}

.historija-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.historija-table th,
.historija-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-300);
}

.historija-table th {
  background: var(--gray-100);
  font-weight: 600;
  color: var(--gray-700);
}

.historija-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.historija-table tbody tr:hover {
  background: #f1f5f9;
}

.historija-empty {
  text-align: center;
  color: var(--gray-500);
  padding: 2rem !important;
}

.historija-placanje {
  display: inline-flex;
  align-items: center;
}

.icon-payment.icon-cash { color: #16a34a; }
.icon-payment.icon-card { color: #2563eb; }

.btn-odradjen {
  padding: 0.3rem 0.6rem;
  border: none;
  border-radius: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-odradjen-da {
  background: rgba(22, 163, 74, 0.15);
  color: var(--success);
}

.btn-odradjen-ne {
  background: var(--gray-100);
  color: var(--gray-500);
}

.btn-odradjen:hover {
  opacity: 0.9;
}

.historija-pagination {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.historija-pagination[hidden] { display: none !important; }
.historija-page-info {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-right: 0.5rem;
}
.historija-page-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.historija-page-btn {
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--gray-700);
}
.historija-page-btn:hover:not(:disabled) {
  background: var(--gray-100);
  border-color: var(--gray-400);
}
.historija-page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.historija-page-btn.historija-page-active {
  background: #2676C7;
  border-color: #2676C7;
  color: #fff;
}
.historija-page-btn.historija-page-active:hover {
  background: #1e5fa8;
  border-color: #1e5fa8;
}

@media (max-width: 1024px) {
  .historija-main { padding: 1rem; }
  .historija-table-wrap { overflow-x: scroll; }
  .historija-table { font-size: 0.8rem; min-width: 900px; }
  .historija-table th,
  .historija-table td { padding: 0.5rem 0.6rem; }
}

/* Statistika */
.statistika-main {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  gap: 1.5rem;
}

.statistika-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.statistika-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-700);
}

.statistika-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.statistika-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-card-highlight {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.stat-card-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gray-700);
}

.stat-card-highlight .stat-card-value {
  color: var(--primary);
}

.statistika-charts {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 1.5rem;
}

.chart-box {
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  padding: 1rem;
}

.chart-box-wide {
  grid-column: 1 / -1;
}

.statistika-two-cols {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.chart-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
}

.chart-container {
  position: relative;
  height: 240px;
}

.chart-legend-text {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-700);
  text-align: center;
}

.chart-box-wide .chart-container {
  height: 280px;
}

@media (max-width: 1024px) {
  .statistika-main { padding: 1rem; }
  .statistika-charts { grid-template-columns: 1fr; }
  .statistika-two-cols { grid-template-columns: 1fr; }
}

/* Korisnici */
.korisnici-main {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  gap: 1.5rem;
}

.korisnici-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.korisnici-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-700);
}

.korisnici-table-wrap {
  overflow-x: auto;
  background: #fff;
  border-radius: 0.5rem;
  border: 1px solid var(--gray-300);
}

.korisnici-table .btn-edit,
.korisnici-table .btn-delete {
  margin-right: 0.5rem;
  font-size: 0.9rem;
}

.korisnici-table .btn-delete { color: var(--danger); }

.korisnici-uvid-cell { text-align: center; vertical-align: middle; }
.korisnici-uvid-label { display: inline-flex; align-items: center; cursor: pointer; margin: 0; }
.korisnici-uvid-cb { width: 1.1rem; height: 1.1rem; cursor: pointer; }

.form-field-checkbox { display: flex; align-items: center; gap: 0.5rem; }
.form-field-checkbox input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.35rem;
}

.role-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.role-badge.role-admin {
  background: rgba(37, 99, 235, 0.15);
  color: var(--primary);
}

.role-badge.role-radnik {
  background: rgba(100, 116, 139, 0.15);
  color: var(--gray-500);
}

@media (max-width: 1024px) {
  .korisnici-main { padding: 1rem; }
}

/* Email predlošci */
.email-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.email-header {
  margin-bottom: 0.5rem;
}

.email-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-700);
}

.email-desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--gray-500);
}

.email-templates-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.email-template-card {
  background: #fff;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
}

.email-template-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gray-700);
}

.email-template-card .form-label {
  display: block;
  margin-bottom: 0.35rem;
}

.email-template-form label {
  display: block;
  margin-bottom: 1rem;
}

.email-template-form input,
.email-template-form textarea {
  width: 100%;
}

.email-template-actions {
  margin-top: 1rem;
}

.email-loading,
.email-empty,
.email-error {
  text-align: center;
  color: var(--gray-500);
  padding: 2rem;
}

.email-error {
  color: var(--danger);
}

/* Email modal (dashboard) */
.email-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.email-options .radio-label {
  display: inline;
  font-weight: 500;
  cursor: pointer;
}

.email-modal-recipient {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--gray-700);
}

.email-modal-recipient.email-no-address {
  color: var(--danger);
}
