:root {
  /* MAIN THEME */
  --bg: #0b0f1a;
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);

  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);

  /* SIDEBAR THEME */
  --side-bg: rgba(255, 255, 255, 0.04);
  --side-border: rgba(255, 255, 255, 0.1);
  --side-active: rgba(255, 255, 255, 0.1);
  --side-hover: rgba(255, 255, 255, 0.06);

  --radius: 18px;
  --sidebar-w: 280px;
}

body.light {
  --bg: #e9edf3;
  --text: rgba(10, 14, 22, 0.88);
  --muted: rgba(10, 14, 22, 0.6);

  --card: rgba(0, 0, 0, 0.035);
  --card2: rgba(0, 0, 0, 0.05);
  --border: rgba(0, 0, 0, 0.12);
  --shadow: 0 14px 36px rgba(10, 20, 60, 0.14);

  --side-bg: rgba(0, 0, 0, 0.035);
  --side-border: rgba(0, 0, 0, 0.12);
  --side-active: rgba(0, 0, 0, 0.075);
  --side-hover: rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}
html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  background:
    radial-gradient(
      1200px 700px at 20% 10%,
      rgba(0, 181, 217, 0.22),
      transparent 55%
    ),
    radial-gradient(
      900px 600px at 80% 30%,
      rgba(255, 140, 50, 0.16),
      transparent 55%
    ),
    var(--bg);
  color: var(--text);
}

html {
  background:
    radial-gradient(
      1200px 700px at 20% 10%,
      rgba(0, 181, 217, 0.22),
      transparent 55%
    ),
    radial-gradient(
      900px 600px at 80% 30%,
      rgba(255, 140, 50, 0.16),
      transparent 55%
    ),
    var(--bg);
}

/* Auth loading gate */
.auth-loading {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-loading-card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  text-align: center;
}

.auth-loading-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-loading-sub {
  color: var(--muted);
  font-size: 13px;
}

body.auth-pending .auth-loading {
  display: flex;
}

body.auth-pending .app {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

/* LOGIN */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-wrap {
  width: min(520px, 100%);
}

.login-card {
  display: grid;
  gap: 14px;
  text-align: center;
}

.login-logo {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  object-fit: cover;
  margin: 0 auto;
  border: 1px solid var(--border);
}

.login-title {
  margin: 0;
  font-size: 22px;
}

.login-form {
  display: grid;
  gap: 12px;
  text-align: left;
}

/* APP LAYOUT */
.app {
  min-height: 100vh;
  height: auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* SIDEBAR */
.sidebar {
  padding: 22px 16px;
  border-right: 1px solid var(--side-border);
  background: linear-gradient(180deg, var(--side-bg), transparent);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.sidebar-toggle {
  display: none;
  width: 100%;
  margin: 12px 0 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--side-border);
  background: var(--side-bg);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-toggle .toggle-ico {
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--text);
  border-bottom: 2px solid var(--text);
  transform: rotate(45deg);
  display: inline-block;
}

.sidebar-mobile-actions {
  display: none;
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-radius: 12px;
  border: none;
  background: transparent;
}

.sidebar-mobile-actions .topbar-right {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 16px;
}

.avatar-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden; /* <- circle crop */
  border: 2px solid var(--side-border);
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-placeholder {
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  user-select: none;
}

.welcome-title {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.1;
}

.nav-title {
  margin: 18px 10px 10px;
  font-weight: 800;
  font-size: 22px;
}

.nav {
  display: grid;
  gap: 8px;
  padding: 0 6px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 6px 0;
}

.signout-btn {
  width: 100%;
  justify-content: center;
}

.nav-signout {
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  width: 100%;
  font: inherit;
  display: none;
}

.nav-signout:hover {
  background: var(--side-hover);
  border-color: var(--side-border);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
}

.nav-link:hover {
  background: var(--side-hover);
  border-color: var(--side-border);
}

.nav-link.active {
  background: var(--side-active);
  border-color: var(--side-border);
}

.nav-ico {
  width: 28px;
  text-align: center;
  opacity: 0.9;
}

.nav-link[data-page="dashboard"] .nav-ico {
  color: #4aa3ff;
}

.nav-link[data-page="calendar"] .nav-ico {
  color: #3ecf8e;
}

.nav-link[data-page="notebook"] .nav-ico {
  color: #f0b429;
}

.nav-link[data-page="email"] .nav-ico {
  color: #8b5cf6;
}

/* MAIN */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  max-width: 1050px;
  margin: 0 auto;
  width: 100%;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.3px;
}

.grid {
  max-width: 1050px;
  margin: 0 auto;
  padding: 0 22px 22px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  width: 100%;
}

.card {
  grid-column: span 6;
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  backdrop-filter: blur(10px);
}

.hero {
  grid-column: span 12;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
  align-items: center;
}

.clock {
  font-size: clamp(34px, 4.5vw, 58px);
  font-weight: 800;
  letter-spacing: 1px;
}

.date {
  margin-top: 6px;
  color: var(--muted);
}

.greeting {
  margin: 0 0 10px 0;
  font-size: clamp(22px, 3vw, 34px);
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.field span {
  color: var(--muted);
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  padding: 12px 12px;
  outline: none;
}

body.light input,
body.light textarea {
  background: rgba(255, 255, 255, 0.7);
}

input:focus,
textarea:focus {
  border-color: rgba(0, 181, 217, 0.65);
}

input[type="checkbox"] {
  width: 20%;
}

.textarea {
  min-height: 150px;
  resize: vertical;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.card-title h2 {
  margin: 0;
  font-size: 18px;
}

.row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0px);
}

.btn.subtle {
  padding: 8px 10px;
  background: transparent;
}

.btn.icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
  padding: 10px 12px;
  border-radius: 12px;
}

