:root {
  --bg: #ffffff;
  --text: #232a36;
  --muted: #727b89;
  --border: #e8edf3;
  --accent: #2448e6;
  --accent-soft: #edf2ff;
  --sidebar-width: 280px;
  --header-height: 72px;
  --week-toolbar-height: 64px;
  --time-col-width: 48px;
  --row-height: 52px;
  --footer-height: 44px;
}

body.theme-dark {
  --bg: #0f172a;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #273449;
  --accent: #60a5fa;
  --accent-soft: #17233a;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
.hidden { display: none !important; }
body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg);
  padding: 20px 14px;
  overflow: auto;
  position: fixed;
  left: 0;
  top: var(--header-height);
  bottom: 0;
  width: var(--sidebar-width);
  z-index: 40;
  transform: translateX(-105%);
  transition: transform 0.18s ease;
}

body.sidebar-open .sidebar {
  transform: translateX(0);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.15s ease;
}

body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 50px;
  font-weight: 700;
  margin: 4px 8px 16px;
}

.brand-mark {
  width: 27px;
  height: 27px;
  background: var(--accent);
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  border-radius: 4px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-item {
  border: 0;
  background: transparent;
  color: #4b5563;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  text-decoration: none;
}

.menu-item.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.menu-icon {
  width: 24px;
  text-align: center;
  color: #6b7280;
}

.main {
  display: grid;
  grid-template-rows: var(--header-height) 1fr auto;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.header {
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--bg);
  position: relative;
  z-index: 45;
  position: sticky;
  top: 0;
  min-width: 0;
}

.menu-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: #475569;
  font-size: 22px;
  line-height: 1;
  position: relative;
  z-index: 46;
}

