/* CurbScribe — Sidewalk Square Porch Board
   Colors: primary #2f5d62, secondary #f3e9d2, accent #e76f51 */

:root {
  --primary: #2f5d62;
  --primary-deep: #24484c;
  --secondary: #f3e9d2;
  --secondary-soft: #f8f1e2;
  --accent: #e76f51;
  --accent-deep: #c9553a;
  --concrete: #efeae0;
  --concrete-line: #d9d1c0;
  --ink: #31302c;
  --ink-soft: #6f6a5d;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

html, body {
  height: 100%;
  background: var(--concrete);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { font-size: 16px; line-height: 1.4; }

#app {
  min-height: 100%;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 14px);
}

.tab-panel {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 10px) 14px 0 14px;
}

/* ---------- Porch header ---------- */
.porch-header {
  background: var(--primary);
  color: var(--secondary);
  border-radius: 14px;
  padding: 14px 16px 16px 16px;
  box-shadow: 0 2px 0 var(--primary-deep);
}

.porch-rail {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(243, 233, 210, 0.25);
}

.porch-light {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--secondary);
  box-shadow: 0 0 8px rgba(243, 233, 210, 0.8);
  flex: none;
}

.porch-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.porch-sub { margin-left: auto; font-size: 11px; opacity: 0.75; text-align: right; }

.counter-row {
  display: flex;
  justify-content: center;
  padding: 16px 0 14px 0;
}

.open-counter {
  width: 116px; height: 116px;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--primary-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}

.counter-num { font-size: 40px; font-weight: 800; line-height: 1; }
.counter-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; margin-top: 4px; opacity: 0.85; }

.post-cta {
  display: block;
  width: 100%;
  padding: 15px 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 3px 0 var(--accent-deep);
  cursor: pointer;
}
.post-cta:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-deep); }

/* ---------- House-number tile (pinned latest) ---------- */
.pinned-wrap { padding-top: 14px; }

.house-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--secondary);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 2px 0 var(--concrete-line);
}

.pinned-tile { border-top: 4px solid var(--accent); }

.house-notch {
  flex: none;
  background: var(--primary);
  color: var(--secondary);
  font-weight: 800;
  font-size: 15px;
  padding: 7px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.house-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.house-title { font-weight: 700; font-size: 15px; color: var(--primary-deep); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.house-meta { font-size: 13px; color: var(--ink-soft); }

/* ---------- Tab headers ---------- */
.tab-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 2px 12px 2px;
}
.tab-title { font-size: 20px; font-weight: 800; color: var(--primary-deep); }
.tab-count { font-size: 13px; color: var(--ink-soft); margin-left: auto; }

/* ---------- Sidewalk square tiles ---------- */
.square-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sq-tile {
  background: var(--secondary-soft);
  border: 1px solid var(--concrete-line);
  border-radius: 10px;
  padding: 10px 12px 12px 12px;
  box-shadow: 0 2px 0 var(--concrete-line);
}

.sq-notch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.house-notch.small { font-size: 12px; padding: 4px 8px; }

.day-disc {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-left: auto;
}
.day-disc .d-num { font-size: 15px; font-weight: 800; }
.day-disc .d-mon { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.85; }

.sq-title { font-weight: 700; font-size: 15px; color: var(--primary-deep); overflow-wrap: anywhere; }
.sq-type { font-size: 13px; font-weight: 600; color: var(--accent-deep); margin-top: 2px; }
.sq-note { font-size: 13px; color: var(--ink-soft); margin-top: 6px; overflow-wrap: anywhere; }

.sq-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-sq {
  flex: 1;
  padding: 9px 8px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-edit { background: var(--primary); color: var(--secondary); box-shadow: 0 2px 0 var(--primary-deep); }
.btn-del { background: var(--secondary); color: var(--accent-deep); border: 1px solid var(--accent); box-shadow: 0 2px 0 var(--concrete-line); }
.btn-sq:active { transform: translateY(2px); box-shadow: none; }

/* ---------- Mailbox form panel ---------- */
.mailbox-panel {
  background: var(--secondary);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 3px 0 var(--concrete-line);
}

.field { margin-bottom: 14px; }
.field:last-of-type { margin-bottom: 18px; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-deep);
  margin-bottom: 5px;
}
.req-mark { color: var(--accent); }
.opt-mark { color: var(--ink-soft); font-weight: 500; }

.field-input {
  width: 100%;
  padding: 12px;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--concrete-line);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}
.field-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(47, 93, 98, 0.18); }

.field-select { background-image: linear-gradient(45deg, transparent 50%, var(--primary) 50%), linear-gradient(135deg, var(--primary) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }

.field-note { resize: vertical; min-height: 72px; }

.field-error {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
}

.field.invalid .field-input { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(231, 111, 81, 0.18); }

.form-actions { display: flex; flex-direction: column; gap: 8px; }

.btn-primary {
  padding: 14px 12px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 3px 0 var(--accent-deep);
  cursor: pointer;
}
.btn-primary:active { transform: translateY(2px); box-shadow: none; }

.btn-ghost {
  padding: 12px;
  border: 1px solid var(--primary);
  border-radius: 10px;
  background: transparent;
  color: var(--primary-deep);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Find / search ---------- */
.search-wrap { padding-bottom: 12px; }
.search-index { border-radius: 24px; padding: 12px 16px; }
.search-wrap { -webkit-appearance: none; }

/* ---------- Empty states ---------- */
.empty-note {
  padding: 26px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
  background: var(--secondary-soft);
  border: 1px dashed var(--concrete-line);
  border-radius: 10px;
  margin-top: 10px;
}
.pinned-wrap .empty-note { margin-top: 12px; }

/* ---------- Bottom tab bar: four porch-light silhouettes ---------- */
.tab-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--primary-deep);
  border-top: 3px solid var(--primary);
  z-index: 20;
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px 0 6px 0;
}

.tab-light {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(243, 233, 210, 0.28);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.tab-name { font-size: 11px; font-weight: 600; opacity: 0.7; letter-spacing: 0.3px; }

.tab-btn.active .tab-light {
  background: #ffb95e;
  box-shadow: 0 0 10px rgba(255, 185, 94, 0.9), 0 2px 3px rgba(0, 0, 0, 0.4);
}
.tab-btn.active .tab-name { opacity: 1; color: #ffd9a0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  background: var(--primary-deep);
  color: var(--secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }

/* ---------- Small screens ---------- */
@media (max-width: 360px) {
  .counter-num { font-size: 32px; }
  .open-counter { width: 104px; height: 104px; }
}