body.light .item {
  background: rgba(255, 255, 255, 0.7);
}

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

.item .text {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
  width: 100%;
  min-width: 0;
}

body.calendar-page .grid {
  padding-left: 0;
  padding-right: 0;
}

.checkbox {
  background-color: red;
}

.item.done .text {
  text-decoration: line-through;
  opacity: 0.65;
}

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
}

.chart {
  grid-column: span 12;
}

.widget-placeholder {
  grid-column: span 12;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.widget-add-box {
  width: min(420px, 100%);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  display: grid;
  gap: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
}

.widget-plus {
  font-size: 32px;
  font-weight: 700;
}

.widget-modal-card {
  width: min(520px, 100%);
}

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

.widget-option {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.widget-option:hover {
  border-color: rgba(0, 181, 217, 0.6);
}

.widget-option-title {
  font-weight: 700;
}

.widget-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.widget-half {
  grid-column: span 6;
}

.weather-body {
  display: grid;
  gap: 6px;
}

.weather-temp {
  font-size: 28px;
  font-weight: 700;
}

.weather-location {
  font-weight: 600;
}

.weather-icon {
  width: 44px;
  height: 44px;
  color: var(--text);
}

.weather-icon-sun {
  color: #f5c542;
}

.weather-icon-rain {
  color: #4aa3ff;
}

.weather-icon-moon {
  color: #b3b7c6;
}

.weather-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.weather-controls {
  margin-top: 6px;
  display: grid;
  gap: 8px;
}

.weather-search {
  display: flex;
  gap: 8px;
}

.weather-input {
  flex: 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

body.light .weather-input {
  background: rgba(255, 255, 255, 0.7);
}

.chart-placeholder {
  height: 360px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.08);
}

.tv-wrap {
  height: 420px; /* Bitbo-ish size */
  border-radius: 14px;
  overflow: hidden; /* keeps rounded corners */
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.08);
}

body.light .tv-wrap {
  background: rgba(255, 255, 255, 0.6);
}

/* The widget injects an iframe/div inside this container */
#tv-advanced-chart,
.tv-advanced-chart {
  width: 100%;
  height: 100%;
}

body.light .chart-placeholder {
  background: rgba(255, 255, 255, 0.6);
}

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

.footer {
  max-width: 1050px;
  margin: 0 auto;
  padding: 0 22px 22px;
  width: 100%;
}

/* RESPONSIVE */
@media (max-width: 980px) {
  .page-item-title,
  .page-item-snippet,
  .note-preview,
  .note-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    align-content: start;
  }
  .main {
    height: auto;
    min-height: 0;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--side-border);
    align-self: start;
    grid-row: 1;
    position: relative;
    z-index: 5;
    height: auto;
  }
  .notebook {
    grid-row: 2;
    position: relative;
    z-index: auto;
  }
  .sidebar-toggle {
    display: flex;
  }
  .sidebar-mobile-actions {
    display: block;
  }
  .nav,
  .nav-title {
    display: none;
  }
  .sidebar.is-open .nav {
    display: grid;
  }
  .sidebar.is-open .nav-title {
    display: block;
  }
  .grid {
    padding-top: 6px;
  }
  .sidebar-footer {
    display: none;
  }
  .nav-signout {
    display: flex;
  }
}

