/* ==============================
   CSS VARIABLES & THEME SYSTEM
   ============================== */
:root {
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Light Theme */
  --bg-primary: #F7F5F2;
  --bg-secondary: #EEEBE6;
  --bg-card: #FFFFFF;
  --bg-input: #F0EDE8;
  --bg-sidebar: #FFFFFF;
  --bg-sidebar-hover: #F0EDE8;
  --bg-sidebar-active: #C8843A;

  --text-primary: #1A1714;
  --text-secondary: #6B6560;
  --text-muted: #9E9890;
  --text-sidebar: #1A1714;
  --text-sidebar-muted: #6B6560;

  --accent-primary: #C8843A;
  --accent-secondary: #E8A050;
  --accent-green: #3A7D5C;
  --accent-red: #C04040;
  --accent-yellow: #C89030;
  --accent-blue: #3A6090;

  --border-color: #DDD8D0;
  --border-input: #C8C0B8;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  --status-ok: #3A7D5C;
  --status-repair: #C89030;
  --status-disabled: #C04040;

  --font-main: 'Heebo', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --sidebar-w: 280px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

[data-theme="dark"] {
  --bg-primary: #151210;
  --bg-secondary: #1E1B18;
  --bg-card: #252018;
  --bg-input: #1E1B18;
  --bg-sidebar: #0F0D0B;
  --bg-sidebar-hover: #1E1B18;
  --bg-sidebar-active: #C8843A;

  --text-primary: #F0EAE0;
  --text-secondary: #A09880;
  --text-muted: #6A6258;
  --text-sidebar: #D8D0C0;
  --text-sidebar-muted: #6A6258;

  --border-color: #2E2A24;
  --border-input: #3A3530;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

  --bg-sidebar: #0F0D0B;
}

/* ==============================
   RESET & BASE
   ============================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden; /* Safari <15.4 fallback */
  overflow-x: clip; /* clip לא יוצר scroll container — מונע באג position:fixed ב-Android Chrome */
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -webkit-touch-callout: none; /* disable iOS text callout */
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
}

/* Allow selection/cursor in form fields */
input, textarea, select {
  -webkit-user-select: text;
  user-select: text;
}

/* Prevent double-tap zoom on interactive elements only (not on the whole body) */
button, .btn, .nav-item, .fab, .icon-btn, .mobile-menu-btn,
.checkbox-item, .radio-item, .avail-btn, .report-card,
.inventory-item, .contact-item, .journal-check,
a, [onclick], .theme-btn, .size-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ==============================
   APP LAYOUT
   ============================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ==============================
   SIDEBAR
   ============================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  /* transform: translateX(0) הוסר — שכבת GPU מיותרת, גורמת ריצוד ב-Android */
  transition: transform var(--transition), width var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 18px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-logo {
  font-size: 22px;
  font-weight: 900;
  color: var(--accent-primary);
  letter-spacing: -0.5px;
  display: block;
}

.sidebar-subtitle {
  font-size: 11px;
  color: var(--text-sidebar-muted);
  margin-top: 4px;
  font-weight: 400;
  letter-spacing: 0.5px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info-name { font-size: 13px; font-weight: 600; color: var(--text-sidebar); }
.user-info-role { font-size: 11px; color: var(--text-sidebar-muted); }

.sidebar-nav {
  flex: 1;
  padding: 8px 8px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-sidebar-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 8px 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
  color: var(--text-sidebar);
  font-family: var(--font-main);
  min-height: 48px;
}

.nav-item:hover { background: var(--bg-sidebar-hover); }
.nav-item.active { background: var(--bg-sidebar-active); color: white; }
.nav-item.active .nav-icon { color: white; }

.nav-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  flex-shrink: 0;
  font-size: 17px;
  color: var(--text-sidebar-muted);
  transition: all var(--transition);
}

.nav-item.active .nav-icon { background: rgba(255,255,255,0.15); }
.nav-item:hover .nav-icon { color: var(--accent-secondary); background: rgba(200,132,58,0.12); }
.nav-item.active:hover .nav-icon { color: white; }

.nav-label { font-size: 14px; font-weight: 500; flex: 1; }
.nav-badge {
  background: var(--accent-red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

/* ==============================
   MAIN CONTENT
   ============================== */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  transition: margin var(--transition);
  overflow-x: hidden; /* Safari <15.4 fallback */
  overflow-x: clip; /* clip במקום hidden — לא משפיע על position:fixed */
  max-width: 100%;
  box-sizing: border-box;
}

/* ==============================
   TOP BAR
   ============================== */
.topbar {
  height: 68px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background var(--transition);
  box-shadow: var(--shadow-sm);
}

/* Safe-area mode — topbar pushes below the device notch/camera */
html.safe-area-on .topbar {
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(68px + env(safe-area-inset-top, 0px));
}
@media (max-width: 480px) {
  html.safe-area-on .topbar {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(60px + env(safe-area-inset-top, 0px));
  }
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.btn-sort-active {
  border-color: var(--accent-primary);
  background: rgba(200,132,58,0.16);
  color: white;
}

/* Status indicator */
.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--bg-secondary);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #44ee44;
  flex-shrink: 0;
  animation: blink-green 1.2s infinite;
}

