/* TESLAELECTRIC - Radno vreme i plata
   Čist, poslovno orijentisan dizajn u duhu elektro-struke: bela pozadina
   sa plavim akcentima (bez tamno-teget/crne palete). */

:root {
  --brand-950: #0a3866;
  --brand-900: #0f4c86;
  --brand-800: #14609f;
  --brand-700: #1c74b8;
  --brand-600: #2f8ed6;
  --brand-100: #e9f3fc;
  --brand-on-dark: #7ec8f5;

  --gray-50: #f6f7fa;
  --gray-100: #eef0f4;
  --gray-200: #e2e5ec;
  --gray-300: #cbd0db;
  --gray-500: #7c8494;
  --gray-600: #5b6473;
  --gray-700: #3b4453;
  --gray-900: #1c222e;

  --green-600: #1c8a52;
  --green-100: #e2f6ec;
  --red-600: #c0392b;
  --red-100: #fbe6e3;
  --blue-600: #2563eb;
  --blue-100: #e7effe;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(11, 31, 58, 0.16);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";

  --topbar-h: 64px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
/* body raste sa sadržajem (min-height, ne height) - sa fiksnom visinom od
   100% svijetla pozadina je pokrivala samo prvi ekran, pa se ispod, kad se
   stranica skroluje, iza kartica vidjela tamnoplava pozadina (html). */
html { height: 100%; }
body { min-height: 100%; }
/* Fallback canvas colour behind the document (iOS Safari rubber-band
   overscroll, and any sliver outside the painted body) - brand navy reads
   far better than the default white flash, on every page. */
html { background: var(--brand-950); }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--gray-50);
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 8px; }
a { color: inherit; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

.app-root { min-height: 100%; display: flex; flex-direction: column; }

/* ---------- Boot loader ---------- */
/* Fiksni sloj PREKO cijele stranice (ne dio #app) - tako ostaje vidljiv
   dok se JS učitava, i dok se prva prava stranica iscrtava ispod njega,
   pa se tek onda lijepo utopi (opacity fade) umjesto da naglo nestane. */
.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  height: 100vh;
  height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  background: linear-gradient(160deg, var(--brand-950), var(--brand-700));
  color: var(--gray-100);
  opacity: 1;
  transition: opacity .35s ease;
}
.boot-loader.boot-loader--hide {
  opacity: 0;
  pointer-events: none;
}
.boot-mark { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .6; transform: scale(.92);} }
/* Osoba koja je uključila "manje pokreta" u telefonu/računaru - ugasi bez
   animacije umjesto da joj nešto treperi/pulsira i blijedi. */
@media (prefers-reduced-motion: reduce) {
  .boot-loader { transition: none; }
  .boot-mark { animation: none; }
}

/* ---------- Login page ---------- */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, var(--brand-700), var(--brand-950) 65%);
  /* viewport-fit=cover lets this bleed under the notch/home-indicator on
     iOS - pad the content itself in from those safe-area insets so the
     card never sits under the notch, while the background still fully
     covers the screen edge to edge instead of leaving a white sliver. */
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  position: relative;
  overflow: hidden;
}
.login-bg-logo {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  z-index: 0;
}
.login-bg-logo img {
  width: min(980px, 82vw);
  max-width: none;
  opacity: 0.2;
  user-select: none;
}
@media (max-width: 640px) {
  .login-bg-logo { align-items: flex-start; padding-top: 64px; }
  .login-bg-logo img { width: min(640px, 92vw); opacity: 0.22; }
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 28px;
  position: relative;
  z-index: 1;
}
.brand-mark {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  margin-bottom: 22px;
}
.brand-mark svg { flex-shrink: 0; }
.brand-mark .brand-text {
  font-size: 22px; font-weight: 800; letter-spacing: 0.02em;
  color: var(--brand-950);
}
.brand-mark .brand-text span { color: var(--brand-600); }
.version-tag {
  display: inline-block; font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em; padding: 2px 7px; border-radius: 999px;
  vertical-align: middle; margin-left: 7px; text-transform: uppercase;
}
.brand-mark .version-tag { background: var(--brand-100); color: var(--brand-600); }
.brand-sub {
  text-align: center; color: var(--gray-500); font-size: 13px; margin-bottom: 26px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 600; color: var(--gray-700);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  color: var(--gray-900);
  transition: border-color .15s, background .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-600); background: #fff;
}
.field-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
/* "Prikaži lozinku" dugme (oko ikonica) unutar polja za lozinku. */
.password-field-wrap { position: relative; }
.password-field-wrap input { padding-right: 44px; }
.password-toggle-btn {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--gray-500); cursor: pointer; padding: 0;
}
.password-toggle-btn:hover { color: var(--gray-700); background: var(--gray-100); }
.password-toggle-btn:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 1px; }
/* Amount fields where scrolling/clicking the native spinner could
   accidentally change a typed value - digits must be typed by hand. */
input.no-spinner::-webkit-outer-spin-button,
input.no-spinner::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input.no-spinner {
  -moz-appearance: textfield;
  appearance: textfield;
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.checkbox-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
  padding: 10px 12px; background: var(--gray-50); border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200);
}
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand-600); }
.checkbox-row label { font-weight: 600; font-size: 14px; color: var(--gray-700); cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--radius-sm);
  padding: 11px 18px; font-weight: 700; font-size: 14px;
  cursor: pointer; transition: transform .05s, box-shadow .15s, background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-700); }
