* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f9fafb;
  color: #1f2937;
  font-size: 16px;
  line-height: 1.5;
}

/* Layout */
.app-header {
  background-color: #2563eb;
  color: white;
  padding: 1rem;
  text-align: center;
  border-bottom: 1px solid #1d4ed8;
}

.app-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 80px;
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background-color: white;
  border-top: 1px solid #e5e7eb;
  padding: 0.5rem 0;
}

.tab-link {
  flex: 1;
  text-align: center;
  padding: 0.75rem 0;
  text-decoration: none;
  color: #6b7280;
  font-weight: 500;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.tab-link:hover {
  color: #2563eb;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s, color 0.2s;
  width: 100%;
  max-width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: #2563eb;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: #1d4ed8;
}

.btn-secondary {
  background-color: #6b7280;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #4b5563;
}

.btn-google {
  background-color: #ffffff;
  color: #1f2937;
  border: 1px solid #d1d5db;
}

.btn-google:hover:not(:disabled) {
  background-color: #f3f4f6;
}

/* Containers */
.login-container,
.error-container,
.dashboard-container {
  max-width: 500px;
  margin: 2rem auto;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form .btn {
  min-height: 44px;
}

.divider {
  border: none;
  border-top: 1px solid #d1d5db;
  margin: 1rem 0;
}

.text-small {
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
}

.welcome-section {
  background-color: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e5e7eb;
}

.welcome-section p {
  font-size: 1.125rem;
  font-weight: 500;
}

.actions {
  display: flex;
  gap: 1rem;
}

.actions form {
  flex: 1;
}

.actions .btn {
  width: 100%;
  min-height: 44px;
}

/* Forms */
input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='date'],
select,
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 0.5rem;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 500;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.form-control {
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Children and Settings Containers */
.children-container,
.split-container {
  max-width: 500px;
  margin: 0 auto;
}

.children-container h2,
.split-container h2 {
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.children-container h3,
.split-container h3 {
  margin-bottom: 1rem;
  font-size: 1.125rem;
  font-weight: 500;
  color: #374151;
}

section {
  background-color: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e5e7eb;
}

/* Children List */
.children-list {
  margin-bottom: 1.5rem;
}

.child-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.child-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
}

.child-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.child-name {
  font-weight: 500;
  font-size: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-inactive {
  background-color: #fecaca;
  color: #991b1b;
}

.child-action {
  display: flex;
  justify-content: flex-end;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  width: auto;
  max-width: none;
}

.btn-link {
  background: none;
  color: #2563eb;
  text-decoration: underline;
  padding: 0;
  width: auto;
  max-width: none;
  min-height: auto;
}

.btn-link:hover {
  color: #1d4ed8;
}

/* Split Rules Table */
.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.rules-table thead {
  background-color: #f3f4f6;
  border-bottom: 2px solid #d1d5db;
}

.rules-table th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
}

.rules-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.rules-table tbody tr:hover {
  background-color: #f9fafb;
}

/* Empty State */
.empty-state {
  text-align: center;
  color: #6b7280;
  padding: 2rem 0;
  font-size: 0.95rem;
}

/* Split Rule Info */
.rule-explanation {
  background-color: #eff6ff;
  border-left: 4px solid #2563eb;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 0.375rem;
  font-size: 0.95rem;
  color: #1e40af;
}

/* Settings and Logout Sections */
.settings-link,
.logout-section {
  text-align: center;
}

.add-child-section,
.new-rule-section {
  margin-top: 1.5rem;
}

.logout-section .btn {
  background-color: #ef4444;
}

.logout-section .btn:hover {
  background-color: #dc2626;
}

/* Receipts */
.receipt-container,
.receipt-list-container,
.receipt-detail-container {
  background-color: white;
  border-radius: 0.375rem;
  padding: 1.5rem;
}

.receipt-list-actions {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.75rem;
}

.receipt-filters {
  margin-bottom: 1.5rem;
  background-color: #f9fafb;
  padding: 1rem;
  border-radius: 0.375rem;
}

.filter-form {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.filter-group {
  flex: 1;
}

.filter-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.receipt-cards {
  display: grid;
  gap: 1rem;
}

.receipt-card {
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.receipt-card:hover {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: white;
  border-bottom: 1px solid #e5e7eb;
}

.receipt-date {
  font-weight: 600;
  color: #374151;
}

.receipt-body {
  padding: 1rem;
}

.receipt-child {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
}

.receipt-merchant {
  margin: 0 0 0.5rem 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.receipt-amount {
  margin: 0.75rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #059669;
}

.receipt-submitted {
  margin: 0.5rem 0 0 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.receipt-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e5e7eb;
  text-align: right;
}

.receipt-footer .btn-link {
  width: auto;
  display: inline-block;
  color: #2563eb;
  text-decoration: none;
  padding: 0;
}

/* Receipt Status Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.receipt-status-badge {
  font-size: 0.8rem;
}

.badge-submitted {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-approved {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-rejected {
  background-color: #fee2e2;
  color: #991b1b;
}

.badge-withdrawn {
  background-color: #f3f4f6;
  color: #374151;
}

.badge-inactive {
  background-color: #f3f4f6;
  color: #6b7280;
}

/* Receipt Detail */
.receipt-detail-card {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.detail-section {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.detail-section:last-child {
  border-bottom: none;
}

.detail-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: #374151;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: #6b7280;
  flex: 0 0 30%;
}

.detail-value {
  flex: 1;
  text-align: right;
  color: #374151;
}

.receipt-image {
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
  margin-top: 0.5rem;
}

.status-info {
  background-color: #eff6ff;
  border-left: 4px solid #2563eb;
  padding: 0.75rem;
  border-radius: 0.375rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #1e40af;
}

.status-info p {
  margin: 0;
}

.detail-actions {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.action-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-navigation {
  margin-top: 1.5rem;
}

.detail-navigation .btn-link {
  width: auto;
  display: inline-block;
  color: #2563eb;
  text-decoration: none;
  padding: 0;
}

/* Extraction Status */
.extraction-status {
  display: none;
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.extraction-status.active {
  display: block;
}

.extraction-message {
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.status-loading {
  color: #2563eb;
}

.status-success {
  color: #059669;
  font-weight: 500;
}

.status-error {
  color: #dc2626;
  font-weight: 500;
}

/* Alert Messages */
.alert {
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
}

.alert-warning {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.alert-warning a {
  color: #d97706;
  font-weight: 600;
}

.alert-error {
  background-color: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-error a {
  color: #dc2626;
  font-weight: 600;
}

.alert-success {
  background-color: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.alert-success a {
  color: #15803d;
  font-weight: 600;
}

/* Form Styling */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
}

.form-group textarea {
  font-family: inherit;
  resize: vertical;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 1rem;
  color: #374151;
}

.form-control:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Dashboard */
.dashboard-container {
  max-width: 500px;
  margin: 0 auto;
}

.dashboard-welcome {
  background-color: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e5e7eb;
}

.dashboard-welcome h2 {
  margin-bottom: 0.75rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.welcome-text {
  color: #6b7280;
  font-size: 0.95rem;
}

.dashboard-month-section {
  background-color: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e5e7eb;
}

.dashboard-month-section h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.saldo-box {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #2563eb;
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.saldo-sentence {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e40af;
  margin: 0;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0.75rem;
  text-align: center;
}

.stat-label {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
  margin: 0;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0.25rem 0 0 0;
}

.dashboard-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.btn-large {
  min-height: 50px;
  font-size: 1.05rem;
}

.pending-section {
  background-color: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e5e7eb;
}

.pending-section h3 {
  margin-bottom: 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: #374151;
}

.receipt-card-link {
  text-decoration: none;
  color: inherit;
}

.dashboard-logout {
  text-align: center;
}

/* Months List */
.months-container {
  max-width: 500px;
  margin: 0 auto;
}

.months-container h2 {
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.months-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.month-card-link {
  text-decoration: none;
  color: inherit;
}

.month-card {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 1rem;
  transition: box-shadow 0.2s;
}

.month-card:hover {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.month-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.month-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.badge-settled {
  background-color: #d1fae5;
  color: #065f46;
}

.month-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.stat {
  display: flex;
  justify-content: space-between;
}

.stat-label {
  color: #6b7280;
  font-weight: 500;
}

.stat-value {
  font-weight: 600;
  color: #1f2937;
}

.saldo-text {
  color: #2563eb;
}

.months-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Month Detail */
.month-detail-container {
  max-width: 500px;
  margin: 0 auto;
}

.month-detail-container h2 {
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.notice {
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.notice-info {
  background-color: #eff6ff;
  border-left: 4px solid #2563eb;
  color: #1e40af;
}

.month-table-wrapper {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  overflow: auto;
  margin-bottom: 1.5rem;
}

.month-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.month-table thead {
  background-color: #f3f4f6;
  border-bottom: 2px solid #d1d5db;
}

.month-table th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.month-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.month-table tbody tr:hover {
  background-color: #f9fafb;
}

.amount {
  text-align: right;
  font-weight: 500;
}

.month-table tfoot {
  background-color: #f9fafb;
  border-top: 2px solid #d1d5db;
}

.summary-row {
  font-weight: 600;
  color: #1f2937;
}

.summary-row td {
  padding: 1rem 0.75rem;
}

.month-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settle-form {
  display: flex;
  gap: 0.5rem;
}

.settle-form .btn {
  flex: 1;
}

/* Photo Upload Styling */
.photo-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.photo-btn {
  flex: 1;
  min-width: 200px;
  text-align: center;
  cursor: pointer;
}

.photo-preview {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background-color: #f9fafb;
}

.photo-preview img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
}

.photo-preview-text {
  display: block;
  font-size: 0.875rem;
  color: #6b7280;
}

.photo-taken {
  color: #15803d;
}

.product-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.product-preview {
  position: relative;
  flex: 0 0 auto;
}

.product-preview img {
  max-height: 100px;
  border-radius: 0.375rem;
  display: block;
}

.product-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.product-photo-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.product-photo-thumb {
  max-height: 140px;
  border-radius: 0.375rem;
}

.btn-delete-photo {
  background-color: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.btn-delete-photo:hover {
  background-color: #dc2626;
}

/* hidden-Attribut darf nicht von display-Regeln überschrieben werden */
[hidden] {
  display: none !important;
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
  .app-main {
    padding: 0.75rem;
    padding-bottom: 80px;
  }

  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.95rem;
  }

  .child-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .child-action {
    width: 100%;
  }

  .child-action .btn-sm {
    width: 100%;
  }

  .rules-table {
    font-size: 0.8rem;
  }

  .rules-table th,
  .rules-table td {
    padding: 0.5rem;
  }

  .detail-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-label {
    flex: 1 1 100%;
    margin-bottom: 0.25rem;
  }

  .detail-value {
    flex: 1 1 100%;
    text-align: left;
  }

  .filter-form {
    flex-direction: column;
  }

  .filter-group {
    flex: 1 1 100%;
  }

  .detail-actions {
    gap: 0.75rem;
  }

  .action-form {
    gap: 0.5rem;
  }

  .action-form .form-group {
    margin-bottom: 0.75rem;
  }

  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .month-table {
    font-size: 0.8rem;
  }

  .month-table th,
  .month-table td {
    padding: 0.5rem;
  }
}

.inline-form {
  display: inline;
}
