/* My Work widget framework: opt-in widgets, Edit layout controls, the Add
   widget gallery, the settings popover and the notes modal. My Work only.

   Tokens live on .mp-main--mywork (not #mp-mywork-root): the gallery,
   popover and notes modal are siblings of the root, inside .mp-main. My Work
   is not a dark-content page, so the global text tokens stay "light content"
   in Dark; the Dark values for these surfaces are set here explicitly. */

@font-face {
  font-family: "Kalam";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/kalam/kalam-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.mp-main--mywork {
  --mww-page: var(--bg-page, #f4f2ef);
  --mww-card: #fff;
  --mww-panel: #f6f4f1;
  --mww-raised: #fff;
  --mww-input: #fff;
  --mww-hover: #f1eeea;
  --mww-border: #eae6e1;
  --mww-border-strong: #dcd7d0;
  --mww-text: #24211e;
  --mww-secondary: #5c5752;
  --mww-muted: #736d67;          /* >= 4.5:1 on white and on the note paper */
  --mww-accent: var(--accent, #ff5a00);
  --mww-accent-hover: color-mix(in srgb, var(--accent, #ff5a00) 88%, #000);
  --mww-accent-text: #b9561e;
  --mww-accent-soft: rgba(255, 90, 0, 0.12);
  --mww-focus: 0 0 0 3px rgba(238, 122, 59, 0.28);
  --mww-blue: #2450a8;
  --mww-amber: #8a4e0c;
  --mww-green: #1d6e45;
  --mww-green-bg: #c9ebd5;
  --mww-red: #a92f26;
  --mww-red-bg: #f9d3ce;
  --mww-red-border: #f2b8b2;
  --mww-shadow-sm: 0 1px 2px rgba(30, 25, 20, 0.06), 0 2px 6px rgba(30, 25, 20, 0.04);
  --mww-shadow-lg: 0 18px 48px rgba(30, 25, 20, 0.18);
  --mww-scrim: rgba(30, 25, 20, 0.3);
}

html[data-portal="manage"][data-theme="dark"] .mp-main--mywork {
  --mww-page: #14111a;
  --mww-card: #232026;
  --mww-panel: #232026;
  --mww-raised: #2a262c;
  --mww-input: #1f1c21;
  --mww-hover: #302c33;
  --mww-border: rgba(255, 255, 255, 0.08);
  --mww-border-strong: rgba(255, 255, 255, 0.14);
  --mww-text: #f3efea;
  --mww-secondary: #b3aca5;
  --mww-muted: #9a938c;
  --mww-accent-text: #f29a62;
  --mww-accent-soft: rgba(238, 122, 59, 0.18);
  --mww-blue: #8fb0f5;
  --mww-amber: #f2b76a;
  --mww-green: #6fd6a4;
  --mww-green-bg: rgba(69, 192, 138, 0.2);
  --mww-red: #ff8f84;
  --mww-red-bg: rgba(240, 106, 94, 0.2);
  --mww-red-border: rgba(240, 106, 94, 0.36);
  --mww-shadow-sm: none;
  --mww-shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.5);
  --mww-scrim: rgba(0, 0, 0, 0.5);
}

.mw-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* -- Widget shell ---------------------------------------------------------- */

.mw-personal-widget {
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 14px 16px;
  overflow: hidden;
  border: 1px solid var(--mww-border);
  border-radius: 18px;
  background: var(--mww-card);
  background-clip: padding-box;
  box-shadow: var(--mww-shadow-sm);
  color: var(--mww-text);
  container: mww / inline-size;
  font-variant-numeric: tabular-nums;
}

.mw-personal-widget__title {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 22px;
  margin: 0 0 8px;
  color: var(--mww-text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.mw-personal-widget__title svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: var(--mww-accent-text);
}

.mw-personal-widget__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mw-personal-widget__state {
  display: grid;
  flex: 1;
  place-items: center;
  min-height: 0;
  color: var(--mww-secondary);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.mw-personal-widget__state svg { width: 28px; height: 28px; color: var(--mww-muted); }

.mw-widget-retry {
  margin-top: 6px;
  padding: 4px 10px;
  border: 1px solid var(--mww-border-strong);
  border-radius: 999px;
  background: var(--mww-raised);
  color: var(--mww-text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.mw-widget-retry:hover { background: var(--mww-hover); }

/* -- Edit layout: per-widget toolbar ---------------------------------------- */

.mw-widget-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  display: flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.mw-grid.is-editing .mw-item:hover > .mw-widget-toolbar,
.mw-grid.is-editing .mw-item:focus-within > .mw-widget-toolbar,
.mw-grid.is-editing .mw-item:focus-visible > .mw-widget-toolbar {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .mw-grid.is-editing .mw-widget-toolbar { opacity: 1; pointer-events: auto; }
}

.mw-widget-tool {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--mww-border);
  border-radius: 50%;
  background: var(--mww-raised);
  box-shadow: 0 1px 2px rgba(30, 25, 20, 0.08);
  color: var(--mww-secondary);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.mw-widget-tool svg { width: 14px; height: 14px; }
.mw-widget-tool:hover { color: var(--mww-text); }
.mw-widget-tool:focus-visible { outline: none; box-shadow: var(--mww-focus); }

.mw-widget-tool--remove:hover {
  border-color: var(--mww-red-border);
  background: var(--mww-red-bg);
  color: var(--mww-red);
}

.mw-grid.is-editing .mw-item:focus-visible { outline: none; }
.mw-grid.is-editing .mw-item:focus-visible > .mw-item__content { outline: 2px solid var(--mww-accent); outline-offset: 2px; border-radius: 18px; }

@keyframes mw-widget-flash { 0%, 100% { outline-color: transparent; } 25%, 70% { outline-color: var(--mww-accent); } }
.mw-widget-flash > .mw-item__content { outline: 3px solid transparent; outline-offset: 2px; border-radius: 18px; animation: mw-widget-flash 850ms ease; }

/* -- Add widget gallery ------------------------------------------------------ */

html.mw-gallery-open,
html.mw-gallery-open body,
html.mw-notes-open,
html.mw-notes-open body { overflow: hidden; }

.mw-widget-gallery { position: fixed; inset: 0; z-index: 1300; }
.mw-widget-gallery[hidden], .mw-settings-popover[hidden], .mw-notes-modal[hidden] { display: none !important; }

.mw-widget-gallery__backdrop,
.mw-notes-modal__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: var(--mww-scrim);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  cursor: default;
}

.mw-widget-gallery__drawer {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(440px, calc(100vw - 24px));
  overflow: hidden;
  overflow: clip;   /* never scrolled by scrollIntoView: header + search stay put */
  border: 1px solid var(--mww-border);
  border-radius: 20px;
  background: var(--mww-raised);
  box-shadow: var(--mww-shadow-lg);
  color: var(--mww-text);
  animation: mw-drawer-in 220ms ease both;
}

@keyframes mw-drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.mw-widget-gallery__head {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--mww-border);
}

.mw-widget-gallery__head h2 { margin: 0; color: var(--mww-text); font-size: 20px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.mw-widget-gallery__head p { margin: 4px 0 0; color: var(--mww-secondary); font-size: 13px; }

.mw-gallery-close {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--mww-secondary);
  cursor: pointer;
}

.mw-gallery-close svg { width: 16px; height: 16px; }
.mw-gallery-close:hover { background: var(--mww-hover); color: var(--mww-text); }
.mw-gallery-close:focus-visible { outline: none; box-shadow: var(--mww-focus); }

.mw-widget-gallery__tools {
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  padding: 12px 20px 12px;
}

.mw-widget-search { position: relative; display: block; margin: 0; }

.mw-widget-search svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--mww-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.mw-widget-search input {
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--mww-border-strong);
  border-radius: 12px;
  outline: none;
  background: var(--mww-input);
  color: var(--mww-text);
  font: inherit;
  font-size: 14px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.mw-widget-search input::placeholder { color: var(--mww-muted); }
.mw-widget-search input:focus { border-color: var(--mww-accent); box-shadow: var(--mww-focus); }

/* Category filter: the JSA segmented pills (small). */
.mw-seg {
  display: inline-flex;
  justify-self: start;
  gap: 3px;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--mww-border);
  border-radius: 999px;
  background: var(--mww-raised);
  scrollbar-width: none;
}

html[data-portal="manage"][data-theme="dark"] .mp-main--mywork .mw-seg {
  background: #1f1c21;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mw-seg__option {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--mww-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 200ms ease, color 200ms ease;
}

.mw-seg__option:hover:not(.is-active) { background: var(--mww-hover); color: var(--mww-text); }
.mw-seg__option.is-active { background: var(--mww-accent); color: #fff; box-shadow: 0 4px 12px rgba(238, 122, 59, 0.3); }
.mw-seg__option:focus-visible { outline: 2px solid var(--mww-accent); outline-offset: 2px; }

.mw-widget-gallery__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 20px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--mww-border-strong) transparent;
}

.mw-widget-gallery__body::-webkit-scrollbar { width: 6px; }
.mw-widget-gallery__body::-webkit-scrollbar-track { background: transparent; }
.mw-widget-gallery__body::-webkit-scrollbar-thumb { border-radius: 3px; background: var(--mww-border-strong); }

.mw-gallery-section h3 {
  margin: 16px 0 8px;
  color: var(--mww-secondary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mw-gallery-card {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
  margin: 0 0 8px;
  padding: 10px;
  border: 1px solid var(--mww-border);
  border-radius: 16px;
  background: var(--mww-panel);
  color: var(--mww-text);
  cursor: grab;
  transition: border-color 140ms ease;
}

.mw-gallery-card:hover { border-color: var(--mww-border-strong); }
.mw-gallery-card.is-added { cursor: default; }

.mw-gallery-preview {
  position: relative;
  width: 160px;
  height: 96px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--mww-page);
  pointer-events: none;
}

.mw-gallery-preview__stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(var(--mw-preview-scale, 0.5));
  transform-origin: center;
  pointer-events: none;
}

.mw-gallery-preview__stage > * {
  box-sizing: border-box;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  overflow: hidden;
}

.mw-gallery-card__text { display: flex; flex-direction: column; min-width: 0; }
.mw-gallery-card__text h4 { margin: 2px 0 3px; color: var(--mww-text); font-size: 14px; font-weight: 700; line-height: 1.25; }

.mw-gallery-card__text p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--mww-secondary);
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mw-gallery-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.mw-size-chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--mww-hover);
  color: var(--mww-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.mw-add-btn,
.mw-added-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.mw-add-btn svg, .mw-added-chip svg { width: 14px; height: 14px; }
.mw-add-btn { background: var(--mww-accent); color: #fff; cursor: pointer; transition: background-color 140ms ease; }
.mw-add-btn:hover { background: var(--mww-accent-hover); }
.mw-add-btn:focus-visible { outline: none; box-shadow: var(--mww-focus); }
.mw-added-chip { background: var(--mww-hover); color: var(--mww-secondary); cursor: default; }

.mw-gallery-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 56px 16px;
  color: var(--mww-secondary);
  font-size: 13px;
  text-align: center;
}

.mw-gallery-empty svg { width: 28px; height: 28px; color: var(--mww-muted); }
.mw-gallery-empty p { margin: 0; overflow-wrap: anywhere; }

/* Purpose-made thumbnail (a server-rendered widget not present on the page). */
.mw-thumb {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--mww-border);
  border-radius: 18px;
  background: var(--mww-card);
  color: var(--mww-text);
}

.mw-thumb__head { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.mw-thumb__head svg { width: 24px; height: 24px; color: var(--mww-accent-text); }
.mw-thumb__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }
.mw-thumb__stats span { height: 56px; border-radius: 12px; background: var(--mww-hover); }
.mw-thumb__rows { display: grid; gap: 10px; }
.mw-thumb__rows i { display: block; height: 16px; border-radius: 8px; background: var(--mww-hover); }
.mw-thumb__rows i:nth-child(2) { width: 80%; }
.mw-thumb__rows i:nth-child(3) { width: 60%; }

@media (max-width: 600px) {
  .mw-widget-gallery__drawer { top: 0; right: 0; bottom: 0; width: 100%; border: 0; border-radius: 0; }
  .mw-gallery-card { grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
  .mw-gallery-preview { width: 120px; height: 72px; }
  .mw-gallery-preview__stage { scale: 0.75; }
}

/* -- Settings popover --------------------------------------------------------- */

.mw-settings-popover {
  position: fixed;
  z-index: 1400;
  box-sizing: border-box;
  width: 300px;
  max-height: min(620px, calc(100vh - 24px));
  padding: 16px;
  overflow-y: auto;
  border: 1px solid var(--mww-border);
  border-radius: 14px;
  background: var(--mww-raised);
  box-shadow: var(--mww-shadow-lg);
  color: var(--mww-text);
}

.mw-settings-popover h2 { margin: 0 0 12px; color: var(--mww-text); font-size: 15px; font-weight: 800; }
.mw-settings-field { display: grid; gap: 6px; margin: 0 0 12px; }

.mw-settings-field > span,
.mw-settings-field > label {
  color: var(--mww-secondary);
  font-size: 12px;
  font-weight: 700;
}

.mw-settings-field input,
.mw-settings-field select {
  box-sizing: border-box;
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--mww-border-strong);
  border-radius: 10px;
  outline: none;
  background: var(--mww-input);
  color: var(--mww-text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
}

.mw-settings-field input::placeholder { color: var(--mww-muted); }
.mw-settings-field input:focus, .mw-settings-field select:focus { border-color: var(--mww-accent); box-shadow: var(--mww-focus); }
.mw-settings-field input[aria-invalid="true"] { border-color: var(--mww-red); }
/* Field validation: rejected-status text (light #a92f26 = --st-rejected-text, dark #ff8f84), under the field. */
.mw-settings-error { display: flex; align-items: flex-start; gap: 6px; margin: 0; color: var(--mww-red); font-size: 12px; font-weight: 600; line-height: 1.35; }
.mw-settings-error[hidden] { display: none; }
.mw-settings-error svg { flex: 0 0 14px; width: 14px; height: 14px; margin-top: 1px; }

.mw-tz-results {
  display: grid;
  gap: 2px;
  max-height: 200px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--mww-border-strong);
  border-radius: 10px;
  background: var(--mww-raised);
}
.mw-tz-results[hidden] { display: none; }
.mw-tz-option.is-active { background: var(--mww-hover); }
.mw-tz-option span { color: var(--mww-secondary); font-size: 12px; }

.mw-settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--mww-text);
  font-size: 13px;
  font-weight: 600;
}

