* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f4f6;
  color: #111827;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.app-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.app-header h1 {
  margin: 0;
  font-size: 2rem;
}

.app-header p {
  margin: 0.25rem 0 0;
  color: #6b7280;
}

.card {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

/* Week controls */
.week-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.week-controls label {
  font-weight: 500;
  margin-right: 0.5rem;
}

#weekStart {
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
}

.week-range {
  font-size: 0.9rem;
  color: #4b5563;
}

/* Layout */
.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.45rem 0.35rem;
  text-align: left;
  font-size: 0.92rem;
}

th {
  border-bottom: 1px solid #e5e7eb;
  color: #6b7280;
  font-weight: 600;
}

tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.names-table select {
  width: 100%;
  padding: 0.25rem 0.35rem;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
}

/* Buttons */
button {
  cursor: pointer;
  border-radius: 999px;
  border: none;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.btn-small {
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
}

.btn-done {
  background: #22c55e;
  color: #ffffff;
  margin-right: 0.25rem;
}

.btn-penalty {
  background: #ef4444;
  color: #ffffff;
}

.btn-collect {
  background: #3b82f6;
  color: #ffffff;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Totals */
.week-total {
  font-weight: 600;
  color: #111827;
}

/* Collection / receipt */
.collection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.collection-header h2 {
  margin: 0;
}

#downloadPdfBtn {
  background: #10b981;
  color: #ffffff;
  padding: 0.3rem 0.8rem;
}

.collection-content h3 {
  margin-top: 0;
}

.collection-summary-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.4rem 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.collection-summary-grid div.label {
  font-weight: 500;
  color: #4b5563;
}

.collection-summary-grid div.value {
  font-weight: 600;
}

.collection-details-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.collection-details-table th,
.collection-details-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.35rem 0.25rem;
  font-size: 0.85rem;
}

/* Log */
.log-section {
  margin-bottom: 1rem;
}

/* Certificate layout */
.certificate {
  display: flex;
  justify-content: center;
}

.certificate-border {
  border: 4px solid #111827;
  border-radius: 16px;
  padding: 1.5rem 2rem;
  max-width: 700px;
  width: 100%;
  text-align: center;
  background: #f9fafb;
}