.sync-dot.offline  { background: #ff4444; animation: blink-red  1.2s infinite; }
.sync-dot.fallback { background: #3399ff; animation: blink-blue 1.2s infinite; }
.sync-dot.pending  { background: #888888; animation: none; }

@keyframes blink-green {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.1; }
}
@keyframes blink-red {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.1; }
}
@keyframes blink-blue {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.1; }
}

/* Theme toggle */
.theme-toggle {
  width: 46px;
  height: 26px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  transition: all var(--transition);
}

[data-theme="dark"] .theme-toggle::after { right: auto; left: 2px; }

.theme-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  right: 5px;
}

[data-theme="dark"] .theme-icon { right: auto; left: 5px; }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition);
  color: var(--text-secondary);
}

/* ── שורת התראות ── */
.notif-bar {
  height: 42px;
  background: rgba(0,0,0,0.06);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  overflow: hidden;
  position: sticky;
  top: 68px;
  z-index: 49;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.notif-bar:hover { background: rgba(0,0,0,0.09); }
[data-textsize="xs"]  .main-content { zoom: 0.75; }
[data-textsize="xs2"] .main-content { zoom: 0.80; }
/* Firefox: xs/xs2 שני הערכים הנוספים */
@supports not (zoom: 1) {
  [data-textsize="xs"]  .main-content { font-size: 75%; zoom: unset; }
  [data-textsize="xs2"] .main-content { font-size: 80%; zoom: unset; }
}
[data-theme="dark"] .notif-bar { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .notif-bar:hover { background: rgba(255,255,255,0.07); }
.notif-bar:empty::before { content: '— לחץ לפתיחת היסטוריה'; opacity: 0.3; font-size:12px; }
.notif-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  animation: pillIn 0.25s ease;
}
@keyframes pillIn { from { opacity:0; } to { opacity:1; } }
.notif-pill.info    { background: rgba(58,96,144,0.12); color: var(--accent-blue); }
.notif-pill.success { background: rgba(58,125,92,0.12); color: var(--status-ok); }
.notif-pill.warning { background: rgba(200,144,48,0.15); color: var(--accent-yellow); }
.notif-pill.error   { background: rgba(192,64,64,0.12); color: var(--status-disabled); }
.notif-dismiss { cursor:pointer; opacity:0.5; margin-right:2px; font-size:11px; }
.notif-dismiss:hover { opacity:1; }

/* ── פאנל היסטוריה מורחב ── */
.notif-dropdown {
  display: none;
  position: fixed;
  top: 110px;
  right: 0;
  left: 0;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  margin-bottom: 3px;
  font-size: 13px;
  line-height: 1.5;
}
.notif-dropdown-item.info    { background: rgba(58,96,144,0.07); }
.notif-dropdown-item.success { background: rgba(58,125,92,0.07); }
.notif-dropdown-item.warning { background: rgba(200,144,48,0.08); }
.notif-dropdown-item.error   { background: rgba(192,64,64,0.07); }

.icon-btn:hover { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }

/* ==============================
   PAGE CONTENT
   ============================== */
.page {
  display: none;
  padding: 28px;
  flex: 1;
  animation: fadeIn 0.25s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ==============================
   CARDS & COMPONENTS
   ============================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), box-shadow var(--transition);
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 20px 24px; }

/* Compact layout specifically for the New Report page */
#page-newReport .card-header {
  padding: 14px 16px 10px;
}
#page-newReport .card-body {
  padding: 14px 16px;
}
#page-newReport .grid-2 {
  gap: 12px;
}
#page-newReport .form-group {
  margin-bottom: 10px;
}

/* ==============================
   BUTTONS
   ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(200,132,58,0.3);
}

.btn-primary:hover {
  background: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(200,132,58,0.4);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover { background: var(--border-color); }

.btn-danger { background: var(--accent-red); color: white; }
.btn-danger:hover { background: #A83030; transform: translateY(-1px); }

.btn-success { background: var(--accent-green); color: white; }
.btn-success:hover { background: #2D6048; transform: translateY(-1px); }

.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 16px 28px; font-size: 17px; border-radius: var(--radius-md); }
.btn-full { width: 100%; }
.btn-icon { width: 42px; height: 42px; padding: 0; border-radius: var(--radius-sm); }

/* ==============================
   FORM ELEMENTS
   ============================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: -0.1px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-main);
  transition: all var(--transition);
  direction: rtl;
  -webkit-appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px rgba(200,132,58,0.12);
}

.form-textarea { min-height: 100px; resize: vertical; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 40px;
}

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--accent-red); margin-top: 6px; }

/* ── שדות מלאים — ירוק עדין ── */
.form-input:not(:placeholder-shown):not([readonly]):not(:focus),
.form-textarea:not(:placeholder-shown):not([readonly]):not(:focus) {
  background: rgba(58,125,92,0.07);
  border-color: rgba(58,125,92,0.35);
}