@media (min-width: 981px) {
  .nav-signout {
    display: none;
  }
}

@media (max-width: 900px) {
  .card {
    grid-column: span 12;
  }
  .hero {
    grid-template-columns: 1fr;
  }
}

/* ---------------- CALENDAR ---------------- */
.calendar-card {
  grid-column: span 12;
  padding: 16px 16px 0;
}

.cal-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.cal-left,
.cal-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cal-right {
  justify-content: flex-end;
}

.cal-title {
  text-align: center;
}

#monthLabel {
  margin: 0;
  font-size: 20px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 0 -16px 8px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin: 0 -16px;
}

.day {
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 6px;
  min-height: 110px;
  background: rgba(0, 0, 0, 0.12);
  cursor: default;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.light .day {
  background: rgba(255, 255, 255, 0.7);
}

.day.outside {
  opacity: 0.5;
}

.day .day-num {
  font-weight: 800;
  font-size: 13px;
}

.day.selected {
  outline: 2px solid rgba(0, 181, 217, 0.65);
}

.day.today {
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: -1px;
}

.day.today:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.light .day.today {
  outline-color: rgba(0, 0, 0, 0.25);
}

.day.selected.today {
  outline: 2px solid rgba(0, 181, 217, 0.65);
  background: rgba(0, 181, 217, 0.18);
}

.day.in-range {
  background: rgba(0, 181, 217, 0.18);
  border-color: rgba(0, 181, 217, 0.65);
}

.day .day-num {
  pointer-events: none;
}

body.light .day.in-range {
  background: rgba(0, 181, 217, 0.25);
}

.pills {
  display: grid;
  gap: 6px;
}

.pill {
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.2;
}

.pill:hover {
  border-color: rgba(0, 181, 217, 0.7);
  background: rgba(0, 181, 217, 0.2);
  cursor: pointer;
}

body.light .pill {
  background: rgba(0, 0, 0, 0.05);
}

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

.event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.08);
}

body.light .event-row {
  background: rgba(255, 255, 255, 0.7);
}

.event-left {
  min-width: 0;
}

.event-title {
  font-weight: 700;
}

.event-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  z-index: 50;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 60;
  padding: 18px;
  pointer-events: none;
}

.modal-card {
  width: min(560px, 100%);
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.modal-body {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.modal.show,
.modal-backdrop.show {
  display: grid;
}

/* Responsive */
@media (max-width: 900px) {
  .cal-header {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .cal-title {
    text-align: left;
  }
  .cal-right {
    justify-content: flex-start;
  }
  .day {
    min-height: 96px;
  }
}

.pill.holiday {
  font-weight: 800;
  opacity: 0.95;
  background-color: green;
}

.pill {
  border: 1px solid var(--border);
}

/* --- Circle color picker (event modal) --- */
#eventColor {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

/* Remove default padding/box inside the color input (Chrome/Safari/Edge) */
#eventColor::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 999px;
}

/* Make the actual color swatch a circle */
#eventColor::-webkit-color-swatch {
  border: none;
  border-radius: 999px;
}

/* Firefox */
#eventColor::-moz-color-swatch {
  border: none;
  border-radius: 999px;
}

/* Optional hover/focus polish */
#eventColor:hover {
  transform: scale(1.03);
}

#eventColor:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 181, 217, 0.35);
}

.color-swatches {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: -4px;
}

.color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.color-swatch.is-selected {
  box-shadow: 0 0 0 2px rgba(0, 181, 217, 0.45);
}

/* Make the Color field not full-width */
.field.color-field {
  width: fit-content;
}

/* If your .field is flex/column, keep it compact */
.field.color-field input {
  width: 20px !important;
  flex: 0 0 auto;
}

