@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600;700;800&family=Spectral:wght@500;700&display=swap');

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f9f4fa;
  --ink: #1f2433;
  --muted: #5f6678;
  --accent: #7b1f6f;
  --accent-2: #a73c8f;
  --success: #1f8d58;
  --warning: #b76a13;
  --danger: #c03d3d;
  --border: #e2dce6;
  --shadow: 0 14px 30px rgba(50, 39, 69, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Nunito Sans', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(167, 60, 143, 0.14), transparent 45%),
    radial-gradient(circle at top left, rgba(123, 31, 111, 0.08), transparent 40%),
    var(--bg);
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
  padding-bottom: 60px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
  background: rgba(244, 246, 251, 0.92);
  border-bottom: 1px solid rgba(123, 31, 111, 0.08);
}

.topbar-inner {
  width: min(1200px, 92vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
}

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

.brand .symbol {
  width: clamp(110px, 22vw, 160px);
  height: 42px;
  object-fit: contain;
}

.brand .portrait {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.brand h1 {
  font-family: 'Spectral', serif;
  font-size: clamp(1rem, 2.7vw, 1.4rem);
  margin: 0;
  color: #3e2942;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

h2,
h3 {
  margin-top: 0;
  font-family: 'Spectral', serif;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.is-loading,
.slot-btn.is-loading {
  position: relative;
  pointer-events: none;
}

.btn.is-loading::after,
.slot-btn.is-loading::after {
  content: '';
  display: inline-block;
  width: 0.86em;
  height: 0.86em;
  margin-left: 8px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  vertical-align: -1px;
  animation: spin 0.8s linear infinite;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 18px rgba(123, 31, 111, 0.22);
}

.btn-neutral {
  background: #ece8f1;
  color: #41374e;
}

.btn-danger {
  background: #fce9e9;
  color: var(--danger);
}

.btn-success {
  background: #e8f8ef;
  color: var(--success);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d8cfe0;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.96rem;
  background: #fff;
}

label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #4a3f58;
}

.form-row {
  display: grid;
  gap: 6px;
}

.hidden {
  display: none !important;
}

.kpi {
  border-radius: 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid #ebd7eb;
}

.kpi p {
  margin: 0;
  color: var(--muted);
}

.kpi strong {
  display: block;
  font-size: 1.8rem;
  color: #3b2b46;
}

.list {
  display: grid;
  gap: 10px;
}

.user-row {
  border: 1px solid #e6deea;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.message {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.93rem;
}

.message.info {
  background: #eef0ff;
  border-color: #d4d8ff;
  color: #323c7b;
}

.message.success {
  background: #e8f8ef;
  border-color: #b8e8cb;
  color: #1d784a;
}

.message.error {
  background: #fdeeee;
  border-color: #f6c7c7;
  color: #9f2f2f;
}

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

.day-card {
  border: 1px solid #e4d8e8;
  border-radius: 12px;
  padding: 8px;
  background: #fff;
}

.day-title {
  font-size: 0.92rem;
  margin: 0 0 8px;
  color: #4a3554;
  font-weight: 800;
}

.slot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.slot-btn,
.slot-tag {
  border: 1px solid #d6c7de;
  border-radius: 999px;
  background: #fff;
  color: #4d4560;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.slot-btn {
  cursor: pointer;
}

.slot-btn.disabled {
  background: #f6eef8;
  color: #9a8daa;
  border-color: #e8dbec;
}

.slot-btn.occupied {
  background: #fbeceb;
  color: #9a3838;
  border-color: #f4cdcd;
  cursor: not-allowed;
}

.slot-btn.selected {
  background: linear-gradient(130deg, #7b1f6f, #a73c8f);
  color: #fff;
  border-color: #7b1f6f;
}

.slot-checkbox {
  display: none;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #5f5b67;
  font-size: 0.86rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.enabled {
  background: #5a9d7c;
}

.dot.disabled {
  background: #b7a6bf;
}

.dot.occupied {
  background: #c66868;
}

.log-box {
  max-height: 240px;
  overflow: auto;
  background: #f5f0f8;
  border: 1px solid #e4d7e9;
  border-radius: 10px;
  padding: 10px;
  font-size: 0.86rem;
  white-space: pre-wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pendiente {
  color: #7d5d11;
  background: #fff3d9;
}

.status-propuesto {
  color: #0f5d85;
  background: #def3ff;
}

.status-confirmado {
  color: #1f7d4f;
  background: #ddf7e8;
}

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

@media (max-width: 780px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    width: 100%;
  }
}

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