/* Checkbox & Radio */
.checkbox-group, .radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-item, .radio-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-input);
  background: var(--bg-input);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 15px;
  font-weight: 500;
}

.checkbox-item:hover, .radio-item:hover {
  border-color: var(--accent-primary);
  background: rgba(200,132,58,0.06);
}

.checkbox-item input, .radio-item input { display: none; }

.check-box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-input);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
  font-size: 13px;
}

.radio-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-input);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.radio-circle::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
  transform: scale(0);
  transition: transform var(--transition);
}

.radio-item.selected .radio-circle {
  border-color: var(--accent-primary);
}

.radio-item.selected .radio-circle::after { transform: scale(1); }
.radio-item.selected { border-color: var(--accent-primary); background: rgba(200,132,58,0.06); }

.checkbox-item.checked .check-box {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* Status radio specific – compact pill buttons */
.status-radio {
  display: flex;
  gap: 6px;
}
.status-radio .radio-item {
  padding: 10px 12px;
  border-radius: 999px;
  justify-content: center;
}
.status-ok .radio-circle::after { background: var(--status-ok); }
.status-ok.selected { border-color: var(--status-ok); background: rgba(58,125,92,0.06); }
.status-ok.selected .radio-circle { border-color: var(--status-ok); }

.status-repair .radio-circle::after { background: var(--status-repair); }
.status-repair.selected { border-color: var(--status-repair); background: rgba(200,144,48,0.06); }
.status-repair.selected .radio-circle { border-color: var(--status-repair); }

.status-disabled .radio-circle::after { background: var(--status-disabled); }
.status-disabled.selected { border-color: var(--status-disabled); background: rgba(192,64,64,0.06); }
.status-disabled.selected .radio-circle { border-color: var(--status-disabled); }

/* ==============================
   STATUS BADGES
   ============================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.badge-ok { background: rgba(58,125,92,0.12); color: var(--status-ok); }
.badge-repair { background: rgba(200,144,48,0.12); color: var(--status-repair); }
.badge-disabled { background: rgba(192,64,64,0.12); color: var(--status-disabled); }
.badge-pending { background: rgba(58,96,144,0.12); color: var(--accent-blue); }
.badge-tow { background: rgba(192,64,64,0.15); color: var(--status-disabled); border: 1px solid rgba(192,64,64,0.3); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-ok { background: var(--status-ok); }
.dot-repair { background: var(--status-repair); }
.dot-disabled { background: var(--status-disabled); animation: blink 1s infinite; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ==============================
   REPORT CARD (Dashboard)
   ============================== */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.report-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.report-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
}
.report-card.sla-overdue {
  border-color: rgba(192,64,64,0.5);
  box-shadow: 0 0 0 1px rgba(192,64,64,0.25);
}

.report-card-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.report-card-id {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 500;
}

.report-card-body {
  padding: 14px 16px;
  display: flex;
  gap: 12px;
}

.report-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  overflow: hidden;
}

.report-thumb img { width: 100%; height: 100%; object-fit: cover; }

.report-info { flex: 1; min-width: 0; }
.report-tool-name { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.report-meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }

.report-card-footer {
  padding: 10px 16px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ==============================
   STEP WIZARD
   ============================== */
.step-wizard {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.step-item {
  display: flex;
  align-items: center;
  flex: 1;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.step-circle.active {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(200,132,58,0.2);
}

.step-circle.done {
  border-color: var(--accent-green);
  background: var(--accent-green);
  color: white;
}

.step-line {
  height: 2px;
  flex: 1;
  background: var(--border-color);
  transition: background var(--transition);
}

.step-line.done { background: var(--accent-green); }

.step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
}

.step-label.active { color: var(--accent-primary); }
.step-label.done { color: var(--accent-green); }

.step-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==============================
   NEW REPORT – STEP 1 LAYOUT
   ============================== */
.step1-layout {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.step1-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 160px;
}

.step1-nav-item {
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 8px 14px;
  font-size: 13px;
  text-align: right;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.step1-nav-item::after {
  content: '•';
  font-size: 10px;
  color: var(--text-muted);
}

.step1-nav-item.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.step1-nav-item.completed {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.step1-nav-item.completed::after {
  content: '✓';
  color: var(--accent-green);
}

.step1-content {
  flex: 1;
  min-width: 0;
}

.step1-pane {
  animation: fadeIn 0.2s ease;
}

@media (max-width: 768px) {
  .step1-layout {
    gap: 12px;
  }
  .step1-nav {
    width: 135px;
  }
}

@media (max-width: 480px) {
  .step1-layout {
    gap: 8px;
  }
  .step1-nav {
    width: 120px;
  }
  .step1-nav-item {
    padding: 7px 10px;
    font-size: 12px;
  }
}

/* ==============================
   NEW REPORT – STEP 2 LAYOUT
   ============================== */
.step2-layout {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.step2-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 140px;
}

.step2-nav-item {
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 8px 14px;
  font-size: 13px;
  text-align: right;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.step2-nav-item.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.step2-content {
  flex: 1;
  min-width: 0;
}

.step2-pane {
  animation: fadeIn 0.2s ease;
}

@media (max-width: 768px) {
  .step2-layout {
    gap: 12px;
  }
  .step2-nav {
    width: 130px;
  }
}

@media (max-width: 480px) {
  .step2-layout {
    gap: 8px;
    flex-direction: row-reverse;
  }
  .step2-nav {
    width: 110px;
    flex-direction: column;
    justify-content: flex-start;
  }
  .step2-nav-item {
    padding: 7px 10px;
    font-size: 12px;
    width: 100%;
  }
  .finding-card {
    padding: 12px;
  }

  /* כפתורי חזרה/המשך: משתמשים ב‑FAB התחתון */
  #page-newReport #reportStep2 .step-footer { display: none; }

  /* ריווח לתוכן כדי לא להיכנס מתחת לאלבום + FAB */
  #page-newReport #reportStep2 #findingsList { padding-bottom: 240px; }
  /* שמור תמיד 2 עמודות בכרטיס ממצא */
  #page-newReport .finding-card .grid-2 { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* ==============================
   FINDINGS CAROUSEL (Step 2)
   ============================== */
.finding-carousel {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 18px) + 78px);
  z-index: 95;
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  overflow-x: auto;
  direction: rtl;
  scroll-snap-type: x mandatory;
}

.finding-carousel::-webkit-scrollbar { height: 0; }

.finding-carousel-item {
  scroll-snap-align: start;
  width: 76px;
  height: 76px;
  border-radius: 18px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
}

.finding-carousel-item.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(200,132,58,0.15);
}

.finding-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
}

.finding-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.finding-carousel-top {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
}

.finding-carousel-bottom {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ==============================
   FINDING CARD
   ============================== */
.finding-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
  transition: all var(--transition);
}

.finding-card.inactive { display: none; }
.finding-card.active-finding { display: block; }

.finding-card.collapsed {
  padding: 10px 14px;
  cursor: pointer;
}
.finding-card.collapsed .grid-2,
.finding-card.collapsed .form-group:nth-of-type(n+2) {
  display: none;
}

.finding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.finding-chip {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 180px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Footer buttons for steps */
.step-footer {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 16px;
}

.finding-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.finding-num {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 500;
}

.finding-status-bar {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* ==============================
   PHOTO UPLOAD
   ============================== */
.photo-upload-area {
  border: 2px dashed var(--border-input);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  text-align: right;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
}

.photo-upload-area:hover {
  border-color: var(--accent-primary);
  background: rgba(200,132,58,0.04);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.photo-thumb {
  min-height: 72px; /* Safari <15 fallback when aspect-ratio unsupported */
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
}

.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }

.photo-remove {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(192,64,64,0.85);
  color: white;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ==============================
   STATS / KPI
   ============================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ==============================
   TABLE
   ============================== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: right;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-secondary);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(200,132,58,0.03); }
.data-table tr:last-child td { border-bottom: none; }

/* ==============================
   MODAL
   ============================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  /* backdrop-filter הוסר — גורם קריסת GPU ב-Android Chrome */
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: min(520px, calc(100vw - 16px));
  max-height: 90vh;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
  border: 1px solid var(--border-color);
}

.modal-overlay.open .modal { opacity: 1; }

.modal-header {
  padding: 24px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 16px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Report images + fullscreen viewer */
.report-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}
.report-img-thumb {
  width: 100%;
  min-height: 86px; /* Safari <15 fallback */
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  overflow: hidden;
  display: block;
  cursor: pointer;
}
.report-img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  touch-action: none; /* no pinch zoom inside viewer */
}
.image-viewer.open { display: flex; }
.image-viewer img {
  width: 100%;
  max-width: 1000px;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
}
.image-viewer-close {
  position: fixed;
  top: calc(env(safe-area-inset-top, 10px) + 10px);
  right: calc(env(safe-area-inset-right, 10px) + 10px);
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* ==============================
   FAB (Floating Action Button)
   ============================== */
.fab-group {
  position: fixed;
  bottom: 28px;
  left: calc((100vw - var(--sidebar-w)) / 2);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 36px;
  z-index: 90;
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  /* backdrop-filter הוסר — גורם קריסת GPU ב-Android Chrome */
}

/* מובייל: ביטול transform על position:fixed — מונע ריצוד ב-Android Chrome */
@media (max-width: 768px) {
  .fab-group {
    left: 0;
    right: 0;
    transform: none;
    width: fit-content;
    margin: 0 auto;
  }
}

.fab {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}

.fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.fab-main {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--accent-primary);
  color: white;
  font-size: 22px;
  border: none;
  box-shadow: 0 4px 16px rgba(200,132,58,0.45);
}

.fab-main:hover {
  background: var(--accent-secondary);
  box-shadow: 0 6px 22px rgba(200,132,58,0.6);
}

/* בית — בולט מעט: גדול יותר ועם טבעת */
.fab-home {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  font-size: 26px;
  box-shadow: 0 0 0 2px var(--accent-primary), var(--shadow-md);
}

.fab-step {
  font-size: 13px;
  font-weight: 700;
  width: max-content !important;
  min-width: 52px;
  flex-shrink: 0;
  padding: 0 14px;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.fab-step.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.fab-next {
  padding: 0 18px;
  width: max-content !important;
  min-width: 52px;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  background: var(--accent-green);
  color: white;
  border-color: var(--accent-green);
  white-space: nowrap;
}

.fab-next:hover { background: #2D6048; }

/* ==============================
   LOGIN SCREEN
   ============================== */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: fixed;
  inset: 0;
  z-index: 9999;
  transition: background var(--transition);
  /* Samsung Chrome: allow scrolling when virtual keyboard shrinks viewport */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 44px 36px;
  border: 1px solid var(--border-color);
  animation: loginFadeIn 0.35s ease both;
  position: relative; z-index: 1;
}

/* Simple fade — no transform to avoid Samsung Chrome stacking-context bugs */
@keyframes loginFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Keep slideUp alias so any other reference still works */
@keyframes slideUp {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-text {
  font-size: 36px;
  font-weight: 900;
  color: var(--accent-primary);
  letter-spacing: -1px;
}

.login-logo-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }

/* ==============================
   NOTIFICATION / TOAST
   ============================== */
.toast-container {
  position: fixed;
  top: 80px;
  left: 0;
  right: 0;
  width: fit-content;
  margin: 0 auto;
  /* ללא transform — מונע שכבת GPU ב-Android Chrome */
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 240px;
  max-width: 380px;
}

@keyframes toastIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.toast.success { border-color: var(--accent-green); }
.toast.error { border-color: var(--accent-red); }
.toast.warning { border-color: var(--accent-yellow); }

/* ==============================
   DIVIDER
   ============================== */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: 20px 0;
}

/* ==============================
   EMPTY STATE
   ============================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-desc { font-size: 14px; }

/* ==============================
   INVENTORY
   ============================== */
.inventory-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  margin-bottom: 8px;
  transition: all var(--transition);
}

