:root {
  /* Shadows */
  --shadow-soft: 0 1px 2px rgba(35, 31, 22, 0.06);
  --shadow-card: 0 10px 30px rgba(35, 31, 22, 0.06);
  --shadow-header: 0 10px 30px rgba(28, 35, 28, 0.12);

  /* Amber / Warning variables we keep for now */
  --crm-amber-bg: #f7f0dc;
  --crm-amber-border: #e4c97e;
  --crm-amber-text: #7b5320;

  /* New color scheme */
  --color-sand-bg: #F4EFE6;
  --color-forest-footer: #163C2B;
  --color-anthracite-text: #1F2937;
  --color-mint-cta: #22C55E;
  --color-neutral-button: #D6D0C4;
  --color-active-taupe: #9F9484;
  --color-card-white: #FFFFFF;
  --color-card-border: #D6D0C4;
  --color-danger: #B91C1C;
  --color-note-bg: #E7E1D8;
  --color-cell-alt: #FAF8F5;   /* alternating calendar cell background */
  --color-warning: #EAB308;    /* Yellow — progress bar warning state */
}

@font-face {
  font-family: 'Manrope';
  src: url("../webfonts/Manrope-VariableFont_wght.b64c0369e943.ttf") format('truetype');
  font-display: swap;
  font-style: normal;
  font-weight: 200 800;
}

html {
  font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  line-height: 1;
  white-space: nowrap;
}

.brand-mark {
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 1.5rem;
}

button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

body,
input,
select,
textarea,
button {
  font-family: inherit;
}

.btn-cta {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 0.75rem;
  background-color: var(--color-mint-cta);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-anthracite-text);
  transition: all 0.15s ease;
  box-shadow: 0 6px 18px rgba(34, 197, 94, 0.2);
}
.btn-cta--icon {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  line-height: 1;
}
.btn-cta--icon i {
  font-size: 1.2rem;
}
.btn-cta:hover {
  background-color: #16A34A;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(34, 197, 94, 0.25);
}
.btn-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3);
}

.btn-back {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 0.75rem;
  background-color: var(--color-neutral-button);
  border: 1px solid var(--color-card-border);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-anthracite-text);
  transition: all 0.15s ease;
}
.btn-back:hover {
  background-color: var(--color-active-taupe);
  color: #ffffff;
  transform: translateY(-1px);
}
.btn-back:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-back:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(159, 148, 132, 0.3);
}

.btn-danger {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 0.75rem;
  background-color: transparent;
  border: 1px solid var(--color-danger);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-danger);
  transition: all 0.15s ease;
}
.btn-danger:hover {
  background-color: var(--color-danger);
  color: #ffffff;
  transform: translateY(-1px);
}
.btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.25);
}

.btn-row-action {
  min-height: 2.15rem;
  min-width: 2.15rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.98rem;
  font-weight: 500;
  border-radius: 0.75rem;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-edit {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 0.75rem;
  background-color: var(--color-neutral-button);
  border: 1px solid var(--color-mint-cta);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-anthracite-text);
  transition: all 0.15s ease;
}
.btn-edit:hover {
  background-color: var(--color-active-taupe);
  border-color: var(--color-mint-cta);
  color: #ffffff;
  transform: translateY(-1px);
}
.btn-edit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn-edit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.card {
  background-color: var(--color-card-white);
  border-radius: 1rem;
  border: 1px solid var(--color-card-border);
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-card);
}

.badge-neutral {
  font-size: 0.75rem;
  line-height: 1rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid var(--color-card-border);
  background-color: var(--color-note-bg);
  color: #52574f;
}

.badge-amber {
  font-size: 0.75rem;
  line-height: 1rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid var(--crm-amber-border);
  background-color: var(--crm-amber-bg);
  color: var(--crm-amber-text);
}

.badge-success {
  font-size: 0.75rem;
  line-height: 1rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid #cfe3cb;
  background-color: #f1f7ef;
  color: #45694a;
}

