:root {
  --ink: #111827;
  --muted: #667085;
  --line: #e6eaf0;
  --paper: #f7f9fc;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --accent: #0f9f88;
  --accent-2: #ff6b4a;
  --accent-soft: #e7f8f4;
  --shadow: 0 22px 55px rgba(17, 24, 39, 0.11);
  --soft-shadow: 0 12px 28px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(15, 159, 136, 0.18), transparent 28rem),
    radial-gradient(circle at 90% 0%, rgba(255, 107, 74, 0.16), transparent 30rem),
    linear-gradient(135deg, #f7fbff 0%, #eef4f8 48%, #f8fbfd 100%);
  font-family: "Manrope", "Segoe UI", sans-serif;
}

body.auth-locked {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(15, 159, 136, 0.22), transparent 28rem),
    radial-gradient(circle at 85% 15%, rgba(255, 107, 74, 0.18), transparent 26rem),
    linear-gradient(135deg, #f7fbff 0%, #edf4f8 100%);
}

body.auth-locked .login-gate {
  display: grid;
}

body.auth-locked .app-shell {
  filter: blur(12px);
  pointer-events: none;
  user-select: none;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(540px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 32px 90px rgba(17, 24, 39, 0.18);
  backdrop-filter: blur(18px);
}

.login-card .brand-mark {
  width: 56px;
  height: 56px;
  font-size: 1.55rem;
}

.login-card h1 {
  margin: 0;
  max-width: 460px;
  font-size: clamp(2rem, 6vw, 4rem);
}

.login-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.login-card .primary-button {
  width: fit-content;
  min-width: 220px;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 24px;
  background: rgba(255, 255, 255, 0.74);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(20px);
  overflow-y: auto;
}

.brand,
.date-card,
.side-section {
  flex-shrink: 0;
}

.brand,
.date-card,
.room-item,
.status-strip,
.calendar-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 8px;
  box-shadow: var(--soft-shadow);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #0b7c71);
  border-radius: 8px;
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(15, 159, 136, 0.28);
}

.brand strong,
.brand span,
.date-card span,
.date-card strong {
  display: block;
}

.brand span,
.date-card span,
.metric-label,
.eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.date-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, #111827, #243142);
  color: #fff;
}

.date-card strong {
  margin-top: 6px;
  font-size: 1.85rem;
  line-height: 1;
}

.date-card span {
  color: rgba(255, 255, 255, 0.66);
}

.side-section {
  display: grid;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ghost-button,
.nav-button,
.switch-button,
.primary-button,
.icon-button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.ghost-button:hover,
.nav-button:hover,
.switch-button:hover,
.primary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 107, 77, 0.35);
  box-shadow: var(--soft-shadow);
}

.ghost-button {
  padding: 7px 10px;
  font-size: 0.78rem;
}

.room-list {
  display: grid;
  gap: 9px;
}

.room-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.room-item:hover {
  transform: translateX(2px);
  border-color: rgba(15, 159, 136, 0.35);
  background: #fff;
}

.room-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.room-meta strong,
.room-meta span {
  display: block;
}

.room-meta span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.room-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.05);
}

.integration-note {
  margin-top: auto;
  padding: 15px;
  border-left: 0;
  background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0.86));
  box-shadow: none;
}

.integration-note p {
  margin: 8px 0 0;
  color: #3d4b42;
  font-size: 0.92rem;
  line-height: 1.5;
}

.graph-status.success {
  color: #08786c;
}

.graph-status.error {
  color: #b42318;
}

.auth-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.auth-actions .ghost-button {
  width: 100%;
}

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.72);
}

.content {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 30px;
}

.topbar {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
}

h1,
h2 {
  margin: 0;
}

h1 {
  margin-top: 4px;
  max-width: 780px;
  font-size: clamp(2rem, 5vw, 4.9rem);
  font-weight: 800;
  line-height: 0.96;
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(1.45rem, 2vw, 2.2rem);
  letter-spacing: -0.03em;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.nav-button {
  min-width: 46px;
  min-height: 42px;
  padding: 0 15px;
  font-weight: 700;
  background: #fff;
}

.primary-button {
  min-height: 42px;
  padding: 0 18px;
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #08786c);
  box-shadow: 0 14px 28px rgba(15, 159, 136, 0.24);
  font-weight: 800;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-size: 1.5rem;
  line-height: 1;
}

.view-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--soft-shadow);
}

.switch-button {
  padding: 8px 14px;
  border-color: transparent;
  background: transparent;
}

.switch-button.active {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.22);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.status-strip > div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--soft-shadow);
}

.status-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 1.12rem;
}