.inventory-item:hover { border-color: var(--accent-primary); transform: translateX(-2px); }
.inventory-icon { font-size: 22px; width: 44px; height: 44px; background: var(--bg-secondary); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.inventory-name { font-weight: 600; font-size: 15px; color: var(--text-primary); }
.inventory-sku { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }
.inventory-stock { font-size: 14px; font-weight: 700; }
.inventory-stock.in-stock { color: var(--accent-green); }
.inventory-stock.out-stock { color: var(--accent-red); }

/* ==============================
   CHAT
   ============================== */
.chat-container { display: flex; height: calc(100vh - 200px); gap: 20px; }
.chat-list { width: 280px; flex-shrink: 0; }
.chat-main { flex: 1; display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--bg-secondary); border-radius: var(--radius-md) var(--radius-md) 0 0; border: 1px solid var(--border-color); }

.msg {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  gap: 4px;
}

.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
}

.msg.mine .msg-bubble {
  background: var(--accent-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg.theirs .msg-bubble {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.msg-meta { font-size: 11px; color: var(--text-muted); }

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.chat-input-bar .form-input {
  margin: 0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.contact-item:hover { background: var(--bg-secondary); border-color: var(--border-color); }
.contact-item.active { background: rgba(200,132,58,0.08); border-color: var(--accent-primary); }
.contact-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-blue); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.contact-name { font-size: 14px; font-weight: 600; }
.contact-status { font-size: 11px; color: var(--text-muted); }

/* ==============================
   SECTION HEADER
   ============================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.section-sub { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

/* ==============================
   USER CARD (Management)
   ============================== */
.user-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
}

.user-card:hover { border-color: var(--accent-primary); box-shadow: var(--shadow-md); }

/* ==============================
   MOBILE SIDEBAR TOGGLE
   ============================== */
.mobile-menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-primary);
  flex-shrink: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ==============================
   JOURNAL / WORK LOG
   ============================== */
.journal-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition);
}

