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

:root {
  --bg: #f4f0fb;
  --bg-soft: #ebe4f7;
  --panel: #ffffff;
  --text: #1b1430;
  --muted: #665c84;
  --brand: #3a1d63;
  --brand-2: #25123f;
  --line: #ddd2f0;
  --line-strong: #c7b9e3;
  --danger: #8b3259;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 10px 28px rgba(44, 20, 78, 0.10);
  --shadow-strong: 0 20px 48px rgba(30, 12, 58, 0.20);
  --sidebar-width: 276px;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html, body {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 15px;
  background:
    radial-gradient(1200px 700px at -10% -20%, #efe8fb 0%, rgba(239, 232, 251, 0) 60%),
    radial-gradient(1100px 560px at 110% -10%, #efe4f9 0%, rgba(239, 228, 249, 0) 62%),
    linear-gradient(180deg, #f9f6ff 0%, var(--bg) 56%, var(--bg-soft) 100%);
  color: var(--text);
  line-height: 1.45;
  --sidebar-offset: 0px;
}

html {
  scroll-behavior: smooth;
}

h1, h2, h3, label, .tab {
  font-family: "Manrope", "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
}

.topbar {
  padding: 14px 22px;
  background: linear-gradient(110deg, #0a0418 0%, var(--brand-2) 35%, var(--brand) 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-soft);
}
.topbar > * {
  min-width: 0;
}
.topbar h1 { margin: 0; font-size: 1.35rem; letter-spacing: 0.02em; }
.muted { color: var(--muted); margin: 0; }
.topbar .muted { color: #d8e6df; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar .button.ghost {
  color: #f4fffa;
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.08);
}
.topbar .button.ghost:hover { background: rgba(255,255,255,0.16); }
.brand-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.brand-logo-sm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: transparent;
}
.brand-logo-lg {
  width: min(300px, 72vw);
  height: min(300px, 72vw);
  object-fit: contain;
  background: transparent;
  border: 0 !important;
  outline: 0;
  box-shadow: none !important;
  border-radius: 0;
  padding: 0;
  mix-blend-mode: multiply;
}

.site-notice-shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 10px auto 0;
}
.site-notice {
  margin: 0;
  padding: 11px 14px;
  border: 1px solid #e7cc7f;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff2ca 0%, #ffe8ad 100%);
  color: #5d4700;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(93, 71, 0, 0.12);
}

.theme-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 6px;
}
.theme-swatch {
  border-radius: 10px;
  border: 1px solid var(--line);
  min-height: 46px;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  overflow: visible;
}
.app-nav-wrap .app-nav {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  justify-content: center;
}
.app-nav-wrap {
  border-bottom: 1px solid rgba(208, 194, 236, 0.35);
  background: linear-gradient(110deg, #130a22 0%, #241143 55%, #2f1756 100%);
  box-shadow: 0 10px 20px rgba(20, 9, 37, 0.24);
  position: sticky;
  top: 0;
  z-index: 50;
  overflow: visible;
}
.app-sidebar-wrap {
  display: none;
}
.app-sidebar-toggle {
  display: none;
}
.app-nav-mobile-toggle {
  display: none;
}
.app-nav-link {
  display: inline-flex;
  white-space: nowrap;
  text-decoration: none;
  color: #f6efff;
  border: 1px solid rgba(226, 212, 248, 0.45);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 15px;
  font-weight: 600;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
  cursor: pointer;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 0.9rem;
}
.app-nav-link:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(236, 222, 255, 0.75);
}
.app-nav-link.active {
  background: #f2e8ff;
  color: #2e1454;
  border-color: #f2e8ff;
}
.app-nav-group {
  position: relative;
}
.app-nav-trigger {
  appearance: none;
  box-shadow: none !important;
  padding: 8px 15px;
  border: 1px solid rgba(226, 212, 248, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #f6efff;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.app-nav-trigger.active {
  background: #f2e8ff;
  color: #2e1454;
  border-color: #f2e8ff;
}
.app-nav-trigger::after {
  content: "▾";
  font-size: 0.75rem;
  line-height: 1;
  transition: transform .16s ease;
}
.app-nav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  border: 1px solid #d7c7ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(37, 18, 63, 0.15);
  padding: 6px;
  display: none;
  z-index: 60;
}
.app-nav-group.open .app-nav-trigger::after {
  transform: rotate(180deg);
}
.app-nav-dropdown-link {
  display: block;
  text-decoration: none;
  color: #33204f;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
  font-weight: 600;
}
.app-nav-dropdown-link:hover {
  background: #f2e8ff;
}
.app-nav-dropdown-link.active {
  background: #e9dcff;
  color: #25123f;
}
.app-nav-group:focus-within .app-nav-dropdown,
.app-nav-group.open .app-nav-dropdown {
  display: block;
}

@media (min-width: 901px) {
  body.sidebar-expanded {
    --sidebar-offset: var(--sidebar-width);
  }
  body.sidebar-collapsed {
    --sidebar-offset: 0px;
  }
  body.with-left-sidebar main,
  body.with-left-sidebar .site-footer,
  body.with-left-sidebar .site-notice-shell {
    width: min(1500px, calc(100vw - 32px - var(--sidebar-offset)));
    margin-left: auto;
    margin-right: auto;
    position: relative;
    left: calc(var(--sidebar-offset) / 2);
    transition: none;
  }
  .app-sidebar-wrap {
    display: block;
    position: fixed;
    top: var(--sidebar-top-offset, 0px);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100dvh - var(--sidebar-top-offset, 0px));
    border-right: 1px solid #bca9df;
    background: linear-gradient(180deg, #dbcdee 0%, #cfbde8 100%);
    box-shadow: 0 14px 26px rgba(32, 14, 57, 0.18);
    transform: translateX(calc(var(--sidebar-offset) - var(--sidebar-width)));
    transition: none;
    z-index: 70;
    overflow: visible;
    display: grid;
    grid-template-rows: auto 1fr;
  }
  .app-sidebar-user {
    padding: 14px 14px 10px;
    border-bottom: 1px solid rgba(91, 53, 145, 0.28);
    background: linear-gradient(180deg, rgba(255,255,255,0.46) 0%, rgba(255,255,255,0.22) 100%);
    display: grid;
    gap: 8px;
    justify-items: center;
    text-align: center;
  }
  .app-sidebar-avatar {
    width: 96px;
    height: 96px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.86);
    box-shadow: 0 8px 16px rgba(29, 12, 54, 0.2);
  }
  .app-sidebar-user-meta {
    display: grid;
    gap: 2px;
  }
  .app-sidebar-user-name,
  .app-sidebar-user-role {
    margin: 0;
  }
  .app-sidebar-user-name {
    font-size: 0.92rem;
    font-weight: 800;
    color: #27124a;
  }
  .app-sidebar-user-role {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #553e79;
    font-weight: 700;
  }
  .app-sidebar-day-pill {
    margin: 0;
    width: 100%;
    border: 1px solid #bda3e5;
    border-radius: 999px;
    padding: 8px 12px;
    background: linear-gradient(180deg, #f7f1ff 0%, #ede2ff 100%);
    color: #2c1750;
    font-size: 0.78rem;
    line-height: 1.35;
    font-weight: 700;
    text-align: center;
  }
  .app-sidebar-day-pill.is-empty {
    border-color: #d7c8a0;
    background: linear-gradient(180deg, #fff5d8 0%, #ffecc0 100%);
    color: #6a4f00;
  }
  .app-sidebar-logout {
    width: 100%;
    border-color: #b14b63 !important;
    background: linear-gradient(145deg, #ce5a74, #a33d57) !important;
    color: #fff !important;
    box-shadow: 0 8px 16px rgba(128, 39, 65, 0.24) !important;
  }
  .app-sidebar-logout:hover {
    border-color: #98344d !important;
    background: linear-gradient(145deg, #bf516a, #93324b) !important;
  }
  .app-sidebar-toggle {
    position: fixed;
    top: calc(var(--sidebar-top-offset, 0px) + 14px);
    left: 10px;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: 1px solid #b291de;
    background: linear-gradient(165deg, #ffffff 0%, #ecddff 100%);
    color: var(--brand);
    box-shadow: 0 12px 22px rgba(35, 16, 63, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 120;
    transition: none;
  }
  body.sidebar-ready.with-left-sidebar main,
  body.sidebar-ready.with-left-sidebar .site-footer,
  body.sidebar-ready.with-left-sidebar .site-notice-shell {
    transition: left .32s ease, width .32s ease;
  }
  body.sidebar-ready .app-sidebar-wrap {
    transition: transform .32s ease, top .2s ease, height .2s ease;
  }
  body.sidebar-ready .app-sidebar-toggle {
    transition: left .32s ease, top .2s ease, background .2s ease, border-color .2s ease;
  }
  .app-sidebar-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    transition: transform .22s ease;
  }
  .app-sidebar-toggle-icon svg {
    width: 100%;
    height: 100%;
    display: block;
  }
  body.sidebar-expanded .app-sidebar-toggle {
    left: calc(var(--sidebar-width) - 20px);
  }
  body.sidebar-collapsed .app-sidebar-toggle {
    left: 10px;
  }
  body.sidebar-collapsed .app-sidebar-toggle-icon {
    transform: rotate(180deg);
  }
  .app-sidebar-toggle:hover {
    transform: none;
    opacity: 1;
    border-color: #9a77ce;
    background: #efe2ff;
  }
  .app-sidebar-nav {
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 9px;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 14px 18px;
  }
  .app-sidebar-nav .app-nav-link,
  .app-sidebar-nav .app-nav-trigger {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    border-radius: 12px;
    color: #2d184e;
    border: 1px solid #c5b2e5;
    background: #f0e7fb;
    font-weight: 700;
  }
  .app-sidebar-nav .app-nav-link:hover,
  .app-sidebar-nav .app-nav-trigger:hover {
    background: #e8dafb;
    border-color: #aa8fda;
  }
  .app-sidebar-nav .app-nav-link.active,
  .app-sidebar-nav .app-nav-trigger.active {
    background: #4f2a86;
    border-color: #4f2a86;
    color: #fff;
  }
  .app-sidebar-nav .app-nav-group {
    width: 100%;
  }
  .app-sidebar-nav .app-nav-dropdown {
    position: static;
    top: auto;
    left: auto;
    min-width: 0;
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 5px 0 0 10px;
  }
  .app-sidebar-nav .app-nav-group:focus-within .app-nav-dropdown {
    display: none;
  }
  .app-sidebar-nav .app-nav-group.open .app-nav-dropdown {
    display: block;
  }
  .app-sidebar-nav .app-nav-dropdown-link {
    border: 1px solid #ccb9ea;
    background: #f6f0ff;
    margin-bottom: 6px;
    font-size: 0.86rem;
    color: #321d58;
  }
  .app-sidebar-nav .app-nav-dropdown-link:hover {
    background: #ebdcff;
    border-color: #aa8fda;
  }
  .app-sidebar-nav .app-nav-dropdown-link.active {
    background: #dfcdfd;
    color: #2c1750;
    border-color: #a786dc;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .app-sidebar-wrap,
  body.with-left-sidebar main,
  body.with-left-sidebar .site-footer {
    transition: none !important;
  }
}

.welcome-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 26px 18px;
  overflow: hidden;
}
.welcome-card .actions {
  justify-content: center;
}
.welcome-card * {
  max-width: 100%;
}
.welcome-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 0;
  box-shadow: 0 4px 12px rgba(37, 18, 63, 0.12);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  margin: 0 auto 12px !important;
  display: block;
}
.welcome-card h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  overflow-wrap: anywhere;
}
.welcome-date {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #32424f;
  overflow-wrap: anywhere;
}
.welcome-prompt {
  margin: 0;
  color: #5a6771;
  font-size: 0.93rem;
  overflow-wrap: anywhere;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 39, 0.46);
  z-index: 120;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, 100vw);
  height: 100vh;
  background: #fdfbff;
  box-shadow: var(--shadow-strong);
  z-index: 130;
  display: flex;
  flex-direction: column;
}
.drawer.hidden,
.drawer-backdrop.hidden { display: none; }
.edit-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(980px, calc(100vw - 24px));
  height: min(86vh, 900px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-strong);
  z-index: 150;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.edit-modal.hidden { display: none; }

.preview-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 39, 0.5);
  z-index: 140;
}
.preview-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(980px, calc(100vw - 20px));
  height: min(86vh, 920px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-strong);
  z-index: 150;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.preview-modal.hidden,