.btn-block { width: 100%; }
.btn-secondary { background: var(--brand-900); color: #fff; }
.btn-secondary:hover { background: var(--brand-800); }
.btn-ghost { background: transparent; color: var(--brand-900); border: 1.5px solid var(--gray-300); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-danger { background: var(--red-100); color: var(--red-600); }
.btn-danger:hover { background: #f7d3ce; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-icon { padding: 8px; border-radius: 8px; }

.forgot-link {
  display: block; text-align: center; margin-top: 16px; font-size: 13.5px;
  font-weight: 700; color: var(--brand-600); text-decoration: none; cursor: pointer;
}
.forgot-link:hover { text-decoration: underline; }
.login-error {
  background: var(--red-100); color: var(--red-600); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; margin-bottom: 16px; font-weight: 600;
}
.login-credit {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 1;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.02em;
  pointer-events: none;
}
@media (max-width: 640px) {
  .login-credit {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    font-size: 11px;
  }
}

/* ---------- Shell layout (post-login) ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand-950), var(--brand-900));
  color: var(--gray-100);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform .2s ease;
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .brand-text { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: .02em; }
.sidebar-brand .brand-text span { color: var(--brand-on-dark); }
.sidebar-close {
  display: none; background: none; border: none; color: rgba(255,255,255,0.7);
  font-size: 18px; line-height: 1; padding: 6px; cursor: pointer; border-radius: 6px;
  min-width: 40px; min-height: 40px; /* lakše za prst na telefonu */
}
.sidebar-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 9px; margin-bottom: 3px;
  color: rgba(255,255,255,0.75); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .15s, color .15s;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav .nav-link.active { background: #fff; color: var(--brand-900); }
.nav-badge {
  margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px !important;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; flex-shrink: 0;
}
.nav-badge:hover { filter: brightness(1.08); }
.sidebar-nav .nav-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,0.45); padding: 14px 12px 6px;
}
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer .btn-ghost {
  color: #fff;
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.04);
}
.sidebar-footer .btn-ghost:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.4); }
.sidebar-footer .btn-ghost svg { stroke: #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-600); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.user-meta .user-name { font-size: 13.5px; font-weight: 700; color: #fff; }
.user-meta .user-role { font-size: 11.5px; color: rgba(255,255,255,0.55); text-transform: capitalize; }

.main-col { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: #fff; border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-size: 18px; font-weight: 800; color: var(--brand-900); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.hamburger { display: none; }

/* Extra bottom padding (beyond the 24px on every other side) leaves room
   for .notif-fab, which - unlike the mobile-only quick-add .fab - can float
   over the bottom of any page at any screen width, so the last card's
   content never ends up hidden behind it. Dva kruga jedan iznad drugog
   (zvonce + Poruke) - zato 170px (na telefonu 160px). */
.content { padding: 24px 24px 170px; flex: 1; width: 100%; max-width: 1200px; }

/* ---------- Cards / dashboard ---------- */
.card {
  background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200); padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
}
.card-header h2, .card-header h3 { font-size: 16px; color: var(--brand-900); }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  background: #fff; border-radius: var(--radius-md); border: 1px solid var(--gray-200);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat-card .stat-label {
  font-size: 12px; color: var(--gray-500); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.stat-card .stat-value { font-size: 22px; font-weight: 800; color: var(--brand-900); }
.stat-card .stat-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.stat-card.accent { border-color: var(--brand-600); background: linear-gradient(160deg, #fff, var(--brand-100)); }
.stat-card.accent .stat-value { color: var(--brand-950); }
.stat-card.total { background: linear-gradient(160deg, var(--brand-900), var(--brand-700)); border: none; }
.stat-card.total .stat-label { color: rgba(255,255,255,0.65); }
.stat-card.total .stat-value { color: #fff; font-size: 26px; }
.stat-card.rate-hidden .stat-value {
  font-size: 15px; font-weight: 700; color: var(--brand-600);
  text-decoration: underline; text-underline-offset: 2px;
}
.stat-card.rate-toggle .stat-sub {
  color: var(--brand-600); font-weight: 700; text-decoration: underline;
  text-underline-offset: 2px; cursor: pointer;
}

/* ---------- Month picker (sole month navigation on the month page) ------ */
.month-picker-row {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.month-picker-input {
  padding: 9px 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--gray-200);
  background: #fff; color: var(--brand-900); font-weight: 700; font-size: 13.5px;
  flex-shrink: 0; cursor: pointer; text-align: left; font-family: var(--font-sans);
}
.month-picker-input:hover, .month-picker-input:focus { outline: none; border-color: var(--brand-600); }
/* Standalone trigger showing just the current month - bigger and clearer
   since it's the only month control on the page now (no more chip row). */
.current-month-picker .month-picker-input {
  padding: 13px 20px 13px 44px; font-size: 17px; border-radius: var(--radius-md);
  border-width: 2px; position: relative;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230a3866' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center;
}
.current-month-picker .month-picker-input::after {
  content: '▾'; margin-left: 10px; color: var(--gray-500); font-size: 12px;
}

/* ---------- Custom Serbian date/month picker (components/datePicker.js) --
   Native <input type="date"/"month"> pop-up calendars follow the browser's
   own language, not the page's - so entry dates and month navigation use
   this custom dropdown instead, always shown in Serbian. --------------- */
.date-picker { position: relative; width: 100%; }
.date-picker.month-picker { width: auto; }
.date-picker-trigger {
  width: 100%; text-align: left; cursor: pointer; font-family: var(--font-sans);
  padding: 11px 13px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  background: var(--gray-50); color: var(--gray-900); font-size: 14px;
  transition: border-color .15s, background .15s;
}
.date-picker-trigger:hover, .date-picker-trigger:focus {
  outline: none; border-color: var(--brand-600); background: #fff;
}
.date-picker-popup {
  position: fixed; z-index: 250; background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 12px;
  animation: fadeIn .1s ease;
}
.date-picker-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.date-picker-title { font-weight: 700; font-size: 13.5px; color: var(--brand-900); }
.date-picker-nav {
  width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--gray-200);
  background: #fff; color: var(--brand-800); font-size: 15px; line-height: 1; cursor: pointer;
}
.date-picker-nav:hover { border-color: var(--brand-600); background: var(--brand-100); }
.date-picker-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.date-picker-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--gray-500); padding: 4px 0; }
.date-picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-picker-cell {
  width: 34px; height: 34px; border: none; background: none; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--gray-900); cursor: pointer;
}
.date-picker-cell:hover { background: var(--brand-100); }
.date-picker-cell.today { font-weight: 700; color: var(--brand-800); box-shadow: inset 0 0 0 1.5px var(--brand-600); }
.date-picker-cell.selected { background: var(--brand-900); color: #fff; font-weight: 700; }
.date-picker-cell.empty { cursor: default; }
.date-picker-cell.empty:hover { background: none; }
.date-picker-cell.disabled { color: var(--gray-300); cursor: not-allowed; }
.date-picker-cell.disabled:hover { background: none; }
.month-picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; min-width: 200px; }
.month-picker-cell {
  padding: 10px 6px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  background: #fff; color: var(--gray-700); font-size: 13px; font-weight: 600; cursor: pointer;
}
.month-picker-cell:hover { border-color: var(--brand-600); color: var(--brand-800); }
.month-picker-cell.selected { background: var(--brand-900); border-color: var(--brand-900); color: #fff; }
.month-picker-cell.disabled { color: var(--gray-300); cursor: not-allowed; }
.month-picker-cell.disabled:hover { border-color: var(--gray-200); color: var(--gray-300); }

/* Stat card showing a total that isn't final yet (month still in progress) */
.stat-card.pending { border-style: dashed; }
.stat-card.total.pending { background: linear-gradient(160deg, var(--gray-600), var(--gray-700)); }
.stat-card.total.pending .stat-value { color: rgba(255,255,255,0.85); font-size: 20px; }
.stat-card.total.pending .stat-sub { color: rgba(255,255,255,0.65); }
/* Stat card for an amount that subtracts from the total (deductions) */
.stat-card.negative .stat-value { color: var(--red-600); }

/* ---------- Salary breakdown ("receipt") ---------- */
.calc-breakdown {
  margin-top: 4px; padding-top: 16px; border-top: 1px dashed var(--gray-200);
}
.calc-breakdown-row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 6px 0; font-size: 14px; color: var(--gray-700);
}
.calc-breakdown-row .calc-label { color: var(--gray-600); }
.calc-breakdown-row .calc-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.calc-breakdown-row.total {
  margin-top: 6px; padding-top: 14px; border-top: 2px solid var(--brand-900);
  font-size: 17px; font-weight: 800; color: var(--brand-950);
}
.calc-breakdown-row.total .calc-value { font-size: 19px; }