.entity-status-dot {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  flex: 0 0 0.8rem;
  border-radius: 9999px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.entity-status-dot--success {
  background-color: var(--color-mint-cta);
}

.entity-status-dot--warning {
  background-color: var(--color-warning);
}

.input-base {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: block;
  height: 3rem;
  box-sizing: border-box;
  border-radius: 0.75rem;
  border: 1px solid var(--color-card-border);
  padding: 0.75rem;
  font-size: 1rem;
  color: var(--color-anthracite-text);
  background-color: var(--color-card-white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="date"].input-base,
input[type="time"].input-base {
  -webkit-appearance: none;
  appearance: none;
}

.input-base::placeholder {
  color: var(--color-active-taupe);
}
.input-base:hover {
  border-color: var(--color-active-taupe);
}
.input-base:focus {
  outline: none;
  border-color: var(--color-mint-cta);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.input-base:disabled {
  background-color: var(--color-note-bg);
  cursor: not-allowed;
  opacity: 0.8;
}
.input-error {
  border-color: var(--crm-amber-border);
}
.input-error:focus {
  border-color: var(--crm-amber-border);
  box-shadow: 0 0 0 3px rgba(228, 201, 126, 0.24);
}
.input-valid {
  border-color: var(--color-mint-cta);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.input-valid:focus {
  border-color: var(--color-mint-cta);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.input-invalid {
  border-color: var(--color-danger);
}
.input-invalid:focus {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.2);
}

.form-field {
  margin-bottom: 1rem;
}
.form-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-anthracite-text);
}
.form-hint {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--color-active-taupe);
}
.form-error {
  margin-top: 0.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--crm-amber-border);
  background-color: var(--crm-amber-bg);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--crm-amber-text);
}

/* ── Bulma input overrides ─────────────────────────────────────────── */
.input, .textarea, .select select {
  background-color: var(--color-card-white);
  border-color: var(--color-card-border);
  color: var(--color-anthracite-text);
  box-shadow: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:hover, .textarea:hover, .select select:hover {
  border-color: var(--color-active-taupe);
}
.input:focus, .textarea:focus, .select select:focus,
.input.is-focused, .textarea.is-focused {
  border-color: var(--color-mint-cta);
  box-shadow: 0 0 0 0.125em rgba(34, 197, 94, 0.2);
}
.input[disabled], .textarea[disabled] {
  background-color: var(--color-note-bg);
  cursor: not-allowed;
}
.label {
  color: var(--color-anthracite-text);
  font-weight: 600;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 9999px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 16px;
  background: var(--color-card-white);
  border: 1px solid var(--color-card-border);
  box-shadow: var(--shadow-card);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.toast-success {
  border-color: var(--color-mint-cta);
  box-shadow: inset 3px 0 0 rgba(177, 229, 91, 0.52), var(--shadow-card);
}
.toast-info {
  border-color: var(--color-card-border);
  box-shadow: inset 3px 0 0 rgba(177, 229, 91, 0.35), var(--shadow-card);
}
.toast-warning {
  border-color: rgba(228, 201, 126, 0.55);
  box-shadow: inset 3px 0 0 rgba(228, 201, 126, 0.7), var(--shadow-card);
}
.toast-error {
  border-color: rgba(228, 201, 126, 0.55);
  box-shadow: inset 3px 0 0 rgba(228, 201, 126, 0.7), var(--shadow-card);
  color: var(--color-anthracite-text);
}
.toast-close {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-active-taupe);
  flex: 0 0 auto;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.toast-close:hover {
  background-color: var(--color-note-bg);
  color: var(--color-anthracite-text);
}
.toast-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.2);
}
.toast-leave {
  opacity: 0;
  transform: translateY(-4px);
}

.page-fade {
  opacity: 0;
  transition: opacity 200ms ease;
}

.page-fade.is-visible {
  opacity: 1;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-anthracite-text);
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--color-active-taupe);
}

a {
  transition: color 0.15s ease;
}