.preview-backdrop.hidden { display: none; }
.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f0ff;
}
.preview-head h3 {
  margin: 0;
  font-size: 1rem;
}
.preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.ai-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 39, 0.46);
  z-index: 160;
}
.ai-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 24px));
  max-height: min(86vh, 760px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-strong);
  z-index: 170;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f6f0ff;
}
.ai-modal-head h3 {
  margin: 0;
}
.ai-modal-body {
  padding: 14px;
  overflow: auto;
  display: grid;
  gap: 10px;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f6f0ff;
}
.drawer-body {
  padding: 16px 18px 30px;
  overflow: auto;
  display: grid;
  gap: 12px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}
.layout.has-right-panel {
  transition: grid-template-columns .28s ease;
}
.layout-right-panel {
  transition: opacity .2s ease, transform .28s ease, padding .28s ease, border-color .28s ease, box-shadow .28s ease;
}
.layout.layout-single {
  grid-template-columns: 1fr;
}
.layout-right-toggle-wrap {
  width: min(1500px, calc(100vw - 32px - var(--sidebar-offset)));
  margin: 12px auto -6px;
  display: flex;
  justify-content: flex-end;
  position: relative;
  left: calc(var(--sidebar-offset) / 2);
}
.layout-right-toggle {
  min-width: 178px;
}
body.right-panel-collapsed .layout.has-right-panel .layout-right-panel {
  display: none;
}
body.right-panel-collapsed .layout.has-right-panel {
  grid-template-columns: 1fr;
}
.panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  min-height: 80vh;
  min-width: 0;
}
.panel h2 {
  margin: 18px 0 12px;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.25;
}
.panel h3 {
  margin: 16px 0 10px;
  font-size: 0.96rem;
  font-weight: 800;
  line-height: 1.25;
}
.panel > h2:first-child,
.panel > h3:first-child {
  margin-top: 0;
}
.panel > * + h2 {
  margin-top: 24px;
}
.panel > * + h3 {
  margin-top: 20px;
}
.panel p,
.panel label,
.muted {
  font-size: 0.93rem;
  line-height: 1.4;
}
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.form-grid, .inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.inline-grid { grid-template-columns: repeat(5, 1fr); margin-bottom: 10px; }
.filter-print-tools {
  display: flex;
  gap: 8px;
  margin: 2px 0 14px;
  padding: 10px 12px;
  border: 1px solid #d8ccef;
  border-radius: 14px;
  background: #f8f4ff;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}
.summary-controls {
  grid-template-columns: 1fr 1fr;
  margin-top: -6px;
  margin-bottom: 10px;
}
.mobile-collapsible {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #faf8ff;
  margin: 8px 0 10px;
  overflow: hidden;
}
.mobile-collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.mobile-collapsible > summary::-webkit-details-marker {
  display: none;
}
.mobile-collapsible > summary::after {
  content: "▾";
  font-size: 0.9rem;
  transition: transform .18s ease;
}
.mobile-collapsible[open] > summary::after {
  transform: rotate(180deg);
}
.mobile-collapsible-body {
  padding: 2px 12px 12px;
}
.filter-print-tools .button {
  min-width: 140px;
  padding: 9px 14px;
  font-size: 0.9rem;
  border-radius: 10px;
}
.slot-filter-form { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
#planFilterForm {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  padding: 10px 12px;
  border: 1px solid #d8ccef;
  border-radius: 14px;
  background: #f8f4ff;
  align-items: center;
}
.slot-filter-form {
  padding: 10px 12px;
  border: 1px solid #d8ccef;
  border-radius: 14px;
  background: #f8f4ff;
  align-items: center;
}
.summary-action-group {
  padding: 10px 12px;
  border: 1px solid #d8ccef;
  border-radius: 14px;
  background: #f8f4ff;
  display: grid;
  gap: 8px;
}
.summary-action-group .filter-print-tools {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.summary-buttons {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  align-items: end;
}
.summary-buttons-title {
  margin: 0 0 -2px;
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #5d4a81;
}
.summary-btn-form {
  display: grid;
  width: 100%;
}
#quickFilterPrintForm.summary-btn-form {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}
#weeklySummaryForm.summary-btn-form {
  grid-template-columns: minmax(220px, 1fr);
  max-width: none;
  justify-self: stretch;
}
.slot-list-scroll {
  margin-top: 8px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.slot-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
.slot-table th,
.slot-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e6e0d4;
  text-align: left;
  font-size: 0.86rem;
}
.slot-table th {
  background: #f8f4ea;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
label { margin-top: 4px; font-size: 0.9rem; color: #555; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  font-size: 0.93rem;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, transform .08s ease;
}
textarea { min-height: 86px; resize: vertical; }
input[type="checkbox"],
input[type="radio"] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  margin: 0;
  border-radius: 6px;
  accent-color: var(--brand);
  box-shadow: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #7a56b3;
  box-shadow: 0 0 0 3px rgba(122, 86, 179, 0.16);
}

.form-grid > .full-span,
.form-grid > .actions,
.form-grid > .card,
.form-grid > .reflection-helper-card,
.form-grid > .no-lesson-card {
  grid-column: 1 / -1;
}

.form-grid > label.full-span {
  margin-top: 2px;
}

.plan-reflection-area {
  min-height: 170px;
  line-height: 1.45;
  background: #fcf9ff;
}

.reflection-helper-card {
  border: 1px solid #d7c8ef;
  background: linear-gradient(180deg, #faf6ff 0%, #f0e8fb 100%);
  padding: 18px;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.reflection-helper-card h3 {
  margin: 2px 0 6px;
  font-size: 1.05rem;
}

.reflection-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.reflection-top-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr;
  gap: 10px;
}

.reflection-helper-card label {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
  font-weight: 600;
  color: #37434f;
  font-family: "Manrope", "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
}
.reflection-helper-card .field-optional {
  font-size: 0.78rem;
  font-weight: 600;
  color: #70808d;
  margin-left: 6px;
}

.reflection-helper-card textarea {
  min-height: 96px;
}

.reflection-helper-card select[multiple] {
  min-height: 130px;
  padding-top: 8px;
  background: #fbfefd;
}

.reflection-helper-card .actions {
  margin-top: 12px;
}

.ref-improve-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.ref-improve-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d7c8ef;
  border-radius: 12px;
  background: #fff;
  margin: 0 !important;
  font-family: "Manrope", "Segoe UI", sans-serif !important;
  font-size: 0.96rem !important;
  font-weight: 600 !important;
  color: #37434f !important;
  letter-spacing: 0.01em !important;
  cursor: pointer;
}

.ref-improve-item:hover {
  border-color: #b497df;
  background: #f5eeff;
}

.lesson-form-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
}
.lesson-form-chip {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 !important;
  padding: 10px 12px;
  border: 1px solid #d7c8ef;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  color: #3a2660 !important;
}
.lesson-form-chip:hover {
  border-color: #b497df;
  background: #f5eeff;
}
.lesson-form-chip input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
}
.lesson-form-hint {
  grid-column: 1 / -1;
  margin-top: -6px;
}