.title {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 700;
  margin-right: auto;
  margin-left: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-card.profile-link {
  cursor: pointer;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #334155;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  object-fit: cover;
  overflow: hidden;
}

.user-text .name {
  font-size: 14px;
  font-weight: 600;
  max-width: min(42vw, 220px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-text .id {
  font-size: 12px;
  color: var(--muted);
  display: none;
}

.schedule-card {
  margin: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  display: block;
  overflow: auto;
  min-height: 0;
  max-height: calc(100vh - var(--header-height) - var(--footer-height) - 32px);
  position: relative;
  background: #fff;
}

.week-toolbar {
  display: grid;
  grid-template-columns: 36px minmax(150px, 260px) 36px 220px 36px 1fr;
  grid-template-rows: 1fr;
  align-items: center;
  column-gap: 10px;
  row-gap: 0;
  padding: 8px 14px;
  height: var(--week-toolbar-height);
  min-height: var(--week-toolbar-height);
  max-height: var(--week-toolbar-height);
  border-bottom: 1px solid var(--border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: hidden;
}

.week-range {
  font-size: 34px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-mode-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
  background: #fff;
  min-height: 40px;
}

.view-mode-btn {
  border: 0;
  background: #fff;
  color: #475569;
  padding: 10px 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
}

.view-mode-btn + .view-mode-btn {
  border-left: 1px solid var(--border);
}

.view-mode-btn.active {
  background: var(--accent-soft);
  color: #1d4ed8;
}

.schedule-status {
  font-size: 12px;
  color: #64748b;
  min-height: 0;
  line-height: 1.1;
  display: flex;
  align-items: center;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  font-size: 22px;
  color: #64748b;
}

.refresh-btn {
  font-size: 18px;
}

.refresh-btn.loading {
  opacity: 0.7;
  cursor: progress;
}

#prevBtn { grid-column: 1; grid-row: 1; }
#weekRange { grid-column: 2; grid-row: 1; }
#nextBtn { grid-column: 3; grid-row: 1; }
.week-toolbar .view-mode-switch { grid-column: 4; grid-row: 1; width: 100%; justify-self: stretch; }
#refreshCalendarBtn { grid-column: 5; grid-row: 1; }
#scheduleStatus { display: none; }

.week-head {
  display: grid;
  grid-template-columns: var(--time-col-width) repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: #fff;
  position: -webkit-sticky;
  position: sticky;
  top: var(--week-toolbar-height);
  z-index: 26;
  overflow: hidden;
}

.week-head-cell {
  min-height: 44px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  background: inherit;
}

.week-head-cell.today {
  background: #eef5ff;
}

.week-head-cell:last-child {
  border-right: 0;
}

.week-head-cell .dow {
  color: var(--muted);
  margin-left: 6px;
  font-weight: 500;
}

.week-grid {
  min-height: 0;
  overflow: visible;
  display: grid;
  grid-template-columns: var(--time-col-width) repeat(7, 1fr);
  grid-template-rows: repeat(24, var(--row-height));
  grid-auto-flow: row;
  align-content: start;
  position: relative;
  z-index: 1;
}

.time-cell,
.day-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  align-content: start;
}

.month-grid.hidden {
  display: none;
}

.month-dow {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  padding: 6px 0;
  text-transform: none;
  background: #f8fafc;
  position: sticky;
  top: var(--week-toolbar-height);
  z-index: 18;
}

.month-day-cell {
  min-height: 110px;
  border: 0;
  border-radius: 0;
  padding: 4px;
  background: #fff;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 3px;
  cursor: pointer;
  overflow: hidden;
}

.month-day-cell.today {
  background: #eef5ff;
  border-color: #bfdbfe;
}

.month-day-cell.outside {
  opacity: 0.55;
}

.month-day-num {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.month-day-events {
  display: grid;
  gap: 2px;
  align-content: start;
}

.month-event-pill {
  border-radius: 2px;
  padding: 2px 4px;
  font-size: 12px;
  line-height: 1.1;
  border: 1px solid #93c5fd;
  background: #dbeafe;
  color: #1e3a8a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  width: 100%;
}

.month-event-more {
  font-size: 11px;
  color: #64748b;
  line-height: 1.1;
}

.day-cell.today {
  background: #eef5ff;
}

.time-cell {
  background: #fff;
}

.time-label {
  position: absolute;
  right: 4px;
  top: 0;
  transform: translateY(-50%);
  font-size: 9px;
  font-weight: 700;
  color: #6b7280;
  line-height: 1;
  background: #fff;
  padding: 0 1px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.time-cell.first-hour .time-label {
  transform: translateY(0);
}

.week-grid {
  position: relative;
}

.meeting-pill {
  position: absolute;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 1px 2px;
  border-radius: 4px;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  overflow: hidden;
  align-items: flex-start;
  justify-content: flex-start;
}

.meeting-pill-title {
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: hidden;
  width: 100%;
}

.meeting-pill.continues-from-prev::before {
  content: "↥";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.7;
}

.meeting-pill.continues-to-next::after {
  content: "↧";
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.7;
}

.now-time-line {
  position: absolute;
  left: var(--time-col-width);
  right: 0;
  height: 1px;
  background: #f43f5e;
  z-index: 12;
  pointer-events: none;
}

.now-time-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #f43f5e;
  left: -6px;
  top: -6px;
}

.page-card {
  margin: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 18px;
  max-height: calc(100vh - var(--header-height) - var(--footer-height) - 32px);
  overflow: auto;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 14px;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.page-title-row .page-title {
  margin: 0;
}

.fab-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.page-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.page-form input,
.page-form textarea,
.page-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.page-status {
  min-height: 18px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

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

.task-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.task-tab {
  border: 0;
  border-right: 1px solid var(--border);
  background: #fff;
  color: #475569;
  padding: 10px 8px;
  font: inherit;
  font-weight: 700;
  text-transform: lowercase;
  cursor: pointer;
}

.task-tab:last-child {
  border-right: 0;
}

.task-tab.active {
  background: var(--accent-soft);
  color: #1e40af;
}

.task-tab.drop-target {
  background: #eaf1ff;
  color: #1d4ed8;
}

.page-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: flex-start;
}

.page-item.dragging {
  opacity: 0.55;
}

.page-item.dragging-source {
  opacity: 0.2;
}

.task-touch-ghost {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  opacity: 0.95;
  box-shadow: 0 14px 32px rgba(2, 6, 23, 0.25);
  transform: scale(1.02);
}

.page-item-title {
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.page-item-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.page-item.note-item {
  cursor: pointer;
}

.page-item.note-item .page-item-meta {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.note-delete-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #be123c;
  border-radius: 999px;
  cursor: pointer;
}

.page-item-meta.due-urgent {
  color: #dc2626;
  font-weight: 600;
}

.task-check {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid #94a3b8;
  background: #fff;
  margin-top: 2px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.task-check.done {
  border-color: var(--accent);
  background: var(--accent);
}

.task-check.done::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #fff;
  left: 5px;
  top: 5px;
}

.task-text.done .page-item-title,
.task-text.done .page-item-meta {
  color: #94a3b8;
  text-decoration: line-through;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 14px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

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

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 18px;
}

.event-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.45);
}

#deleteScopeModal {
  z-index: 95;
}

.event-modal.hidden {
  display: none;
}

.event-modal-card {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  background: #fff;
  display: grid;
  grid-template-rows: auto 1fr;
}

.event-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.event-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.event-close-btn,
.event-more-btn,
.event-edit-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-size: 20px;
}

.event-edit-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.event-more-menu {
  position: absolute;
  right: 46px;
  top: 44px;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.14);
  overflow: hidden;
  z-index: 3;
}

.event-more-menu.hidden {
  display: none;
}

.event-more-menu button {
  width: 100%;
  text-align: left;
  border: 0;
  background: #fff;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: #334155;
}

.event-more-menu button + button {
  border-top: 1px solid var(--border);
}

.event-more-menu button.danger {
  color: #b91c1c;
}

.event-modal-body {
  padding: 20px 16px 24px;
  overflow: auto;
  overflow-x: hidden;
}

.event-modal-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.event-modal-datetime {
  margin-top: 8px;
  font-size: 17px;
  color: #64748b;
}

.event-modal-status {
  min-height: 20px;
  margin-top: 12px;
  color: #64748b;
  font-size: 14px;
}

.event-edit-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.event-edit-form.hidden {
  display: none;
}

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

.event-field span {
  font-size: 13px;
  color: #64748b;
}

.event-field input,
.event-field select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  width: 100%;
  min-width: 0;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease, transform .12s ease;
}

.event-field select,
.reminder-row select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border-color: #d5deea;
  padding-right: 40px;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 6 5-6' stroke='%2360708a' stroke-width='1.75' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  background-position:
    calc(100% - 14px) 50%,
    0 0;
  background-size: 12px 8px, 100% 100%;
  background-repeat: no-repeat;
}

.event-field input:focus,
.event-field select:focus {
  outline: none;
  border-color: #4f8ff8;
  box-shadow: 0 0 0 3px rgba(79, 143, 248, 0.22);
  transform: translateY(-1px);
}

.time-wheel-picker {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  min-height: 164px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.time-wheel-picker select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  height: 148px;
  text-align: center;
  text-align-last: center;
  overflow-y: auto;
  padding: 10px 8px;
  font-size: 19px;
  font-weight: 600;
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  background:
    linear-gradient(to bottom, rgba(15, 23, 42, 0.16) 0%, rgba(15, 23, 42, 0) 24%),
    linear-gradient(to top, rgba(15, 23, 42, 0.16) 0%, rgba(15, 23, 42, 0) 24%),
    linear-gradient(
      to bottom,
      transparent 0%,
      transparent 38%,
      rgba(255, 255, 255, 0.92) 38%,
      rgba(255, 255, 255, 0.92) 62%,
      transparent 62%,
      transparent 100%
    ),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: rgba(15, 23, 42, 0.44);
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.delete-scope-card {
  width: min(420px, calc(100vw - 24px));
  border-radius: 14px;
  padding: 18px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #dbe5f2;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
}

.delete-scope-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #0f172a;
}

