:root {
  --primary: #00897B;
  --primary-dark: #00695C;
  --primary-light: #B2DFDB;
  --primary-bg: #E0F2F1;
  --secondary: #5C6BC0;
  --secondary-light: #C5CAE9;
  --accent: #FF7043;
  --danger: #EF5350;
  --danger-bg: #FFEBEE;
  --success: #66BB6A;
  --success-bg: #E8F5E9;
  --warning: #FFA726;
  --warning-bg: #FFF3E0;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-hover: #F9FAFB;
  --text: #263238;
  --text-secondary: #607D8B;
  --text-muted: #90A4AE;
  --border: #E0E0E0;
  --border-light: #F0F0F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --owner-color: #00897B;
  --sitter-color: #5C6BC0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', 'Quicksand', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app-container {
  min-height: 100vh;
}

/* Header */
.app-header {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-emoji {
  font-size: 2.25rem;
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.role-current-badge {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.role-current-badge.owner-badge {
  background: var(--primary-bg);
  color: var(--primary-dark);
}

.role-current-badge.sitter-badge {
  background: var(--secondary-light);
  color: var(--secondary);
}

.role-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-family: inherit;
}

.role-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

.role-indicator-bar {
  height: 3px;
  transition: background 0.3s;
}

.role-indicator-bar.owner-bar {
  background: linear-gradient(90deg, var(--owner-color), var(--primary-light));
}

.role-indicator-bar.sitter-bar {
  background: linear-gradient(90deg, var(--sitter-color), var(--secondary-light));
}

/* Tab Bar */
.tab-bar {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.75rem 1.1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

/* Main Content */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.tab-section {
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Header */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
}

.section-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.15rem;
}

/* Buttons */
.btn-primary {
  padding: 0.55rem 1.25rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 0.55rem 1.25rem;
  background: var(--surface);
  color: var(--text-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  background: var(--surface-hover);
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--border-light);
  transform: scale(1.1);
}

.btn-icon.btn-complete:hover {
  background: var(--success-bg);
}

.btn-icon.btn-reopen:hover {
  background: var(--warning-bg);
}

.btn-icon.btn-delete:hover {
  background: var(--danger-bg);
}

/* Form Card */
.form-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  border: 2px solid var(--primary-light);
}

.form-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.2s;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  min-height: 80px;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.mt-sm {
  margin-top: 8px;
}

.mt-md {
  margin-top: 1rem;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.4rem 1rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
  font-family: inherit;
}

.filter-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Tasks */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--warning);
  transition: all 0.2s;
}

.task-card:hover {
  box-shadow: var(--shadow-md);
}

.task-card.task-done {
  border-left-color: var(--success);
  background: var(--success-bg);
}

.task-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.task-status-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.task-card-body {
  flex: 1;
  min-width: 0;
}

.task-desc {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  word-break: break-word;
}

.task-done .task-desc {
  text-decoration: line-through;
  opacity: 0.7;
}

.task-due {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.task-completion-note {
  font-size: 0.82rem;
  color: var(--primary-dark);
  margin-top: 0.35rem;
  background: var(--primary-bg);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.task-card-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-emoji {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.75rem;
}

.empty-state p {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}

.info-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.info-card-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.info-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.info-card-value {
  font-size: 0.9rem;
  color: var(--text);
  white-space: pre-line;
  word-break: break-word;
  line-height: 1.5;
}

/* Pets Grid */
.pets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.pet-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.pet-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.pet-card-photo {
  height: 180px;
  overflow: hidden;
}

.pet-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pet-card-body {
  padding: 1.25rem;
}

.pet-card-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.pet-card-breed {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  font-weight: 600;
}

.pet-detail {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.75rem;
}

.pet-detail-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.pet-detail p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: pre-line;
  line-height: 1.4;
}

.pet-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.upload-zone:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.upload-zone.large {
  min-height: 200px;
}

.upload-placeholder {
  color: var(--text-muted);
}

.upload-placeholder span {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.upload-placeholder p {
  font-size: 0.85rem;
  font-weight: 600;
}

.upload-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.hidden-input {
  position: absolute;
  top: -9999px;
  left: -9999px;
  opacity: 0;
}

/* Photos Grid */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.photo-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.photo-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.photo-card-img {
  height: 200px;
  overflow: hidden;
}

.photo-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-card-caption {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.photo-card-actions {
  padding: 0.5rem 1rem 0.75rem;
  display: flex;
  gap: 0.35rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.modal-task-name {
  font-weight: 700;
  margin: 0.5rem 0;
  color: var(--primary-dark);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Responsive */
@media (max-width: 600px) {
  .header-inner {
    padding: 0.75rem 1rem;
  }

  .main-content {
    padding: 1rem;
  }

  .brand-title {
    font-size: 1.15rem;
  }

  .section-title {
    font-size: 1.1rem;
  }

  .pets-grid,
  .photos-grid {
    grid-template-columns: 1fr;
  }

  .tab-btn {
    padding: 0.6rem 0.75rem;
    font-size: 0.78rem;
  }
}