/* KG Pool Care — mobile-first, PSS-like */
* { box-sizing: border-box; }
:root {
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --green: #188038;
  --green-bg: #e6f4ea;
  --red: #d93025;
  --red-bg: #fce8e6;
  --amber: #e37400;
  --ink: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --card: #ffffff;
  --bg: #f1f3f4;
  --radius: 10px;
}
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--blue); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }

.banner {
  background: #fef7e0;
  color: #7a4a00;
  border-bottom: 1px solid #f9ab00;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 14px; gap: 8px;
}
.brand { font-weight: 700; font-size: 18px; color: var(--blue-dark); white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.topbar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav {
  display: flex; gap: 2px; overflow-x: auto;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 6px; position: sticky; top: 0; z-index: 50;
  -webkit-overflow-scrolling: touch;
}
.nav a {
  flex: 0 0 auto; padding: 11px 12px; text-decoration: none;
  color: var(--muted); font-weight: 600; font-size: 14px;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.nav a.active { color: var(--blue); border-bottom-color: var(--blue); }

.app { max-width: 860px; margin: 0 auto; padding: 14px 12px 48px; }
.loading { color: var(--muted); text-align: center; padding: 40px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error {
  background: var(--red-bg); color: var(--red);
  border: 1px solid #f5c6cb; border-radius: var(--radius);
  padding: 10px 12px; margin: 10px 0; font-size: 14px;
}
.success {
  background: var(--green-bg); color: var(--green);
  border: 1px solid #a8dab5; border-radius: var(--radius);
  padding: 10px 12px; margin: 10px 0; font-size: 14px;
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.card h2, .card h3 { margin: 0 0 8px; }
.card h2 { font-size: 18px; }
.card h3 { font-size: 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.divider { border: none; border-top: 1px solid var(--line); margin: 12px 0; }

h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 18px 0 8px; }

.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff;
  color: var(--ink); border-radius: 8px; padding: 9px 14px;
  font-weight: 600; font-size: 14px; text-decoration: none; text-align: center;
}
.btn:hover { background: #f8f9fa; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--blue); }
.btn-small { padding: 6px 10px; font-size: 13px; }
.btn-big {
  display: block; width: 100%; padding: 16px; font-size: 18px;
  border-radius: 12px; margin: 8px 0;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-block { display: block; width: 100%; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600;
}
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.today { border-color: var(--blue); color: var(--blue); }
.chip.active.today { color: #fff; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button {
  border: none; background: none; padding: 10px 12px; font-weight: 600;
  font-size: 14px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.tabs select {
  margin: 6px 0 6px auto; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; font-weight: 600; color: var(--muted);
}

.pill {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.pill-draft { color: var(--muted); border: 1px solid var(--muted); background: #fff; }
.pill-sent { color: #fff; background: var(--blue); }
.pill-late { color: #fff; background: var(--red); }
.pill-paid { color: #fff; background: var(--green); }
.pill-sim { color: #7a4a00; background: #fef7e0; border: 1px solid #f9ab00; }
.pill-gray { color: var(--muted); background: #f1f3f4; }
.pill-green { color: #fff; background: var(--green); }
.pill-red { color: #fff; background: var(--red); }

.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 8px; width: 100%; text-align: left;
}
button.list-row { cursor: pointer; }
.list-row:hover { background: #f8f9fa; }
.list-row .name { font-weight: 600; font-size: 15px; }
.list-row .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.list-row .sub.red { color: var(--red); font-weight: 600; }
.list-row .amount { font-weight: 600; text-align: right; white-space: nowrap; }
.list-row .amount.red { color: var(--red); }

form label, .field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="password"], input[type="date"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--blue); }
.checkline { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f3f4; font-size: 15px; }
.checkline:last-child { border-bottom: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type="text"], .toolbar input[type="search"] { flex: 1; min-width: 160px; }
.search { width: 100%; }
.fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: var(--green); color: #fff; font-size: 30px; line-height: 1;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 8px; }
.section-head h2 { margin: 0; }

.map-wrap { height: 420px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; background: #e5e3df; }
.map-wrap .leaflet-container { height: 100%; width: 100%; }
.pin-num {
  background: var(--blue); color: #fff; border: 2px solid #fff; border-radius: 50%;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.pin-num.dim { background: #9aa0a6; }

.photo-grid { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.photo-item { position: relative; width: 110px; }
.photo-item img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.photo-item button { margin-top: 4px; width: 100%; }
.video-item { margin: 8px 0; }
.video-item video { width: 100%; max-width: 420px; border-radius: 8px; display: block; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  background: var(--blue); color: #fff; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 16px; flex: 0 0 auto;
}
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }

.report-preview { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.report-preview h3 { margin-top: 0; }
.report-preview .safe { color: var(--green); font-weight: 700; }
.report-preview img { max-width: 100%; border-radius: 8px; margin: 4px 4px 4px 0; max-height: 220px; }

.inbox-list { display: flex; gap: 12px; }
.inbox-convos { flex: 0 0 260px; }
.inbox-thread { flex: 1; min-width: 0; }
@media (max-width: 640px) {
  .inbox-list { flex-direction: column; }
  .inbox-convos { flex: none; }
}
.msg { max-width: 80%; padding: 9px 12px; border-radius: 12px; margin: 6px 0; font-size: 14px; }
.msg-in { background: #f1f3f4; }
.msg-out { background: #d3e3fd; margin-left: auto; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

table.plain { width: 100%; border-collapse: collapse; font-size: 14px; }
table.plain th, table.plain td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plain th { color: var(--muted); font-size: 12px; text-transform: uppercase; }

.picker { border: 1px solid var(--line); border-radius: var(--radius); background: #f8f9fa; padding: 10px; margin: 8px 0; }
.picker button { display: block; width: 100%; text-align: left; margin: 2px 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.totals { font-size: 14px; color: var(--muted); margin: 4px 0 12px; }
.totals strong { color: var(--ink); }