.no-lesson-card {
  border: 1px solid #dfddd1;
  background: linear-gradient(180deg, #fffdf7 0%, #f8f4e8 100%);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.check-lg {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: #37434f;
}
.check-lg.compact {
  font-size: 0.95rem;
  font-weight: 600;
}

.no-lesson-card .no-lesson-label {
  margin: 0;
  font-size: 0.86rem;
  font-family: "Manrope", "Segoe UI", sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #66737f;
  font-weight: 700;
}

.list-tools {
  display: grid;
  gap: 10px;
  margin: 4px 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8f2ff;
}
.list-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.list-tools-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.list-tools-print {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.list-tools .button {
  min-width: 130px;
  padding: 9px 14px;
  font-size: 0.92rem;
  border-radius: 10px;
}

.button, button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: 11px;
  padding: 9px 14px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  transition: transform .08s ease, box-shadow .18s ease, opacity .18s ease, background .18s ease, border-color .18s ease;
  box-shadow: 0 4px 12px rgba(58, 29, 99, 0.18);
}
.button:hover, button:hover { opacity: 0.96; transform: translateY(-1px); }
.button.ghost {
  background: #f6f0ff;
  color: var(--brand);
  border-color: #b79edb;
  box-shadow: none;
}
.button.danger {
  background: #f1e2df;
  color: var(--danger);
  border-color: #e3b9b1;
}
.filter-apply-btn,
.export-pdf-btn {
  background: linear-gradient(145deg, #4f2a86, #381c68);
  border-color: #4f2a86;
  color: #fff;
}
.filter-reset-btn,
.selection-btn,
.print-action-btn {
  background: linear-gradient(145deg, #e9ddfb, #d9c8f4);
  border-color: #9f85cb;
  color: #351b61;
  box-shadow: 0 3px 9px rgba(53, 27, 97, 0.12);
}
.filter-reset-btn:hover,
.selection-btn:hover,
.print-action-btn:hover {
  background: linear-gradient(145deg, #e1d1f8, #cfb8ee);
  border-color: #8162b7;
}
.weekly-summary-btn {
  background: linear-gradient(145deg, #1c7f87, #14636a);
  border-color: #1c7f87;
  color: #fff;
}
.export-csv-btn {
  background: linear-gradient(145deg, #2a5fa0, #234f86);
  border-color: #2a5fa0;
  color: #fff;
}
.delete-selected-btn {
  background: linear-gradient(145deg, #c45669, #a14054) !important;
  border-color: #a14054 !important;
  color: #fff !important;
}

/* Compact action controls in planner content (not nav) */
.slot-filter-form .button,
#planFilterForm .button,
#quickFilterPrintForm .button,
#weeklySummaryForm .button,
#plansExportForm .button,
#plansList .button,
.table .button {
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 10px;
  min-height: 38px;
  justify-content: center;
}
.slot-filter-form .slot-filter-action {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  border-radius: 14px;
  font-size: 0.97rem;
}
.slot-filter-form .button,
#planFilterForm .button,
#quickFilterPrintForm .button,
#weeklySummaryForm .button,
.bulk-actions-box .button {
  margin-inline: auto;
}
#planFilterForm select,
#planFilterForm .button {
  min-height: 54px;
  font-size: 0.97rem;
}
#planFilterForm .button {
  width: 100%;
  border-radius: 14px;
}
#quickFilterPrintForm .button,
#weeklySummaryForm .button {
  min-height: 54px;
  width: 100%;
  border-radius: 14px;
  font-size: 0.97rem;
}

#plansList .actions .button {
  padding: 6px 10px;
  min-height: 32px;
  font-size: 0.88rem;
}
.planner-shortcuts {
  margin-top: 4px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #d9cef0;
  border-radius: 14px;
  background: #f8f3ff;
  justify-content: center;
}
.planner-shortcuts .button {
  min-height: 44px;
  min-width: 250px;
  font-size: 0.95rem;
}
.ai-suggest-shortcut {
  justify-content: center;
}
.ai-suggest-shortcut .button {
  min-width: min(460px, 100%);
  gap: 10px;
}
.ai-suggest-shortcut .button.ghost {
  background: linear-gradient(145deg, #4f2a86, #381c68);
  border-color: #4f2a86;
  color: #fff;
  box-shadow: 0 4px 12px rgba(58, 29, 99, 0.24);
}
.ai-suggest-shortcut .button.ghost:hover {
  background: linear-gradient(145deg, #45257a, #31185b);
  border-color: #45257a;
}
.ai-suggest-icon {
  font-size: 1.05rem;
  line-height: 1;
}
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.bulk-actions-box {
  padding: 10px 12px;
  border: 1px solid #d8ccef;
  border-radius: 14px;
  background: #f8f4ff;
  justify-content: center;
}
.class-list-editor {
  display: grid;
  gap: 8px;
}
.class-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.class-remove-btn {
  white-space: nowrap;
}
.cards { display: grid; gap: 10px; }
#savedPlanFilterForm {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  align-items: center;
}
.saved-print-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
}
#savedQuickPrintForm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
#savedSummaryForm {
  display: grid;
  grid-template-columns: 1fr;
}
#savedPlansList {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}
#savedPlansList .plan-card {
  min-height: 320px;
  display: flex;
  flex-direction: column;
}
#savedPlansList .plan-card .actions {
  margin-top: auto;
}
.timetable-series-row {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}
.timetable-series-row .series-field {
  display: grid;
  gap: 6px;
}
.timetable-series-row .series-field label {
  margin: 0;
}
.timetable-toolbar-actions {
  margin-top: 0;
  margin-bottom: 0;
  flex-wrap: nowrap;
}
.timetable-toolbar-actions .button {
  min-width: 0;
  white-space: nowrap;
}
.timetbl-block {
  margin-top: 12px;
  padding: 14px;
}
.timetbl-block h3 {
  margin: 0 0 10px;
}
.timetable-glance-card {
  margin-top: 12px;
}
.timetable-glance-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}
.timetable-glance-head h3 {
  margin: 0;
}
.timetable-glance-head .muted {
  margin: 0;
}
.timetable-glance-controls {
  display: grid;
  gap: 4px;
  min-width: 220px;
}
.timetable-glance-controls label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}
.timetable-glance-controls select {
  min-height: 36px;
}
.timetable-glance-card .js-tg-meta {
  margin: 8px 0;
}
.timetable-glance-table {
  min-width: 0;
  table-layout: fixed;
}
.timetable-glance-table th,
.timetable-glance-table td {
  font-size: 0.84rem;
  padding: 8px 10px;
}
.timetable-glance-table .tg-day {
  font-weight: 800;
  white-space: nowrap;
  vertical-align: top;
}
.timetable-glance-table .tg-line {
  line-height: 1.35;
  padding: 1px 0;
}
.timetable-glance-table .tg-line + .tg-line {
  border-top: 1px dashed #e6def5;
  margin-top: 2px;
  padding-top: 3px;
}
.import-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.pagination-wrap {
  margin-top: 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
#plansPagination,
#plansPaginationTop {
  align-items: center;
}
#plansPagination .pagination-controls,
#plansPaginationTop .pagination-controls {
  justify-content: center;
}
#savedPlansPaginationTop,
#savedPlansPaginationBottom {
  align-items: center;
}
#savedPlansPaginationTop .pagination-controls,
#savedPlansPaginationBottom .pagination-controls {
  justify-content: center;
}
.pagination-info {
  font-size: 0.94rem;
  color: var(--muted);
  margin-right: 0;
}
.pagination-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.pagination-wrap .button {
  min-width: 50px;
  min-height: 42px;
  padding: 9px 14px;
  font-size: 0.95rem;
}
.pagination-wrap .button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(37, 18, 63, 0.08);
}
.plan-card {
  position: relative;
  padding-top: 40px;
}
.plan-card.plan-exam {
  border-color: #d4b2ff;
  box-shadow: 0 6px 16px rgba(90, 26, 161, 0.16);
  background: linear-gradient(180deg, #ffffff 0%, #fcf9ff 100%);
}
.plan-card.plan-no-lesson {
  border-color: #e5bfd8;
  background: linear-gradient(180deg, #ffffff 0%, #fff9fc 100%);
}
.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  margin: 0;
  position: absolute;
  top: 12px;
  right: 12px;
}
.plan-chip.exam {
  color: #4b157e;
  background: #f4e9ff;
  border-color: #cfa7f8;
}
.plan-chip.no-lesson {
  color: #7d2a56;
  background: #ffeef6;
  border-color: #f2bdd7;
}
.blocked {
  opacity: 0.55;
  background: #ededed !important;
}
.blocked * {
  pointer-events: none;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.table-wrap.no-scroll {
  overflow: visible;
}
.table-wrap.no-scroll .table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}
.table-wrap.no-scroll .table th,
.table-wrap.no-scroll .table td {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.table th,
.table td {
  border-bottom: 1px solid #e6e0d4;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
}
.table th {
  background: #f8f4ea;
  font-weight: 700;
}
.code-block {
  margin: 8px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9f8f4;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
}
.card h3 { margin: 6px 0; }
.card h3 { font-size: 0.98rem; line-height: 1.28; }
.select-line { display: flex; gap: 8px; align-items: center; }
.profile-photo-lg {
  width: 160px;
  height: 160px;
  max-width: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 0;
  box-shadow: 0 6px 14px rgba(37, 18, 63, 0.12);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  margin-top: 8px;
  display: block;
}
.school-badge-preview {
  width: 140px;
  height: 140px;
  max-width: 100%;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  display: block;
  margin-top: 8px;
}
.alert { padding: 10px; border-radius: 10px; margin: 10px 0; }
.alert.success { background: #eee6ff; color: #3a1d63; }
.alert.error { background: #fceaea; color: #842727; }
.alert { transition: opacity .45s ease, transform .45s ease; }
.alert.fade-out { opacity: 0; transform: translateY(-4px); }

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
}
.toast {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-strong);
  color: var(--text);
  padding: 10px 12px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}
.toast.success {
  border-left-color: var(--brand);
}
.toast.error {
  border-left-color: #a13968;
  background: #fff7fb;
}
.toast-body {
  font-size: 0.95rem;
  line-height: 1.35;
}
.toast-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
  box-shadow: none;
}
.toast-close:hover {
  color: var(--text);
  transform: none;
  opacity: 1;
}

.to-top-btn {
  position: fixed;
  right: 16px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.24);
  background: linear-gradient(145deg, #4e2a86, #2a1346);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(28, 9, 54, 0.35);
  z-index: 1600;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, box-shadow .2s ease;
}
.to-top-btn.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.to-top-btn:hover {
  box-shadow: 0 14px 24px rgba(28, 9, 54, 0.42);
}

.app-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 39, 0.28);
  display: grid;
  place-items: center;
  z-index: 9999;
}
.app-loading-overlay.hidden { display: none; }
.app-spinner {
  width: 56px;
  height: 56px;
  border: 5px solid rgba(255, 255, 255, 0.34);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 24px;
  background:
    radial-gradient(1100px 600px at -10% -20%, rgba(98, 64, 154, 0.38) 0%, rgba(98, 64, 154, 0) 62%),
    radial-gradient(900px 500px at 110% -10%, rgba(73, 36, 126, 0.34) 0%, rgba(73, 36, 126, 0) 58%),
    linear-gradient(180deg, #120823 0%, #22103d 45%, #34195b 100%);
}

.auth-landing {
  width: min(640px, 100%);
  margin: 0 auto;
  background: rgba(255,255,255,0.9);
  border: 1px solid #dbcff1;
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow-strong);
}
.auth-landing h1 {
  margin: 8px 0 0;
  font-size: clamp(1.65rem, 3.8vw, 2.55rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-align: center;
  color: #12222f;
}
.auth-tagline {
  margin: 8px 0 2px;
  text-align: center;
  color: #4d5c67;
  font-size: clamp(0.94rem, 1.75vw, 1.08rem);
  font-weight: 500;
}
.auth-logo-clean {
  filter: drop-shadow(0 8px 18px rgba(37, 18, 63, 0.2));
  mix-blend-mode: multiply;
  border: 0 !important;
  box-shadow: none !important;
  outline: 0;
  background: transparent !important;
}
.auth-cta-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 18px 0 4px;
}
.auth-cta-row .button {
  font-size: 1rem;
  padding: 11px 18px;
  border-radius: 14px;
  width: min(460px, 100%);
  justify-content: center;
  text-align: center;
}
.google-delima-btn {
  width: min(460px, 100%);
  max-width: 100%;
  background: #db4437;
  border: 1px solid #c53929;
  color: #ffffff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 14px;
}
.google-delima-btn:hover,
.google-delima-btn:focus-visible {
  background: #c53929;
  color: #ffffff;
}
.google-delima-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 39, 0.48);
  z-index: 200;
}