/* Layout */
html,
body {
  background-color: var(--color-sand-bg);
}

body {
  color: var(--color-anthracite-text);
  min-height: 100vh;
}

.layout-root {
  background-color: var(--color-sand-bg);
}

/* Header */
.site-header {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  height: 3.25rem;
  border-color: rgba(201, 191, 172, 0.24);
  background-color: var(--color-forest-footer);
  box-shadow: var(--shadow-header);
  padding: 0 0.75rem;
}

/* Custom header flex layout */
.header-left {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 1;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Brand name */
.brand-name {
  font-size: 1rem;
  font-weight: 600;
  color: #f3f4f2;
}

/* Sidebar burger button */
.sidebar-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: 0.375rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.sidebar-burger span {
  display: block;
  width: 1.125rem;
  height: 2px;
  background-color: rgba(255, 255, 255, 0.85);
  border-radius: 1px;
}

.sidebar-burger:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

@media (min-width: 1024px) {
  .sidebar-burger {
    display: none;
  }
}

/* Dark glass UI elements */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  border-color: rgba(255, 255, 255, 0.35);
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  max-width: 8rem;
}

.user-chip__icon {
  flex-shrink: 0;
  font-size: 0.68rem;
  color: inherit;
}

.user-chip__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip--pro {
  border-color: rgba(228, 201, 126, 0.72);
  background-color: rgba(228, 201, 126, 0.22);
  color: #f7e4a4;
}

.user-chip--pro .user-chip__icon {
  color: #f4d98a;
}

.btn-ghost-dark {
  border-color: rgba(255, 255, 255, 0.16);
  background-color: rgba(255, 255, 255, 0.08);
}

/* Logout form and icon button */
.header-logout-form {
  display: inline-flex;
  margin: 0;
}

/* Compact icon-only logout button */
.header-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.625rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  color: #ffffff;
}

.header-logout-btn:hover {
  background-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.header-logout-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/* ── Bulma overrides ───────────────────────────────────────────── */

/* Reset Bulma's default blue link color */
a { color: inherit; }

/* Fixed navbar body offset */
body.has-navbar-fixed-top {
  padding-top: 3.25rem;
}

/* Toast container */
.toast-container {
  position: fixed;
  top: calc(3.25rem + 0.75rem);
  right: 1rem;
  left: 1rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 540px) {
  .toast-container {
    left: auto;
    width: 420px;
  }
}

.toast-body {
  min-width: 0;
  flex: 1;
  font-size: 0.875rem;
  color: var(--color-anthracite-text);
}

/* Main content */
.main-content {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

@media (min-width: 640px) {
  .main-content {
    padding: 2rem 1.5rem 2rem;
  }
}

@media (min-width: 1024px) {
  .main-content {
    padding: 2rem 2rem 2rem;
  }
}

.main-content--auth {
  padding-bottom: 2rem;
}

/* Sidebar burger: visible on mobile only */
.sidebar-burger {
  display: flex;
}

@media (min-width: 1024px) {
  .sidebar-burger {
    display: none;
  }
}

/* ── Confirm Modal ─────────────────────────────────────────── */
.modal-confirm-card {
  background: var(--color-card-white);
  border-radius: 12px;
  box-shadow: var(--shadow-header);
  width: min(480px, 92vw);
  margin: auto;
  position: relative;
  z-index: 41;
}

.modal-confirm-header {
  padding: 1.25rem 1.5rem 0;
}

.modal-confirm-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-anthracite-text);
}

.modal-confirm-body {
  padding: 0.75rem 1.5rem 1.25rem;
  color: var(--color-active-taupe);
  font-size: 0.95rem;
  line-height: 1.5;
}

.modal-confirm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-card-border);
}

/* ── Tabs ──────────────────────────────────────────────────────────── */
.tabs-container {
  display: flex;
  flex-direction: column;
}

.tabs-header {
  display: flex;
  gap: 1.5rem;
  border-bottom: 2px solid var(--color-card-border);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-active-taupe);
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
}

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