/* Ensure the color input itself is the only hit area */
.field.color-field {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Notebook CSS */

.is-hidden {
  display: none !important;
}

.notebook {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  padding-top: 8rem;
}

.pages-panel {
  padding: 24px;
}

.pages-search {
  margin-bottom: 12px;
}

.pages-actions {
  margin-bottom: 12px;
}

.pages-actions .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notes-panel {
  padding: 24px;
}

.page-item-title {
  font-size: 14px;
  font-weight: 600;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: rgba(255, 255, 255, 0.9);
}

.page-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  border-radius: 10px;
  padding: 10px;
  min-width: 0;
  width: 100%;
}

body:not(.light) .page-item {
  background: rgba(11, 15, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.page-item-snippet {
  font-size: 12px;
  opacity: 0.8; /* a little softer */
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: rgba(255, 255, 255, 0.7);
}

body.light .page-item-title,
body.light .page-item-snippet {
  color: #000000;
}

.favorite-btn {
  padding: 10px 30px;
  border-radius: 10px;
}

.new-note-btn {
  padding: 10px 30px;
  border-radius: 10px;
  cursor: pointer;
}

.notes-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  width: 80%;
}

.notes-topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.note-card {
  background: #ffffff;
  color: #000000;
  border-radius: 10px;
  padding: 12px;

  /* makes title sit at bottom */
  display: flex;
  flex-direction: column;
  min-height: 160px; /* adjust card height to taste */
  min-width: 0;
  width: 100%;
}

body:not(.light) .note-card {
  background: rgba(11, 15, 26, 0.7);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.note-preview {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.note-divider {
  height: 1px;
  background: #000000;
  margin: 10px 0;
  opacity: 0.2; /* lighter line, still black */
}

.note-title {
  /* bottom title */
  font-weight: 600;
  font-size: 14px;
}

.notes-panel {
  border-left: 1px solid #ffffff;
}

.pages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 220px));
  gap: 24px;
}

@media (max-width: 980px) {
  .notebook {
    display: flex;
    flex-direction: column;
    padding-top: 2rem;
  }

  .notes-panel {
    order: 0;
  }

  .pages-panel {
    order: 1;
  }

  .pages-panel,
  .notes-panel {
    padding: 18px;
  }

  .notes-panel {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .notes-topbar {
    width: 100%;
  }

  .notes-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

/* Utility from earlier (if not already added) */
.is-hidden {
  display: none !important;
}

/* Full-screen overlay container */
.note-modal {
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0; */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Dim the background */
.note-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4); /* overlay only */
}

/* Centered box */
.note-modal-dialog {
  position: relative;
  max-width: 720px;
  width: 90%;
  min-height: 420px;

  background: var(--card);
  border-radius: 20px;
  padding: 32px 40px;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
}

@media (min-width: 981px) {
  .note-modal {
    align-items: stretch;
    justify-content: flex-end;
  }

  .note-modal::before {
    display: none;
  }

  .note-modal-dialog {
    width: 50vw;
    max-width: none;
    height: 100%;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 220ms ease;
  }

  .note-modal:not(.is-hidden) .note-modal-dialog {
    transform: translateX(0);
  }
}

.note-modal.is-expanded {
  align-items: stretch;
  justify-content: stretch;
}

.note-modal.is-expanded .note-modal-dialog {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.note-modal.is-expanded .note-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.note-modal.is-expanded .note-modal-editor {
  flex: 1;
  min-height: 0;
}

.note-modal.is-expanded .note-modal-textarea {
  height: 100%;
  min-height: 0;
}

/* Default = dark mode */
.note-modal-dialog {
  background: var(--card);
  color: #ffffff;
}

/* Light mode override */
body.light .note-modal-dialog {
  background: var(--card);
  color: #111111;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 50px rgba(10, 20, 60, 0.18);
}

body.light .note-modal-title,
body.light .note-modal-textarea {
  background: #f5f7fb;
}

/* Layout inside modal */
.note-modal-header {
  margin-bottom: 16px;
}

.note-modal-icon {
  font-size: 28px;
}

.note-modal-title-row {
  margin-bottom: 8px;
}

.note-modal-title {
  width: 100%;
  padding: 20px 20px;
  border-radius: 6px;
  border: none;
  background: #0b0f1a;
  outline: none;
}

.note-modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 16px;
}

.note-modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.note-modal-editor {
  flex: 1;
  min-height: 0;
  position: relative;
}

.note-modal-textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 8px;
  border: none;
  background: #0b0f1a;
  outline: none;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-modal-textarea[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.note-modal-preview {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 8px;
  border: none;
  background: #0b0f1a;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-modal-preview .note-h1 {
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
  margin: 8px 0;
}

.note-modal-preview .note-h2 {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  margin: 6px 0;
}

.note-modal-preview .note-h3 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  margin: 6px 0;
}

.note-modal-preview .note-p {
  font-size: 16px;
  line-height: 1.5;
}

.note-md-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 8px;
  color: var(--text);
}

