:root {
  color-scheme: light;
  --bg: #f6efe6;
  --bg-strong: #f1e5d7;
  --ink: #1f2a24;
  --muted: #6e6e6e;
  --accent: #0f8b8d;
  --accent-strong: #0b6b6e;
  --card: #ffffff;
  --line: #e4d8c9;
  --success: #1d7f5f;
  --error: #b34040;
  --shadow: 0 16px 50px rgba(31, 42, 36, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(1000px 420px at 10% -10%, #fceede, transparent 70%),
    radial-gradient(900px 360px at 90% 0%, #e4f2f3, transparent 65%),
    linear-gradient(180deg, var(--bg), #fdf8f2 30%, #f9f3ea 100%);
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

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

.brand-dot {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f8b8d, #59c3c3);
  box-shadow: 0 10px 24px rgba(15, 139, 141, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef6f1;
  color: #2c664f;
  font-size: 0.85rem;
}

.tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(135deg, #ffffff, #f2fbfa);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 40px;
  background: rgba(15, 139, 141, 0.12);
}

.hero-text {
  flex: 1 1 300px;
  z-index: 1;
}

.hero-title {
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin: 0 0 8px;
}

.hero-sub {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
  animation: rise 0.5s ease both;
}

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

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

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 6px 10px;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-label {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: center;
}

.day-btn {
  border: 1px solid transparent;
  background: #f9f4ed;
  padding: 10px 6px;
  border-radius: 12px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: 0.2s ease;
}

.day-btn:hover {
  border-color: var(--accent);
  background: #e8f5f4;
}

.day-btn.is-outside {
  opacity: 0.45;
}

.day-btn.is-selected {
  border-color: var(--accent-strong);
  background: #d7f0ef;
  font-weight: 600;
}

.day-btn:disabled {
  background: #f4ede5;
  color: #9b948c;
  cursor: not-allowed;
  border-color: transparent;
}

.slot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.slot-btn {
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.slot-btn strong {
  font-size: 1rem;
}

.slot-btn span {
  font-size: 0.8rem;
  color: var(--muted);
}

.slot-btn.is-selected {
  border-color: var(--accent-strong);
  background: #e6f6f5;
}

.slot-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.proc-list {
  display: grid;
  gap: 12px;
}

.proc-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  cursor: pointer;
  transition: 0.2s ease;
}

.proc-item:hover {
  border-color: var(--accent);
  background: #f3fbfa;
}

.proc-item.is-selected {
  border-color: var(--accent-strong);
  background: #e6f6f5;
}

.proc-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.proc-title {
  font-weight: 600;
}

.proc-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.proc-price {
  font-weight: 600;
  color: var(--accent-strong);
}

.summary {
  display: grid;
  gap: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
}

.summary-row strong {
  font-weight: 600;
}

.input-field {
  display: grid;
  gap: 6px;
}

.input-field label {
  font-size: 0.85rem;
  color: var(--muted);
}

.input-field input,
.input-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-family: inherit;
}

.input-field textarea {
  resize: vertical;
  min-height: 80px;
}

.primary-btn {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.primary-btn:disabled {
  background: #9fc9c8;
  cursor: not-allowed;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 500;
}

.ghost-btn:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.notice {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
}

.notice.info {
  background: #f7f0e7;
  color: #6a5f52;
}

.notice.error {
  background: #f8e3e3;
  color: var(--error);
}

.notice.success {
  background: #e4f3eb;
  color: var(--success);
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #e3d6c6;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.footer-note {
  margin-top: 28px;
  font-size: 0.85rem;
  color: var(--muted);
}

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

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

#blazor-error-ui {
  color-scheme: light only;
  background: #fff3cd;
  border-radius: 12px;
  padding: 0.8rem 1.2rem;
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  display: none;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  margin-left: 12px;
  font-weight: 600;
}

.loading-progress {
  position: absolute;
  width: 6rem;
  height: 6rem;
  inset: 20vh 0 auto 0;
  margin: 0 auto;
}

.loading-progress circle {
  fill: none;
  stroke: #e4d8c9;
  stroke-width: 0.6rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.loading-progress circle:last-child {
  stroke: var(--accent);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
  position: absolute;
  text-align: center;
  font-weight: 600;
  inset: calc(20vh + 2.6rem) 0 auto 0;
  color: var(--muted);
}

.loading-progress-text:after {
  content: var(--blazor-load-percentage-text, \"Carregando\");
}

/* Gestão de Agenda */
.appointments-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.appointment-card {
  background: var(--bg);
  border-radius: 12px;
  padding: 16px;
  border-left: 4px solid var(--accent);
}

.appointment-card.status-cancelled {
  border-left-color: var(--error);
  opacity: 0.7;
}

.appointment-card.status-completed {
  border-left-color: var(--success);
}

.appointment-card.status-confirmed {
  border-left-color: var(--accent);
}

.appointment-card.status-pending {
  border-left-color: var(--muted);
}

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

.appointment-time {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
}

.appointment-status {
  font-size: 0.875rem;
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--bg-strong);
  color: var(--muted);
  font-weight: 500;
}

.appointment-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.appointment-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.appointment-client,
.appointment-phone,
.appointment-procedures,
.appointment-notes {
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.5;
}

.appointment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn.reagendar {
  background: var(--accent);
  color: white;
}

.action-btn.reagendar:hover {
  background: var(--accent-strong);
}

.action-btn.finalizar {
  background: var(--success);
  color: white;
}

.action-btn.finalizar:hover {
  opacity: 0.85;
}

.action-btn.cancelar {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
}

.action-btn.cancelar:hover {
  background: var(--error);
  color: white;
}

.calendar-day.has-appointments {
  position: relative;
}

.calendar-day.has-appointments::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.appointment-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(31, 42, 36, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--card);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--ink);
}

.form-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.1);
}

.primary-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.primary-btn:hover:not(:disabled) {
  background: var(--accent-strong);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