/* ---------- Lock badge / header actions ---------- */
.badge-locked { background: var(--gray-700); color: #fff; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- "Ko danas radi" panel ---------- */
.today-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.today-col-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.today-col-title.working { color: var(--green-600); }
.today-col-title.off { color: var(--gray-500); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.person-chip { padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.person-chip.working { background: var(--green-100); color: var(--green-600); }
.person-chip.off { background: var(--gray-100); color: var(--gray-600); }

/* ---------- Missing-hours alert panel ---------- */
.alert-card { border-color: var(--red-100); background: linear-gradient(160deg, #fff, #fdf4f3); }
.alert-line { font-size: 14px; color: var(--red-600); font-weight: 600; padding: 4px 0; }
tr.row-alert { background: #fdf4f3; }
tr.row-alert:hover { background: #fbe8e6; }

/* ---------- Informational notice box (e.g. "these figures are approximate") ---------- */
.notice-box {
  background: #fdf6e8; border: 1px solid #f0dba6; color: #7a5a10;
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px;
  line-height: 1.5; margin-bottom: 16px;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--gray-200); }
table.data-table { width: 100%; border-collapse: collapse; min-width: 640px; background: #fff; }
table.data-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--gray-500); font-weight: 700; padding: 12px 14px; background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
table.data-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--gray-100); font-size: 14px; vertical-align: top;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--gray-50); }
table.data-table tr.clickable { cursor: pointer; }
th.sortable-th {
  cursor: pointer; user-select: none;
}
th.sortable-th:hover { color: var(--brand-900); }
th.sortable-th.active { color: var(--brand-900); }
th.sortable-th .sort-arrow { display: inline-block; font-size: 10px; }
.cell-muted { color: var(--gray-500); font-size: 13px; }
.cell-strong { font-weight: 700; color: var(--brand-900); }
.expense-tag {
  display: inline-block; background: var(--blue-100); color: var(--blue-600);
  border-radius: 6px; padding: 2px 7px; font-size: 12px; font-weight: 600; margin: 1px 3px 1px 0;
}
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-amber { background: var(--brand-100); color: var(--brand-900); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-green { background: var(--green-100); color: var(--green-600); }
.badge-red { background: var(--red-100); color: var(--red-600); }
.badge-blue { background: var(--blue-100); color: var(--blue-600); }

/* Inline "wasn't at work" marker on the monthly entries table, for a
   weekday with no logged work entry but a matching announced absence
   (godišnji/slava show as a badge instead; unexcused "odsutan" gets this
   bold red X so it stands out as something the admin should notice). */
.absence-x { color: var(--red-600); font-weight: 800; font-size: 16px; }

.row-actions { display: flex; gap: 6px; }

.empty-state {
  text-align: center; padding: 46px 20px; color: var(--gray-500);
}
.empty-state svg { margin-bottom: 10px; opacity: .5; }
.empty-state p { font-size: 14px; }

/* ---------- Učinak (grouped by employee) ---------- */
.ucinak-emp-section { border-top: 1px solid var(--gray-200); padding: 14px 0; }
.ucinak-emp-section:first-child { border-top: none; padding-top: 4px; }
.ucinak-emp-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ucinak-emp-name { font-weight: 700; color: var(--brand-900); font-size: 14.5px; }
.ucinak-emp-count { margin-left: auto; font-size: 12px; color: var(--gray-500); font-weight: 600; }
.ucinak-emp-empty { margin: 0 0 0 38px; }

/* ---------- Absences ("odsustva") list ---------- */
.absence-list { display: flex; flex-direction: column; }
.absence-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  padding: 14px 2px; border-bottom: 1px solid var(--gray-200);
}
.absence-row:last-child { border-bottom: none; }
.absence-row.own { background: var(--brand-100); margin: 0 -14px; padding-left: 14px; padding-right: 14px; border-radius: var(--radius-sm); border-bottom-color: transparent; }
.absence-row.unseen { background: var(--red-100); margin: 0 -14px; padding-left: 14px; padding-right: 14px; border-radius: var(--radius-sm); border-bottom-color: transparent; }
.absence-row.unseen .absence-row-main { color: var(--red-600); font-weight: 700; }
.absence-row-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.absence-row .tag-new { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--red-600); color: #fff; }
/* Novosti u aplikaciji - uvijek svijetloplave, sa plavom crtom lijevo. */
.absence-row.novost { background: #dcecfb; margin: 0 -14px; padding-left: 12px; padding-right: 14px; border-radius: var(--radius-sm); border-bottom-color: transparent; border-left: 4px solid var(--brand-600); }
.absence-row.novost .absence-row-main { color: var(--brand-900); font-weight: 600; }
.absence-row .tag-novost { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--brand-600); color: #fff; letter-spacing: .03em; }
.absence-name { font-weight: 700; color: var(--brand-900); font-size: 14px; }
.absence-range { font-size: 14px; color: var(--gray-700); font-weight: 600; }
.absence-note { font-size: 13px; color: var(--gray-500); flex-basis: 100%; }
@media (max-width: 640px) {
  .absence-row { flex-direction: column; align-items: flex-start; }
  .absence-row .row-actions { width: 100%; }
  .absence-row .row-actions .btn { flex: 1; }
}

/* ---------- Predaja sati ("Predaj sate") ---------- */
.submit-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-radius: var(--radius-md); padding: 16px 20px; margin-bottom: 18px;
}
.submit-banner.pending { background: var(--red-100); border: 1.5px solid #f1b8b0; }
.submit-banner.waiting { background: var(--brand-100); border: 1.5px solid #bcdcf6; }
.submit-banner.waiting .submit-banner-title { color: var(--brand-900); }
.submit-banner.done { background: var(--green-100); border: 1.5px solid #a9dfc2; }
.submit-banner-title { font-weight: 800; font-size: 15px; }
.submit-banner.pending .submit-banner-title { color: var(--red-600); }
.submit-banner.done .submit-banner-title { color: var(--green-600); }
.submit-banner-sub { font-size: 13px; color: var(--gray-600); margin-top: 3px; line-height: 1.45; }
.submit-banner .btn { flex-shrink: 0; }
.btn-green { background: var(--green-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-green:hover { background: #166b3f; }
@media (max-width: 640px) {
  .submit-banner { flex-direction: column; align-items: stretch; gap: 12px; }
  .submit-banner .btn { width: 100%; }
}

/* Traka "predalo X od Y" na administratorovom Pregledu. */
.submit-progress {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
  font-size: 13.5px; color: var(--gray-700);
}
.submit-progress.all-done { background: var(--green-100); border-color: #a9dfc2; }
.submit-progress.all-done strong { color: var(--green-600); }
.submit-progress .bar { flex: 1; min-width: 120px; height: 8px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.submit-progress .bar i { display: block; height: 100%; background: var(--green-600); }
.submit-missing { color: var(--red-600); font-weight: 700; }
.submit-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.submit-cell .btn { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; }

/* ---------- Password reset requests ("Obavještenja" - admin) ---------- */
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--red-100); border-radius: var(--radius-sm); padding: 14px 16px;
}
.req-row .req-text { font-size: 14.5px; font-weight: 700; color: var(--red-600); }
.req-row .req-note { font-size: 13px; color: var(--gray-600); font-weight: 500; margin-top: 3px; }
.req-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 640px) {
  .req-row { flex-direction: column; align-items: flex-start; }
  .req-actions { width: 100%; }
  .req-actions .btn { flex: 1; }
}

/* ---------- Forms / modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 56, 102, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 16px; overflow-y: auto; z-index: 100;
  animation: fadeIn .12s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}

/* Short informational notices (e.g. "bolji pregled na računaru") are
   centered in the middle of the screen, unlike the regular top-aligned
   (and, on mobile, edge-to-edge) modals used for forms. */
.modal-backdrop.notice-modal { align-items: center; }
.modal-backdrop.notice-modal .modal { max-width: 420px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: 16.5px; color: var(--brand-900); }
.modal-close {
  background: none; border: none; cursor: pointer; color: var(--gray-500); font-size: 22px; line-height: 1;
  /* Dovoljno veliko za prst na telefonu (ranije ~20x28 px, lako se promaši). */
  min-width: 40px; min-height: 40px; margin: -8px -10px -8px 0; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--gray-100); }
.modal-body { padding: 20px 22px; max-height: 70vh; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }

.expense-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.expense-row .field { margin-bottom: 0; flex: 1; }
.expense-row .field.amount { max-width: 130px; }
.add-expense-btn { margin-top: 4px; }

.form-error { background: var(--red-100); color: var(--red-600); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 14px; font-weight: 600; }
.form-success { background: var(--green-100); color: var(--green-600); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 14px; font-weight: 600; }

.divider { height: 1px; background: var(--gray-200); margin: 18px 0; }

.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.helper-text { color: var(--gray-500); font-size: 13px; }

/* Field-work allowance readout inside forms */
.allowance-readout {
  background: var(--brand-100); border: 1.5px dashed var(--brand-600); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13.5px; color: var(--brand-900); font-weight: 600; margin-bottom: 16px;
}

/* Fab (mobile quick-add) */
.fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand-600); color: #fff;
  display: none; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg); border: none; cursor: pointer; font-size: 26px;
}

/* Notification fab - bottom-left, floats above the main content (not the
   sidebar itself, so it never sits under/behind the sidebar's own footer
   card). Only ever in the DOM when there's something unread/unseen to show
   - see attachNotificationFab() in shell.js - so it simply isn't there the
   rest of the time, same as the small inline sidebar badges it complements. */
.notif-fab {
  position: fixed; left: calc(var(--sidebar-w) + 20px); bottom: 20px; z-index: 45;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand-600); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg); border: none; cursor: pointer;
  animation: notifFabPop .18s ease;
}
.notif-fab:hover { background: var(--brand-700); }
.notif-fab-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--red-600); color: #fff; font-size: 14px; font-weight: 900;
  min-width: 25px; height: 25px; border-radius: 13px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid #fff; line-height: 1;
  box-shadow: 0 2px 5px rgba(192, 57, 43, 0.5);
}
@keyframes notifFabPop { from { transform: scale(.6); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* Drugi plutajući krug - nova najavljena odsustva - stoji IZNAD onog za
   obavještenja (koji ostaje na svom mjestu, na dnu). Pojavljuje se samo kad
   stvarno ima novih odsustava, pa u normalnom stanju na ekranu i dalje stoji
   samo jedan krug. Visina 88px = 20px (dno) + 56px (visina kruga) + 12px
   razmaka na računaru, odnosno 16 + 60 + 12 na telefonu - ista vrijednost
   odgovara i jednom i drugom, pa nije potreban poseban mobilni slučaj.
   Zelena, da se na prvi pogled razlikuje od plavog kruga za obavještenja. */
/* Napomena "Obavještenja na telefonu" - dok je skrivena, kartica ispod nje
   ne smije dobiti razmak kao da je iznad nje nešto. */
.push-card[hidden] { display: none; }
.push-card[hidden] + .card { margin-top: 0; }

/* Krug je namjerno SAMO JEDAN. Ranije je postojao i drugi (zeleni, za
   odsustva) iznad ovog, ali je zatrpavao ekran - sad se sve sabira na ovaj
   jedan, a pojedinačni brojevi stoje na stavkama menija. */

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-500); margin-bottom: 14px; }
.breadcrumb a, .breadcrumb .crumb-link { color: var(--brand-800); font-weight: 700; cursor: pointer; }
.breadcrumb a:hover, .breadcrumb .crumb-link:hover { text-decoration: underline; }

