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

:root {
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --primary-dark: #1d4ed8;
  --secondary: #60a5fa;
  --bg: #f0f4ff;
  --white: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(37, 99, 235, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 18px 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.header-top h1 {
  font-size: 19px;
  font-weight: 700;
}

.header-emoji {
  font-size: 24px;
}

/* ── Nav tabs ── */
.nav-tabs {
  display: flex;
  gap: 2px;
}

.nav-tab {
  flex: 1;
  padding: 9px 4px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.75);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.nav-tab .tab-icon {
  font-size: 19px;
}

.nav-tab.active {
  background: var(--white);
  color: var(--primary);
}

/* ── Main ── */
main {
  padding: 16px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
}

/* ── Form ── */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-row .form-group {
  flex: 1;
}

input[type="text"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 64px;
}

/* ── Buttons ── */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:active {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
}

.btn-ghost {
  background: #f1f5f9;
  color: var(--text-light);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ── Action bar ── */
.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* ── Progress ── */
.progress-bar {
  background: var(--border);
  border-radius: 100px;
  height: 7px;
  overflow: hidden;
}

.progress-fill {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  height: 100%;
  border-radius: 100px;
  transition: width 0.4s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.progress-text {
  font-size: 12px;
  color: var(--text-light);
}

/* ── Check items ── */
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 9px;
  margin-bottom: 5px;
  background: var(--bg);
  transition: all 0.2s;
}

.check-item.checked {
  background: #f0fdf4;
  opacity: 0.7;
}

.check-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.check-item label {
  flex: 1;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.check-item.checked label {
  text-decoration: line-through;
  color: var(--text-light);
}

.item-delete {
  background: none;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 4px;
  transition: color 0.2s;
  line-height: 1;
}

.item-delete:hover {
  color: var(--danger);
}

/* ── Badge ── */
.badge {
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}

.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ── Schedule items ── */
.schedule-item {
  padding: 13px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  border-left: 4px solid var(--primary);
  background: var(--white);
  box-shadow: var(--shadow);
}

.schedule-item.s-today { border-left-color: var(--warning); background: #fffbeb; }
.schedule-item.s-overdue { border-left-color: var(--danger); background: #fff1f2; }
.schedule-item.s-done { opacity: 0.6; border-left-color: var(--success); }

.schedule-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.schedule-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.schedule-note {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
  line-height: 1.5;
}

.schedule-actions {
  display: flex;
  gap: 6px;
}

/* ── Today banner ── */
.today-banner {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.25);
}

.banner-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.banner-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}

.banner-sub {
  font-size: 12px;
  opacity: 0.9;
  line-height: 1.4;
}

/* ── Category card (travel) ── */
.cat-card {
  background: var(--white);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  color: #fff;
}

.cat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-name {
  font-weight: 700;
  font-size: 14px;
}

.cat-count {
  font-size: 12px;
  opacity: 0.85;
}

.cat-done-badge {
  background: rgba(255, 255, 255, 0.3);
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}

.cat-chevron {
  font-size: 13px;
  transition: transform 0.25s;
}

.cat-chevron.closed {
  transform: rotate(-90deg);
}

.cat-body {
  padding: 10px;
}

.cat-body.hidden {
  display: none;
}

/* ── Trip selector ── */
.trip-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.trip-row select {
  flex: 1;
}

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-light);
}

.empty-icon {
  font-size: 44px;
  margin-bottom: 10px;
}

.empty p {
  font-size: 14px;
  line-height: 1.6;
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 22px 20px 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-light);
  padding: 2px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e293b;
  color: #fff;
  padding: 10px 22px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  transition: transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}
