
*{box-sizing:border-box;font-family:Tahoma,Arial}
body{margin:0;background:#f3f6fb;color:#1f2937}
.app{max-width:520px;margin:auto;min-height:100vh;background:white;padding:18px}
.logo{
  text-align:center;
  color:#0f4c81;
  margin:20px 0;
  cursor:pointer;
  user-select:none;
  line-height:1.1;
}

.logo-main{
  display:block;
  font-size:42px;
  font-weight:900;
  letter-spacing:1px;
}

.logo-sub{
  display:block;
  font-size:20px;
  font-weight:700;
  margin-top:4px;
  opacity:.92;
}
.card{background:white;border-radius:22px;padding:22px;margin:14px 0;box-shadow:0 8px 25px #00000012}
button,input,select,textarea{
  width:100%;
  padding:15px 16px;
  margin:8px 0;
  border-radius:18px;
  border:2px solid #cbd5e1;
  font-size:17px;
  font-weight:800;
  color:#111827;
  background:#ffffff;
}

button{
  background:#ffffff;
  color:#0f4c81;
  border:2px solid #0f4c81;
  font-weight:900;
  cursor:pointer;
  min-height:54px;
  box-shadow:0 6px 14px #0000000d;
  transition:transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}

button:active{
  transform:scale(.98);
  box-shadow:0 4px 10px #0f4c811f;
}
button:disabled{opacity:.55;cursor:not-allowed}
textarea{min-height:95px;resize:vertical}
.secondary{
  background:#eef2f7;
  color:#0f4c81;
  box-shadow:none;
  border:1px solid #dbe3ee;
}

.success{
  background:#f0fdf4;
  color:#166534;
  border:2px solid #16a34a;
}

.danger{
  background:#fef2f2;
  color:#991b1b;
  border:2px solid #dc2626;
}

.warning{
  background:#fff7ed;
  color:#9a3412;
  border:2px solid #f97316;
}
.hidden{display:none}
.item{border:1px solid #e5e7eb;border-radius:16px;padding:14px;margin:10px 0;background:#fafafa}
.move{border-bottom:1px solid #ddd;padding:8px 0;font-size:13px}
.badge{display:inline-block;padding:4px 9px;border-radius:20px;background:#e0f2fe;color:#0369a1;font-size:12px;margin:4px}
.badge-off{background:#fee2e2;color:#991b1b}
.badge-online{background:#dcfce7;color:#166534}
.badge-warning{background:#fef3c7;color:#92400e}
small{color:#6b7280}
.checkbox-row{display:flex;align-items:center;gap:8px;margin:8px 0;font-size:14px}
.checkbox-row input{width:auto;margin:0}
.privacy-link{color:#0f4c81;text-decoration:underline;font-weight:bold}
.privacy-scroll{
  max-height:320px;
  overflow-y:auto;
  padding:10px;
  line-height:1.9;
  font-size:15px;
  text-align:right;
}
.filter-box{background:#f8fafc;border:1px solid #e5e7eb;border-radius:16px;padding:12px;margin:12px 0}
.logo-container{margin-top:30px;text-align:center}
.company-logo{width:260px;max-width:85%;height:auto;opacity:.98;border-radius:12px}
.result-card{border-radius:18px;padding:18px;margin-top:14px;color:white;text-align:center;box-shadow:0 8px 20px #00000018}
.result-in{background:#15803d}
.result-out{background:#b91c1c}
.sticky-back{position:sticky;top:8px;z-index:20;margin-bottom:16px;box-shadow:0 8px 18px #00000012}
.action-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}
.action-grid button{margin:0;padding:11px 6px;font-size:13px;border-radius:12px;min-height:50px}
.manager-menu button{padding:12px 8px;font-size:14px;border-radius:14px;margin:7px 0;min-height:50px}
#managerPanel.manager-submode #managerTitle,
#managerPanel.manager-submode .manager-menu{
  display:none;
}
#employeePanel.employee-submode #employeeTitle,
#employeePanel.employee-submode > button{
  display:none;
}
.profile-circle{
  width:58px;
  height:58px;
  border-radius:50%;
  background:#ffe1ef;
  border:3px solid #f062a0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:28px;
  cursor:pointer;
  margin:0 0 12px auto;
  box-shadow:0 6px 16px #00000018;
}

.profile-modal{
  position:fixed;
  inset:0;
  background:#00000055;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  z-index:9999;
}

.profile-modal.hidden{
  display:none;
}

.profile-card{
  background:white;
  width:100%;
  max-width:520px;
  border-radius:24px 24px 0 0;
  padding:22px;
  box-shadow:0 -10px 30px #00000025;
}

.profile-row{
  display:flex;
  justify-content:space-between;
  gap:10px;
  border-bottom:1px solid #e5e7eb;
  padding:10px 0;
}
.compact-full{grid-column:1 / -1}
.hours-box{background:#eef7ff;border:1px solid #d6ecff;border-radius:14px;padding:10px;margin:10px 0;color:#0f4c81;font-weight:bold;text-align:center}
.date-input{text-align:center;direction:ltr;letter-spacing:1px}
.notice{background:#fff7ed;border:1px solid #fed7aa;color:#9a3412;border-radius:14px;padding:10px;margin:10px 0;font-size:14px}
.ok{background:#ecfdf5;border:1px solid #bbf7d0;color:#166534}
.error{background:#fef2f2;border:1px solid #fecaca;color:#991b1b}
.success-overlay{position:fixed;inset:0;background:#00000055;display:flex;align-items:center;justify-content:center;z-index:9999}
.success-overlay.hidden{display:none}
.success-popup{background:white;border-radius:26px;padding:28px 22px;width:86%;max-width:340px;text-align:center;box-shadow:0 20px 45px #00000030;animation:popupDrop .45s ease}
.success-circle{width:86px;height:86px;border-radius:50%;background:#0f4c81;color:white;display:flex;align-items:center;justify-content:center;font-size:52px;font-weight:bold;margin:0 auto 16px;animation:circlePop .55s ease}
.success-popup h2{margin:8px 0;color:#0f4c81}
.success-popup p{margin:6px 0;color:#374151;font-size:15px}
@keyframes popupDrop{from{transform:translateY(-45px);opacity:0}to{transform:translateY(0);opacity:1}}
@keyframes circlePop{0%{transform:scale(.25);opacity:0}65%{transform:scale(1.18);opacity:1}100%{transform:scale(1)}}
.analysis-summary{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  text-align:center;
}
.summary-tile{
  background:#f8fafc;
  border:1px solid #e5e7eb;
  border-radius:18px;
  padding:14px 8px;
}
.summary-label{font-size:13px;color:#64748b}
.summary-value{font-size:24px;font-weight:900;color:#0f4c81;margin-top:6px}

.analysis-day-card{
  border:1px solid #dbeafe;
  border-right:6px solid #0f4c81;
  border-radius:18px;
  padding:14px;
  margin:12px 0;
  background:#fff;
  box-shadow:0 6px 18px #00000010;
}
.analysis-date{
  font-size:24px;
  font-weight:900;
  color:#0f4c81;
  direction:ltr;
}
.analysis-hours{
  font-size:22px;
  font-weight:900;
  color:#0f4c81;
  margin:10px 0;
}
.analysis-employee{
  font-weight:bold;
  font-size:17px;
}
.status-ok{color:#15803d;font-weight:bold}
.status-review{color:#b45309;font-weight:bold}
.analysis-issues{
  color:#b00020;
  font-size:14px;
  margin-top:8px;
  line-height:1.8;
}
.analysis-separator{
  border-top:1px dashed #cbd5e1;
  margin:12px 0;
}
.map-link{
  color:#0f4c81;
  font-weight:700;
  text-decoration:underline;
  cursor:pointer;
}

.manager-title-wrap{position:relative;text-align:center;padding-top:44px}
.support-icon-btn{
  position:absolute;
  top:0;
  right:0;
  width:42px;
  height:42px;
  margin:0;
  padding:0;
  border-radius:14px;
  background:#fff;
  border:1px solid #e5e7eb;
  color:#0f4c81;
  font-size:24px;
  box-shadow:0 6px 16px #00000014;
}
.support-card{text-align:center}
.support-card textarea{min-height:150px}
.support-meta{font-size:13px;color:#64748b;line-height:1.8}
.support-type{font-weight:bold;color:#0f4c81}

/* Home screen */
#home{
  min-height:calc(100vh - 36px);
  margin:0;
  background:linear-gradient(180deg,#ffffff,#f5f8fc);
}

#home .logo-container{
  margin-top:10px;
}

#home .company-logo{
  width:260px;
  max-width:90%;
}

body:has(#home:not(.hidden)) .logo{
  display:none;
}

.home-title{
  text-align:center;
  margin-top:28px;
  color:#0f4c81;
}

.home-title b{
  display:block;
  font-size:20px;
  font-weight:900;
  letter-spacing:.5px;
}

.home-title span{
  display:block;
  margin-top:8px;
  font-size:18px;
  font-weight:700;
  color:#1f2937;
}


/* =========================
   Desktop layout - 1024px+
   يحسن عرض لوحة المدير ولوحة الأندلس على الكمبيوتر فقط
   ========================= */
@media (min-width: 1024px) {

  body {
    background:#eef2f7;
  }

  .app:has(#managerPanel:not(.hidden)),
  .app:has(#adminPanel:not(.hidden)),
  .app:has(#companiesList:not(.hidden)),
  .app:has(#companyDetails:not(.hidden)) {
    max-width:1200px;
    width:94%;
  }

  #managerPanel,
  #adminPanel,
  #companiesList,
  #companyDetails {
    max-width:none;
  }

  .manager-menu {
    display:grid;
    grid-template-columns:repeat(3, 1fr);
    gap:12px;
  }

  .manager-menu button {
    margin:0;
    min-height:72px;
    font-size:16px;
  }

  #adminPanel > button {
    display:inline-block;
    width:auto;
    min-width:190px;
    margin:6px;
  }

  .action-grid {
    grid-template-columns:repeat(3, 1fr);
  }

  .compact-full {
    grid-column:auto;
  }

  .item {
    padding:18px;
  }
}

.btn-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  margin-left:8px;
  border-radius:10px;
  background:#f1f5f9;
  color:#0f4c81;
  font-size:18px;
  vertical-align:middle;
}

button.secondary .btn-icon{
  background:#ffffff;
}

.branch-department-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
}

.branch-department-field label {
  display: block;
  text-align: right;
  margin: 8px 0 2px;
  font-weight: 900;
  color: #111827;
}

.branch-department-field select {
  width: 100%;
}

@media (max-width: 380px) {
  .branch-department-row {
    grid-template-columns: 1fr;
  }
}

.manager-today-stats{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  margin:14px auto 12px;
  flex-wrap:nowrap;
}

.today-circle{
  width:82px;
  height:82px;
  min-width:82px;
  border-radius:50%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  color:#fff;
  cursor:pointer;
  box-shadow:0 8px 18px #00000020;
  transition:transform .15s ease;
}

.today-circle:active{
  transform:scale(.96);
}

.today-circle strong{
  font-size:24px;
  line-height:1;
  color:#fff;
}

.today-circle span{
  font-size:11px;
  color:#fff;
  opacity:.95;
  margin-top:2px;
}

.today-circle small{
  font-size:11px;
  font-weight:700;
  color:#fff;
  margin-top:2px;
}

.today-circle.present{
  background:linear-gradient(145deg,#16a34a,#22c55e);
}

.today-circle.absent{
  background:linear-gradient(145deg,#f97316,#fb923c);
}

.overnight-shift-box{
  max-width:320px;
  margin:10px auto 14px;
  padding:10px 12px;
  border:1px solid #dbeafe;
  border-radius:18px;
  background:#f8fbff;
  text-align:right;
}

.overnight-shift-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-weight:900;
  color:#0f4c81;
}

.overnight-shift-box small{
  display:block;
  margin-top:6px;
  color:#64748b;
  font-size:12px;
  line-height:1.6;
}

.switch{
  position:relative;
  display:inline-block;
  width:52px;
  height:28px;
}

.switch input{
  opacity:0;
  width:0;
  height:0;
}

.slider{
  position:absolute;
  cursor:pointer;
  inset:0;
  background:#cbd5e1;
  transition:.2s;
  border-radius:999px;
}

.slider:before{
  content:"";
  position:absolute;
  height:22px;
  width:22px;
  left:3px;
  bottom:3px;
  background:white;
  transition:.2s;
  border-radius:50%;
  box-shadow:0 2px 6px #00000033;
}

.switch input:checked + .slider{
  background:#16a34a;
}

.switch input:checked + .slider:before{
  transform:translateX(24px);
}

.manager-menu{
  position:relative;
}

.manager-menu-wide{
  position:absolute;
  top:-125px;
  left:0;
  width:330px;
  z-index:5;
}

.manager-menu-wide .overnight-shift-box{
  margin:0;
  max-width:330px;
}

.analysis-report-card{
  padding:18px;
}

.analysis-table-wrap{
  width:100%;
  overflow-x:auto;
  border:1px solid #dbeafe;
  border-radius:18px;
  background:#ffffff;
  box-shadow:0 8px 20px #0000000d;
}

.analysis-table{
  width:100%;
  min-width:760px;
  border-collapse:separate;
  border-spacing:0;
  font-size:14px;
  text-align:center;
  overflow:hidden;
}

.analysis-table thead th{
  background:#0f4c81;
  color:#ffffff;
  padding:13px 10px;
  font-weight:900;
  white-space:nowrap;
}

.analysis-table tbody td{
  padding:12px 10px;
  border-bottom:1px solid #e5e7eb;
  color:#1f2937;
  vertical-align:middle;
}

.analysis-table tbody tr:nth-child(even){
  background:#f8fafc;
}

.analysis-table tbody tr:hover{
  background:#eef7ff;
}

.analysis-date-cell{
  direction:ltr;
  font-weight:900;
  color:#0f4c81 !important;
  white-space:nowrap;
}

.analysis-work-cell{
  font-weight:900;
  color:#0f4c81 !important;
  white-space:nowrap;
}

.analysis-status-badge{
  display:inline-block;
  padding:6px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  white-space:nowrap;
}

.analysis-status-badge.ok{
  background:#dcfce7;
  color:#166534;
}

.analysis-status-badge.review{
  background:#ffedd5;
  color:#9a3412;
}

.analysis-notes-cell{
  min-width:170px;
  font-size:13px;
  color:#64748b !important;
  line-height:1.7;
}

.analysis-filter-box{
  padding:14px;
}

.analysis-filter-row{
  display:grid;
  grid-template-columns:1fr 1fr 160px;
  gap:10px;
  align-items:center;
}

.analysis-filter-row input{
  margin:0;
  min-height:46px;
  padding:10px 14px;
  border-radius:14px;
  font-size:15px;
}

.analysis-filter-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:10px;
}

.analysis-filter-actions button{
  margin:0;
  min-height:46px;
  padding:10px 14px;
  border-radius:14px;
  font-size:15px;
}

@media (max-width: 700px){
  .analysis-filter-row{
    grid-template-columns:1fr;
  }

  .analysis-filter-actions{
    grid-template-columns:1fr;
  }
}

.analysis-filter-box{
  padding:14px;
}

.analysis-filter-row{
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:10px;
  align-items:start;
}

.analysis-filter-field{
  position:relative;
}

.analysis-filter-field label{
  display:block;
  margin:0 0 6px;
  color:#0f4c81;
  font-size:13px;
  font-weight:900;
  text-align:right;
}

.analysis-filter-field input{
  margin:0;
  min-height:46px;
  padding:10px 14px;
  border-radius:14px;
  font-size:15px;
}

.analysis-filter-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:12px;
}

.analysis-filter-actions button{
  margin:0;
  min-height:46px;
  padding:10px 14px;
  border-radius:14px;
  font-size:15px;
}

.analysis-employee-suggestions{
  position:absolute;
  top:74px;
  right:0;
  left:0;
  background:#ffffff;
  border:1px solid #cbd5e1;
  border-radius:14px;
  box-shadow:0 12px 28px #0000001f;
  z-index:50;
  overflow:hidden;
}

.analysis-employee-option{
  padding:10px 12px;
  cursor:pointer;
  border-bottom:1px solid #e5e7eb;
  text-align:right;
}

.analysis-employee-option:hover{
  background:#eef7ff;
}

.analysis-employee-option b{
  display:block;
  color:#0f4c81;
  font-size:14px;
}

.analysis-employee-option small{
  font-size:12px;
}

.analysis-selected-employee{
  margin-top:7px;
  padding:7px 10px;
  border-radius:12px;
  background:#ecfdf5;
  border:1px solid #bbf7d0;
  color:#166534;
  font-size:12px;
  font-weight:800;
}

.analysis-selected-employee span{
  display:block;
  margin-top:3px;
}

@media (max-width:700px){
  .analysis-filter-row{
    grid-template-columns:1fr;
  }

  .analysis-filter-actions{
    grid-template-columns:1fr;
  }
}

.analysis-report-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.analysis-report-header h4{
  margin:0;
  color:#111827;
  font-size:18px;
  font-weight:900;
}

.analysis-export-actions{
  display:flex;
  gap:8px;
  align-items:center;
}

.analysis-export-actions button{
  width:auto;
  min-width:96px;
  min-height:38px;
  margin:0;
  padding:8px 14px;
  border-radius:12px;
  font-size:14px;
}

@media (max-width:520px){
  .analysis-report-header{
    align-items:stretch;
    flex-direction:column;
  }

  .analysis-export-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
  }

  .analysis-export-actions button{
    width:100%;
  }
}