/* תמר — installed web app styles. RTL, mobile-first, iOS-friendly. */

:root {
  --bg: #faf7f4;
  --card: #ffffff;
  --ink: #3a3335;
  --muted: #8a8185;
  --line: #eee7e2;
  --accent: #b5838d;
  --accent-ink: #ffffff;
  --accent-soft: #f6e8ea;
  --danger: #b4544e;
  --radius: 16px;
  --shadow: 0 1px 4px rgba(58, 51, 53, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #201c1e;
    --card: #2b2628;
    --ink: #efe8ea;
    --muted: #a1979b;
    --line: #3a3335;
    --accent: #c98f9a;
    --accent-ink: #2b1d21;
    --accent-soft: #3d3134;
    --danger: #d98680;
    --shadow: none;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* The hidden attribute must beat any display rule (.overlay is display:flex). */
[hidden] { display: none !important; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, "Heebo", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

body {
  min-height: 100vh;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
  -webkit-user-select: none;
  user-select: none;
}

/* ---------------- header ---------------- */

.app-header {
  padding: calc(14px + env(safe-area-inset-top)) 20px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.app-title { font-size: 26px; font-weight: 700; letter-spacing: 0.01em; }
.app-today { color: var(--muted); font-size: 15px; }

/* ---------------- layout ---------------- */

#main { padding: 4px 16px 24px; max-width: 560px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 18px;
  margin-bottom: 14px;
}

.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------------- buttons ---------------- */

.btn {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  border-radius: 14px;
  padding: 13px 16px;
  margin-top: 10px;
  cursor: pointer;
}

.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled { opacity: 0.45; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn:active { transform: scale(0.985); }

/* ---------------- report ---------------- */

.field-label { font-weight: 700; margin: 14px 0 6px; }
.field-label:first-child { margin-top: 0; }

.report-types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-btn { margin-top: 0; padding: 18px 10px; font-size: 18px; }
.type-btn.small { font-size: 15px; padding: 12px 10px; }
.type-btn.selected { background: var(--accent-soft); border-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}

.chip.selected { background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }

.date-picker {
  width: 100%;
  margin-top: 10px;
  font: inherit;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

.result { white-space: pre-wrap; }
.result.ok { border-color: var(--accent); }
.result.err { border-color: var(--danger); color: var(--danger); }

/* ---------------- status ---------------- */

.status-situation { font-size: 19px; font-weight: 600; }
.status-extra { color: var(--muted); margin-top: 8px; }
.status-extra:empty { display: none; }

.alerts { margin-top: 12px; }
.alert-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.alert-row .when { color: var(--muted); }
.alert-row.past { opacity: 0.5; }
.alerts-head { font-weight: 700; margin-bottom: 2px; }

.lost { color: var(--danger); margin-top: 12px; white-space: pre-wrap; }
.lost:empty { display: none; }

/* ---------------- log ---------------- */

.log-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 10px; }
.log-cycle .row { display: flex; justify-content: space-between; padding: 3px 0; }
.log-cycle .row .k { color: var(--muted); }
.log-intervals { color: var(--muted); text-align: center; margin: 10px 0 4px; }

/* ---------------- tab bar ---------------- */

.tabbar {
  position: fixed;
  bottom: 0; right: 0; left: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1;
  border: none;
  background: none;
  font: inherit;
  font-size: 15px;
  color: var(--muted);
  padding: 13px 0 11px;
  cursor: pointer;
}

.tab.selected { color: var(--accent); font-weight: 700; }

/* ---------------- overlays ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 24, 26, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.pair-card, .modal-card { width: 100%; max-width: 380px; }

.pair-input {
  width: 100%;
  font: inherit;
  text-align: center;
  padding: 12px;
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

.install-steps { margin: 12px 22px; }
.install-steps li { margin-bottom: 8px; }
.share-glyph { font-size: 20px; }

.modal-text { white-space: pre-wrap; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns .btn { flex: 1; }

/* ---------------- toast ---------------- */

.toast {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom));
  right: 20px; left: 20px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  z-index: 90;
  white-space: pre-wrap;
}