.delete-scope-actions {
  display: grid;
  gap: 8px;
}

.delete-scope-btn {
  border: 1px solid #cbd7e6;
  border-radius: 10px;
  background: #f8fbff;
  color: #0f172a;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.delete-scope-btn:hover {
  border-color: #78a4f8;
  background: #eef5ff;
}

.delete-scope-btn:focus-visible,
.delete-scope-cancel:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 143, 248, 0.22);
}

.delete-scope-btn.danger {
  border-color: #f2a6a6;
  background: #fff5f5;
  color: #b42323;
}

.delete-scope-btn.danger:hover {
  border-color: #de7474;
  background: #ffeaea;
}

.delete-scope-cancel {
  margin-top: 10px;
  border: none;
  background: transparent;
  color: #475569;
  font: inherit;
  cursor: pointer;
  padding: 8px 10px;
}

.time-wheel-picker option {
  min-height: 30px;
  padding: 8px 0;
  scroll-snap-align: center;
  color: rgba(15, 23, 42, 0.36);
  font-weight: 600;
  letter-spacing: 0;
}

.time-wheel-picker option:checked {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.95);
  font-weight: 800;
}

.event-options-toggle {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: #334155;
  min-height: 44px;
  padding: 10px 13px;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.event-options-toggle::after {
  content: "⌄";
  float: right;
  color: #64748b;
}

.event-options-toggle.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.event-options-toggle.active::after {
  content: "⌃";
}

.event-more-options {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.event-more-options.hidden {
  display: none;
}

.reminder-list {
  display: grid;
  gap: 8px;
}

.reminder-row {
  display: grid;
  grid-template-columns: minmax(90px, auto) minmax(86px, 0.8fr) minmax(70px, 0.7fr) minmax(96px, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.reminder-row > * {
  min-width: 0;
}

.reminder-prefix {
  font-size: 13px;
  color: #475569;
  white-space: nowrap;
}

.reminder-remove-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: #64748b;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.reminder-remove-btn:hover {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff5f5;
}

.reminder-add-btn {
  border: 1px dashed #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.reminder-add-btn:hover {
  background: #f8fafc;
}

@media (max-width: 640px) {
  .reminder-row {
    grid-template-columns: 1fr 1fr 1fr auto;
  }

  .reminder-prefix {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .event-modal-head {
    padding: 12px;
  }

  .event-modal-body {
    padding: 16px 12px 20px;
  }

  .reminder-row {
    grid-template-columns: 1fr 1fr auto;
  }

  .reminder-prefix {
    grid-column: 1 / -1;
  }
}

.event-color-picker {
  position: relative;
  width: 100%;
}

.event-color-trigger {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 42px;
  background: #fff;
  color: var(--text);
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  cursor: pointer;
}

.event-color-label {
  font-weight: 600;
  line-height: 1.1;
}

.event-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.35);
  background: #9aa0a6;
  display: block;
  flex: 0 0 16px;
}

.event-color-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.18);
  max-height: 248px;
  overflow-y: auto;
  z-index: 40;
}

.event-color-option {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 8px 10px 8px 14px;
  cursor: pointer;
}

.event-color-option:last-child {
  border-bottom: 0;
}

.event-color-option:hover,
.event-color-option.active {
  background: var(--accent-soft);
}

.event-color-option-label {
  font-weight: 600;
}

.event-color-option-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.35);
  flex: 0 0 16px;
}

.app-footer {
  margin: 0 16px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  color: #94a3b8;
  font-size: 12px;
  text-transform: lowercase;
  text-align: center;
}

.workout-form {
  margin-top: 10px;
}

.workout-layout {
  display: grid;
  gap: 14px;
}

.workout-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
}

.workout-menu-toggle {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbff;
  color: #1f3f71;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.workout-current-view {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  color: #1e293b;
  font-weight: 800;
}

.workout-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(15, 23, 42, 0.36);
}

.workout-tabs {
  position: fixed;
  left: 50%;
  top: 74px;
  z-index: 40;
  display: grid;
  width: min(420px, calc(100vw - 28px));
  grid-template-columns: 1fr;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  padding: 10px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.2);
  transform: translate(-50%, -10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.workout-tabs.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.workout-tab {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbff;
  color: #35537d;
  min-height: 38px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.workout-tab.active {
  background: #eaf1ff;
  border-color: #91add5;
  color: #163766;
}

.workout-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.workout-section.hidden {
  display: none;
}

.workout-section-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

.workout-profile-details {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px 12px;
}

.workout-profile-details summary {
  color: #35537d;
  cursor: pointer;
  font-weight: 700;
}

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

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

.workout-modes label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  cursor: pointer;
}

.workout-actions-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.workout-secondary-btn {
  border-color: #9fb6dc;
  background: #eef5ff;
  color: #1d4f9a;
}

.workout-plan-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.workout-subtitle {
  margin: 12px 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: #3a4e6b;
}

.workout-plan-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.workout-plan-item.done {
  opacity: 0.82;
}

.workout-plan-item.added {
  border-color: #b9d0ef;
  background: #f9fcff;
}

.workout-plan-main {
  min-width: 0;
  flex: 1;
}

.workout-plan-title {
  font-size: 15px;
  font-weight: 700;
}

.workout-plan-title.clickable {
  cursor: pointer;
}

.workout-plan-edit-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 1fr) 92px;
  gap: 8px;
}

.workout-plan-edit-row label {
  display: grid;
  gap: 5px;
}

.workout-plan-edit-row span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.workout-input-time,
.workout-mode-select,
.workout-input-duration {
  width: 100%;
  min-width: 0;
  border: 1px solid #d3ddea;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-weight: 650;
}

