/* ===== Variables – Sheba color palette ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal:          #18B4A8;
  --teal-dark:     #12968C;
  --teal-light:    #E6F8F7;
  --teal-border:   #A8DDD9;
  --pink:          #D4176E;
  --pink-light:    #FCE8F2;
  --pink-border:   #F0A8CE;
  --navy:          #1C2267;
  --navy-mid:      #2B3380;
  --bg:            #F7F8FA;
  --white:         #FFFFFF;
  --gray-row:      #F2F4F6;
  --text-main:     #1C2267;
  --text-muted:    #5A6880;
  --gold:          #A07800;
  --gold-bg:       #FFFBE6;
  --red:           #C0392B;
  --radius:        8px;
  --shadow:        0 2px 14px rgba(28,34,103,0.09);
}

html, body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  direction: rtl;
}

/* ===== Logo frame ===== */
.logo-frame {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(28,34,103,0.13);
  border: 1px solid rgba(200,210,230,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  flex-shrink: 0;
}

.logo-frame--small {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.18);
}

.logo-frame .sheba-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sheba-logo {
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

/* ===== Login page ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(145deg, #EAF9F8 0%, #F7F8FA 60%, #FCE8F2 100%);
}

.login-card {
  background: var(--white);
  border-radius: 18px;
  box-shadow: 0 6px 36px rgba(28,34,103,0.13);
  padding: 48px 40px 40px;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

.login-logo-row {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.login-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.5;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 32px;
  line-height: 1.35;
}

.btn-enter {
  display: inline-block;
  background: var(--teal);
  color: var(--white);
  font-size: 17px;
  font-weight: 700;
  padding: 14px 44px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.18s, transform 0.1s;
  letter-spacing: 0.3px;
}
.btn-enter:hover  { background: var(--teal-dark); }
.btn-enter:active { transform: scale(0.98); }

.login-note {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ===== Monitor page ===== */
.monitor-page { background: var(--bg); }

.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 12px 20px;
  box-shadow: 0 2px 10px rgba(28,34,103,0.25);
}

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-logo-text {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-text { text-align: right; }

.header-org {
  font-size: 11px;
  color: #9ecbff;
  line-height: 1.4;
}

.header-system {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin-top: 2px;
}

/* Exit button */
.btn-exit {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.55);
  border-radius: 6px;
  padding: 7px 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-exit:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.85);
}

/* ===== Main content ===== */
.main-content {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.page-title {
  font-size: 21px;
  font-weight: 800;
  color: var(--navy);
  text-align: center;
  margin-bottom: 20px;
}

/* ===== Month navigator ===== */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
}

.month-label {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  min-width: 180px;
  text-align: center;
}