.mw-settings-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--mww-accent); }
.mw-location-results { display: grid; gap: 2px; max-height: 180px; overflow-y: auto; }

.mw-location-result {
  display: grid;
  gap: 1px;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--mww-text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: left;
}

.mw-location-result span { color: var(--mww-secondary); font-size: 12px; }
.mw-location-result:hover, .mw-location-result:focus-visible { outline: none; background: var(--mww-hover); }
.mw-location-note { padding: 6px 9px; color: var(--mww-secondary); font-size: 12px; }
.mw-settings-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.mw-settings-actions .mw-btn--ghost { color: var(--mww-secondary); }
.mw-settings-actions .mw-btn--ghost:hover { background: var(--mww-hover); color: var(--mww-text); }

/* -- Clocks -------------------------------------------------------------------- */

.mw-clock-face-wrap { aspect-ratio: 1; min-width: 0; min-height: 0; }
.mw-clock-face { display: block; width: 100%; height: 100%; overflow: visible; }
.mw-clock-dial { stroke: var(--mww-border-strong); stroke-width: 1; }
.mw-clock-face.is-day { color: #24211e; }
.mw-clock-face.is-day .mw-clock-dial { fill: #fff; }
.mw-clock-face.is-night { color: #f3efea; }
.mw-clock-face.is-night .mw-clock-dial { fill: #24211e; }
.mw-clock-ticks line { stroke: currentColor; stroke-linecap: round; }
.mw-clock-hour, .mw-clock-minute { stroke: currentColor; stroke-linecap: round; }
.mw-clock-second { stroke: #ee7a3b; stroke-linecap: round; }
.mw-clock-pin { fill: #ee7a3b; }

.mw-clock-body {
  display: grid;
  flex: 1;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 0;
}

.mw-clock-body .mw-clock-face-wrap { height: 100%; max-height: 120px; align-self: center; }
.mw-clock-digital { min-width: 0; }
.mw-clock-line { display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.mw-clock-time { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.mw-clock-ampm { font-size: 12px; font-weight: 700; }

.mw-clock-label {
  margin-top: 6px;
  overflow: hidden;
  color: var(--mww-secondary);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mw-clock-date { margin-top: 2px; color: var(--mww-muted); font-size: 12px; white-space: nowrap; }

@container mww (max-width: 250px) {
  .mw-clock-body { gap: 10px; }
  .mw-clock-time { font-size: 26px; }
}

.mw-dual-body {
  display: grid;
  flex: 1;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-height: 0;
  text-align: center;
}

.mw-dual-clock {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  justify-items: center;
  min-width: 0;
  min-height: 0;
}

.mw-dual-clock .mw-clock-face-wrap { height: 100%; max-height: 96px; }

.mw-dual-label {
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  color: var(--mww-text);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mw-dual-meta { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.mw-dual-time { font-size: 13px; font-weight: 700; }
.mw-dual-offset { color: var(--mww-secondary); font-size: 11px; }

@container mww (max-width: 250px) {
  .mw-dual-meta { display: grid; }
}

/* -- Today's date ------------------------------------------------------------- */

.mw-date-body { display: grid; flex: 1; align-content: center; justify-items: center; min-height: 0; text-align: center; }
.mw-date-weekday { color: var(--mww-accent-text); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.mw-date-number { font-size: 64px; font-weight: 800; line-height: 0.9; letter-spacing: -0.05em; }
.mw-date-month { margin-top: 2px; color: var(--mww-secondary); font-size: 14px; font-weight: 600; }
.mw-date-meta { margin-top: 4px; color: var(--mww-muted); font-size: 11px; }

/* -- Month calendar ----------------------------------------------------------- */

.mw-calendar-body { display: grid; flex: 1; grid-template-columns: 40% 60%; min-height: 0; }
.mw-calendar-today { display: flex; flex-direction: column; min-width: 0; padding: 4px 16px 4px 2px; border-right: 1px solid var(--mww-border); }
.mw-calendar-today__weekday { color: var(--mww-accent-text); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.mw-calendar-today__number { margin: 2px 0 14px; font-size: 48px; font-weight: 800; line-height: 1; letter-spacing: -0.04em; }
.mw-calendar-next { margin-top: auto; min-width: 0; }
.mw-calendar-next__label { color: var(--mww-secondary); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }

.mw-calendar-next p {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--mww-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mw-calendar-next p.is-empty { color: var(--mww-muted); font-weight: 500; }
.mw-month-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding-left: 14px; }
.mw-month-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 6px; }
.mw-month-name { overflow: hidden; color: var(--mww-accent-text); font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.mw-month-nav { display: flex; gap: 2px; }

.mw-month-nav button {
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--mww-secondary);
  cursor: pointer;
}

.mw-month-nav button svg { width: 14px; height: 14px; }
.mw-month-nav button:hover { background: var(--mww-hover); color: var(--mww-text); }
.mw-month-nav button:focus-visible { outline: none; box-shadow: var(--mww-focus); }

.mw-month-grid {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  align-items: center;
  min-height: 0;
  margin-top: 6px;
  text-align: center;
}

.mw-month-grid span { position: relative; display: grid; place-items: center; height: 24px; font-size: 12px; font-weight: 600; }
.mw-month-grid .is-head { color: var(--mww-muted); font-size: 11px; font-weight: 600; }
.mw-month-grid .is-weekend { color: var(--mww-secondary); }
.mw-month-grid .is-today { width: 24px; margin: auto; border-radius: 50%; background: var(--mww-accent); color: #fff; }
.mw-month-grid .has-meeting::after { position: absolute; bottom: -3px; left: 50%; width: 3px; height: 3px; margin-left: -1.5px; border-radius: 50%; background: var(--mww-accent-text); content: ""; }
.mw-month-grid .is-today.has-meeting::after { bottom: 3px; background: #fff; }

/* -- Notes -------------------------------------------------------------------- */

.mw-personal-widget--notes,
.mw-notes-page {
  --note-line: rgba(60, 90, 160, 0.12);
  --note-margin: rgba(210, 69, 59, 0.25);
  --note-paper: #fffbef;
  --note-binding: rgba(100, 72, 35, 0.18);
  --note-ink: #312c26;
  background-color: var(--note-paper);
  background-image: linear-gradient(90deg, transparent 39px, var(--note-margin) 39px, var(--note-margin) 40px, transparent 40px);
  color: var(--note-ink);
}

html[data-portal="manage"][data-theme="dark"] .mw-personal-widget--notes,
html[data-portal="manage"][data-theme="dark"] .mw-notes-page {
  --note-line: rgba(255, 255, 255, 0.06);
  --note-margin: rgba(240, 106, 94, 0.22);
  --note-paper: #26231f;
  --note-binding: rgba(0, 0, 0, 0.35);
  --note-ink: #f3efea;
}

.mw-personal-widget--notes { padding: 0; }

.mw-personal-widget--notes::before,
.mw-notes-page::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  height: 10px;
  background: var(--note-binding);
  content: "";
}

.mw-note-open {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
  padding: 48px 18px 30px 52px;
  overflow: hidden;
  border: 0;
  background: repeating-linear-gradient(180deg, transparent 0 23px, var(--note-line) 23px 24px);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.mw-note-open:focus-visible { outline: 2px solid var(--mww-accent); outline-offset: -4px; border-radius: 18px; }

.mw-note-title {
  position: absolute;
  top: 18px;
  left: 52px;
  right: 18px;
  overflow: hidden;
  color: var(--note-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mw-note-text { display: block; font: 16px/24px "Kalam", "Segoe Print", cursive; white-space: pre-wrap; overflow-wrap: anywhere; }
.mw-note-open.is-empty .mw-note-text { color: var(--mww-muted); }
.mw-note-open::after { position: absolute; right: 0; bottom: 0; left: 0; height: 48px; background: linear-gradient(transparent, var(--note-paper) 70%); content: ""; }
.mw-note-edited { position: absolute; right: 16px; bottom: 9px; z-index: 2; color: var(--mww-muted); font-size: 11px; pointer-events: none; }

.mw-notes-modal { position: fixed; inset: 0; z-index: 1500; }

.mw-notes-page {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(640px, calc(100vw - 24px));
  height: min(80vh, 720px);
  overflow: hidden;
  border: 1px solid var(--mww-border);
  border-radius: 18px;
  box-shadow: var(--mww-shadow-lg);
  transform: translate(-50%, -50%);
}

.mw-notes-page header {
  z-index: 2;
  display: flex;
  flex: 0 0 48px;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 0 52px;
  background: var(--note-binding);
}

.mw-notes-page header h2 { flex: 1; min-width: 0; margin: 0; overflow: hidden; color: var(--note-ink); font-size: 16px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.mw-notes-page header span { color: var(--mww-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }

.mw-notes-page header span:is(:not(:empty)) { cursor: default; }

.mw-notes-page header button {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--note-ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.mw-notes-page header button:hover { background: rgba(0, 0, 0, 0.08); }
html[data-portal="manage"][data-theme="dark"] .mw-notes-page header button:hover { background: rgba(255, 255, 255, 0.08); }
.mw-notes-page header button:focus-visible { outline: none; box-shadow: var(--mww-focus); }

.mw-notes-page textarea {
  flex: 1;
  box-sizing: border-box;
  min-height: 0;
  margin: 0;
  padding: 0 20px 24px 52px;
  overflow-y: auto;
  overscroll-behavior: contain;
  resize: none;
  border: 0;
  outline: 0;
  background: repeating-linear-gradient(180deg, transparent 0 23px, var(--note-line) 23px 24px) local;
  color: var(--note-ink);
  caret-color: var(--mww-accent);
  font: 16px/24px "Kalam", "Segoe Print", cursive;
  scrollbar-width: thin;
  scrollbar-color: var(--mww-border-strong) transparent;
}

/* -- Weather ------------------------------------------------------------------ */

.mw-personal-widget--weather.is-clear { background: linear-gradient(170deg, #eaf3ff, #fff 60%); }
.mw-personal-widget--weather.is-cloud { background: linear-gradient(170deg, #f0f1f3, #fff 60%); }
.mw-personal-widget--weather.is-rain { background: linear-gradient(170deg, #e6ecf3, #fff 60%); }
.mw-personal-widget--weather.is-night { background: linear-gradient(170deg, #e8e9f3, #fff 60%); }
html[data-portal="manage"][data-theme="dark"] .mw-personal-widget--weather.is-clear { background: linear-gradient(170deg, rgba(90, 150, 240, 0.16), rgba(35, 32, 38, 0) 60%), #232026; }
html[data-portal="manage"][data-theme="dark"] .mw-personal-widget--weather.is-cloud { background: linear-gradient(170deg, rgba(160, 170, 185, 0.12), rgba(35, 32, 38, 0) 60%), #232026; }
html[data-portal="manage"][data-theme="dark"] .mw-personal-widget--weather.is-rain { background: linear-gradient(170deg, rgba(110, 140, 185, 0.16), rgba(35, 32, 38, 0) 60%), #232026; }
html[data-portal="manage"][data-theme="dark"] .mw-personal-widget--weather.is-night { background: linear-gradient(170deg, rgba(120, 120, 200, 0.16), rgba(35, 32, 38, 0) 60%), #232026; }

.mw-weather-state { flex: 0 0 auto; margin-left: auto; color: var(--mww-secondary); font-size: 12px; font-weight: 600; }
.mw-personal-widget--weather .mw-personal-widget__title { margin-bottom: 4px; }

.mw-weather-current {
  display: grid;
  grid-template-columns: 40px auto minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
}

.mw-weather-icon svg { display: block; width: 40px; height: 40px; }
.mw-weather-temp { font-size: 48px; font-weight: 800; line-height: 1; letter-spacing: -0.05em; }
.mw-weather-now { min-width: 0; }
.mw-weather-condition { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.mw-weather-meta { overflow: hidden; color: var(--mww-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.mw-weather-field {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin: 8px 0;
  color: var(--mww-secondary);
  font-size: 12px;
}

.mw-weather-field .is-gust { color: var(--mww-amber); font-weight: 700; }

.mw-weather-hourly {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  padding: 8px 0;
  border-block: 1px solid var(--mww-border);
  text-align: center;
}

.mw-weather-hour { display: grid; gap: 2px; justify-items: center; min-width: 0; }
.mw-weather-hour__time { color: var(--mww-secondary); font-size: 11px; white-space: nowrap; }
.mw-weather-hour svg { width: 20px; height: 20px; }
.mw-weather-hour strong { font-size: 13px; font-weight: 700; }
.mw-weather-hour__pop { color: var(--mww-secondary); font-size: 11px; }
.mw-weather-hour__pop.is-wet { color: var(--mww-blue); font-weight: 700; }

.mw-forecast { display: grid; gap: 4px; margin-top: 8px; }

.mw-forecast-row {
  display: grid;
  grid-template-columns: 44px 18px 32px 28px minmax(20px, 1fr) 28px;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.mw-forecast-row strong { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.mw-forecast-row svg { width: 18px; height: 18px; }
.mw-forecast-pop { color: var(--mww-secondary); font-size: 11px; }
.mw-forecast-lo { color: var(--mww-secondary); text-align: right; }
.mw-forecast-hi { font-weight: 700; }
.mw-range { position: relative; height: 4px; border-radius: 99px; background: var(--mww-hover); }
.mw-range i { position: absolute; top: 0; bottom: 0; border-radius: inherit; background: linear-gradient(90deg, #6aa4e0, #ee8b4b); }
.mw-weather-stale { margin-top: auto; padding-top: 6px; color: var(--mww-muted); font-size: 11px; }

.wx { overflow: visible; }
.wx-sun { stroke: #e39a1c; }
.wx-moon { stroke: #8a8fc4; }
.wx-cloud { stroke: var(--mww-secondary); }
.wx-rain { stroke: #3b82d6; }
.wx-snow { stroke: #7fb2e5; stroke-width: 2.6; }
.wx-bolt { stroke: #e39a1c; }
html[data-portal="manage"][data-theme="dark"] .wx-rain { stroke: #8fb0f5; }
html[data-portal="manage"][data-theme="dark"] .wx-moon { stroke: #b9bce8; }

@container mww (max-width: 270px) {
  .mw-weather-current { grid-template-columns: 32px auto; }
  .mw-weather-icon svg { width: 32px; height: 32px; }
  .mw-weather-temp { font-size: 40px; }
  .mw-weather-now { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0 8px; }
  .mw-weather-now .mw-weather-meta { flex: 0 0 auto; }
  .mw-weather-hour__time, .mw-weather-hour__pop { font-size: 10px; }
  .mw-weather-hour strong { font-size: 12px; }
  .mw-weather-hour svg { width: 18px; height: 18px; }
  .mw-forecast-row { grid-template-columns: 40px 16px 30px 24px minmax(12px, 1fr) 26px; gap: 4px; font-size: 11px; }
}

/* -- Meetings ------------------------------------------------------------------ */

.mw-meetings-date { flex: 0 0 auto; margin-left: auto; color: var(--mww-secondary); font-size: 12px; font-weight: 600; }
.mw-meetings-hero { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.mw-meetings-count { font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -0.05em; }
.mw-meetings-hero > span:last-child { color: var(--mww-text); font-size: 14px; font-weight: 600; }
.mw-meetings-sub { margin-top: 2px; color: var(--mww-secondary); font-size: 13px; }

.mw-next-meeting {
  display: grid;
  flex: 0 0 auto;
  gap: 3px;
  margin: 12px 0 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--mww-accent-soft);
}

.mw-next-meeting__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mw-next-meeting small { color: var(--mww-secondary); font-size: 12px; }
.mw-next-meeting__top small { display: inline-flex; align-items: center; gap: 6px; color: var(--mww-text); font-weight: 600; }

.mw-next-meeting strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--mww-text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mw-join {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--mww-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.mw-join:hover { background: var(--mww-accent-hover); }
.mw-join:focus-visible { outline: none; box-shadow: var(--mww-focus); }

.mw-chip { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.mw-chip--now { background: var(--mww-green-bg); color: var(--mww-green); }

.mw-meeting-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--mww-border-strong) transparent;
}

.mw-meeting-row {
  display: grid;
  grid-template-columns: 64px 3px minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  padding: 8px 0;
  border-top: 1px solid var(--mww-border);
  font-size: 12px;
}

.mw-meeting-row__time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mw-meeting-row__bar { align-self: stretch; border-radius: 99px; background: var(--mww-accent); }
.mw-meeting-row__text { display: grid; min-width: 0; }
.mw-meeting-row__text strong { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.mw-meeting-row small { color: var(--mww-secondary); font-size: 12px; }
.mw-meeting-row.is-past, .mw-meeting-row.is-past small { color: var(--mww-muted); }
.mw-meeting-row.is-past .mw-meeting-row__bar { opacity: 0.4; }
.mw-meeting-row.is-past strong { text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.mw-meeting-row.is-live .mw-meeting-row__bar { background: var(--mww-green); }

/* -- Phones / reduced motion -------------------------------------------------- */

@media (max-width: 768px) {
  .mw-personal-widget { height: auto; min-height: 176px; }
  .mw-personal-widget--clock .mw-clock-body .mw-clock-face-wrap,
  .mw-dual-clock .mw-clock-face-wrap { height: 110px; }
  .mw-personal-widget--calendar-month, .mw-personal-widget--notes { min-height: 354px; }
  .mw-personal-widget--weather { min-height: 364px; }
  .mw-personal-widget--meetings { min-height: 540px; }
}

@media (prefers-reduced-motion: reduce) {
  .mw-widget-toolbar, .mw-seg__option, .mw-gallery-card, .mw-add-btn { transition: none; }
  .mw-widget-gallery__drawer { animation: none; }
  .mw-widget-flash > .mw-item__content { animation: none; }
  .mw-clock-second { display: none; }
}

/* -- Very narrow boxes (10-column grid / edit mode at smaller desktops) ------- */
@container mww (max-width: 215px) {
  .mw-clock-body { grid-template-columns: minmax(0, 46%) minmax(0, 1fr); gap: 8px; }
  .mw-clock-body .mw-clock-face-wrap { width: 100%; height: auto; max-height: 100%; }
  .mw-clock-time { font-size: 22px; }
  .mw-clock-ampm { font-size: 10px; }
  .mw-clock-label, .mw-clock-date { font-size: 11px; }
  .mw-date-number { font-size: 56px; }
  .mw-weather-hourly { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mw-weather-hour:nth-child(n + 5) { display: none; }
  .mw-forecast-row { grid-template-columns: 36px 16px 24px minmax(10px, 1fr) 26px; }
  .mw-forecast-pop { display: none; }
  .mw-weather-state { display: none; }
}
