:root {
  --bg: #FFF8F3;
  --surface: #FFFFFF;
  --surface-soft: #FDF1EA;
  --primary: #D95D79;
  --primary-dark: #B9445F;
  --primary-soft: #FCE8ED;
  --text: #2D1E22;
  --text-muted: #786268;
  --border: #EFE0DA;
  --success: #2A9D68;
  --success-soft: #E4F6ED;
  --info: #3B7DDD;
  --info-soft: #E8F1FD;
  --warn: #D97706;
  --warn-soft: #FEF3C7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --shadow: 0 4px 14px rgba(45, 30, 34, 0.06);
  --radius: 16px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.4;
}

body {
  padding-bottom: 96px;
}

.hidden {
  display: none !important;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 10px;
  box-shadow: 0 2px 10px rgba(45, 30, 34, 0.04);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-emoji {
  font-size: 28px;
  line-height: 1;
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

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

.btn-icon {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  min-height: 40px;
}

.btn-icon:active {
  transform: scale(0.97);
}

/* Search */
.search-wrap {
  margin-top: 10px;
}

.search-wrap input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

/* Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.08);
}

.tab.active .badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Container & List */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 14px 24px;
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Order Card */
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  transition: opacity 0.15s ease;
}

.order-card.is-delivered {
  opacity: 0.78;
  background: #FCFAFA;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.due-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.due-pill.today {
  background: var(--warn-soft);
  color: #92400E;
}

.due-pill.overdue {
  background: var(--danger-soft);
  color: var(--danger);
}

.due-pill.done-pill {
  background: var(--success-soft);
  color: #166534;
}

.price-tag {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.cake-title {
  margin: 0 0 6px;
  font-size: 17.5px;
  font-weight: 700;
  color: var(--text);
}

.order-card.is-done .cake-title {
  text-decoration: none;
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: var(--text-muted);
}

.meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.customer-name {
  color: var(--text);
  font-weight: 600;
}

.phone-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.chip-link.wa {
  background: #E6F8EC;
  border-color: #BCE8CA;
  color: #15803D;
}

.notes-box {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 13.5px;
  color: var(--text);
  border-left: 3px solid var(--primary);
}

.ordered-on {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Card Actions */
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-toggle.active-done {
  background: var(--success-soft);
  border-color: #86EFAC;
  color: #166534;
}

.btn-toggle.active-delivered {
  background: var(--info-soft);
  border-color: #93C5FD;
  color: #1E40AF;
}

.btn-toggle.active-paid {
  background: var(--warn-soft);
  border-color: #FCD34D;
  color: #92400E;
}

.edit-group {
  display: flex;
  gap: 6px;
}

.btn-small {
  min-width: 38px;
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
}

.btn-small.delete {
  color: var(--danger);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

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

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--text);
}

.empty-state p {
  margin: 0;
  font-size: 14.5px;
}

/* Floating Action Button */
.fab {
  position: fixed;
  right: 18px;
  bottom: 20px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 15.5px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(217, 93, 121, 0.38);
  cursor: pointer;
}

.fab:active {
  transform: scale(0.96);
}

.fab-plus {
  font-size: 20px;
  line-height: 1;
}

/* Modal Bottom Sheet */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(25, 15, 18, 0.45);
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 18px 18px 26px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.2s ease-out;
}

@media (min-width: 600px) {
  .modal {
    align-items: center;
  }
  .modal-sheet {
    border-radius: 22px;
  }
}

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

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

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

.btn-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 16px;
  cursor: pointer;
}

/* Form */
.form-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 420px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.status-checks {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.check-pill input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn-primary,
.btn-secondary {
  flex: 1;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-align: center;
}

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

.btn-secondary {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.full-width {
  width: 100%;
  display: block;
}

.backup-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.backup-info {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
