/* V222: desktop dock navigation. Replaces the failed V221 workbar. */
:root {
  --dock-height: 58px;
  --dock-bottom-gap: 8px;
  --dock-side-gap: 10px;
  --dock-content-gap: 10px;
  --dock-total-space: calc(var(--dock-height) + var(--dock-bottom-gap) + var(--dock-content-gap));
}
body.has-dock { overflow: hidden; }
body.has-dock .app-shell.desktop-two-column {
  display: grid;
  grid-template-columns: clamp(280px, 27vw, 400px) minmax(0, 1fr);
  gap: 8px;
  height: calc(100vh - var(--dock-total-space));
  min-height: 0;
  padding: 6px 10px 0;
  box-sizing: border-box;
}
body.has-dock .app-shell.desktop-two-column .entity-list,
body.has-dock .app-shell.desktop-two-column .workspace {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
body.has-dock .app-shell.desktop-two-column .workspace { padding-bottom: 18px; }
body.has-dock .main-menu { display: none !important; }
body.has-dock .notebook-focus-shell {
  height: calc(100vh - var(--dock-total-space));
  padding-bottom: 0;
}
body.has-dock .notebook-focus-left,
body.has-dock .notebook-focus-center,
body.has-dock .notebook-focus-right { min-height: 0; }

.desktop-dock {
  position: fixed;
  left: var(--dock-side-gap);
  right: var(--dock-side-gap);
  bottom: var(--dock-bottom-gap);
  min-height: var(--dock-height);
  z-index: 1250;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  box-sizing: border-box;
  background: var(--panel-bg);
  color: var(--text-color);
  border: 2px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
  box-shadow: 1px 1px 0 var(--border-dark);
}
.desktop-dock a { color: inherit; text-decoration: none; }
.desktop-dock-left,
.desktop-dock-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.desktop-dock-left { flex: 1 1 auto; overflow: visible; }
.desktop-dock-right { flex: 0 0 auto; margin-left: auto; }
.dock-menu { position: relative; display: inline-flex; flex: 0 0 auto; }
.dock-button,
.dock-menu-item {
  font: inherit;
  min-height: 34px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--button-bg);
  color: var(--button-text);
  border: 2px solid;
  border-color: var(--border-light) var(--border-mid) var(--border-mid) var(--border-light);
  white-space: nowrap;
  cursor: pointer;
}
.dock-button:active,
.dock-button.active,
.dock-menu.open > .dock-button,
.dock-menu-item:active,
.dock-menu-item.active {
  border-color: var(--border-mid) var(--border-light) var(--border-light) var(--border-mid);
}
.dock-button.active,
.dock-menu-item.active { font-weight: bold; }
.dock-icon { flex: 0 0 auto; font-size: 16px; line-height: 1; }
.dock-label { overflow: hidden; text-overflow: ellipsis; }
.dock-icon-button { position: relative; min-width: 38px; justify-content: center; padding-left: 9px; padding-right: 9px; }
.dock-recurring-button { position: relative; }
.dock-quick-button { max-width: 150px; }
.dock-badge {
  position: absolute;
  top: -8px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  background: #c00000;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  padding: 0 4px;
  box-sizing: border-box;
  border: 1px solid #fff;
}
.dock-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  display: none;
  min-width: 230px;
  max-width: min(360px, calc(100vw - 28px));
  padding: 4px;
  background: var(--panel-bg);
  color: var(--text-color);
  border: 2px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
  box-shadow: 2px 2px 0 rgba(0,0,0,.7);
  z-index: 1260;
}
.dock-menu.open .dock-popover,
.dock-menu:hover .dock-popover { display: flex; flex-direction: column; gap: 2px; }
.dock-popover.align-right { left: auto; right: 0; }
.dock-menu-item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  border-width: 1px;
  background: transparent;
}
.dock-menu-item:hover,
.dock-menu-item:focus { background: var(--content-bg-soft, var(--panel-bg-soft)); outline: none; }