/* Toast */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--brand-950); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; max-width: 320px;
  animation: slideIn .15s ease;
}
.toast.success { background: var(--green-600); }
.toast.error { background: var(--red-600); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0 } to { transform: translateX(0); opacity: 1 } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main-col { margin-left: 0; }
  .hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--gray-200);
    background: #fff; cursor: pointer;
  }
  .sidebar-scrim {
    display: none; position: fixed; inset: 0; background: rgba(10,56,102,0.4); z-index: 39;
  }
  .sidebar-scrim.show { display: block; }
  .fab { display: flex; }
  /* Sidebar is off-canvas below this width (main-col spans full width), so
     the fab belongs at the true left edge of the screen here, not offset
     past a sidebar that's no longer taking up any horizontal space. */
  /* Bigger circle and an even more prominent red number on phones, where
     this button matters most (that's where employees actually use the
     app day to day) - a larger, easier-to-tap target with a badge that
     reads at a glance without squinting. */
  .notif-fab { left: 16px; bottom: 16px; width: 60px; height: 60px; }
  /* Dok je meni otvoren, plutajući krug se sklanja: stoji tačno preko dna
     menija i prekrivao je ime korisnika i dugme "Odjavi se". Dok je meni
     otvoren ionako je suvišan - stavke "Obavijesti" i "Odsustva" su tu, sa
     svojim crvenim brojevima. */
  .sidebar.open ~ .notif-fab,
  #app.menu-otvoren .notif-fab { display: none !important; }
  .notif-fab-badge {
    top: -7px; right: -7px; min-width: 27px; height: 27px; font-size: 15px;
    border-width: 3px;
  }
  .sidebar-nav .nav-link { padding: 13px 12px; }
  .sidebar-close { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; }
}