.journal-item:hover { border-color: var(--accent-primary); }
.journal-item.done { opacity: 0.85; }
.journal-item.done .journal-title { text-decoration: line-through; }
.journal-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-color); flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--transition); margin-top: 2px; }
.journal-check.checked { background: var(--accent-green); border-color: var(--accent-green); color: white; font-size: 13px; }
.journal-info { flex: 1; }
.journal-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.journal-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; }
.journal-urgency { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.urgency-high { background: rgba(192,64,64,0.12); color: var(--accent-red); }
.urgency-medium { background: rgba(200,144,48,0.12); color: var(--status-repair); }
.urgency-low { background: rgba(58,125,92,0.12); color: var(--accent-green); }

/* ==============================
   PROFILE PAGE
   ============================== */
.profile-header {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: white;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.profile-header::before {
  content: '';
  position: absolute;
  top: -40px;
  left: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}

.profile-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 800;
  color: white;
  border: 3px solid rgba(255,255,255,0.4);
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.profile-name { font-size: 24px; font-weight: 800; position: relative; z-index: 1; }
.profile-role { font-size: 14px; opacity: 0.85; position: relative; z-index: 1; margin-top: 4px; }

/* ==============================
   AVAILABILITY
   ============================== */
.availability-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.avail-btn {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-main);
  color: var(--text-secondary);
}

.avail-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.avail-btn.selected { border-color: var(--accent-primary); background: rgba(200,132,58,0.08); color: var(--accent-primary); }

/* ==============================
   GRID HELPERS
   ============================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ==============================
   MOBILE RESPONSIVE
   ============================== */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(100%);
    width: 280px;
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
    --sidebar-w: 280px;
  }

  .sidebar-overlay { display: block; }
  .sidebar-overlay.visible { display: block; }
  .sidebar-overlay:not(.visible) { display: none; }

  .main-content { margin-right: 0; }
  .mobile-menu-btn { display: flex; }

  .page { padding: 16px 16px 140px; }
  .topbar { padding: 0 16px; }
  .topbar-title { font-size: 16px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .report-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }

  .chat-container { flex-direction: column; height: auto; }
  .chat-list { width: 100%; }

  .login-card { padding: 30px 22px; }
  .step-wizard { gap: 0; }

  .availability-grid { grid-template-columns: repeat(2, 1fr); }
  .fab-group { bottom: max(20px, calc(env(safe-area-inset-bottom) + 10px)); gap: 28px; padding: 8px 16px; }
  .fab { width: 46px; height: 46px; font-size: 20px; }
  .fab-main { width: 46px; height: 46px; font-size: 20px; }
  .fab-home { width: 54px; height: 54px; font-size: 24px; }
}

/* ==============================
   iPhone — ≤480px (all models incl. Plus/Pro Max)
   ============================== */
