:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(17, 24, 39, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: 84px;
}

a { color: var(--primary); text-decoration: none; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

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

.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); }

.desktop-nav { display: none; gap: 16px; align-items: center; }
.desktop-nav a { color: var(--muted); font-weight: 500; padding: 6px 10px; border-radius: 8px; }
.desktop-nav a.active, .desktop-nav a:hover { color: var(--primary); background: var(--primary-soft); }

.container { max-width: 1080px; margin: 0 auto; padding: 16px; }

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

.card-title {
  margin: 0 0 12px 0;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.kpi-value { font-size: 1.2rem; font-weight: 700; }
.kpi-sub { font-size: 0.76rem; color: var(--muted); margin-top: 4px; }

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--muted); }

.month-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.month-title { font-weight: 700; font-size: 1.05rem; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill {
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}
.pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
}
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { min-height: 34px; padding: 5px 11px; font-size: 0.82rem; }
.btn-block { width: 100%; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-gray { background: #f3f4f6; color: #4b5563; }

.progress-wrap { background: #e5e7eb; border-radius: 999px; height: 12px; overflow: hidden; margin: 8px 0; }
.progress-bar { height: 100%; background: var(--green); border-radius: 999px; transition: width 0.3s ease; }

.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 0.9rem; font-weight: 500; }
.flash-success { background: var(--green-soft); color: var(--green); border: 1px solid #a7f3d0; }
.flash-danger { background: var(--red-soft); color: var(--red); border: 1px solid #fecaca; }
.flash-warning { background: var(--amber-soft); color: var(--amber); border: 1px solid #fde68a; }
.flash-info { background: var(--primary-soft); color: var(--primary); border: 1px solid #bfdbfe; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 0.84rem; font-weight: 600; margin-bottom: 5px; color: #374151; }
.form-control {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  background: #fff;
}
textarea.form-control { min-height: 76px; }

.list-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.list-item:last-child { border-bottom: none; padding-bottom: 0; }

.cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cal-table { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 0.78rem; }
.cal-table th, .cal-table td { border: 1px solid var(--border); text-align: center; padding: 4px 2px; min-width: 28px; height: 36px; }
.cal-table th.apt-col, .cal-table td.apt-col {
  position: sticky; left: 0; background: var(--surface); z-index: 2;
  min-width: 125px; text-align: left; padding: 6px 8px; font-weight: 600;
}
.cal-today { background: #eff6ff !important; color: var(--primary); font-weight: 700; }
.cal-booked { background: #dbeafe; }
.cal-booked-paid { background: #d1fae5; }
.cal-cell-link { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--text); font-weight: 600; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(4, 1fr);
  z-index: 30; padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 4px; font-size: 0.74rem; font-weight: 600; color: var(--muted);
}
.bottom-nav a.active { color: var(--primary); }

.preview-box { background: var(--primary-soft); border: 1px solid #bfdbfe; border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-size: 0.88rem; }
.empty-state { text-align: center; padding: 24px 12px; color: var(--muted); }

@media (min-width: 768px) {
  body { padding-bottom: 24px; }
  .bottom-nav { display: none; }
  .desktop-nav { display: flex; }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.reminder-panel {
  background: var(--amber-soft);
  color: var(--text);
  border: 1px solid #fde68a;
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.reminder-header {
  font-weight: 700;
  font-size: 0.94rem;
  color: #92400e;
  margin-bottom: 10px;
}

.reminder-item {
  background: var(--surface);
  border: 1px solid #f3e8c8;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.reminder-item + .reminder-item { margin-top: 8px; }

.reminder-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.reminder-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.reminder-pill-tomorrow {
  background: var(--amber-soft);
  color: #b45309;
  border: 1px solid #fcd34d;
}
.reminder-pill-urgent {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #fecaca;
}

.reminder-title { color: var(--text); font-weight: 700; font-size: 0.96rem; }
.reminder-title:hover { color: var(--primary); }
.reminder-meta { font-size: 0.8rem; color: var(--muted); }
.reminder-deposit { margin-top: 6px; font-size: 0.8