@media (max-width: 640px) {
  .content { padding: 14px 14px 160px; }
  .topbar { padding: 0 14px; }
  .topbar-title { font-size: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 13px 14px; }
  .stat-card .stat-value { font-size: 19px; }
  .stat-card.total .stat-value { font-size: 22px; }
  .card { padding: 16px; }
  .modal { max-width: 100%; margin: 0; border-radius: var(--radius-md); }
  .modal-backdrop { padding: 0; align-items: flex-start; }
  .modal-backdrop .modal { border-radius: 0; min-height: 0; }
  /* Na telefonu prozor (npr. "Dodaj radni dan") zauzima najviše cijeli
     ekran: sadržaj se skroluje, a dugmad "Otkaži"/"Sačuvaj" uvijek ostaju
     vidljiva na dnu - ranije su na manjim telefonima znala pasti ispod ivice
     ekrana, pa se moralo skrolovati da bi se došlo do "Sačuvaj". */
  .modal-backdrop:not(.notice-modal) .modal { display: flex; flex-direction: column; max-height: 100vh; max-height: 100dvh; }
  .modal-backdrop:not(.notice-modal) .modal-body { max-height: none; flex: 1 1 auto; min-height: 0; }
  /* Short informational notices stay centered, small, and rounded even on
     mobile - not the edge-to-edge full-screen treatment used for forms. */
  .modal-backdrop.notice-modal { align-items: center; padding: 20px 16px; }
  .modal-backdrop.notice-modal .modal { max-width: 420px; border-radius: var(--radius-lg); margin: 0; }
  .field-row { flex-direction: column; gap: 0; }
  .login-card { padding: 28px 20px; }

  /* Bigger, easier-to-tap controls on touch screens. */
  .btn { min-height: 44px; padding: 11px 16px; }
  .btn-sm { min-height: 38px; }
  .field input, .field select, .field textarea, .date-picker-trigger,
  .month-picker-input, .checkbox-row input[type="checkbox"] {
    font-size: 16px; /* prevents iOS Safari from auto-zooming on focus */
  }
  .field input, .field select, .field textarea, .date-picker-trigger { min-height: 44px; }
  .checkbox-row input[type="checkbox"] { width: 22px; height: 22px; }
  .month-picker-row { flex-direction: column; align-items: stretch; }
  .month-picker-input { min-height: 44px; width: 100%; }
  .card-header { gap: 12px; }
  .card-header .btn { width: 100%; }
  .header-actions { width: 100%; }
  .header-actions .btn { width: 100%; }
  .header-actions .month-picker-input { width: 100%; }
  .today-cols { grid-template-columns: 1fr; gap: 16px; }
  /* Full-width, stacked footer buttons instead of a cramped single row -
     there's plenty of vertical room in the full-screen mobile modal. */
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; }

  /* Stacked "card" layout for wide tables instead of horizontal scrolling. */
  table.responsive-table { min-width: 0; }
  table.responsive-table thead { display: none; }
  table.responsive-table, table.responsive-table tbody, table.responsive-table tr, table.responsive-table td {
    display: block; width: 100%;
  }
  table.responsive-table tr { padding: 12px 14px; border-bottom: 1px solid var(--gray-200); }
  table.responsive-table tr:last-child { border-bottom: none; }
  table.responsive-table td {
    border: none; padding: 5px 0; display: flex; align-items: flex-start;
    justify-content: space-between; gap: 12px; font-size: 13.5px;
  }
  table.responsive-table td::before {
    content: attr(data-label); font-weight: 700; color: var(--gray-500);
    font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
    flex-shrink: 0; padding-top: 1px;
  }
  table.responsive-table td:empty,
  table.responsive-table td.cell-actions { justify-content: flex-end; }
  table.responsive-table td.cell-actions::before { content: none; }
  table.responsive-table td.cell-actions .btn { width: auto; min-width: 84px; }
  table.responsive-table td.cell-actions .row-actions { flex-wrap: wrap; justify-content: flex-end; }

  /* Compact single-line-per-day layout just for "Radni unosi" (work-entry
     days) - the generic stacked layout above put every field (Datum, Dan,
     Sati, Lokacija, Teren, Troškovi...) on its own line, so each day ate up
     6-7 lines and the list got very long. Every value here already reads
     fine without an uppercase label in front of it (dates, "7 h", a place
     name, self-labelled badges) so this drops the labels and lays the
     whole day out as one wrapping line instead. */
  table.entries-table tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px;
  }
  table.entries-table td {
    display: inline-flex; width: auto; padding: 0; font-size: 13.5px;
  }
  table.entries-table td::before { content: none; }
  table.entries-table td.cell-strong { font-weight: 700; }
  table.entries-table td[data-label="Troškovi"]:has(.expense-tag) { flex-basis: 100%; }
  /* The whole row is already tappable (canEdit) - the explicit button just
     duplicated that and forced its own extra line when wrapped, so it's
     replaced with a small trailing chevron, same idea as a native list row. */
  table.entries-table td.cell-actions .btn { display: none; }
  table.entries-table tr.clickable::after {
    content: '›'; margin-left: auto; color: var(--gray-400);
    font-size: 20px; line-height: 1; align-self: center;
  }
}

/* --- PDF izvještaj (adminReport.js) - full-page printable report, no sidebar/topbar --- */
/* padding-top (not 0) deliberately stops .report-locked's top margin from
   collapsing through this container and the body above it - without it,
   the whole page shifts down and the navy html fallback colour shows
   through at the top. */
