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

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

.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;
}

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

main {
  padding: 8px 12px 80px;
}

.tab { display: none; }
.tab.active { display: block; }

h2 { margin-top: 8px; }

.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;
}

.week-divider,
.day-divider {
  margin: 10px 0 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background: #efe3d3;
  color: #1f2430;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.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; }

.card-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.card-buttons button {
  border-radius: 999px;
  padding: 6px 14px;
  border: none;
  font-size: 13px;
  cursor: pointer;
}

.card-buttons .edit {
  background: #1f2937;
  color: #f9fafb;
}

.card-buttons .delete {
  background: #fef2f2;
  color: #b91c1c;
}

.warehouse-section { margin-top: 14px; }

.warehouse-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

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

.warehouse-hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}

.warehouse-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.warehouse-table th,
.warehouse-table td {
  padding: 6px 4px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

.warehouse-table th {
  text-align: left;
  font-size: 13px;
  color: #4b5563;
}

.warehouse-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
}

.warehouse-actions button {
  border-radius: 999px;
  border: none;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.warehouse-actions .edit {
  background: #1f2937;
  color: #f9fafb;
}

.warehouse-actions .delete {
  background: #fef2f2;
  color: #b91c1c;
}

.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(520px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
}

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

#ceremonyForm label,
#warehouseForm label,
#setForm label,
#secondHelperForm label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  margin-bottom: 8px;
}

#ceremonyForm input,
#ceremonyForm select,
#ceremonyForm textarea,
#warehouseForm input,
#setForm input,
#setForm select,
#secondHelperForm input {
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 8px 10px;
  font-size: 14px;
}

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

@media (max-width: 460px) {
  .form-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;
}

#cancelModalBtn,
#cancelWarehouseBtn,
#cancelSetBtn,
#cancelSecondHelperBtn {
  background: #e5e7eb;
}

#saveCeremonyBtn,
#saveWarehouseBtn,
#saveSetBtn,
#saveSecondHelperBtn {
  background: #111827;
  color: #f9fafb;
}

.grave-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 4px 0 6px;
}

.grave-option {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

.grave-fields {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.hint-box {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 10px;
}

.mini-muted {
  margin: 6px 0 0;
  font-size: 12px;
  color: #6b7280;
}

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


/* AI ΒΟΗΘΟΣ V1 — προσθήκη χωρίς αλλαγή υπάρχουσας Βίβλου */
.ai-assistant-strip {
  padding: 6px 12px 2px;
}

.ai-assistant-btn {
  width: 100%;
  border: none;
  border-radius: 18px;
  background: #1f2430;
  color: #f6f0e7;
  padding: 11px 16px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.ai-assistant-btn:active {
  transform: scale(0.99);
}

.ai-modal-content {
  background: #fbf7f0;
}

.ai-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.ai-modal-head h2 {
  margin: 0 0 4px;
}

.ai-modal-head p {
  margin: 0;
  color: #6b7280;
  font-size: 12px;
}

.ai-x-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.ai-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.ai-actions button,
.ai-modal-actions button {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: #e3d7c5;
  color: #1f2430;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}

.ai-actions button:first-child,
.ai-modal-actions button:first-child {
  background: #111827;
  color: #f9fafb;
}

.ai-output {
  border: 1px solid #eadfce;
  border-radius: 18px;
  background: #fffaf2;
  padding: 12px;
  max-height: 58vh;
  overflow-y: auto;
}

.ai-empty {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.45;
}

.ai-section {
  margin-bottom: 14px;
}

.ai-section:last-child {
  margin-bottom: 0;
}

.ai-section-title {
  font-weight: 950;
  font-size: 14px;
  margin-bottom: 7px;
}

.ai-card {
  background: #fbf7f0;
  border: 1px solid #eadfce;
  border-radius: 14px;
  padding: 10px;
  margin: 8px 0;
}

.ai-card.ai-danger {
  border-color: #fecaca;
  background: #fff1f2;
}

.ai-card.ai-warning {
  border-color: #fed7aa;
  background: #fff7ed;
}

.ai-card.ai-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.ai-card-title {
  font-weight: 900;
  margin-bottom: 4px;
}

.ai-meta {
  color: #4b5563;
  font-size: 12px;
  margin-bottom: 4px;
}

.ai-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
  font-size: 13px;
}

.ai-line:last-child {
  border-bottom: none;
}

.ai-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.ai-badge {
  display: inline-flex;
  border-radius: 999px;
  background: #e3d7c5;
  color: #1f2430;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.ai-note-text {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.45;
  color: #1f2430;
}

.ai-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
  flex-wrap: wrap;
}


/* ================================
   V27.2 — Funeral Office OS αρχική
   ================================ */
.top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-links {
  width: 100%;
}

.tabs .new-ceremony {
  display: none;
}

.home-command-center {
  padding: 8px 12px 4px;
}

.hero-ai-btn {
  width: 100%;
  min-height: 46px;
  justify-content: center;
  font-size: 15px;
  letter-spacing: .02em;
  box-shadow: 0 8px 20px rgba(31, 36, 48, .12);
}

.home-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.dash-card {
  background: #fbf7f0;
  border: 1px solid #eadfce;
  border-radius: 18px;
  padding: 10px 10px 9px;
  min-height: 78px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.dash-card span {
  display: block;
  color: #6b7280;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
}

.dash-card strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
  line-height: 1;
  color: #1f2430;
}

.dash-card small {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 11px;
}

.dash-card.danger-soft {
  background: #fff7ed;
  border-color: #fed7aa;
}

.ai-priority-box {
  margin-top: 10px;
  background: #fff1f2;
  border: 1px solid #fecaca;
  border-radius: 18px;
  padding: 11px 12px;
  color: #7f1d1d;
}

.ai-priority-box.hidden {
  display: none;
}

.ai-priority-title {
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .05em;
  margin-bottom: 6px;
}

.ai-priority-box ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.new-ceremony-hero {
  width: 100%;
  margin-top: 10px;
  border-radius: 20px;
  border: none;
  padding: 14px 18px;
  background: #111827;
  color: #f6f0e7;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(31, 36, 48, .16);
}

.ceremony-ai-warning {
  background: #fff1f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  margin: 7px 0;
}

.ceremony-ai-warning span {
  display: block;
  font-weight: 600;
  margin-top: 3px;
  color: #991b1b;
}

@media (max-width: 760px) {
  .home-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* V27.3 — Cloud AI bridge */
.ai-actions .ai-cloud-btn,
.ai-cloud-btn {
  background: #111827 !important;
  color: #f9fafb !important;
  border: 1px solid rgba(255,255,255,.08) !important;
}
