/* ============ Tokens ============ */
:root {
  --ink: #1B2430;
  --ink-soft: #4B5568;
  --paper: #F7F5F1;
  --card: #FFFFFF;
  --line: #E4E0D8;
  --teal: #2A9D8F;
  --amber: #E76F51;
  --today-ring: #1B2430;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(27, 36, 48, 0.06), 0 8px 24px rgba(27, 36, 48, 0.06);
  font-family: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
}

button { font-family: inherit; }

.muted { color: var(--ink-soft); }

/* ============ Login page ============ */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 15%, rgba(42, 157, 143, 0.16), transparent 45%),
    radial-gradient(circle at 88% 85%, rgba(231, 111, 81, 0.16), transparent 45%),
    var(--paper);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.login-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.login-mark .dot-pair {
  display: inline-flex;
  gap: 4px;
}

.login-mark .dot-pair span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.login-mark .dot-pair span:first-child { background: var(--teal); }
.login-mark .dot-pair span:last-child { background: var(--amber); }

.login-mark .brand {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.login-card h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.login-card .subtitle {
  margin: 0 0 26px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(27, 36, 48, 0.1);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.error-text {
  color: #C0392B;
  font-size: 0.85rem;
  min-height: 1.2em;
  margin: -4px 0 14px;
}

.login-footnote {
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
}

/* ============ Dashboard shell ============ */
.dash-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

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

.dash-header .brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-header .dot-pair span {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
}
.dash-header .dot-pair span:first-child { background: var(--teal); }
.dash-header .dot-pair span:last-child { background: var(--amber); margin-left: 3px; }

.dash-header .brand { font-weight: 600; font-size: 1.05rem; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-ghost:hover { background: var(--paper); }

.legend {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

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

.calendar-toolbar .month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

#month-label {
  font-size: 1.15rem;
  font-weight: 600;
  min-width: 170px;
  letter-spacing: -0.01em;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
}
.icon-btn:hover { background: var(--paper); }

/* ============ Calendar grid ============ */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: transparent;
}

.grid-dow {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding: 4px 0 8px;
  text-transform: uppercase;
}

.grid-cell {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  padding: 8px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.grid-cell:hover { border-color: var(--ink); }
.grid-cell.empty { background: transparent; border: none; cursor: default; }
.grid-cell.today { box-shadow: inset 0 0 0 2px var(--today-ring); }

.cell-date {
  font-weight: 600;
  font-size: 0.85rem;
}

.cell-chips {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chip {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--chip-color) 16%, white);
  color: color-mix(in srgb, var(--chip-color) 55%, black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 3px solid var(--chip-color);
}

.chip-more {
  background: var(--paper);
  color: var(--ink-soft);
  border-left: 3px solid var(--line);
}

/* ============ Modal ============ */
dialog#day-modal {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
}
dialog#day-modal::backdrop {
  background: rgba(27, 36, 48, 0.45);
}

.modal-inner { padding: 24px; }

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

.modal-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink-soft);
  line-height: 1;
  padding: 4px;
}

#existing-bookings {
  margin: 14px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.booking-row {
  border-left: 3px solid var(--chip-color);
  background: var(--paper);
  border-radius: 7px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.booking-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 0.8rem;
}
.booking-channel { font-weight: 600; }
.booking-time { color: var(--ink-soft); }
.booking-user { color: var(--ink-soft); }
.booking-note { font-style: italic; color: var(--ink-soft); }

.btn-icon-delete {
  border: none;
  background: transparent;
  color: #C0392B;
  font-size: 0.76rem;
  cursor: pointer;
  white-space: nowrap;
}

.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 4px 0 16px;
}

.form-row {
  display: flex;
  gap: 10px;
}
.form-row .field { flex: 1; }

.field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  resize: vertical;
}

/* ============ Toast ============ */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.toast-error { background: #C0392B; }

/* ============ Responsive ============ */
@media (max-width: 640px) {
  .grid-cell { min-height: 68px; padding: 5px; }
  .cell-date { font-size: 0.75rem; }
  .chip { font-size: 0.6rem; }
  #month-label { font-size: 1rem; min-width: auto; }
  .form-row { flex-direction: column; }
}