.workout-input-time:disabled,
.workout-mode-select:disabled,
.workout-input-duration:disabled {
  opacity: 1;
  color: #334155;
  background: #eef4fb;
}

.modern-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px;
  border-color: #d3ddea;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 6 5-6' stroke='%2367798f' stroke-width='1.75' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  background-position:
    calc(100% - 14px) 50%,
    0 0;
  background-size: 12px 8px, 100% 100%;
  background-repeat: no-repeat;
}

select::-ms-expand {
  display: none;
}

.workout-plan-summary {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.workout-pretty-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.workout-pretty-meta span {
  border: 1px solid #d7e4f5;
  border-radius: 999px;
  background: #f8fbff;
  color: #335071;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
}

.workout-report-block {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.workout-report-block label {
  display: grid;
  gap: 5px;
}

.workout-report-block span {
  color: #4b607a;
  font-size: 12px;
  font-weight: 700;
}

.workout-workdone-input,
.workout-feeling-input {
  margin-top: 8px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
  color: var(--text);
  resize: vertical;
}

.workout-workdone-input:disabled,
.workout-feeling-input:disabled {
  opacity: 0.9;
  background: #f1f5f9;
}

.workout-item-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workout-mini-btn {
  border: 1px solid #c7d5ea;
  border-radius: 9px;
  background: #f8fbff;
  color: #1f3f71;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 10px;
  cursor: pointer;
}

.workout-mini-btn:disabled {
  cursor: default;
  opacity: 0.65;
}

.workout-mini-btn.delete {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b42318;
}

.workout-recommendation {
  display: none;
  margin-top: 10px;
  white-space: pre-wrap;
  border: 1px solid #cfe0f5;
  border-radius: 10px;
  background: #f8fbff;
  color: #1d3557;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.workout-recommendation.visible {
  display: block;
}

.workout-urbanfit-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.workout-today-date {
  margin: 4px 0 12px;
  color: #2563eb;
  font-size: clamp(24px, 7vw, 42px);
  font-weight: 900;
  line-height: 1.05;
  text-transform: capitalize;
}

.workout-load-card {
  border: 1px solid #e4e9f3;
  border-radius: 22px;
  background: #f4f6fb;
  padding: 18px;
  margin-bottom: 12px;
}

.workout-load-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.workout-load-card-title {
  color: #111827;
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 900;
  line-height: 1.05;
}

.workout-load-pill {
  display: inline-flex;
  margin-top: 14px;
  border-radius: 999px;
  background: #fff;
  padding: 8px 16px;
  font-size: clamp(18px, 4.8vw, 28px);
  font-weight: 900;
}

.workout-load-pill.low {
  color: #2ab51f;
}

.workout-load-pill.mid {
  color: #2563eb;
}

.workout-load-pill.high {
  color: #f97316;
}

.workout-load-ring {
  position: relative;
  width: 86px;
  height: 86px;
  flex: 0 0 auto;
}

.workout-load-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.workout-load-ring circle {
  fill: none;
  stroke-width: 8;
}

.workout-load-ring circle:first-child {
  stroke: #d7dbe3;
}

.workout-load-ring circle:last-child {
  stroke: #32b91f;
  stroke-linecap: round;
  stroke-dasharray: var(--dash) var(--rest);
}

.workout-load-ring span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #4b5563;
  font-size: 22px;
  font-weight: 900;
}

.workout-load-bars {
  height: 150px;
  display: grid;
  grid-template-columns: repeat(18, minmax(4px, 1fr));
  gap: clamp(5px, 1.6vw, 12px);
  align-items: end;
  margin-top: 20px;
}

.workout-load-bars i {
  display: block;
  min-height: 8px;
  border-radius: 999px;
  background: #b9c8e8;
}

.workout-load-bars i.current {
  background: #2e6bd9;
}

.workout-load-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: #667085;
  font-size: clamp(14px, 3vw, 22px);
  font-weight: 900;
}

.workout-day-switch {
  display: inline-flex;
  gap: 6px;
  border: 1px solid #d6e2f2;
  border-radius: 999px;
  background: #f8fbff;
  padding: 5px;
  margin: 4px 0 12px;
}

.workout-day-switch button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #46617f;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.workout-day-switch button.active {
  background: #2563eb;
  color: #fff;
}

.workout-urbanfit-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
}

.workout-urbanfit-note {
  border: 1px solid #d7e4f5;
  border-radius: 10px;
  background: #f8fbff;
  color: #46617f;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 600;
}

.workout-urbanfit-time {
  color: #2563eb;
  font-weight: 800;
}

.workout-urbanfit-name {
  color: #1e293b;
  font-weight: 800;
}

.workout-urbanfit-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.workout-urbanfit-seat {
  margin-top: 5px;
  color: #166534;
  font-size: 12px;
  font-weight: 800;
}

.workout-plan-time {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.workout-empty {
  border: 1px dashed #cfdbea;
  border-radius: 12px;
  background: #f8fbff;
  color: #64748b;
  padding: 14px;
  font-size: 13px;
  font-weight: 700;
}

.workout-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.workout-stat-card,
.workout-chart-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
}

.workout-stat-card span,
.workout-chart-title {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.workout-stat-card strong {
  display: block;
  margin-top: 6px;
  color: #0f172a;
  font-size: 20px;
  line-height: 1.15;
}

.workout-chart-card {
  margin-top: 12px;
}

.workout-section-note,
.workout-source-note {
  margin: 6px 0 12px;
  color: #64748b;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.workout-chart {
  min-height: 180px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding-top: 14px;
}

.workout-chart-axis {
  position: relative;
  height: 180px;
  border-right: 1px solid #d8e3f2;
}

.workout-chart-axis span {
  position: absolute;
  right: 8px;
  transform: translateY(50%);
  color: #7b8da5;
  font-size: 11px;
  font-weight: 800;
}

.workout-chart-bars {
  position: relative;
  height: 180px;
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  overflow: hidden;
  padding-bottom: 24px;
  background-image: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent 43px,
    rgba(148, 163, 184, 0.18) 44px
  );
}