.report-app { min-height: 100vh; background: var(--gray-50); padding-top: 1px; }
.report-page {
  max-width: 980px; margin: 0 auto; background: #fff; padding: 26px 34px 40px;
  font-size: 12.5px; color: #1a2b3c; min-height: 100vh;
}
.report-toolbar { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.report-locked {
  max-width: 480px; margin: 60px auto; text-align: center; padding: 28px;
  background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.report-locked p { margin: 0 0 10px; }
.report-locked .btn { margin-top: 10px; }

.report-header-centered {
  text-align: center;
  border-bottom: 2px solid var(--brand-900); padding-bottom: 16px; margin-bottom: 20px;
}
.report-brand-mark-centered {
  width: 40px; height: 40px; border-radius: 9px; background: var(--brand-900);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 10px;
  overflow: hidden;
}
.report-brand-big { font-size: 26px; font-weight: 900; letter-spacing: 0.5px; color: var(--brand-950); text-transform: uppercase; }
.report-brand-big span { color: var(--brand-600); }
.report-subtitle-big { font-size: 13px; font-weight: 700; letter-spacing: 1px; color: var(--gray-600); text-transform: uppercase; margin-top: 5px; }
.report-meta-centered { margin-top: 14px; }
.report-title { font-size: 16px; font-weight: 700; color: var(--brand-950); }
.report-sub { font-size: 11.5px; color: var(--gray-500); margin-top: 3px; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.summary-card { border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px 12px; background: var(--gray-50); }
.summary-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--gray-600); font-weight: 600; }
.summary-value { font-size: 16px; font-weight: 700; color: var(--brand-950); margin-top: 3px; }
.summary-card.total { background: var(--brand-100); border-color: var(--brand-600); }
.summary-card.total .summary-value { color: var(--brand-900); }

.report-section-title { font-size: 13px; color: var(--brand-950); margin: 22px 0 10px; }

table.report-table { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
.report-table th, .report-table td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--gray-200); }
.report-table th { background: var(--gray-100); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.2px; color: var(--gray-600); font-weight: 700; }
.report-table td { font-size: 12px; }
.report-table td.strong, .report-table th.strong { font-weight: 700; color: var(--brand-950); }
.report-table tbody tr:nth-child(even) { background: var(--gray-50); }
.report-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.report-footer {
  margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: space-between; font-size: 10.5px; color: var(--gray-500);
}