@media (max-width: 480px) {
  html { font-size: 16px; }

  /* ── Topbar ── */
  .topbar { height: 60px; padding: 0 12px; gap: 8px; }
  .topbar-title { font-size: 15px; }
  .topbar-actions { gap: 8px; }
  .sync-status { padding: 6px 11px; font-size: 12px; gap: 6px; border-radius: 14px; }
  .sync-dot { width: 8px; height: 8px; }
  .theme-toggle { width: 40px; height: 24px; }
  .theme-toggle::after { width: 16px; height: 16px; top: 2px; right: 2px; }
  [data-theme="dark"] .theme-toggle::after { left: 2px; }
  .icon-btn { width: 40px; height: 40px; font-size: 17px; }
  .mobile-menu-btn { width: 40px; height: 40px; font-size: 20px; }

  /* ── Page padding (space for FAB at bottom) ── */
  .page { padding: 12px 12px 165px; }

  /* ── Section header ── */
  .section-title { font-size: 17px; letter-spacing: -0.3px; }
  .section-sub { font-size: 12px; }
  .section-header { flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
  #page-dashboard .section-header > div { width: 100%; }
  #page-dashboard .section-header > button.btn { width: 100%; justify-content: center; }

  /* ── Cards ── */
  .card-header { padding: 13px 14px 11px; }
  .card-title { font-size: 14px; }
  .card-body { padding: 13px 14px; }

  /* ── Buttons ── */
  .btn { padding: 14px 18px; font-size: 15px; border-radius: 10px; min-height: 48px; }
  .btn-lg { padding: 15px 20px; font-size: 16px; min-height: 52px; }
  .btn-sm { padding: 10px 14px; font-size: 13px; min-height: 42px; }
  .btn-full { width: 100%; }

  /* ── Forms ── */
  .form-group { margin-bottom: 14px; }
  .form-label { font-size: 14px; margin-bottom: 6px; }
  .form-input,
  .form-select { font-size: 16px; padding: 14px 16px; min-height: 52px; }
  .form-textarea { min-height: 90px; font-size: 16px; padding: 14px 16px; }
  .form-hint { font-size: 12px; }

  /* ── Stat cards ── */
  .stat-value { font-size: 28px; }
  .stat-label { font-size: 12px; }
  .stat-sub { font-size: 12px; }
  .stats-grid { gap: 8px; }

  /* ── Report grid ── */
  .report-grid { grid-template-columns: 1fr; gap: 10px; }

  /* ── Step wizard ── */
  .step-wizard { margin-bottom: 18px; }
  .step-circle { width: 28px; height: 28px; font-size: 12px; }
  .step-label { font-size: 9px; margin-top: 4px; }

  /* ── Modal ── */
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal { border-radius: var(--radius-md) var(--radius-md) 0 0; max-height: 88vh; }
  .modal-header { padding: 16px 16px 12px; }
  .modal-title { font-size: 15px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 10px 16px 20px; gap: 8px; flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; min-width: 120px; }

  /* ── Grids ── */
  .grid-2 { grid-template-columns: 1fr; gap: 10px; }
  .grid-3 { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* ── New Report – compact first step ── */
  #page-newReport #reportStep1 .card-header { padding: 10px 12px 8px; }
  #page-newReport #reportStep1 .card-body { padding: 10px 12px; }
  #page-newReport #reportStep1 .form-group { margin-bottom: 10px; }
  #page-newReport #reportStep1 .photo-upload-area {
    padding: 10px 12px;
  }
  #page-newReport #reportStep1 .photo-upload-area div[style*="font-size:28px"] {
    font-size: 22px !important;
  }
  #page-newReport #reportStep1 .photo-upload-area div[style*="font-size:15px"] {
    font-size: 13px !important;
  }
  #page-newReport #reportStep1 .photo-upload-area div[style*="font-size:13px"] {
    display: none;
  }

  /* ── FAB group – no overflow ── */
  .fab-group {
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
    gap: 28px;
    max-width: calc(100vw - 20px);
    flex-wrap: nowrap;
    justify-content: center;
  }
  .fab { width: 46px; height: 46px; font-size: 19px; border-radius: 14px; }
  .fab-main { width: 46px; height: 46px; font-size: 19px; border-radius: 14px; }
  .fab-home { width: 54px; height: 54px; font-size: 23px; border-radius: 16px; }
  .fab-step { padding: 0 12px; font-size: 13px; min-width: 50px; }
  .fab-next { padding: 0 14px; font-size: 13px; min-width: 50px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.fw-bold { font-weight: 700; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.hidden { display: none !important; }

/* ==============================
   QR CODE SIDEBAR SECTION
   ============================== */
.qr-section {
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.qr-toggle-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  background: rgba(200,132,58,0.10);
  border: 1px solid rgba(200,132,58,0.18);
  width: 100%;
  text-align: right;
  color: var(--text-sidebar);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  min-height: 48px;
}
.qr-toggle-btn:hover { background: rgba(200,132,58,0.18); }

.qr-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 14px 4px 6px;
  gap: 10px;
  animation: fadeInDown 0.25s ease;
}
@keyframes fadeInDown {
  from { opacity:0; transform:translateY(-8px); }
  to   { opacity:1; transform:translateY(0); }
}
.qr-panel.open { display: flex; }

.qr-canvas-wrapper {
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.qr-url-text {
  font-size: 10px;
  color: var(--text-sidebar-muted);
  text-align: center;
  word-break: break-all;
  line-height: 1.6;
  font-family: var(--font-mono);
  max-width: 220px;
}

.qr-arrow {
  transition: transform var(--transition);
  font-style: normal;
  font-size: 11px;
  color: var(--accent-primary);
}
.qr-toggle-btn.open .qr-arrow { transform: rotate(180deg); }

/* ── Key toggle button ── */
.key-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 14px 18px; width: 100%;
  border-radius: var(--radius-sm);
  border: 2px solid var(--accent-red);
  background: rgba(192,64,64,0.08);
  color: var(--accent-red);
  font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all var(--transition);
}
.key-toggle-btn.present {
  border-color: var(--status-ok);
  background: rgba(56,161,105,0.12);
  color: var(--status-ok);
}

/* ── Preview photos grid ── */
.preview-photos { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.preview-photos img {
  width: 80px; height: 80px; object-fit: cover;
  border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border-color);
  transition: transform 0.15s;
}
.preview-photos img:active { transform: scale(0.96); }
.preview-section { margin-bottom:18px; padding-bottom:14px; border-bottom: 1px solid var(--border-color); }
.preview-section:last-child { border-bottom: none; }
.preview-label { font-size:11px; color:var(--text-muted); margin-bottom:2px; }
.preview-value { font-size:14px; font-weight:600; color:var(--text-primary); }
.preview-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
.preview-finding { background:var(--bg-secondary); border-radius:var(--radius-sm); padding:12px; margin-bottom:10px; border-right:3px solid var(--border-color); }
.preview-finding.status-ok    { border-right-color: var(--status-ok); }
.preview-finding.status-repair { border-right-color: var(--status-repair); }
.preview-finding.status-disabled { border-right-color: var(--status-disabled); }

/* ── PDF Print ── */
@page { size: A4; margin: 1.5cm; }
@media print {
  body > * { display: none !important; }
  #pdfPrintArea { display: block !important; width: 100%; margin: 0; padding: 0;
    background: #fff; font-family: Arial, sans-serif; color: #111;
    font-size: 13px; line-height: 1.7; direction: rtl; }
}
#pdfPrintArea { display: none; }

