* {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

body {
  margin: 0;
  background: #f6f0e7;
  color: #1f2430;
}

.hidden { display: none !important; }

.top-bar {
  background: #f6f0e7;
  padding: 12px 16px 4px;
}

.brand-pill {
  display: inline-block;
  background: #1f2430;
  color: #f6f0e7;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: 13px;
}

.top-links {
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

.top-links span + span::before { content: " · "; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 8px 12px 4px;
  align-items: center;
  flex-wrap: wrap;
}

.tab-button {
  flex: 0 0 auto;
  border-radius: 999px;
  border: none;
  padding: 8px 18px;
  background: #e3d7c5;
  color: #1f2430;
  font-weight: 500;
  cursor: pointer;
}

.tab-button.active {
  background: #1f2430;
  color: #f6f0e7;
}

main { padding: 8px 12px 80px; }
.tab { display: none; }
.tab.active { display: block; }
h2 { margin-top: 8px; }

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

button.primary{
  margin-left:auto;
  border-radius: 999px;
  border: none;
  padding: 8px 18px;
  background: #111827;
  color: #f6f0e7;
  font-weight: 800;
  cursor: pointer;
  opacity: 1;
}

button.secondary{
  border-radius: 999px;
  border: none;
  padding: 8px 14px;
  background: #1f2937;
  color: #f9fafb;
  font-size: 14px;
  cursor: pointer;
}

.history-search { margin: 8px 0 10px; }
.history-search input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 10px 12px;
  font-size: 14px;
  background: #fbf7f0;
}

/* Cards */
.ceremony-card {
  background: #fbf7f0;
  border-radius: 18px;
  padding: 14px 14px 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  border: 2px solid transparent;
}

.ceremony-card.green-frame { border-color: #16a34a; }

.ceremony-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 10px;
}

.ceremony-name {
  font-weight: 800;
  font-size: 18px;
  line-height: 1.15;
}

.ceremony-date {
  font-size: 13px;
  color: #4b5563;
  white-space: nowrap;
}

.ceremony-place {
  font-size: 14px;
  color: #4b5563;
  margin-bottom: 6px;
}

.ceremony-row {
  font-size: 13px;
  margin-bottom: 2px;
}

.ceremony-label { font-weight: 700; }

/* Actions row */
.card-actions{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:10px;
}

.btn-edit{
  border-radius:999px;
  padding:6px 14px;
  border:none;
  font-size:13px;
  cursor:pointer;
  background:#1f2937;
  color:#f9fafb;
  font-weight:800;
}

.btn-delete{
  border-radius:999px;
  padding:6px 14px;
  border:none;
  font-size:13px;
  cursor:pointer;
  background:#fef2f2;
  color:#b91c1c;
  margin-left:auto;
  font-weight:900;
}

.btn-whatsapp{
  width:36px;
  height:36px;
  border-radius:50%;
  background:#25d366;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
}

.btn-whatsapp svg{
  width:18px;
  height:18px;
  fill:#fff;
}

/* Warehouse table */
.table-wrap{ width:100%; overflow:auto; }
.table{ width:100%; border-collapse:collapse; font-size:14px; }
.table th, .table td{
  padding: 6px 4px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}
.table th { text-align:left; font-size:13px; color:#4b5563; }

.warehouse-actions{
  display:flex;
  gap:6px;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.warehouse-actions button{
  border-radius:999px;
  border:none;
  padding:4px 10px;
  font-size:12px;
  cursor:pointer;
  font-weight:800;
}
.warehouse-actions .edit{ background:#1f2937; color:#f9fafb; }
.warehouse-actions .delete{ background:#fef2f2; color:#b91c1c; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.modal.hidden { display: none; }

.modal-content {
  background: #f9fafb;
  border-radius: 18px;
  padding: 16px 16px 12px;
  width: min(420px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 { margin-top:0; margin-bottom:8px; }

.form label{
  display:flex;
  flex-direction:column;
  gap:4px;
  font-size:13px;
  margin-bottom:8px;
}

.form input, .form select, .form textarea{
  border-radius:10px;
  border:1px solid #d1d5db;
  padding:8px 10px;
  font-size:14px;
  background:#fff;
}

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

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

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:8px;
}
.modal-actions button{
  border-radius:999px;
  border:none;
  padding:7px 14px;
  font-size:14px;
  cursor:pointer;
  font-weight:900;
}
#cancelModalBtn, #cancelWarehouseBtn, #closeQrBtn, #cancelSetBtn{
  background:#e5e7eb;
  color:#111827;
}
.modal-actions .primary{ background:#111827; color:#f9fafb; }

/* Grave */
.grave-fields{ margin-top:6px; }
.grave-types{ display:flex; gap:10px; flex-wrap:wrap; }
.radio{ display:flex; align-items:center; gap:6px; font-size:13px; }

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  text-align: center;
  font-size: 12px;
  background: #111827;
  color: #e5e7eb;
}

/* =========================
   Ceremony V2: AUTO STATUS + MISSING ITEMS
   ========================= */
.auto-statusbar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:10px 12px;border-radius:14px;border:1px solid #e6dccf;
  background:rgba(255,255,255,0.7);margin:10px 0 10px;
}
.auto-pill{
  display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;
  font-size:12px;font-weight:900;border:1px solid #e6dccf;background:#fff;color:#1f2430;white-space:nowrap;
}
.auto-pill[data-state="ready"]{background:#dcfce7;color:#14532d;border-color:#86efac;}
.auto-pill[data-state="not_ready"]{background:#fee2e2;color:#7f1d1d;border-color:#fecaca;}
.auto-pill[data-state="warning"]{background:#ffedd5;color:#9a3412;border-color:#fdba74;}
.auto-meta{
  font-size:12px;color:#4b5563;font-weight:650;display:flex;align-items:center;gap:8px;
  flex-wrap:wrap;justify-content:flex-end;
}
.late-badge{
  display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;
  font-size:12px;font-weight:900;background:#fee2e2;color:#7f1d1d;border:1px solid #fecaca;
}
.missing-box{
  border-radius:16px;border:1px solid #fecaca;background:#fff1f2;padding:12px 12px 10px;margin:10px 0 0;
}
.missing-title{
  font-weight:900;font-size:13px;color:#7f1d1d;display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px;
}
.missing-list{display:flex;flex-direction:column;gap:8px;}
.missing-item{
  background:rgba(255,255,255,0.75);border:1px solid #e6dccf;border-radius:14px;padding:10px 10px 8px;
}
.missing-item .top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start;}
.missing-item .label{font-weight:900;font-size:13px;color:#1f2430;}
.missing-item .owner{font-size:12px;color:#4b5563;font-weight:650;margin-top:2px;}
.missing-item .pressure{font-size:12px;font-weight:900;white-space:nowrap;color:#9a3412;}
.missing-actions{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap;justify-content:flex-end;}
.missing-actions button{
  border-radius:999px;padding:6px 12px;border:none;font-size:12px;cursor:pointer;font-weight:900;
}
.btn-open{background:#111827;color:#f9fafb;}
.btn-ping{background:#22c55e;color:#052e16;}
.btn-ping.urgent{background:#ef4444;color:#fff;}