.calendar-panel {
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.panel-head {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.panel-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
}

.scope-switch {
  white-space: nowrap;
}

.search-box {
  display: grid;
  gap: 6px;
  min-width: min(330px, 100%);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search-box input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.12);
}

.calendar-view {
  padding: 18px;
}

.day-view {
  display: grid;
  gap: 10px;
}

.meeting-row {
  display: grid;
  grid-template-columns: 132px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.05);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.meeting-row:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 159, 136, 0.34);
  box-shadow: 0 18px 36px rgba(17, 24, 39, 0.09);
}

.time-range {
  color: var(--accent);
  font-weight: 800;
  font-size: 0.92rem;
}

.meeting-main strong,
.meeting-main span {
  display: block;
}

.meeting-main span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.room-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
  background: var(--paper);
  font-weight: 700;
  font-size: 0.86rem;
}

.meeting-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.meeting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.action-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.action-button:hover {
  border-color: rgba(15, 159, 136, 0.35);
  box-shadow: var(--soft-shadow);
}

.action-button.danger {
  color: #b42318;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(170px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.week-day {
  min-height: 390px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
}

.week-day.today {
  border-color: rgba(15, 159, 136, 0.45);
  background: linear-gradient(180deg, #f1fffb, #ffffff);
}

.week-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.week-day-head strong {
  font-size: 1.06rem;
}

.week-day-head span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.week-event {
  display: grid;
  gap: 5px;
  margin-bottom: 9px;
  padding: 10px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #f7f9fc;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.03);
}

.week-event time {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.week-event strong {
  font-size: 0.92rem;
}

.week-event span {
  color: var(--muted);
  font-size: 0.78rem;
}

.empty-state {
  margin: 18px;
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  background: #fff;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state span {
  margin-top: 6px;
  color: var(--muted);
}

.booking-dialog {
  width: min(720px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-solid);
  box-shadow: 0 32px 90px rgba(17, 24, 39, 0.28);
}

.booking-dialog::backdrop {
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(6px);
}

.booking-form {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

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

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-grid input,
.form-grid select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 159, 136, 0.12);
}

.wide-field {
  grid-column: 1 / -1;
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-message.error {
  color: #b42318;
}

.form-message.success {
  color: #08786c;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-tools {
    align-items: stretch;
    justify-content: flex-start;
  }

  .toolbar {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .sidebar,
  .content {
    padding: 18px;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .scope-switch {
    width: 100%;
  }

  .scope-switch .switch-button {
    flex: 1;
  }

  .meeting-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .room-pill {
    width: fit-content;
  }

  .meeting-side {
    justify-items: start;
  }

  .meeting-actions {
    justify-content: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions button {
    width: 100%;
  }

  .month-cell {
    min-height: 72px;
  }
}

/* ═══════════════════════════════════════════
   Widok miesięczny
═══════════════════════════════════════════ */
.month-grid {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.month-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.month-weekday-label {
  padding: 10px 8px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.month-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(110px, 1fr);
}

.month-cell {
  padding: 6px 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 110px;
  overflow: hidden;
  cursor: default;
}

.month-cell:nth-child(7n) {
  border-right: none;
}

.month-cell--other {
  background: rgba(247, 249, 252, 0.7);
}

.month-cell--other .month-cell-day {
  opacity: 0.4;
}

.month-cell--today .month-cell-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.month-cell-day {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 5px;
  line-height: 26px;
}

.month-event {
  display: block;
  padding: 2px 5px;
  margin-bottom: 2px;
  border-radius: 4px;
  border-left: 3px solid var(--accent);
  background: rgba(15, 159, 136, 0.06);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

.month-event--more {
  border-left-color: transparent;
  background: none;
  color: var(--muted);
  font-size: 0.7rem;
}

/* ═══════════════════════════════════════════
   Formularz rezerwacji cyklicznych
═══════════════════════════════════════════ */
.recurrence-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.recurrence-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  user-select: none;
}

.recurrence-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.recurrence-fields {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.recurrence-pattern-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.recurrence-pattern-label select {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}

.recurrence-pattern-label select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 159, 136, 0.12);
}

.recurrence-range {
  display: grid;
  gap: 8px;
}

.recurrence-range-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  cursor: pointer;
}

.recurrence-range-option input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.recurrence-range-option input[type="number"] {
  width: 64px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.88rem;
  text-align: center;
  outline: none;
}

.recurrence-range-option input[type="date"] {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.88rem;
  outline: none;
}

.recurrence-range-option input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 159, 136, 0.12);
}

.recurrence-range-option input:disabled {
  opacity: 0.4;
  background: var(--paper);
}