.note-md-badge::before {
  content: attr(data-label);
}

.note-slash-menu {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 10;
  display: grid;
  gap: 6px;
  min-width: 160px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.note-slash-menu button {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  color: inherit;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.note-slash-menu button:hover {
  background: var(--side-hover);
}

body.light .note-modal-preview {
  background: #e9edf3;
}

.note-modal-preview a {
  color: #4aa3ff;
  text-decoration: underline;
}

.note-view-mode .note-modal-title,
.note-view-mode .note-modal-textarea {
  color: var(--muted);
  opacity: 0.9;
}

.note-view-mode .note-modal-textarea {
  cursor: default;
}

.note-modal-footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.note-modal-count {
  font-size: 12px;
  color: var(--muted);
}

.note-modal-save {
  padding: 6px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.note-modal-toggle {
  padding: 6px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.weather-modal-card {
  width: min(680px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.weather-forecast-location {
  padding: 0 4px;
}

.weather-forecast-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.weather-forecast-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card2);
  border: 1px solid var(--border);
}

.weather-forecast-icon {
  width: 28px;
  height: 28px;
}

.weather-forecast-day {
  font-weight: 600;
}

.weather-forecast-temp {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Custom Menu Right CLick Menu */

.note-context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 120px;
  padding: 4px;
  border-radius: 8px;

  /* you can change these colours */
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.note-context-menu button {
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.note-context-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.note-context-menu button:hover {
  background: #f2f2f2;
}

.context-favorite {
  color: #333;
}

.context-delete {
  color: #c62828;
}

.note-context-menu button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.note-context-menu button + button {
  margin-top: 4px;
}

/* For search filtering only (kept separate from .is-hidden template) */
.page-item.is-filtered {
  display: none;
}

.fav-star {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
}

.fav-star::before {
  content: "\2605";
  color: #f5c84c;
}

/* Email page */
.email-card,
.email-compose {
  margin-bottom: 20px;
}

.email-card {
  display: none;
}

.email-compose {
  display: none;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.email-detail {
  display: none;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
  flex: 1;
  min-height: 0;
}

.email-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(220px, 320px) minmax(
      0,
      1fr
    );
  gap: 20px;
  height: 100%;
  position: relative;
  flex: 1;
  min-height: 0;
}

.email-layout .card {
  grid-column: auto;
}

.email-list-card {
  display: none;
  height: 100%;
  grid-column: 2;
  position: relative;
}

.email-folders {
  padding: 16px;
  height: 100%;
  grid-column: 1;
}

.email-folder-list {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.email-folder-btn {
  width: 100%;
  text-align: left;
  padding: 12px 10px;
  border: none;
  background: transparent;
  color: inherit;
  border-bottom: 1px solid var(--border);
  outline: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.email-folder-btn.email-new {
  border: 1px solid rgba(0, 181, 217, 0.6);
  border-bottom: none;
  border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(0, 181, 217, 0.12);
  color: #e9f8fb;
  font-weight: 600;
}

.email-folder-btn:last-child {
  border-bottom: none;
}

.email-folder-btn.is-active {
  font-weight: 600;
  color: var(--accent);
}

.email-folder-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.email-folder-icon svg {
  width: 100%;
  height: 100%;
}

.email-folder-sub {
  border: none;
  background: transparent;
  padding: 8px 10px 12px 22px;
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.email-folder-sub.is-active {
  color: var(--accent);
  font-weight: 600;
}

.email-main {
  min-width: 0;
  height: 100%;
  min-height: 0;
  display: none;
  grid-column: 3;
}

.email-main.is-active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.email-layout.email-hide-list {
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
}

.email-layout.email-hide-list .email-main {
  grid-column: 2;
}

.email-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
  gap: 10px;
  align-items: center;
}

.email-pagination {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.email-page {
  font-size: 12px;
  color: var(--muted);
  min-width: 48px;
  text-align: center;
}

.email-modal {
  position: absolute;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-modal.is-hidden {
  display: none;
}

.email-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

@media (max-width: 980px) {
  .email-modal-backdrop {
    background: transparent;
  }
}

.email-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  background: #0b0f1a;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

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

.email-modal-back {
  align-self: flex-start;
}

.email-modal-title {
  font-size: 18px;
  font-weight: 600;
}

.email-modal-meta {
  font-size: 12px;
  color: var(--muted);
}

.email-modal-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card2);
}

.email-modal-body.is-frame {
  padding: 0;
}

.email-modal-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
}

.email-menu-btn {
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  place-items: center;
  align-items: center;
  justify-items: center;
}

.email-folder-overlay {
  display: none;
}

.email-settings {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.email-settings-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--card2);
}

.email-settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.email-status {
  margin-bottom: 12px;
}

.email-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.email-item {
  padding: 12px 16px;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  margin-left: -16px;
  margin-right: -16px;
}

.email-item:first-child {
  border-top: 1px solid var(--border);
}

.email-item.is-selected {
  background: rgba(0, 181, 217, 0.12);
}

.email-item.is-unread .email-subject {
  font-weight: 700;
}

.email-item.is-unread .email-meta {
  color: var(--text);
}

.email-subject {
  font-weight: 600;
  margin-bottom: 6px;
}

.email-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  opacity: 0.8;
  flex-wrap: wrap;
}

.email-detail-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.email-detail-body {
  white-space: pre-wrap;
  line-height: 1.5;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  padding-bottom: 150px;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: auto;
}

.email-detail-body.is-frame {
  height: 100vh;
  padding: 0;
  white-space: normal;
  min-height: 0;
}

.email-detail-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
}

.email-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.email-detail-view {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
}

.email-form {
  display: grid;
  gap: 12px;
  flex: 1;
  grid-template-rows: auto auto auto 1fr auto;
  min-height: 0;
}

.email-label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.email-label--message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  flex: 1;
}

.email-input,
.email-textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}

.email-textarea {
  resize: none;
  min-height: 160px;
  height: auto;
}

.email-label--message .email-textarea {
  flex: 1;
}

/* Title + textarea font for New Notes */
.note-modal-title,
.note-modal-textarea {
  font-family: "Poppins", sans-serif;
  font-size: 16px;
}

@media (max-width: 980px) {
  .page-item-title,
  .page-item-snippet,
  .note-preview,
  .note-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .email-layout {
    grid-template-columns: 1fr;
    row-gap: 0;
    align-content: start;
    height: 100%;
  }

  .email-list-card,
  .email-main {
    display: none;
  }

  .email-folders {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 280px);
    transform: translateX(-100%);
    transition: transform 220ms ease;
    z-index: 1200;
    grid-column: unset;
  }

  .email-folder-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
    z-index: 20;
    width: min(82vw, 280px);
    display: block;
  }

  .email-layout.email-show-folders .email-folders {
    transform: translateX(0);
  }

  .email-layout.email-show-folders .email-folder-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .email-layout.email-show-list .email-list-card {
    display: block;
    height: 100%;
  }

  .email-layout.email-show-compose .email-main,
  .email-layout.email-show-settings .email-main,
  .email-layout.email-show-detail .email-main {
    display: block;
    grid-column: 1 / -1;
  }

  .email-menu-btn {
    display: inline-grid;
    position: static;
    margin-bottom: 8px;
  }
}

.note-modal-title {
  font-size: 18px;
}

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

/* Expand button top-right */
.note-modal-expand-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
  color: #fff;
}

.note-modal-expand-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Light mode tweak if you're using body.light */
body.light .note-modal-expand-btn:hover {
  background: #fff(0, 0, 0, 0.06);
}