.workout-chart-bar-wrap {
  min-width: 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 5px;
  align-items: end;
  height: 100%;
  text-align: center;
}

.workout-chart-bar-value {
  color: #31527a;
  font-size: clamp(8px, 2.4vw, 11px);
  font-weight: 900;
}

.workout-chart-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.workout-chart-bar-wrap.empty .workout-chart-bar {
  min-height: 2px;
  background: #d7e2f1;
  box-shadow: none;
}

.workout-chart-bar-wrap span {
  color: #64748b;
  font-size: clamp(8px, 2.2vw, 11px);
  font-weight: 800;
}

.workout-focus-chart {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.workout-focus-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
}

.workout-focus-row span,
.workout-focus-row b {
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.workout-focus-row div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef8;
}

.workout-focus-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7dd3fc, #2563eb);
}

.workout-load {
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 10px;
}

.workout-load.low {
  background: #e8faf2;
  color: #0f7a4a;
}

.workout-load.mid {
  background: #eef4ff;
  color: #215aa7;
}

.workout-load.high {
  background: #fff1ec;
  color: #a34726;
}

.profile-grid {
  display: grid;
  gap: 10px;
}

.profile-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.profile-item-label {
  font-size: 12px;
  color: var(--muted);
}

.profile-item-value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 600;
}

.profile-timezone-edit {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.profile-timezone-edit select {
  border: 1px solid #cfd8e6;
  border-radius: 12px;
  padding: 11px 42px 11px 14px;
  font: inherit;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  min-width: 0;
  color: #0f172a;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 6 5-6' stroke='%2360708a' stroke-width='1.75' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  background-position:
    calc(100% - 14px) 50%,
    0 0;
  background-size: 12px 8px, 100% 100%;
  background-repeat: no-repeat;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.page-form select,
.event-field select,
.reminder-row select,
.profile-timezone-edit select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px;
  border-color: #d3ddea;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 6 5-6' stroke='%2367798f' stroke-width='1.75' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  background-position:
    calc(100% - 14px) 50%,
    0 0;
  background-size: 12px 8px, 100% 100%;
  background-repeat: no-repeat;
}

.profile-timezone-edit select:focus {
  outline: none;
  border-color: #4f8ff8;
  box-shadow: 0 0 0 3px rgba(79, 143, 248, 0.22);
}

.profile-cal-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.profile-cal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

.profile-cal-row > div:first-child {
  flex: 1;
  min-width: 0;
}

.profile-cal-name {
  font-size: 14px;
  font-weight: 600;
}

.profile-cal-sub {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  border: 0;
  cursor: pointer;
}

.toggle-switch.on {
  background: #3b82f6;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.15s ease;
}

.toggle-switch.on::after {
  transform: translateX(20px);
}

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.theme-current {
  color: var(--muted);
  font-size: 13px;
}

.theme-toggle-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  min-width: 120px;
  padding: 8px 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

body.theme-dark .schedule-card,
body.theme-dark .page-card,
body.theme-dark .week-toolbar,
body.theme-dark .week-head,
body.theme-dark .time-cell,
body.theme-dark .time-label,
body.theme-dark .month-day-cell,
body.theme-dark .month-dow,
body.theme-dark .header,
body.theme-dark .sidebar,
body.theme-dark .menu-toggle,
body.theme-dark .view-mode-switch,
body.theme-dark .view-mode-btn,
body.theme-dark .nav-btn,
body.theme-dark .event-modal-card,
body.theme-dark .event-more-menu,
body.theme-dark .event-more-menu button,
body.theme-dark .event-close-btn,
  body.theme-dark .event-more-btn,
  body.theme-dark .event-edit-btn,
  body.theme-dark .event-options-toggle,
  body.theme-dark .event-more-options,
  body.theme-dark .event-color-trigger,
body.theme-dark .event-color-menu,
body.theme-dark .event-color-option,
body.theme-dark .profile-item,
body.theme-dark .profile-cal-row,
body.theme-dark .theme-toggle-btn,
body.theme-dark .app-footer {
  background: #111c2f;
  color: var(--text);
}

body.theme-dark .workout-modes label,
body.theme-dark .workout-section,
body.theme-dark .workout-plan-item,
body.theme-dark .workout-tab,
body.theme-dark .workout-tabs,
body.theme-dark .workout-current-view,
body.theme-dark .workout-menu-toggle,
body.theme-dark .workout-stat-card,
body.theme-dark .workout-chart-card,
body.theme-dark .workout-profile-details,
body.theme-dark .workout-urbanfit-row,
body.theme-dark .workout-urbanfit-note,
body.theme-dark .workout-recommendation,
body.theme-dark .workout-empty {
  background: #111c2f;
  border-color: #324863;
  color: #f0f5ff;
}

body.theme-dark .workout-plan-item.added {
  background: #13223a;
  border-color: #3b5b80;
}

body.theme-dark .workout-profile-details summary,
body.theme-dark .workout-urbanfit-name {
  color: #f0f5ff;
}

body.theme-dark .workout-urbanfit-time {
  color: #9fcbff;
}

body.theme-dark .workout-urbanfit-meta {
  color: #9fb0c6;
}

body.theme-dark .workout-urbanfit-note {
  color: #bdd2ee;
}

body.theme-dark .workout-load-card,
body.theme-dark .workout-day-switch {
  background: #111c2f;
  border-color: #324863;
}

body.theme-dark .workout-load-card-title,
body.theme-dark .workout-load-ring span {
  color: #f0f5ff;
}

body.theme-dark .workout-load-pill {
  background: #17243a;
}

body.theme-dark .workout-load-ring circle:first-child {
  stroke: #324863;
}

body.theme-dark .workout-load-bars i {
  background: #40577a;
}

body.theme-dark .workout-load-axis,
body.theme-dark .workout-day-switch button {
  color: #bdd2ee;
}

body.theme-dark .workout-urbanfit-seat {
  color: #96efc4;
}

body.theme-dark .workout-section-title {
  color: #f4f8ff;
}

body.theme-dark .workout-current-view,
body.theme-dark .workout-today-date,
body.theme-dark .workout-stat-card strong {
  color: #dbeafe;
}

body.theme-dark .workout-subtitle {
  color: #bdd2ee;
}

body.theme-dark .workout-tab.active {
  background: #1b3251;
  border-color: #3c5f87;
  color: #9fcbff;
}

body.theme-dark .workout-plan-time {
  color: #9fb0c6;
}

body.theme-dark .workout-secondary-btn {
  background: #173154;
  border-color: #355b8c;
  color: #cfe2ff;
}

body.theme-dark .workout-load.low {
  background: rgba(50, 156, 106, 0.2);
  color: #96efc4;
}

body.theme-dark .workout-load.mid {
  background: rgba(65, 126, 206, 0.22);
  color: #c8dcff;
}

body.theme-dark .workout-load.high {
  background: rgba(192, 102, 62, 0.22);
  color: #ffd8c8;
}

body.theme-dark .workout-input-time:disabled,
body.theme-dark .workout-mode-select:disabled,
body.theme-dark .workout-input-duration:disabled {
  background: #17243a;
  color: #e8f1ff;
}

body.theme-dark .workout-input-time,
body.theme-dark .workout-mode-select,
body.theme-dark .workout-input-duration,
body.theme-dark .workout-pretty-meta span {
  background: #0f172a;
  border-color: #324863;
  color: #e8f1ff;
}

body.theme-dark .workout-plan-summary,
body.theme-dark .workout-report-block span {
  color: #bdd2ee;
}

body.theme-dark .workout-workdone-input,
body.theme-dark .workout-feeling-input {
  background: #0f172a;
  border-color: #324863;
  color: #e8edf5;
}

body.theme-dark .workout-workdone-input:disabled,
body.theme-dark .workout-feeling-input:disabled {
  background: #17243a;
}

body.theme-dark .workout-mini-btn {
  background: #162a46;
  border-color: #355072;
  color: #d6e5ff;
}

body.theme-dark .workout-mini-btn.delete {
  background: rgba(127, 29, 29, 0.24);
  border-color: #7f1d1d;
  color: #fecaca;
}

body.theme-dark .workout-focus-row span,
body.theme-dark .workout-focus-row b,
body.theme-dark .workout-stat-card span,
body.theme-dark .workout-chart-title,
body.theme-dark .workout-chart-bar-wrap span,
body.theme-dark .workout-chart-axis span,
body.theme-dark .workout-plan-edit-row span {
  color: #bdd2ee;
}

body.theme-dark .workout-chart-axis {
  border-right-color: #324863;
}

body.theme-dark .workout-chart-bars {
  background-image: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent 43px,
    rgba(148, 163, 184, 0.12) 44px
  );
}