.btn-nav {
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.btn-nav:hover    { background: var(--teal-dark); }
.btn-nav:disabled { background: #b8c0cc; cursor: not-allowed; }

.archive-notice {
  border-radius: 6px;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  margin-bottom: 14px;
  font-weight: 600;
}
.archive-notice--signable {
  background: #FFF8E1;
  border: 1px solid #FFCC5C;
  color: #7A5600;
}
.archive-notice--readonly {
  background: #F0F2F5;
  border: 1px solid #C8CDD8;
  color: #555E72;
}

.hidden { display: none !important; }

/* ===== Table ===== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--white);
}

.sig-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.sig-table th {
  background: var(--navy);
  color: var(--white);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.sig-table td {
  padding: 10px 14px;
  font-size: 14px;
  text-align: center;
  border-bottom: 1px solid #E4E8F0;
  vertical-align: middle;
}

.sig-table tr:last-child td { border-bottom: none; }
.sig-table tbody tr:nth-child(even) td { background: var(--gray-row); }

/* Row states */
.row-signed td   { background: var(--teal-light) !important; }
.row-today td    { background: #FFF4E5 !important; }
.row-today .day-col { color: #C05500; font-weight: 700; }
.row-signed .day-col { color: var(--teal-dark); font-weight: 700; }

/* Badges */
.badge-signed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--teal-light);
  color: var(--teal-dark);
  border: 1px solid var(--teal-border);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-locked {
  display: inline-block;
  background: #ECEEF2;
  color: #888EA0;
  border: 1px solid #D4D8E2;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.badge-pending {
  display: inline-block;
  color: var(--text-muted);
  font-size: 12px;
}

.badge-future {
  display: inline-block;
  background: #F5F5F5;
  color: #9E9E9E;
  border: 1px solid #E0E0E0;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.row-future td {
  background: #FAFAFA !important;
  color: #BDBDBD;
}
.row-future .day-col { color: #BDBDBD; }

.signer-name { font-weight: 600; color: var(--navy); }

.temp-value {
  font-weight: 700;
  color: var(--teal-dark);
  font-size: 14px;
}

.loading-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-size: 15px;
}

/* ===== Action buttons ===== */
.btn-sign {
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: 6px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-sign:hover { background: var(--teal-dark); }

.btn-edit {
  background: var(--white);
  color: var(--pink);
  border: 1.5px solid var(--pink);
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-edit:hover { background: var(--pink-light); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-box {
  background: var(--white);
  border-radius: 14px;
  padding: 32px 28px 24px;
  max-width: 430px;
  width: 100%;
  box-shadow: 0 10px 48px rgba(0,0,0,0.18);
  text-align: right;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}

.modal-date {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.edit-note {
  font-size: 13px;
  color: var(--gold);
  background: var(--gold-bg);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 14px;
  border-right: 3px solid var(--gold);
}

.modal-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 5px;
  margin-top: 14px;
}

.req { color: var(--pink); }

.modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #D0D6E4;
  border-radius: 6px;
  font-size: 15px;
  direction: rtl;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  background: var(--white);
}
.modal-input:focus { border-color: var(--teal); }

/* Hide browser spinners from number input */
.modal-input[type=number]::-webkit-inner-spin-button,
.modal-input[type=number]::-webkit-outer-spin-button { opacity: 1; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.btn-primary {
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: 7px;
  padding: 10px 26px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover    { background: var(--teal-dark); }
.btn-primary:disabled { background: #9BCFCC; cursor: not-allowed; }

.btn-secondary {
  background: var(--white);
  color: var(--text-muted);
  border: 1.5px solid #C8CDD8;
  border-radius: 7px;
  padding: 10px 20px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--gray-row); }

.modal-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--red);
  font-weight: 600;
}

/* ===== Responsive ===== */
@media (max-width: 620px) {
  .login-card { padding: 32px 18px 28px; }
  .login-title { font-size: 18px; }
  .btn-enter { font-size: 15px; padding: 12px 30px; }

  .site-header { padding: 10px 12px; }
  .header-system { font-size: 13px; }
  .header-org { display: none; }
  .logo-frame { width: 72px; height: 72px; border-radius: 12px; padding: 6px; }
  .logo-frame--small { width: 38px; height: 38px; border-radius: 8px; padding: 4px; }
  .btn-exit { padding: 6px 12px; font-size: 13px; }

  .page-title { font-size: 16px; }
  .month-label { font-size: 14px; min-width: 130px; }

  .sig-table th, .sig-table td { padding: 8px 7px; font-size: 12px; }

  .modal-box { padding: 22px 14px 18px; }
  .modal-title { font-size: 16px; }
}

/* ===== Health check page ===== */
.health-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  max-width: 560px;
  margin: 0 auto 24px;
}

.health-intro {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.btn-health-run {
  font-size: 16px;
  padding: 12px 32px;
  margin-bottom: 28px;
}

.health-results {
  border-top: 1px solid #E4E8F0;
  padding-top: 20px;
}

.health-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #F0F2F5;
  font-size: 15px;
}

.health-indicator {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.health-indicator.ok      { color: #1a7a34; }
.health-indicator.error   { color: var(--red); }
.health-indicator.checking{ color: var(--text-muted); }

.health-label {
  flex: 1;
  color: var(--text-main);
  font-weight: 600;
}

.health-val { font-weight: 700; font-size: 14px; }
.health-val.ok    { color: #1a7a34; }
.health-val.error { color: var(--red); }

.health-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #F5F7FA;
  font-size: 16px;
  font-weight: 700;
}
.health-status-row.ok    { background: #E6F4EA; }
.health-status-row.error { background: #FDEDEC; }

.health-status-label { color: var(--text-main); flex: 1; }
.health-status-val   { font-size: 16px; font-weight: 800; }
.health-status-row.ok    .health-status-val { color: #1a7a34; }
.health-status-row.error .health-status-val { color: var(--red); }

.health-error-msg {
  margin-top: 10px;
  font-size: 13px;
  color: var(--red);
  font-weight: 600;
}

.health-back {
  text-align: center;
  margin-top: 8px;
}

/* ── Admin entry link (index.html footer) ── */
.admin-entry-link {
  display: block;
  margin-top: 18px;
  font-size: 0.78rem;
  color: #aaa;
  text-decoration: none;
  text-align: center;
  transition: color .2s;
}
.admin-entry-link:hover { color: #18B4A8; }

/* ── Fridge selector (monitor page) ── */
.fridge-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.fridge-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
}

.fridge-select {
  flex: 1;
  min-width: 160px;
  padding: 8px 12px;
  border: 1.5px solid var(--teal-border);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  background: var(--white);
  cursor: pointer;
  appearance: auto;
  transition: border-color .15s;
}
.fridge-select:focus {
  outline: none;
  border-color: var(--teal);
}

.fridge-load-error {
  font-size: 13px;
  color: var(--pink);
  font-weight: 600;
  margin-bottom: 10px;
}

.btn-retry-fridges {
  background: var(--white);
  color: var(--teal);
  border: 1.5px solid var(--teal);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-retry-fridges:hover { background: var(--teal-light); }

/* ── PWA install section (index page) ── */
.install-section {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.btn-install {
  background: var(--white);
  color: var(--teal);
  border: 2px solid var(--teal);
  border-radius: 8px;
  padding: 11px 36px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  width: 100%;
  max-width: 280px;
  letter-spacing: 0.2px;
  font-family: inherit;
}
.btn-install:hover { background: var(--teal-light); }

.install-note {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.55;
  max-width: 280px;
}

/* ── Install modals ── */
.install-modal-intro {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.6;
}

.install-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.install-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-main);
}

.install-step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  background: var(--teal);
  color: var(--white);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 1px;
}

.install-step-sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}