.dock-toast-stack {
  position: fixed;
  right: 18px;
  bottom: calc(var(--dock-height) + var(--dock-bottom-gap) + 16px);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 36px));
}
.dock-toast {
  background: var(--panel-bg);
  color: var(--text-color);
  border: 2px solid;
  border-color: var(--border-light) var(--border-dark) var(--border-dark) var(--border-light);
  box-shadow: var(--shadow-window);
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  align-items: start;
}
.dock-toast-message { min-width: 0; }
.dock-toast-actions { display: inline-flex; gap: 5px; align-items: center; }
.dock-toast-actions button,
.dock-toast-actions a { padding: 3px 8px; }

.dock-quick-note-modal { width: min(960px, calc(100vw - 40px)); }
.dock-quick-note-content {
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr);
  gap: 10px;
  min-height: 440px;
}
.dock-quick-note-tree-panel {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 2px solid;
  border-color: var(--border-mid) var(--border-light) var(--border-light) var(--border-mid);
  background: var(--panel-bg-soft);
}
.dock-quick-note-tree-panel .window-title { margin: 0; flex: 0 0 auto; }
.dock-quick-note-tree { padding: 6px; overflow: auto; min-height: 0; flex: 1 1 auto; }
.dock-folder-tree-list { list-style: none; margin: 0; padding: 0; }
.dock-folder-tree-list ul { list-style: none; margin: 2px 0 2px 14px; padding: 0; }
.dock-folder-choice {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  text-align: left;
  padding: 4px 6px;
  margin: 1px 0;
  border-width: 1px;
}
.dock-folder-choice.active { background: var(--title-bg); color: var(--title-color); }
.dock-quick-note-form {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
}
.dock-quick-note-body-label { min-height: 0; display: flex; flex-direction: column; }
.dock-quick-note-body-label textarea { min-height: 0; height: 100%; resize: vertical; font-family: Consolas, "Courier New", monospace; }