/* ── Theme panel in sidebar ── */
.theme-panel {
  display: none;
  padding: 12px 16px;
  background: var(--bg-sidebar);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.theme-panel.open { display: block; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.theme-btn {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.theme-btn:hover { border-color: var(--accent-primary); }
.theme-btn.active { border-color: var(--accent-primary); background: var(--bg-sidebar-active); }
.theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}

/* ── שורת הודעות ── */
.msg-tick { font-size: 12px; margin-right: 4px; color: var(--text-muted); }
.msg-tick.read { color: var(--accent-blue); }

/* ── Progress bar (מרווח טיפולים) ── */
.service-progress-wrap {
  background: var(--bg-secondary);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin: 4px 0 2px;
}
.service-progress-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

/* ===== ערכות נושא — כפתור פעיל ===== */
.theme-btn.active {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px var(--accent-primary);
  outline: none;
}
.theme-btn { cursor: pointer; transition: box-shadow 0.2s; }

/* ===== נגישות — גודל תצוגה (zoom אחיד) ===== */
[data-textsize="sm"] .main-content { zoom: 0.9; }
[data-textsize="md"] .main-content { zoom: 1.0; }
[data-textsize="lg"] .main-content { zoom: 1.15; }
[data-textsize="xl"] .main-content { zoom: 1.30; }
/* Firefox fallback — zoom לא נתמך, משתמשים ב-font-size */
@supports not (zoom: 1) {
  [data-textsize="xs"]  .main-content { font-size: 75%; }
  [data-textsize="xs2"] .main-content { font-size: 80%; }
  [data-textsize="sm"]  .main-content { font-size: 90%; }
  [data-textsize="md"]  .main-content { font-size: 100%; }
  [data-textsize="lg"]  .main-content { font-size: 115%; }
  [data-textsize="xl"]  .main-content { font-size: 130%; }
}
.size-btn.active { background: var(--accent-primary) !important; color: #fff !important; border-color: var(--accent-primary) !important; }

/* Safety net — מנע overflow אופקי */
img, video, canvas, iframe, svg { max-width: 100%; height: auto; }
.card-body, .modal-body { word-break: break-word; }
html, body, .app-wrapper { max-width: 100vw; overflow-x: hidden; overflow-x: clip; }

/* בנייד — הגבל zoom ל-1.0 למניעת גלילה אופקית */
@media (max-width: 768px) {
  [data-textsize="lg"] .main-content { zoom: 1.0; }
  [data-textsize="xl"] .main-content { zoom: 1.0; }
}

/* ===== מצב תצוגה כפוי ===== */
/* מצב נייד כפוי */
[data-viewmode="mobile"] .sidebar { transform: translateX(100%) !important; }
[data-viewmode="mobile"] .sidebar.open { transform: translateX(0) !important; }
[data-viewmode="mobile"] .main-content { margin-right: 0 !important; zoom: 1.0 !important; max-width: 100vw !important; }
[data-viewmode="mobile"] .mobile-menu-btn { display: flex !important; }

/* מצב מחשב כפוי */
[data-viewmode="desktop"] .sidebar { transform: translateX(0) !important; width: 280px !important; }
[data-viewmode="desktop"] .main-content { margin-right: 280px !important; }
[data-viewmode="desktop"] .mobile-menu-btn { display: none !important; }

/* כפתורי מצב תצוגה — active state */
.viewmode-btn.active { background: var(--accent-primary) !important; color: #fff !important; border-color: var(--accent-primary) !important; }

/* Emergency Mode */
[data-emergency="true"] .topbar { background: var(--accent-red) !important; }
[data-emergency="true"] #emergencyBanner { display: flex !important; }
#emergencyBanner { display:none; background:var(--accent-red); color:#fff; padding:8px 16px;
  align-items:center; justify-content:space-between; font-weight:700; font-size:14px; z-index:200; position:relative; }

/* Audit Mode */
[data-auditmode="true"] #auditModeBanner { display:flex !important; }
[data-auditmode="true"] button.btn-primary:not([data-allow]),
[data-auditmode="true"] button.btn-success:not([data-allow]),
[data-auditmode="true"] .fab-main { opacity:0.35; pointer-events:none; }
#auditModeBanner { display:none; background:#3A6090; color:#fff; padding:8px 16px;
  align-items:center; justify-content:space-between; font-weight:700; font-size:14px; position:relative; z-index:199; }

/* ==============================
   SPLASH SCREEN
   ============================== */
#appSplash {
  position: fixed; inset: 0; z-index: 99999;
  background: var(--bg-primary, #0d0d1a);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  transition: opacity 0.45s ease;
}
#appSplash.splash-fade { opacity: 0; pointer-events: none; }
.sp-logo { font-size: 52px; line-height: 1; }
.sp-title { font-size: 30px; font-weight: 900; color: var(--accent-primary, #4da6ff); letter-spacing: -1px; }
.sp-sub { font-size: 13px; color: var(--text-muted, #555); }
.sp-track { width: 240px; height: 6px; background: rgba(128,128,128,0.2); border-radius: 99px; overflow: hidden; }
.sp-fill { height: 100%; background: var(--accent-primary, #4da6ff); border-radius: 99px; transition: width 0.22s ease; width: 0%; }
.sp-pct { font-size: 15px; font-weight: 700; color: var(--accent-primary, #4da6ff); min-width: 46px; text-align: center; }
