:root {
  --bg-dark: #0a0f1d;
  --bg-panel: #121a2d;
  --bg-card: #1e253d;
  --bg-soft: #24304a;
  --accent-blue: #3b82f6;
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --text-main: #f1f5f9;
  --text-dim: #94a3b8;
  --border: rgba(255,255,255,0.11);
  --shadow: 0 16px 35px rgba(0,0,0,0.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Arial, system-ui, sans-serif; }
body { background: radial-gradient(circle at top left, #15213a, var(--bg-dark) 45%); color: var(--text-main); height: 100vh; overflow: hidden; direction: rtl; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.screen { display: none; height: 100vh; width: 100%; }
.screen.active { display: flex; }
.loading-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg-dark); z-index: 9999; font-size: 1.2rem; }
.loading-overlay.hide { display: none; }
.fictive-banner { background: linear-gradient(90deg, var(--accent-red), #991b1b); color: white; padding: 7px; font-size: 12px; font-weight: 800; width: 100%; position: absolute; top: 0; text-align: center; letter-spacing: .4px; }
.login-container { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(135deg, #0a0f1d 0%, #1e293b 100%); position: relative; }
.login-box { background: rgba(18,26,45,.92); backdrop-filter: blur(12px); padding: 2.5rem; border-radius: 24px; box-shadow: var(--shadow); width: min(390px, 92vw); text-align: center; border: 1px solid var(--border); }
.logo-placeholder { font-size: 54px; margin-bottom: 10px; }
.login-hint { color: var(--text-dim); font-size: 12px; line-height: 1.6; margin: 10px 0 18px; }
#login-form { display: grid; gap: 12px; }
input, select, textarea, .input-main { width: 100%; background: #0f172a; color: var(--text-main); border: 1px solid var(--border); border-radius: 10px; padding: 12px; outline: none; }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.error-text { color: #fca5a5; min-height: 20px; margin-top: 10px; }
#main-layout { flex-direction: row; width: 100%; }
#sidebar { width: 285px; background: rgba(18,26,45,.98); border-left: 1px solid var(--border); display: flex; flex-direction: column; padding: 1.25rem; transition: 0.3s; box-shadow: var(--shadow); }
.sidebar-top, .sidebar-bottom { display: grid; gap: 12px; }
.sidebar-bottom { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border); }
.user-profile { display: flex; align-items: center; gap: 12px; padding: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 16px; }
.user-details { display: grid; gap: 4px; }
.avatar-sm { min-width: 42px; width: 42px; height: 42px; background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; color: white; }
.tag-role, .pill { font-size: 12px; background: rgba(255,255,255,0.09); padding: 4px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; width: fit-content; }
#main-nav { margin-top: 22px; display: grid; gap: 7px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 13px 15px; color: var(--text-dim); text-decoration: none; border-radius: 12px; cursor: pointer; transition: 0.18s; border: 1px solid transparent; }
.nav-item:hover, .nav-item.active { background: rgba(59,130,246,.16); border-color: rgba(59,130,246,.35); color: white; transform: translateX(-2px); }
#viewport { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#view-header { height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 2rem; border-bottom: 1px solid var(--border); background: rgba(10,15,29,.65); backdrop-filter: blur(10px); }
#view-title { font-size: 1.55rem; }
#header-actions { display: flex; gap: 10px; align-items: center; }
#content-scroll { flex: 1; overflow-y: auto; padding: 1.8rem; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.card-stat, .panel, .table-container, .map-placeholder, .call-card { background: rgba(30,37,61,.92); padding: 1.25rem; border-radius: 18px; border: 1px solid var(--border); box-shadow: 0 8px 22px rgba(0,0,0,.18); }
.card-stat { border-right: 4px solid var(--accent-blue); }
.card-stat h3 { color: var(--text-dim); font-size: .95rem; margin-bottom: 8px; }
.card-stat p.big { font-size: 2rem; font-weight: 900; }
.btn-main, .btn-danger, .btn-secondary, .btn-icon, .btn-link { border: 0; padding: 11px 15px; border-radius: 10px; color: white; font-weight: 700; transition: .16s; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn-main { background: linear-gradient(135deg, var(--accent-blue), #1d4ed8); }
.btn-danger { background: linear-gradient(135deg, var(--accent-red), #991b1b); }
.btn-secondary { background: var(--bg-soft); border: 1px solid var(--border); }
.btn-icon, .btn-link { background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--text-main); }
.btn-main:hover, .btn-danger:hover, .btn-secondary:hover, .btn-icon:hover, .btn-link:hover { transform: translateY(-1px); filter: brightness(1.08); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-row { display: grid; gap: 6px; margin-bottom: 12px; }
.full { grid-column: 1 / -1; }
label { color: var(--text-dim); font-size: 13px; margin-bottom: 5px; display: block; }
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 650px; }
th, td { text-align: right; padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-dim); font-size: 13px; }
tr:hover td { background: rgba(255,255,255,.025); }
.status-valid, .valid, .available, .signed, .closed { color: #bbf7d0; background: rgba(16,185,129,.15); }
.revoked, .stolen, .pending_commander, .חירום { color: #fecaca; background: rgba(239,68,68,.15); }
.pending_officer, .pending_dispatcher, .dispatched, .בינונית { color: #fde68a; background: rgba(245,158,11,.16); }
.status-tag { border-radius: 999px; padding: 5px 10px; font-size: 12px; display: inline-block; }
.alert-item { padding: 8px 10px; border-radius: 10px; background: rgba(239,68,68,.12); color: #fecaca; margin: 4px 0; }
.empty-state { color: var(--text-dim); text-align: center; padding: 25px; border: 1px dashed var(--border); border-radius: 16px; }
.header-flex, .toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.citizen-profile-header { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.3rem; background: var(--bg-panel); padding: 1.5rem; border-radius: 20px; border: 1px solid var(--border); }
.citizen-photo-large { min-width: 150px; width: 150px; height: 150px; background: linear-gradient(135deg, #334155, #111827); border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 4rem; border: 1px solid var(--border); }
.family-tree { display: flex; flex-wrap: wrap; gap: 1rem; padding: 1rem; background: rgba(0,0,0,0.2); border-radius: 15px; border: 1px solid var(--border); }
.family-member { background: var(--bg-card); padding: 10px; border-radius: 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; border: 1px solid transparent; transition: 0.2s; min-width: 170px; }
.family-member:hover { border-color: var(--accent-blue); transform: scale(1.03); }
.moked-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; }
.map-placeholder { min-height: 350px; position: relative; overflow: hidden; background: linear-gradient(135deg, #172033, #0f172a); }
.map-grid { position: absolute; inset: 0; opacity: .14; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 45px 45px; }
.map-unit, .map-call { position: absolute; transform: translate(-50%, -50%); border-radius: 999px; padding: 7px 10px; font-weight: 900; box-shadow: 0 8px 18px rgba(0,0,0,.35); }
.map-unit { background: var(--accent-blue); }
.map-call { background: var(--accent-red); animation: pulse-red 2s infinite; }
.call-card { margin-bottom: 10px; border-right: 5px solid var(--accent-blue); }
.urgency-גבוהה { border-right-color: var(--accent-red); }
.urgency-חירום { border-right-color: var(--accent-red); animation: pulse-red 2s infinite; }
.urgency-בינונית { border-right-color: var(--accent-orange); }
.urgency-נמוכה { border-right-color: var(--accent-blue); }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); } 70% { box-shadow: 0 0 0 12px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }
.timeline { border-right: 2px solid var(--border); padding-right: 15px; display: grid; gap: 8px; }
.timeline-item { position: relative; padding: 8px 12px; background: rgba(255,255,255,.04); border-radius: 10px; }
.timeline-item::before { content: ''; position: absolute; right: -21px; top: 13px; width: 10px; height: 10px; background: var(--accent-blue); border-radius: 50%; }
.report-document { background: white; color: black; padding: 35px; width: 100%; max-width: 820px; margin: 0 auto; border: 1px solid #ddd; position: relative; border-radius: 8px; }
.doc-watermark { color: rgba(255,0,0,0.09); font-size: 56px; position: absolute; top: 42%; left: 8%; transform: rotate(-35deg); pointer-events: none; font-weight: 900; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.86); z-index: 1000; align-items: center; justify-content: center; padding: 18px; }
.modal-wrapper { background: var(--bg-panel); width: min(920px, 96vw); max-height: 92vh; border-radius: 20px; display: flex; flex-direction: column; border: 1px solid var(--border); box-shadow: var(--shadow); }
.modal-header { padding: 1.15rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-content { padding: 1.4rem; overflow-y: auto; }
.close-modal { background: transparent; color: white; border: none; font-size: 28px; }
.toast { position: fixed; bottom: 24px; left: 24px; padding: 12px 16px; background: var(--bg-panel); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 12px; z-index: 2000; }
.tab-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab-btn { background: rgba(255,255,255,.06); border: 1px solid var(--border); color: var(--text-main); padding: 10px 14px; border-radius: 10px; }
.tab-btn.active { background: var(--accent-blue); }
@media print {
  body * { visibility: hidden; }
  #printable-doc, #printable-doc * { visibility: visible; }
  #printable-doc { position: absolute; inset: 0; margin: 0; width: 100%; max-width: none; border: 0; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  #main-layout { min-height: 100vh; height: auto; flex-direction: column; }
  #sidebar { width: 100%; border-left: 0; border-bottom: 1px solid var(--border); }
  #main-nav { grid-template-columns: repeat(2, 1fr); display: grid; }
  #viewport { min-height: 70vh; }
  .moked-layout, .form-grid { grid-template-columns: 1fr; }
  .citizen-profile-header { flex-direction: column; align-items: flex-start; }
}