@media print {
  .report-toolbar { display: none; }
  .report-app { background: #fff; }
  .report-page { max-width: none; margin: 0; padding: 0; box-shadow: none; }
  @page { size: A4; margin: 10mm; }

  /* Compressed sizing so the whole report (header, summary, full employee
     table, notice, footer) fits on a single printed page instead of
     spilling onto a second one - screen viewing is untouched, these rules
     only apply once actually printing/saving as PDF. */
  .report-header-centered { padding-bottom: 8px; margin-bottom: 10px; }
  .report-brand-mark-centered { width: 26px; height: 26px; border-radius: 6px; margin: 0 auto 5px; }
  .report-brand-big { font-size: 17px; }
  .report-subtitle-big { font-size: 9px; letter-spacing: 0.6px; margin-top: 3px; }
  .report-meta-centered { margin-top: 7px; }
  .report-meta-centered .report-title { font-size: 12px; }
  .report-meta-centered .report-sub { font-size: 8.5px; margin-top: 2px; }

  .summary-grid { gap: 5px; margin-bottom: 10px; }
  .summary-card { padding: 5px 7px; }
  .summary-label { font-size: 7px; }
  .summary-value { font-size: 11px; margin-top: 1px; }

  .report-section-title { font-size: 10px; margin: 10px 0 5px; }

  .report-table th, .report-table td { padding: 3px 5px; }
  .report-table th { font-size: 7.5px; }
  .report-table td { font-size: 9px; }

  .notice-box { padding: 5px 8px; font-size: 8px; margin-top: 10px !important; }

  .report-footer { margin-top: 10px; padding-top: 6px; font-size: 7.5px; }
}

/* ---- Dodaci i odbici (mjesečne stavke) ---- */
.adj-plus { color: var(--green-600); font-weight: 700; }
.adj-minus { color: var(--red-600); font-weight: 700; }
.adj-sum { display: flex; gap: 18px; flex-wrap: wrap; justify-content: flex-end; margin-top: 12px; font-size: 14px; }
.adj-warning { color: var(--red-600); font-weight: 600; font-size: 13.5px; margin: 14px 0 0; }
.kind-toggle { display: flex; gap: 10px; margin-bottom: 16px; }
.kind-btn { flex: 1; padding: 11px 10px; border-radius: 10px; border: 1.5px solid #d5dde6; background: #fff; font-weight: 700; font-size: 15px; color: #7a8794; cursor: pointer; }
.kind-btn.plus.active { background: #e3f4ea; border-color: #1f8a4c; color: #1f8a4c; }
.kind-btn.minus.active { background: #fbe4e4; border-color: #c0392b; color: #c0392b; }
/* Brojevi u izvještaju se ne lome u dva reda (npr. "1.100,00" / "KM"). */
.report-table td.num { white-space: nowrap; }

/* ---------- Oznake i krugovi ---------- */
/* Oznaka/broj koji se sakrije atributom hidden (npr. 0 nepročitanih poruka) -
   inače bi ga display:inline-flex/flex iz pravila iznad ostavio vidljivim. */
.nav-badge[hidden], .notif-fab-badge[hidden] { display: none !important; }
/* Krug za Poruke stoji IZNAD zvonca: 20px (dno) + 56px (zvonce) + 12px
   razmaka na računaru, odnosno 16 + 60 + 12 na telefonu - isto 88px. */
.notif-fab.chat-fab { bottom: 88px; }

/* ---------- Prozor "Obavještenja na telefonu" ---------- */
/* Samo jedno dugme - veliko, istaknuto, plavo "Dozvoli". */
.push-ask .modal-footer { justify-content: stretch; padding: 16px 22px 20px; }
.push-ask .btn-dozvoli {
  width: 100%; min-height: 56px; font-size: 18px; font-weight: 800;
  border-radius: 14px; letter-spacing: .01em;
  box-shadow: 0 6px 16px rgba(47, 142, 214, 0.45);
}
.push-ask .modal-body p { font-size: 15.5px; line-height: 1.55; margin: 0; }

/* ---------- Poruke ---------- */
/* Stranica zauzima tačno visinu ekrana: zaglavlje gore, poruke se skroluju
   u sredini, polje za pisanje stoji na dnu. --chat-h postavlja chat.js iz
   visualViewport-a (tastatura na telefonu smanji vidljivi dio ekrana). */
#app.chat-mode { height: 100vh; height: var(--chat-h, 100dvh); min-height: 0; overflow: hidden; }
#app.chat-mode .main-col { height: 100%; min-height: 0; }
#app.chat-mode .content.chat-content {
  padding: 0; max-width: none; flex: 1 1 auto; min-height: 0; display: flex;
}
.chat {
  position: relative; flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, #0c3359 0%, #0a2a4b 100%);
}
/* Blijedi TE logo (munja) na sredini pozadine. */
.chat::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  opacity: .07;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cg fill='%23ffffff'%3E%3Cg fill-opacity='.75'%3E%3Crect x='55' y='160' width='150' height='40'/%3E%3Crect x='105' y='160' width='50' height='196'/%3E%3Crect x='340' y='160' width='50' height='196'/%3E%3Crect x='340' y='160' width='116' height='38'/%3E%3Crect x='340' y='238' width='100' height='36'/%3E%3Crect x='340' y='318' width='116' height='38'/%3E%3C/g%3E%3Cpolygon points='240,92 270,104 226,226 322,164 236,262 266,354 280,350 200,424 186,334 206,344 216,282 160,288'/%3E%3C/g%3E%3C/svg%3E") center / min(70%, 380px) no-repeat;
}
.chat-main { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-scroll {
  position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; padding: 10px 14px 4px;
}
.chat-list { display: flex; flex-direction: column; }
.chat-loading, .chat-older { color: #cfe3f7; text-align: center; font-size: 13.5px; padding: 18px 10px; margin: 0; }
.chat-older { padding: 6px; font-size: 12.5px; }
.chat-older[hidden] { display: none; }
.chat-empty { margin: 14vh auto 0; text-align: center; color: #d6e6f6; padding: 20px; }
.chat-empty p { margin: 0 0 4px; font-size: 15px; }
.chat-empty-icon { font-size: 44px; margin-bottom: 8px; }

.chat-day { align-self: center; margin: 14px 0 6px; }
.chat-day span {
  display: inline-block; background: rgba(255, 255, 255, 0.14); color: #e1edf9;
  font-size: 12.5px; font-weight: 700; padding: 4px 12px; border-radius: 999px;
}
.chat-unread-line {
  display: flex; align-items: center; gap: 10px; margin: 12px 0 6px;
  color: #ffd0c9; font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
}
.chat-unread-line::before, .chat-unread-line::after { content: ''; flex: 1; height: 1px; background: rgba(255, 140, 120, 0.7); }

.msg { display: flex; align-items: flex-end; gap: 6px; margin-top: 2px; }
.msg-first { margin-top: 9px; }
.msg-own { justify-content: flex-end; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; align-self: flex-start;
  color: #fff; font-weight: 800; font-size: 12.5px; display: flex; align-items: center; justify-content: center;
}
.msg-avatar-space { width: 32px; flex-shrink: 0; }
.msg-body { display: flex; flex-direction: column; max-width: min(72%, 560px); min-width: 0; }
.msg-own .msg-body { align-items: flex-end; }
.bubble {
  position: relative; background: #fff; color: var(--gray-900);
  border-radius: 14px; padding: 6px 10px 7px; min-width: 62px; max-width: 100%;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
.msg-own .bubble { background: #d3e9ff; }
/* "Rep" na prvom mjehuriću u nizu poruka istog pošiljaoca. */
.msg-other.msg-first .bubble { border-top-left-radius: 3px; }
.msg-own.msg-first .bubble { border-top-right-radius: 3px; }
.msg-other.msg-first .bubble::before,
.msg-own.msg-first .bubble::before {
  content: ''; position: absolute; top: 0; width: 9px; height: 13px; background: inherit;
}
.msg-other.msg-first .bubble::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.msg-own.msg-first .bubble::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.msg-name { font-size: 13px; font-weight: 800; color: var(--brand-700); margin-bottom: 1px; }
.msg-name.admin, .msg-quote-name.admin, .chat-reply-name.admin, .mention-name.admin, .chat-pin-text strong.admin { color: var(--red-600); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; }
/* Vrijeme u donjem desnom uglu: "rezervisano" mjesto na kraju teksta, pa
   vrijeme stane u zadnji red kad ima mjesta, a inače pređe u novi. */
.msg-time-spacer { display: inline-block; width: 42px; height: 1px; }
.msg-time { position: absolute; right: 9px; bottom: 5px; font-size: 11px; color: #7c8494; line-height: 1; }
.msg-own .msg-time { color: #5a7da1; }
.bubble-deleted .msg-text { color: var(--gray-500); font-style: italic; }
.msg-link { color: #0b63b6; text-decoration: underline; overflow-wrap: anywhere; }
.mention { color: var(--brand-700); font-weight: 700; }
.mention-me { background: #fff1b8; border-radius: 4px; padding: 0 2px; }
.msg-quote {
  border-left: 3px solid var(--brand-600); background: rgba(47, 142, 214, 0.1);
  border-radius: 6px; padding: 4px 8px; margin: 2px 0 5px; cursor: pointer; font-size: 13px;
}
.msg-quote-name { font-weight: 800; color: var(--brand-700); }
.msg-quote-text {
  color: var(--gray-600); white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -5px; padding: 0 6px; position: relative; z-index: 1; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 3px; background: #fff; border: 1px solid var(--gray-200);
  border-radius: 999px; padding: 1px 7px; font-size: 13.5px; line-height: 1.5; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.reaction-chip.mine { background: var(--brand-100); border-color: var(--brand-600); }
.reaction-chip .cnt { font-size: 12px; font-weight: 800; color: var(--gray-700); }
.msg-more, .msg-more-space { width: 28px; height: 28px; flex-shrink: 0; align-self: center; }
.msg-more {
  opacity: 0; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 17px; line-height: 1; padding: 0;
  transition: opacity .12s;
}
.msg-more:focus-visible { opacity: 1; outline: 2px solid #fff; }
@media (hover: hover) {
  .msg:hover .msg-more { opacity: 1; }
  .msg-more:hover { background: rgba(255, 255, 255, 0.28); }
}
@media (hover: none) {
  .msg-more, .msg-more-space { display: none; }
}
/* Na telefonu dugi pritisak otvara meni poruke - ne smije usput označavati
   tekst ni otvarati sistemski meni ("Kopiraj tekst" je u meniju poruke). */
@media (pointer: coarse) {
  .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
.msg-selected .bubble { box-shadow: 0 0 0 2px #ffd54a; }
.msg-flash .bubble { animation: msgFlash 1.4s ease; }
@keyframes msgFlash { 0%, 45% { box-shadow: 0 0 0 3px #ffd54a; } 100% { box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); } }

.chat-typing { color: #cfe3f7; font-size: 13px; font-style: italic; min-height: 22px; padding: 4px 4px 6px 42px; }
.chat-jump {
  position: absolute; right: 14px; bottom: 12px; z-index: 3;
  min-width: 46px; height: 46px; padding: 0 14px; border: none; border-radius: 999px; cursor: pointer;
  background: #fff; color: var(--brand-900); font-weight: 800; font-size: 16px; box-shadow: var(--shadow-lg);
}
.chat-jump.has-new { background: var(--brand-600); color: #fff; }
.chat-jump[hidden] { display: none; }

/* Zakačena poruka - veća traka na vrhu, sa crvenom lijevom ivicom. */
.chat-pin {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 8px;
  background: #fff; border-left: 6px solid var(--red-600); padding: 11px 10px 11px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.chat-pin[hidden] { display: none; }
.chat-pin-main { flex: 1; min-width: 0; cursor: pointer; }
.chat-pin-label { font-size: 12px; font-weight: 800; color: var(--red-600); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.chat-pin-text {
  font-size: 15px; color: var(--gray-900); white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.chat-pin-text strong { color: var(--brand-700); }
.chat-pin-x {
  background: none; border: none; color: var(--gray-500); font-size: 18px; cursor: pointer;
  min-width: 40px; min-height: 40px; border-radius: 8px;
}
.chat-pin-x:hover { background: var(--gray-100); }

/* Dno: odgovor + polje za pisanje (+ liste za @ i emoji iznad njih). */
.chat-bottom { position: relative; z-index: 4; background: #eef3f8; border-top: 1px solid rgba(0, 0, 0, 0.12); }
.chat-reply { display: flex; align-items: center; gap: 8px; padding: 8px 10px 0 14px; }
.chat-reply[hidden] { display: none; }
.chat-reply-box { flex: 1; min-width: 0; border-left: 3px solid var(--brand-600); padding: 2px 8px; }
.chat-reply-name { font-size: 12.5px; font-weight: 800; color: var(--brand-700); }
.chat-reply-text { font-size: 13px; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-reply-x { background: none; border: none; font-size: 17px; color: var(--gray-500); min-width: 40px; min-height: 40px; cursor: pointer; border-radius: 8px; }
.chat-composer {
  position: relative; display: flex; align-items: flex-end; gap: 6px;
  padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.chat-input {
  flex: 1; min-width: 0; resize: none; border: 1.5px solid var(--gray-300); border-radius: 21px;
  padding: 9px 14px; font-size: 16px; line-height: 1.35; min-height: 42px; max-height: 140px;
  background: #fff; color: var(--gray-900); outline: none; overflow-y: auto;
}
.chat-input:focus { border-color: var(--brand-600); }
.chat-emoji-btn, .chat-send {
  width: 42px; height: 42px; border-radius: 50%; border: none; flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.chat-emoji-btn { background: transparent; font-size: 23px; }
.chat-emoji-btn:hover { background: rgba(0, 0, 0, 0.06); }
.chat-send { background: var(--brand-600); color: #fff; }
.chat-send:hover { background: var(--brand-700); }
.chat-send:disabled { opacity: .45; cursor: default; background: var(--brand-600); }
.chat-counter {
  position: absolute; right: 62px; top: -24px; font-size: 12px; font-weight: 800; color: #fff;
  background: rgba(10, 56, 102, 0.9); padding: 2px 9px; border-radius: 999px;
}
.chat-counter.over { background: var(--red-600); }
.chat-counter[hidden] { display: none; }
.chat-popup {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% + 6px); z-index: 6;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto;
}
.chat-popup[hidden] { display: none; }
.chat-mentions { padding: 6px; max-width: 380px; }
.mention-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.mention-item.sel, .mention-item:hover { background: var(--brand-100); }
.mention-avatar {
  width: 30px; height: 30px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mention-name { font-weight: 700; color: var(--gray-900); }
.chat-emoji-panel {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 2px; padding: 8px; max-width: 420px;
}
.chat-emoji-panel button { font-size: 24px; height: 42px; background: none; border: none; border-radius: 8px; cursor: pointer; }
.chat-emoji-panel button:hover { background: var(--gray-100); }

/* Meni poruke (dugi pritisak / desni klik / "⋯") i meni grupe (⋮). */
.chat-sheet-backdrop {
  position: fixed; inset: 0; z-index: 150; background: rgba(8, 28, 52, 0.4);
  display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .12s ease;
}
.chat-sheet {
  background: #fff; width: 100%; max-width: 440px; border-radius: 18px 18px 0 0;
  padding: 12px 8px max(12px, env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg);
}
.chat-sheet-backdrop.chat-sheet-pop { background: transparent; display: block; }
.chat-sheet-pop .chat-sheet { position: fixed; width: 270px; border-radius: 14px; padding: 8px; }
.chat-sheet-reactions { display: flex; justify-content: space-around; gap: 4px; padding: 2px 2px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--gray-200); }
.react-btn { font-size: 25px; width: 48px; height: 48px; border-radius: 50%; border: none; background: var(--gray-50); cursor: pointer; }
.chat-sheet-pop .react-btn { width: 44px; height: 44px; font-size: 23px; }
.react-btn:hover { background: var(--gray-100); }
.react-btn.mine { background: var(--brand-100); box-shadow: inset 0 0 0 2px var(--brand-600); }
.chat-sheet-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: none; background: none;
  border-radius: 10px; font-size: 15.5px; font-weight: 600; color: var(--gray-900); cursor: pointer; text-align: left;
}
.chat-sheet-item:hover { background: var(--gray-100); }
.chat-sheet-item.danger { color: var(--red-600); }
.chat-sheet-icon { width: 24px; text-align: center; flex-shrink: 0; }
.chat-dropdown-backdrop { position: fixed; inset: 0; z-index: 150; }
.chat-dropdown { position: fixed; min-width: 240px; background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.chat-menu-btn {
  width: 42px; height: 42px; border-radius: 8px; border: 1px solid var(--gray-200); background: #fff;
  font-size: 22px; font-weight: 900; line-height: 1; color: var(--brand-900); cursor: pointer;
}
.chat-menu-btn:hover { background: var(--gray-50); }
.chat-muted-icon { font-size: 18px; }
.chat-muted-icon[hidden] { display: none; }
.member-list { display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--gray-100); }
.member-row:last-child { border-bottom: none; }
.member-name { font-weight: 700; flex: 1; }
.member-role { font-size: 12px; font-weight: 800; color: var(--red-600); }

@media (max-width: 640px) {
  .chat-scroll { padding: 8px 8px 4px; }
  .msg-body { max-width: 80%; }
  .msg-avatar, .msg-avatar-space { width: 30px; }
  .msg-avatar { height: 30px; font-size: 12px; }
  .chat-typing { padding-left: 40px; }
  .chat-pin { padding: 10px 8px 10px 12px; }
}