.auth-modal {
  position: fixed;
  z-index: 210;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(520px, 94vw);
  background: #fdfbff;
  border: 1px solid #dbcff1;
  border-radius: 20px;
  box-shadow: var(--shadow-strong);
}

.auth-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e1d5f5;
  background: #f6f0ff;
  border-radius: 20px 20px 0 0;
}

.auth-modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #2b1746;
}

.auth-modal-body {
  padding: 16px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  margin-top: 4px;
  margin-bottom: 2px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #35424e;
}
.auth-form input {
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.95rem;
}
.auth-form button {
  margin-top: 10px;
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 0.96rem;
  font-weight: 700;
}

.site-footer {
  margin: 20px 0 10px;
  padding: 10px 14px 4px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  width: min(640px, 100%);
}

.mobile-jump-saved {
  display: none;
}

@media (max-width: 900px) {
  #savedPlanFilterForm {
    grid-template-columns: 1fr 1fr;
  }
  .saved-print-row {
    grid-template-columns: 1fr;
  }
  #savedQuickPrintForm {
    grid-template-columns: 1fr;
  }
  #savedPlansList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body {
    --sidebar-offset: 0px !important;
  }
  body.with-left-sidebar,
  body.sidebar-expanded,
  body.sidebar-collapsed {
    padding-left: 0 !important;
  }
  .app-sidebar-wrap {
    display: none !important;
  }
  .layout { grid-template-columns: 1fr; }
  .inline-grid { grid-template-columns: 1fr 1fr; }
  .timetable-series-row { grid-template-columns: 1fr; }
  .timetable-toolbar-actions { flex-wrap: wrap; }
  .timetable-glance-controls { width: 100%; min-width: 0; }
  .import-two-col { grid-template-columns: 1fr; }
  .slot-filter-form { grid-template-columns: 1fr 1fr; }
  #planFilterForm { grid-template-columns: 1fr 1fr; }
  #quickFilterPrintForm.summary-btn-form {
    grid-template-columns: 1fr;
  }
  #weeklySummaryForm.summary-btn-form {
    max-width: none;
  }
  .summary-buttons {
    grid-template-columns: 1fr;
  }
  .form-grid { grid-template-columns: 1fr; }
  .class-row { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .app-nav {
    padding: 8px 10px;
    overflow-x: visible;
    overflow-y: visible;
    flex-wrap: wrap;
  }
  .app-nav-dropdown {
    position: absolute;
    left: 0;
    right: auto;
    min-width: 200px;
  }
  .drawer {
    width: 100vw;
    max-width: 100vw;
  }
  .brand-logo-lg {
    width: 300px;
    height: 300px;
  }
  .reflection-top-row {
    grid-template-columns: 1fr;
  }
  .ref-improve-grid {
    grid-template-columns: 1fr;
  }
  .list-tools {
    align-items: flex-start;
  }
  .list-tools-row {
    flex-direction: column;
    align-items: stretch;
  }
  .list-tools-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }
  .list-tools-print {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 901px) {
  body.right-panel-collapsed .layout.has-right-panel {
    grid-template-columns: minmax(0, 1fr) 0;
  }
  body.right-panel-collapsed .layout.has-right-panel .layout-right-panel {
    display: block;
    opacity: 0;
    transform: translateX(24px);
    pointer-events: none;
    overflow: hidden;
    padding-left: 0;
    padding-right: 0;
    border-color: transparent;
    box-shadow: none;
  }
}