body.theme-dark .workout-chart-bar-value {
  color: #d8e8ff;
}

body.theme-dark .workout-section-note,
body.theme-dark .workout-source-note {
  color: #9fb0c6;
}

body.theme-dark .workout-chart-bar-wrap.empty .workout-chart-bar {
  background: #324863;
}

body.theme-dark .workout-focus-row div {
  background: #1e2d45;
}

body.theme-dark .menu-item {
  color: #a4b5cc;
}

body.theme-dark .menu-icon {
  color: #94a9c4;
}

@media (max-width: 760px) {
  .workout-grid-2,
  .workout-actions-row,
  .workout-modes,
  .workout-plan-edit-row,
  .workout-stats-grid {
    grid-template-columns: 1fr;
  }

  .workout-focus-row {
    grid-template-columns: 1fr;
  }

  .workout-urbanfit-row {
    grid-template-columns: 1fr;
  }

  .workout-load-card-head {
    align-items: center;
  }

  .workout-load-ring {
    width: 72px;
    height: 72px;
  }
}

body.theme-dark .month-grid {
  background: #273449;
}

body.theme-dark .month-day-cell.today,
body.theme-dark .day-cell.today,
body.theme-dark .week-head-cell.today {
  background: #1a2b45;
}

body.theme-dark .page-form input,
body.theme-dark .page-form textarea,
body.theme-dark .page-form select,
body.theme-dark .event-field input,
body.theme-dark .event-field select,
body.theme-dark .profile-timezone-edit select {
  background: #0f172a;
  color: var(--text);
  border-color: var(--border);
}

body.theme-dark .event-field select,
body.theme-dark .reminder-row select {
  border-color: #334155;
}