.tab-btn.is-active {
  color: var(--color-mint-cta);
}

.tab-btn.is-active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-mint-cta);
}

.tab-pane {
  display: none;
}

.tab-pane.is-active {
  display: block;
  animation: fadeIn 0.15s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Unified Page Components ───────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

.page-header h1 {
  margin-bottom: 0;
}

.page-header p {
  margin-top: 4px;
  margin-bottom: 0;
}

.page-header--inline-meta {
  align-items: flex-start;
}

.page-header-main {
  flex: 1 1 auto;
  min-width: 0;
}

.page-header-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.page-header-title {
  min-width: 0;
  flex: 1 1 auto;
}

.page-header-side {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-anthracite-text);
  line-height: 1.2;
}

.page-subtitle {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--color-active-taupe);
}

@media (max-width: 768px) {
  .page-header--inline-meta .page-header-topline {
    gap: 0.65rem;
  }

  .page-header--inline-meta .page-header-side {
    align-self: flex-start;
  }
}

.detail-container {
  padding: 1rem 1.1rem;
}

.detail-container--cancelled {
  border-left: 3px solid var(--crm-amber-text);
  background-color: var(--crm-amber-bg);
}

.detail-cancelled-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.8rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--crm-amber-border);
  border-radius: 0.6rem;
  background-color: var(--crm-amber-bg);
  color: var(--crm-amber-text);
  font-size: 0.95rem;
  font-weight: 600;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem 1.1rem;
  margin-bottom: 0.8rem;
}

@media (min-width: 769px) {
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1.25rem;
  }
}

.detail-grid-full {
  grid-column: 1 / -1;
}

.detail-label {
  font-size: 0.82rem;
  color: var(--color-active-taupe);
  margin-bottom: 0.2rem;
}

.detail-value {
  font-size: 1.02rem;
  color: var(--color-anthracite-text);
}

.detail-value a {
  color: var(--color-anthracite-text);
  text-decoration: underline;
}

.detail-note {
  padding: 0.75rem 0.8rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--color-card-border);
  border-radius: 0.75rem;
  background: var(--color-note-bg);
}

.detail-note-value {
  margin: 0;
  white-space: normal;
  word-break: break-word;
}

.detail-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.detail-actions form {
  margin: 0;
}

.detail-actions .btn-back,
.detail-actions .btn-edit,
.detail-actions .btn-danger,
.detail-actions .btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.detail-actions-right {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.detail-actions-right .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.detail-back {
  margin-right: auto;
}

.detail-count {
  margin-left: 0.35rem;
  font-size: 0.88rem;
}

.detail-members {
  margin-bottom: 0.85rem;
  border-top: 1px solid var(--color-card-border);
  padding-top: 0.75rem;
}

.detail-members-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.detail-member-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-card-border);
}

.detail-member-item:last-child {
  border-bottom: none;
}

.detail-member-icon {
  font-size: 0.8rem;
  color: var(--color-active-taupe);
  flex-shrink: 0;
}

.detail-members-list a {
  color: var(--color-anthracite-text);
  font-size: 1.02rem;
}

.detail-inactive {
  font-size: 0.78rem;
  margin-left: 0.1rem;
}

@media (max-width: 768px) {
  .detail-container {
    padding: 0.9rem;
  }
  .detail-grid {
    gap: 0.65rem;
  }
  .detail-note {
    padding: 0.65rem 0.7rem;
    margin-bottom: 0.75rem;
  }
  .detail-members {
    margin-bottom: 0.75rem;
  }
  .detail-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .detail-actions .btn-back,
  .detail-actions .btn-edit,
  .detail-actions .btn-danger,
  .detail-actions .btn-cta {
    width: 100%;
    justify-content: center;
  }
  .detail-actions form {
    width: 100%;
  }
  .detail-actions-right {
    flex-direction: column;
  }
  .detail-actions-right .btn-danger {
    width: 100%;
    justify-content: center;
  }
  .detail-back {
    margin-right: 0;
  }
}