.dock-notifications-modal { width: min(760px, calc(100vw - 40px)); }
.dock-notifications-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.dock-notifications-list { display: flex; flex-direction: column; gap: 6px; max-height: min(65vh, 560px); overflow: auto; }
.dock-notification-item {
  border: 2px solid;
  border-color: var(--border-mid) var(--border-light) var(--border-light) var(--border-mid);
  background: var(--content-bg);
  color: var(--text-color);
  padding: 8px;
}
.dock-notification-item.unread { background: var(--note-pinned-bg, #fffde0); }
.dock-notification-head { display:flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 5px; }
.dock-notification-time { color: var(--muted-text-color); font-size: 12px; }
.dock-notification-actions { display:flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }

.win98-floating-window.program-window { max-height: calc(100vh - var(--dock-total-space) - 12px); }
.win98-floating-window.is-maximized { height: calc(100vh - var(--dock-total-space)) !important; max-height: calc(100vh - var(--dock-total-space)) !important; }

body.theme-winxp .desktop-dock {
  background: linear-gradient(#3d82f7, #245edb 55%, #1941a5);
  border-color: #7db6ff #0d2d7e #0d2d7e #7db6ff;
  box-shadow: 0 -1px 0 rgba(255,255,255,.35), 0 2px 10px rgba(0,0,0,.22);
  color: #fff;
}
body.theme-winxp .dock-button,
body.theme-winxp .dock-menu-item {
  border-radius: 3px;
  border-color: rgba(255,255,255,.55) rgba(0,0,0,.35) rgba(0,0,0,.35) rgba(255,255,255,.55);
  background: linear-gradient(#fff, #dbe8ff);
  color: #000;
}
body.theme-winxp .dock-button.active,
body.theme-winxp .dock-menu.open > .dock-button {
  background: linear-gradient(#d0e4ff, #8fb9ff);
}
body.theme-winxp .dock-popover { border-radius: 3px; }

body.theme-ubuntu24 .desktop-dock {
  left: 14px;
  right: 14px;
  bottom: 10px;
  background: #242424;
  border: 1px solid #393939;
  border-radius: 15px;
  color: #f6f5f4;
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
  padding: 8px 10px;
}
body.theme-ubuntu24 .desktop-dock a { color: #f6f5f4; }
body.theme-ubuntu24 .dock-button,
body.theme-ubuntu24 .dock-menu-item {
  min-height: 36px;
  border: 1px solid #3d3d3d;
  border-radius: 10px;
  background: #303030;
  color: #f6f5f4;
  box-shadow: none;
}
body.theme-ubuntu24 .dock-button:hover,
body.theme-ubuntu24 .dock-button:focus,
body.theme-ubuntu24 .dock-menu.open > .dock-button,
body.theme-ubuntu24 .dock-button.active,
body.theme-ubuntu24 .dock-menu-item:hover,
body.theme-ubuntu24 .dock-menu-item:focus,
body.theme-ubuntu24 .dock-menu-item.active {
  background: #3f3f3f;
  border-color: #555;
  outline: none;
}
body.theme-ubuntu24 .dock-popover {
  background: #2b2b2b;
  color: #f6f5f4;
  border: 1px solid #444;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
  padding: 7px;
}
body.theme-ubuntu24 .dock-badge { background: #e95420; border-color: #242424; }
body.theme-ubuntu24 .dock-toast,
body.theme-ubuntu24 .dock-notification-item,
body.theme-ubuntu24 .dock-quick-note-tree-panel {
  border-width: 1px;
  border-color: var(--border-mid);
  box-shadow: var(--shadow-soft);
}
body.theme-ubuntu24 .dock-folder-choice.active { background: var(--ubuntu-sidebar-selected); color: var(--text-color); }

@media (max-width: 1100px) {
  body.has-dock .app-shell.desktop-two-column { grid-template-columns: clamp(280px, 32vw, 340px) minmax(0,1fr); gap: 6px; padding-left: 6px; padding-right: 6px; }
  .desktop-dock { gap: 6px; overflow-x: auto; overflow-y: visible; }
  .dock-label { max-width: 120px; }
  .desktop-dock-left { overflow: visible; }
}
@media (max-width: 900px) {
  .dock-button { padding-left: 8px; padding-right: 8px; }
  .dock-quick-button .dock-label { display: none; }
  .dock-quick-note-content { grid-template-columns: 1fr; min-height: 0; }
  .dock-quick-note-tree-panel { max-height: 230px; }
}

/* V222.1 hotfix: keep dock-launched modals above the lower dock area. */
.dock-modal-overlay {
  bottom: var(--dock-total-space);
  padding: 32px 20px 16px;
}
.dock-quick-note-modal {
  height: min(720px, calc(100vh - var(--dock-total-space) - 48px));
  max-height: calc(100vh - var(--dock-total-space) - 48px);
}
.dock-quick-note-content {
  flex: 1 1 auto;
  min-height: 0;
}
.dock-quick-note-form .modal-buttons-row,
.reminder-quick-modal .modal-buttons-row {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  background: var(--panel);
  padding-top: 8px;
  margin-top: 4px;
}
.reminder-quick-modal {
  max-height: calc(100vh - var(--dock-total-space) - 48px);
}

@media (max-height: 760px) {
  .dock-modal-overlay { padding-top: 18px; }
  .dock-quick-note-modal {
    height: calc(100vh - var(--dock-total-space) - 30px);
    max-height: calc(100vh - var(--dock-total-space) - 30px);
  }
}

/* V227.1: current active day shortcut in the system zone.
   Uses the same calendar icon as the Work → Days menu item. */
.dock-current-day-button {
  width: 40px;
  min-width: 40px;
}
.dock-current-day-button .dock-icon {
  font-size: 17px;
  line-height: 1;
}
/* V237 nested Planning submenu */
.dock-submenu{position:relative}
.dock-submenu>.dock-menu-item{width:100%}
.dock-submenu-arrow{margin-left:auto;font-size:10px}
.dock-submenu-popover{position:absolute;left:calc(100% + 3px);bottom:0;display:none;min-width:185px;padding:4px;border:2px outset var(--dock-border,#ddd);background:var(--dock-popover-bg,var(--panel-bg,#eee));z-index:220}
.dock-submenu.open>.dock-submenu-popover{display:block}
.dock-submenu-popover.align-left{left:auto;right:calc(100% + 3px)}
.dock-submenu-popover .dock-menu-item{width:100%}