@media (max-width: 640px) {
  #savedPlanFilterForm {
    grid-template-columns: 1fr;
  }
  #savedPlansList {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 12px 14px;
    align-items: flex-start;
    display: grid;
    grid-template-columns: 1fr;
  }
  .topbar h1 {
    font-size: 1.05rem;
    line-height: 1.25;
    word-break: break-word;
  }
  .layout {
    padding: 10px;
    gap: 12px;
  }
  .brand-nav {
    width: 100%;
  }
  .topbar-actions {
    width: auto;
    justify-content: flex-end;
  }
  .topbar .muted {
    font-size: 0.82rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }
  .panel {
    padding: 14px;
    border-radius: 14px;
    min-height: auto;
  }
  .app-nav-wrap {
    position: static;
    background: linear-gradient(110deg, #130a22 0%, #241143 55%, #2f1756 100%);
    border-bottom: 1px solid rgba(208, 194, 236, 0.35);
    box-shadow: 0 10px 20px rgba(20, 9, 37, 0.24);
  }
  .app-nav-mobile-toggle {
    display: inline-flex;
    width: calc(100% - 20px);
    margin: 10px;
    justify-content: center;
    border: 1px solid rgba(226, 212, 248, 0.45);
    background: rgba(255, 255, 255, 0.12);
    color: #f6efff;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.9rem;
    font-weight: 700;
  }
  .app-nav {
    display: none;
    grid-template-columns: 1fr;
    gap: 8px;
    overflow: visible;
    position: static;
    padding: 0 10px 10px;
    width: 100%;
    max-width: 100%;
  }
  .app-nav-wrap.open .app-nav {
    display: grid;
  }
  .app-nav-link,
  .app-nav-trigger {
    width: 100%;
    justify-content: center;
    text-align: center;
    color: #f6efff;
    border: 1px solid rgba(226, 212, 248, 0.45);
    background: rgba(255, 255, 255, 0.12);
  }
  .app-nav-link.active,
  .app-nav-trigger.active {
    background: #f2e8ff;
    color: #2e1454;
    border-color: #f2e8ff;
  }
  .app-nav-group {
    width: 100%;
  }
  .app-nav-dropdown {
    position: static;
    min-width: 0;
    width: 100%;
    margin-top: 6px;
    box-shadow: none;
  }
  .inline-grid,
  .slot-filter-form {
    grid-template-columns: 1fr;
  }
  #planFilterForm {
    grid-template-columns: 1fr;
  }
  .summary-controls {
    grid-template-columns: 1fr;
  }
  .filter-print-tools {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  #quickFilterPrintForm.summary-btn-form,
  #weeklySummaryForm.summary-btn-form {
    grid-template-columns: 1fr;
  }
  .summary-buttons {
    grid-template-columns: 1fr;
  }
  .mobile-collapsible {
    margin: 6px 0 10px;
  }
  .mobile-collapsible > summary {
    font-size: 0.92rem;
    padding: 10px 11px;
  }
  .mobile-collapsible-body {
    padding: 2px 10px 10px;
  }
  .actions .button,
  .actions button {
    width: 100%;
    justify-content: center;
  }
  .brand-logo-lg {
    width: min(220px, 62vw);
    height: min(220px, 62vw);
  }
  .auth-landing {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    border-radius: 18px;
  }
  .auth-body {
    padding: 12px;
    justify-content: flex-start;
  }
  .auth-landing h1 {
    font-size: clamp(1.45rem, 7.2vw, 2rem);
  }
  .auth-tagline {
    font-size: 0.9rem;
  }
  .auth-cta-row .button {
    width: 100%;
    text-align: center;
  }
  .google-delima-btn {
    width: 100%;
  }
  .mobile-jump-saved {
    display: inline-flex;
    position: fixed;
    right: 12px;
    bottom: 14px;
    z-index: 85;
    text-decoration: none;
    border: 1px solid #b79edb;
    background: #3a1d63;
    color: #fff;
    border-radius: 999px;
    padding: 9px 13px;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(34, 14, 62, 0.28);
  }
  .welcome-card {
    padding: 16px 12px;
  }
  .welcome-card h2 {
    font-size: clamp(1.02rem, 5.8vw, 1.28rem);
    line-height: 1.25;
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-align: center;
  }
  .welcome-date,
  .welcome-prompt {
    font-size: 0.98rem;
    line-height: 1.4;
    text-align: center;
  }
  .welcome-avatar {
    width: 88px;
    height: 88px;
    margin: 0 auto 10px !important;
  }
  .panel,
  .card,
  .layout {
    max-width: 100%;
  }
}

@media (min-width: 1500px) {
  #savedPlansList {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 641px) {
  .mobile-collapsible {
    border: 0;
    background: transparent;
    margin: 4px 0 8px;
  }
  .mobile-collapsible > summary {
    display: none;
  }
  .mobile-collapsible > .mobile-collapsible-body {
    display: block !important;
    padding: 0;
  }
  .mobile-collapsible.desktop-collapsible {
    border: 1px solid var(--line);
    background: #faf8ff;
    margin: 8px 0 10px;
  }
  .mobile-collapsible.desktop-collapsible > summary {
    display: flex;
  }
  .mobile-collapsible.desktop-collapsible > .mobile-collapsible-body {
    display: none !important;
    padding: 2px 12px 12px;
  }
  .mobile-collapsible.desktop-collapsible[open] > .mobile-collapsible-body {
    display: block !important;
  }
}