body.theme-dark .time-wheel-picker {
  background: linear-gradient(180deg, #1a2438 0%, #0f172a 100%);
}

body.theme-dark .time-wheel-picker select {
  background:
    linear-gradient(to bottom, rgba(5, 10, 20, 0.42) 0%, rgba(5, 10, 20, 0) 24%),
    linear-gradient(to top, rgba(5, 10, 20, 0.42) 0%, rgba(5, 10, 20, 0) 24%),
    linear-gradient(
      to bottom,
      transparent 0%,
      transparent 38%,
      rgba(226, 232, 240, 0.12) 38%,
      rgba(226, 232, 240, 0.12) 62%,
      transparent 62%,
      transparent 100%
    ),
    linear-gradient(180deg, #192235 0%, #121a2b 100%);
  border-color: #3a4a63;
  color: rgba(230, 237, 247, 0.5);
}

body.theme-dark .time-wheel-picker option {
  color: rgba(230, 237, 247, 0.4);
}

body.theme-dark .time-wheel-picker option:checked {
  color: #f1f6ff;
  background: rgba(226, 232, 240, 0.16);
}

body.theme-dark .event-field select,
body.theme-dark .reminder-row select {
  border-color: #40516a;
}

body.theme-dark .menu-item {
  color: #8fa2bb;
}

body.theme-dark .menu-icon {
  color: #6f829d;
}

body.theme-dark .menu-item.active {
  color: #74adff;
  background: rgba(34, 84, 155, 0.28);
}

body.theme-dark .profile-item-label,
body.theme-dark .profile-cal-sub {
  color: #9fb0c6;
}

body.theme-dark .profile-item-value,
body.theme-dark .profile-cal-name {
  color: #e8edf5;
}

body.theme-dark .profile-timezone-edit select {
  border-color: #365173;
  color: #e8edf5;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 6 5-6' stroke='%239bb3cf' stroke-width='1.75' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #13233a 0%, #0f1d31 100%);
  background-position:
    calc(100% - 14px) 50%,
    0 0;
  background-size: 12px 8px, 100% 100%;
  background-repeat: no-repeat;
}

body.theme-dark .page-form select,
body.theme-dark .event-field select,
body.theme-dark .reminder-row select,
body.theme-dark .profile-timezone-edit select {
  border-color: #415575;
  color: #e6edf7;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 6 5-6' stroke='%23a7b8ce' stroke-width='1.75' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #1a2539 0%, #111b2d 100%);
  background-position:
    calc(100% - 14px) 50%,
    0 0;
  background-size: 12px 8px, 100% 100%;
  background-repeat: no-repeat;
}

body.theme-dark .modern-select {
  border-color: #415575;
  color: #e6edf7;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 6 5-6' stroke='%23a7b8ce' stroke-width='1.75' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #1a2539 0%, #111b2d 100%);
  background-position:
    calc(100% - 14px) 50%,
    0 0;
  background-size: 12px 8px, 100% 100%;
  background-repeat: no-repeat;
}

body.theme-dark .delete-scope-btn {
  background: #13233a;
  border-color: #355072;
  color: #e8edf5;
}

body.theme-dark .delete-scope-btn:hover {
  background: #1a304f;
  border-color: #59779c;
}

body.theme-dark .delete-scope-btn.danger {
  color: #fecaca;
  border-color: #b14949;
  background: #2d1420;
}

body.theme-dark .delete-scope-cancel {
  color: #b4c0d0;
}

body.theme-dark .delete-scope-card {
  background: #101b2d;
  color: #e8edf5;
  border-color: #324863;
  box-shadow: 0 22px 48px rgba(2, 8, 23, 0.55);
}

body.theme-dark .delete-scope-title {
  color: #e8edf5;
}

@media (max-width: 980px) {
  :root {
    --sidebar-width: 220px;
    --week-toolbar-height: 60px;
    --time-col-width: 42px;
    --row-height: 46px;
  }

  .title { font-size: 30px; }
  .week-range { font-size: 24px; }
  .schedule-status { font-size: 12px; }
  .menu-item { font-size: 15px; }
}

@media (max-width: 760px) {
  :root {
    --week-toolbar-height: 56px;
  }

  .header { padding: 0 14px; }
  .schedule-card { margin: 10px; }
  .page-card { margin: 10px; }
  .week-head-cell { font-size: 14px; min-height: 40px; }
  .time-label { font-size: 9px; }
  .user-text .name { font-size: 12px; }
  .user-text .id { font-size: 11px; }
  .meeting-pill-title { font-size: 9px; }
  .event-modal-title { font-size: 22px; }
  .event-modal-datetime { font-size: 15px; }
  .week-toolbar {
    grid-template-columns: 30px minmax(0, 1fr) 30px 132px 30px;
    grid-template-rows: 1fr;
    column-gap: 5px;
    row-gap: 0;
    padding: 6px 8px;
  }
  .week-range {
    font-size: clamp(15px, 4.8vw, 18px);
    min-width: 0;
  }
  .nav-btn {
    width: 30px;
    height: 30px;
    font-size: 20px;
  }
  .view-mode-switch {
    width: 132px;
  }
  .view-mode-btn {
    font-size: 10px;
    padding: 5px 0;
    flex: 1 1 0;
  }
  .week-toolbar .view-mode-switch { grid-column: 4; grid-row: 1; }
  #refreshCalendarBtn { grid-column: 5; grid-row: 1; }
  .month-grid { gap: 1px; padding: 1px; }
  .month-day-cell { min-height: 96px; padding: 3px; }
  .month-day-num { font-size: 12px; }
  .month-event-pill { font-size: 11px; padding: 2px 3px; }
  .profile-timezone-edit { grid-template-columns: 1fr; }
}

/* Obsidian-inspired polish for compact mini-app pages */
:root {
  --bg: #f6f5f2;
  --text: #262626;
  --muted: #6f6a61;
  --border: #ddd8cf;
  --accent: #7c5cff;
  --accent-soft: #ebe6ff;
  --panel: #fffdf8;
  --panel-raised: #ffffff;
  --shadow-soft: 0 18px 44px rgba(42, 35, 25, 0.08);
  --header-height: 68px;
}

body.theme-dark {
  --bg: #1e1e1e;
  --text: #dcddde;
  --muted: #9b9b9b;
  --border: #343434;
  --accent: #a78bfa;
  --accent-soft: #302a3f;
  --panel: #252526;
  --panel-raised: #2b2b2c;
  --shadow-soft: 0 18px 42px rgba(0, 0, 0, 0.32);
}

body {
  background: var(--bg);
  color: var(--text);
}

.header {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-bottom-color: var(--border);
  padding: 0 22px;
  backdrop-filter: blur(16px);
}

.title {
  font-family: "Inter", system-ui, sans-serif;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: 0;
  color: var(--text);
}

.menu-toggle {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--panel-raised);
  border-color: var(--border);
  color: var(--muted);
  box-shadow: none;
}

.user-card {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 8px 4px 4px;
}

.user-card.profile-link:hover {
  border-color: var(--border);
  background: var(--panel-raised);
}

.avatar {
  width: 42px;
  height: 42px;
  background: var(--accent-soft);
  color: var(--accent);
}

.user-text .name {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.sidebar {
  background: var(--panel);
  border-right-color: var(--border);
  box-shadow: var(--shadow-soft);
}

.menu-item {
  color: var(--muted);
  border-radius: 9px;
  padding: 11px 12px;
}

.menu-item:hover {
  color: var(--text);
  background: var(--panel-raised);
}

.menu-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.menu-icon {
  color: currentColor;
  opacity: 0.8;
}

.page-card {
  background: var(--panel);
  border-color: var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  padding: 28px;
}

.page-title {
  color: var(--text);
  font-size: clamp(30px, 6vw, 44px);
  line-height: 1;
  letter-spacing: 0;
}

.page-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--accent);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 28%, transparent);
  font-size: 34px;
}