.certificate-title {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.certificate-subtitle {
  margin: 0.3rem 0;
  color: #4b5563;
  font-size: 0.95rem;
}

.certificate-name {
  margin: 0.4rem 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.certificate-week {
  margin: 0.25rem 0 0.75rem;
  font-weight: 500;
}

.certificate-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin: 0.5rem 0 1rem;
}

.certificate-stats .label {
  font-size: 0.85rem;
  color: #6b7280;
}

.certificate-stats .value {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

.certificate-amount {
  font-size: 1.4rem;
}

.certificate-details-heading {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.certificate-no-entries {
  margin-top: 0.75rem;
}

.certificate-signature {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 1.2rem;
  font-size: 0.9rem;
}

.signature-line {
  border-bottom: 1px solid #9ca3af;
  width: 140px;
  margin-top: 0.25rem;
}

/* Enhanced Mobile Optimization */
@media (max-width: 800px) {
  body {
    font-size: 14px;
  }

  .app {
    padding: 0.5rem;
  }

  .app-header h1 {
    font-size: 1.5rem;
  }

  .app-header p {
    font-size: 0.9rem;
  }

  .card {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  }

  .main-layout {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* Week controls */
  .week-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .week-controls > div {
    width: 100%;
  }

  .week-controls input[type="date"] {
    width: 100%;
    max-width: 100%;
  }

  .week-range {
    width: 100%;
    font-size: 0.85rem;
  }

  /* Tables - make scrollable and compact */
  .names-section table,
  .log-section table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .names-table,
  .log-table {
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.4rem 0.3rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  /* Buttons - make more touch-friendly */
  button {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    min-height: 44px;
  }

  .names-table button {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    min-height: 36px;
  }

  /* Collection section */
  .collection-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .collection-header h2 {
    margin-bottom: 0;
  }

  #downloadPdfBtn {
    width: 100%;
  }

  /* Certificate styling */
  .certificate-border {
    padding: 1rem;
    margin: 0.5rem 0;
  }

  .certificate-title {
    font-size: 1.25rem;
  }

  .certificate-recipient {
    font-size: 1rem;
  }

  .certificate-amount {
    font-size: 1.5rem;
  }

  /* Input fields */
  input[type="text"],
  input[type="number"],
  input[type="date"],
  select {
    font-size: 16px;
    padding: 0.5rem;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .log-table th:nth-child(2),
  .log-table td:nth-child(2) {
    display: none;
  }
  
  th, td {
    padding: 0.3rem 0.2rem;
    font-size: 0.75rem;
  }
}

/* Tablet optimization */
@media (min-width: 801px) and (max-width: 1024px) {
  .app {
    padding: 1rem;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Print styles */
@media print {
  body {
    background: #ffffff;
    margin: 0;
  }

  .app {
    padding: 0;
    max-width: none;
  }

  header,
  .week-controls,
  .names-section,
  .log-section {
    display: none !important;
  }

  #collectionCard {
    display: block !important;
    box-shadow: none;
    border-radius: 0;
    max-width: 800px;
    margin: 0 auto;
  }

  #printReceiptBtn,
  #downloadPdfBtn {
    display: none !important;
  }

  .certificate-border {
    border-width: 6px;
    padding: 3cm 2.5cm;
    max-width: none;
    background: #ffffff !important;
    color: #000 !important;
  }

  .certificate * {
    color: #111827 !important;
  }
}

/* Mobile-friendly Kids & Chores improvements */
@media (max-width: 800px) {
  /* Card layout for each kid */
  .names-section .names-table {
    display: block;
  }

  .names-section thead {
    display: none;
  }

  .names-section tbody {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .names-section tbody tr {
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .names-section tbody tr:nth-child(even) {
    background: #f9fafb;
  }

  .names-section tbody td {
    display: flex;
    flex-direction: column;
    padding: 0;
    border: none;
  }

  .names-section tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
  }

  /* Name styling */
  .names-section tbody td:first-child {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
  }

  .names-section tbody td:first-child::before {
    display: none;
  }

  /* Select dropdown - bigger touch target */
  .names-table select {
    width: 100%;
    padding: 0.75rem;
    font-size: 16px;
    border-radius: 0.5rem;
    border: 2px solid #d1d5db;
    background: white;
    min-height: 48px;
  }

  /* Action buttons in a row */
  .names-section tbody td:nth-child(3) {
    flex-direction: row;
    gap: 0.5rem;
  }

  .names-section tbody td:nth-child(3)::before {
    display: none;
  }

  .names-section tbody td:nth-child(3) button {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.9rem;
    min-height: 48px;
    border-radius: 0.5rem;
  }

  /* Total display */
  .names-section .week-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: #10b981;
  }

  /* Collect button - full width */
  .names-section tbody td:last-child button {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    min-height: 48px;
    border-radius: 0.5rem;
    font-weight: 600;
  }
}


/* Mobile-friendly Chore Log improvements - FIXED */
@media (max-width: 800px) {
  /* Card layout for each log entry */
  .log-section .log-table {
    display: block;
  }

  .log-section thead {
    display: none;
  }

  .log-section tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .log-section tbody tr {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem;
    gap: 0.5rem;
    position: relative;
  }

  .log-section tbody tr:nth-child(even) {
    background: #ffffff;
  }

  .log-section tbody td {
    padding: 0;
    border: none;
    display: block;
    width: 100%;
  }

  /* Remove existing pseudo-elements that cause issues */
  .log-section tbody td::before,
  .log-section tbody td::after {
    display: none;
  }

  /* Header row with name and remove button */
  .log-section tbody td:nth-child(3) {
    order: 1;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  /* Remove button inside name td */
  .log-section tbody td:nth-child(6) {
    order: 1;
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: auto;
  }

  .log-section tbody td:nth-child(6) button {
    padding: 0.4rem 0.65rem;
    font-size: 1.1rem;
    min-height: 36px;
    min-width: 36px;
    border-radius: 0.375rem;
  }

  /* Chore description */
  .log-section tbody td:nth-child(4) {
    order: 2;
    font-size: 0.9rem;
    color: #374151;
    padding-right: 3rem;
  }

  /* Timestamp */
  .log-section tbody td:nth-child(1) {
    order: 3;
    font-size: 0.8rem;
    color: #6b7280;
  }

  /* Day */
  .log-section tbody td:nth-child(2) {
    order: 4;
    font-size: 0.8rem;
    color: #6b7280;
  }

  /* Value */
  .log-section tbody td:nth-child(5) {
    order: 5;
    font-weight: 700;
    font-size: 1.1rem;
    color: #10b981;
    margin-top: 0.25rem;
  }
}

/* Keep collection section uniform on mobile */
@media (max-width: 800px) {
  .collection-section {
    max-width: 100%;
  }

  .certificate {
    max-width: 100%;
  }

  .certificate-border {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Make certificate stats stack on mobile */
  .certificate-stats {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .certificate-stats > div {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 0.375rem;
  }

  .certificate-stats .label {
    text-align: left;
  }

  .certificate-stats .value {
    text-align: right;
  }

  /* Make details table scrollable if needed */
  .collection-details-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Signature section */
  .certificate-signature {
    flex-direction: column;
    gap: 1rem;
  }

  .signature-line {
    width: 100%;
  }
}

/* Force certificate to fit screen on mobile - OVERRIDE */
@media (max-width: 800px) {
  .collection-section.card {
    overflow: hidden;
  }

  #collectionCard {
    overflow: hidden;
  }

  .collection-content {
    overflow: hidden;
    max-width: 100%;
  }

  .certificate {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden;
  }

  .certificate-border {
    width: 100% !important;
    max-width: 100% !important;
    padding: 1rem 0.75rem !important;
    box-sizing: border-box !important;
    overflow: hidden;
    border-width: 2px !important;
  }

  .certificate-title {
    font-size: 1.1rem !important;
    word-wrap: break-word;
  }

  .certificate-name {
    font-size: 1.3rem !important;
  }

  .certificate-week {
    font-size: 0.85rem !important;
    word-wrap: break-word;
  }

  /* Force table to fit */
  .collection-details-table {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 0.75rem !important;
  }

  .collection-details-table th,
  .collection-details-table td {
    padding: 0.25rem 0.15rem !important;
    font-size: 0.7rem !important;
    word-break: break-word;
  }
}

/* Penalty styling in chore log */
.log-table tbody tr.penalty-entry {
  background-color: #fef2f2 !important;
  border-left: 4px solid #ef4444;
}

.log-table tbody tr.penalty-entry td:nth-child(4) {
  color: #dc2626;
  font-weight: 600;
}

.log-table tbody tr.penalty-entry td:nth-child(5) {
  color: #dc2626 !important;
  font-weight: 700;
}

/* Mobile penalty styling */
@media (max-width: 800px) {
  .log-section tbody tr.penalty-entry {
    background-color: #fef2f2 !important;
    border-left: 4px solid #ef4444;
  }

  .log-section tbody tr.penalty-entry td:nth-child(4) {
    color: #dc2626;
    font-weight: 600;
  }

  .log-section tbody tr.penalty-entry td:nth-child(5) {
    color: #dc2626 !important;
  }
}

/* Force colors for PDF generation */
.certificate-border {
  background-color: #f9fafb !important;
  border-color: #111827 !important;
}

.certificate-title,
.certificate-name {
  color: #111827 !important;
}

.certificate-subtitle,
.certificate-week {
  color: #4b5563 !important;
}

.collection-details-table th {
  color: #6b7280 !important;
}

.collection-details-table td {
  color: #111827 !important;
}

/* Ensure certificate renders properly for PDF */
.certificate-border * {
  visibility: visible !important;
  display: block !important;
}

.certificate-border .certificate-stats {
  display: flex !important;
}

.certificate-border table,
.certificate-border thead,
.certificate-border tbody,
.certificate-border tr,
.certificate-border th,
.certificate-border td {
  display: table !important;
}

.certificate-border thead {
  display: table-header-group !important;
}

.certificate-border tbody {
  display: table-row-group !important;
}

.certificate-border tr {
  display: table-row !important;
}

.certificate-border th,
.certificate-border td {
  display: table-cell !important;
}

/* Chore log filter */
.log-filter {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 0.5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-weight: 500;
  color: #6b7280;
  font-size: 0.85rem;
}

.filter-group select,
.filter-group input[type="date"],
.filter-group input[type="time"] {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
  background: white;
  min-width: 140px;
}

.filter-group button {
  margin-top: 1.25rem;
}

@media (max-width: 800px) {
  .log-filter {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .filter-group select,
  .filter-group input[type="date"],
  .filter-group input[type="time"] {
    width: 100%;
    font-size: 16px;
    min-height: 44px;
  }
  
  .filter-group button {
    width: 100%;
    margin-top: 0.5rem;
  }
}


/* Improved week controls for better mobile viewing */
.week-controls {
  background: #f9fafb;
  padding: 1rem;
  border-radius: 0.75rem;
}

.week-controls > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#weekStart {
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 2px solid #d1d5db;
}

.week-range {
  font-weight: 600;
  color: #111827;
  padding: 0.5rem;
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  text-align: center;
}

@media (max-width: 800px) {
  .week-controls {
    padding: 0.75rem;
  }
  
  .week-controls > div:first-child {
    width: 100%;
  }
  
  .week-controls label {
    font-size: 0.9rem;
    margin-right: 0;
    margin-bottom: 0.25rem;
  }
  
  #weekStart {
    width: 100%;
    padding: 0.75rem;
    font-size: 16px;
    min-height: 48px;
    border-radius: 0.5rem;
  }
  
  .week-range {
    margin-top: 0.75rem;
    padding: 0.75rem;
    font-size: 0.95rem;
  }
}

/* PIN Overlay */
.pin-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.pin-overlay.hidden {
  display: none;
}

.pin-modal {
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.pin-modal h2 {
  margin: 0 0 0.5rem;
  color: #111827;
  font-size: 1.5rem;
}

.pin-modal p {
  margin: 0 0 1.5rem;
  color: #6b7280;
}

.pin-modal input {
  width: 100%;
  padding: 1rem;
  font-size: 1.5rem;
  text-align: center;
  border: 2px solid #d1d5db;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  letter-spacing: 0.5rem;
  font-family: monospace;
}

.pin-modal input:focus {
  outline: none;
  border-color: #3b82f6;
}

.pin-modal button {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 600;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
}

.pin-modal button:hover {
  background: #2563eb;
}

.pin-modal button:active {
  transform: scale(0.98);
}

.pin-error {
  color: #ef4444;
  font-weight: 600;
  margin-top: 1rem !important;
  min-height: 1.5rem;
}

@media (max-width: 800px) {
  .pin-modal {
    padding: 1.5rem;
  }
  
  .pin-modal input {
    font-size: 1.25rem;
  }
}

/* Shake animation for wrong PIN */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
  20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Leaderboard */
.leaderboard {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  padding: 1.5rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  border: 3px solid #f59e0b;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.leaderboard h3 {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 1.25rem;
  color: #92400e;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.leaderboard-content {
  background: white;
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.leaderboard-loading {
  text-align: center;
  color: #6b7280;
  margin: 0;
  font-style: italic;
}

.leaderboard-winner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.leaderboard-winner .winner-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.leaderboard-winner .winner-rank {
  font-size: 3rem;
  line-height: 1;
}

.leaderboard-winner .winner-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.leaderboard-winner .winner-stats {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0.25rem 0 0;
}

.leaderboard-winner .winner-amount {
  font-size: 2rem;
  font-weight: 700;
  color: #10b981;
  text-align: right;
}

.leaderboard-all {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid #e5e7eb;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  background: #f9fafb;
  border-radius: 0.375rem;
}

.leaderboard-row .rank {
  font-weight: 600;
  color: #6b7280;
  min-width: 2rem;
}

.leaderboard-row .name {
  flex: 1;
  font-weight: 600;
  color: #111827;
}

.leaderboard-row .amount {
  font-weight: 700;
  color: #10b981;
}

@media (max-width: 800px) {
  .leaderboard {
    padding: 1rem;
  }
  
  .leaderboard h3 {
    font-size: 1.1rem;
  }
  
  .leaderboard-winner {
    flex-direction: column;
    text-align: center;
  }
  
  .leaderboard-winner .winner-info {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .leaderboard-winner .winner-name {
    font-size: 1.25rem;
  }
  
  .leaderboard-winner .winner-amount {
    font-size: 1.75rem;
  }
}

/* PIN counter */
.pin-counter {
  color: #6b7280;
  font-size: 0.85rem;
  margin-top: 0.5rem !important;
  min-height: 1.25rem;
}

/* Force remove PIN overlay to be visible */
#removeEntryOverlay {
  display: flex !important;
  z-index: 10001 !important;
  visibility: visible !important;
  opacity: 1 !important;
}

#removeEntryOverlay.hidden {
  display: none !important;
}

/* Force pin-modal to display */
#removeEntryOverlay .pin-modal {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 1 !important;
}

/* Parent Menu */
.parent-menu {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto 16px auto;
  width: fit-content;
  background: white;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
}

.parent-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #333;
}

.avatar-icon {
  font-size: 24px;
}

.parent-actions {
  display: flex;
  gap: 8px;
}

.menu-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: #f3f4f6;
  color: #333;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.menu-btn:hover {
  background: #e5e7eb;
}

.logout-btn {
  background: #fee;
  color: #c00;
}

.logout-btn:hover {
  background: #fdd;
  .parent-menu {
    top: 0;
    margin: 8px auto;
    padding: 8px 12px;
    flex-wrap: wrap;
    width: fit-content;
    max-width: calc(100vw - 20px);
  }
  
  .avatar-icon {
    font-size: 20px;
  }
  
  .menu-btn {
    font-size: 13px;
    padding: 6px 10px;
  }
}

/* Settings Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 10000;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  margin: 20px auto;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.close-btn:hover {
  background: #f3f4f6;
  color: #333;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

#choresListEditor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.chore-edit-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 100px 40px;
  gap: 8px;
  align-items: center;
}

.chore-edit-item input[type=text] {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.chore-edit-item input[type=number] {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.chore-edit-item .delete-chore-btn {
  background: #fee;
  color: #c00;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chore-edit-item .delete-chore-btn:hover {
  background: #fdd;
}

.btn-primary {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-success {
  background: #10b981;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn-success:hover {
  background: #059669;
}

.btn-cancel {
  background: #f3f4f6;
  color: #333;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn-cancel:hover {
  background: #e5e7eb;
}

@media (max-width: 800px) {
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }
  
  .chore-edit-item {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  
  .chore-edit-item input[type=text],
  .chore-edit-item input[type=number] {
    width: 100%;
  }
  
  .delete-chore-btn {
    justify-self: end;
  }
}

/* Kids editor */
#kidsListEditor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.kid-edit-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 8px;
  align-items: center;
}

.kid-edit-item input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.modal-body h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
}

@media (max-width: 800px) {
  .kid-edit-item {
    grid-template-columns: 1fr;
  }
}
