:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --gray-100: #f8fafc;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #374151;
  --danger: #dc2626;
  --sidebar-bg: #334155;
  --sidebar-hover: #475569;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--sidebar-bg);
  color: var(--gray-700);
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.card {
  width: min(1080px, 100%);
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  padding: 1.5rem 1.5rem 1.35rem;
}

.brand {
  margin: 0 0 0.85rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--sidebar-bg);
  text-align: center;
}

.demo {
  position: relative;
  display: grid;
  grid-template-columns: 148px 1fr;
  min-height: 560px;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--gray-100);
}

.demo-side {
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.1rem 0.7rem;
}

.nav {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.35rem;
  cursor: default;
}

.nav.is-on {
  background: var(--sidebar-hover);
  color: #fff;
}

.demo-main {
  position: relative;
  min-width: 0;
  background: #fff;
  padding: 1rem 1.1rem 1.1rem;
}

.view {
  display: none;
}

.view.is-on {
  display: block;
}

.month-layout {
  display: grid;
  grid-template-columns: 1fr 0fr;
  gap: 0;
  overflow: hidden;
  transition: grid-template-columns 0.45s ease;
}

.month-layout.is-open {
  grid-template-columns: 1fr 240px;
  gap: 0.85rem;
}

.cal {
  min-width: 0;
}

.cal-head,
.week-head,
.hist-head {
  text-align: center;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.85rem;
  font-size: 1.2rem;
}

.cal-wd,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.cal-wd {
  margin-bottom: 0.5rem;
}

.cal-wd span {
  text-align: center;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--gray-700);
}

.cal-wd .wk { color: var(--danger); }

.cal-grid {
  grid-template-rows: repeat(6, minmax(68px, 1fr));
}

.day {
  min-height: 68px;
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  background: #fff;
  padding: 0.35rem 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.day.out { opacity: 0.35; }
.day.we { background: rgba(37, 99, 235, 0.08); }
.day.today { border-color: var(--primary); }

.day.sel {
  border: 2px solid var(--danger);
  font-weight: 600;
}

.num {
  font-size: 0.95rem;
  line-height: 1.2;
  color: #374151;
}

.badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-left: auto;
}

.b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  background: #2676C7;
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
}

.b.o {
  min-width: 18px;
  height: 18px;
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fdba74;
  font-size: 0.68rem;
  font-weight: 700;
}

.day-panel {
  overflow: hidden;
  opacity: 0;
  min-width: 0;
  pointer-events: none;
}

.month-layout.is-open .day-panel {
  opacity: 1;
  transition: opacity 0.35s ease 0.15s;
}

.panel-title {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
  color: var(--gray-700);
}

.appt {
  border: 1px solid var(--gray-300);
  border-radius: 0.35rem;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.45rem;
  background: #fff;
}

.appt.is-done {
  background: #f0fdf4;
}

.appt-meta {
  font-size: 0.68rem;
  color: var(--gray-500);
}

.appt-time {
  font-size: 0.82rem;
  font-weight: 700;
}

.appt-name {
  font-size: 0.85rem;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
  min-height: 420px;
}

.week-col {
  border: 1px solid var(--gray-300);
  border-radius: 0.4rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.week-col.we { background: rgba(37, 99, 235, 0.06); }
.week-col.today { border: 2px solid var(--primary); }

.week-col-h {
  text-align: center;
  padding: 0.4rem 0.2rem;
  border-bottom: 1px solid var(--gray-300);
  font-size: 0.78rem;
}

.week-col-h span {
  display: block;
  color: var(--gray-500);
}

.week-col-b {
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.wcard {
  border-radius: 0.3rem;
  padding: 0.35rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.25;
}

.hist {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.hist th,
.hist td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-300);
}

.hist th {
  background: var(--gray-100);
  font-weight: 600;
}

.hist tbody tr:nth-child(even) {
  background: #fafafa;
}

.cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 40;
  pointer-events: none;
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.35));
  transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.cursor.is-click svg {
  animation: poke 0.18s ease;
}

@keyframes poke {
  50% { transform: translate(3px, 3px) scale(0.86); }
}

.cta {
  display: block;
  width: min(420px, 100%);
  margin: 1.25rem auto 0;
  text-align: center;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  border-radius: 0.35rem;
}

.cta:hover {
  background: var(--primary-dark);
}

@media (max-width: 800px) {
  .page { padding: 0.75rem; }
  .card { padding: 1rem 0.75rem 1rem; }
  .demo { grid-template-columns: 92px 1fr; min-height: 480px; }
  .demo-side { padding: 0.7rem 0.4rem; }
  .nav { font-size: 0.72rem; padding: 0.45rem 0.4rem; }
  .cal-grid { grid-template-rows: repeat(6, minmax(46px, 1fr)); gap: 0.2rem; }
  .cal-wd span { font-size: 0.75rem; }
  .day { min-height: 46px; padding: 0.15rem 0.2rem; }
  .num { font-size: 0.75rem; }
  .b { min-width: 16px; height: 16px; font-size: 0.65rem; }
  .month-layout.is-open { grid-template-columns: 1fr; }
  .day-panel { display: none; }
  .week-grid { min-height: 280px; gap: 0.2rem; }
  .wcard { font-size: 0.62rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor { display: none; }
  .month-layout,
  .cursor { transition: none; }
}