.fab-btn:hover,
.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.task-tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel-raised) 86%, var(--bg));
  border-color: var(--border);
}

.task-tab {
  flex: 1 1 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  min-height: 42px;
  text-transform: lowercase;
}

.task-tab + .task-tab {
  border-left: 0;
}

.task-tab.active {
  background: var(--panel);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--border);
}

.page-item {
  background: var(--panel-raised);
  border-color: var(--border);
  border-radius: 16px;
  padding: 16px;
  grid-template-columns: auto minmax(0, 1fr);
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.page-item:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  transform: translateY(-1px);
}

.page-item-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 750;
}

.page-item-meta,
.page-status {
  color: var(--muted);
}

.task-check {
  width: 22px;
  height: 22px;
  border-color: color-mix(in srgb, var(--muted) 64%, var(--border));
  background: var(--panel);
}

.task-check.done {
  background: var(--accent);
  border-color: var(--accent);
}

.note-dot {
  width: 8px;
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.page-form input,
.page-form textarea,
.page-form select,
.event-field input,
.event-field select {
  background: var(--panel-raised);
  border-color: var(--border);
  color: var(--text);
  border-radius: 12px;
}

.page-form input:focus,
.page-form textarea:focus,
.page-form select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 650;
}

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

.primary-btn,
.ghost-btn {
  border-radius: 12px;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: var(--panel-raised);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.modal {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
}

.modal-card {
  background: var(--panel);
  border-color: var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.modal-title {
  color: var(--text);
}

.modal-close {
  background: var(--panel-raised);
  border-color: var(--border);
  color: var(--muted);
}

.note-actions {
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.note-delete-btn {
  width: auto;
  height: auto;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 750;
}

.notes-page-card {
  display: grid;
  gap: 18px;
}

.notes-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 18px;
  min-height: 0;
}

.notes-column,
.obsidian-panel {
  min-width: 0;
}

.obsidian-panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-raised);
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.obsidian-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.obsidian-title {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

.obsidian-path {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.obsidian-status {
  color: var(--muted);
  font-size: 13px;
}

.obsidian-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.obsidian-breadcrumb button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.obsidian-files {
  display: grid;
  gap: 8px;
}

.obsidian-file-row {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.obsidian-file-row span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.obsidian-file-row small {
  color: var(--muted);
  font-weight: 700;
}

.obsidian-file-row:hover {
  border-color: color-mix(in srgb, var(--accent) 44%, var(--border));
}

.obsidian-file-icon {
  width: 34px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.obsidian-empty {
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 14px;
}

.obsidian-view-card {
  width: min(760px, 100%);
}

.obsidian-file-content {
  max-height: min(62vh, 620px);
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-raised);
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.app-footer {
  background: var(--panel);
  color: var(--muted);
  border-color: var(--border);
  box-shadow: none;
}

body.theme-dark .schedule-card,
body.theme-dark .page-card,
body.theme-dark .header,
body.theme-dark .sidebar,
body.theme-dark .menu-toggle,
body.theme-dark .task-tabs,
body.theme-dark .task-tab,
body.theme-dark .page-item,
body.theme-dark .modal-card,
body.theme-dark .modal-close,
body.theme-dark .app-footer {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
}

body.theme-dark .task-tab.active,
body.theme-dark .page-item,
body.theme-dark .obsidian-panel,
body.theme-dark .obsidian-file-row,
body.theme-dark .ghost-btn,
body.theme-dark .page-form input,
body.theme-dark .page-form textarea,
body.theme-dark .page-form select,
body.theme-dark .obsidian-file-content {
  background: var(--panel-raised);
  color: var(--text);
  border-color: var(--border);
}

body.theme-dark .task-tab,
body.theme-dark .page-item-meta,
body.theme-dark .page-status,
body.theme-dark .page-subtitle,
body.theme-dark .obsidian-status,
body.theme-dark .obsidian-path,
body.theme-dark .obsidian-file-row small,
body.theme-dark .inline-check {
  color: var(--muted);
}

@media (max-width: 760px) {
  .header {
    padding: 0 14px;
  }

  .title {
    font-size: 28px;
  }

  .header-user {
    gap: 8px;
  }

  .user-text .name {
    max-width: 150px;
    font-size: 13px;
  }

  .page-card {
    margin: 10px;
    padding: 22px 16px;
    border-radius: 20px;
  }

  .page-title {
    font-size: 38px;
  }

  .fab-btn {
    width: 52px;
    height: 52px;
  }

  .task-tabs {
    gap: 4px;
  }

  .task-tab {
    font-size: 14px;
    min-height: 40px;
  }

  .notes-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .title {
    font-size: 23px;
  }

  .avatar {
    width: 36px;
    height: 36px;
  }

  .user-text .name {
    max-width: 112px;
  }

  .page-title-row {
    align-items: flex-start;
  }
}
