/* Dropdowns: the app's own pick menu (in place of the browser's select
   list), the date picker and the notifications panel. Loaded after
   tile.css. Flat surfaces, one hairline edge, a soft shadow only because
   they float; colour only on the picked item's tick and on priorities. */

/* ---------- pick menu ---------- */
.pm { position: relative; display: inline-flex; min-width: 0; max-width: 100%; }
.pm-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 0; max-width: 100%;
  font: inherit; cursor: pointer;
}
.pm-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-chev { flex: none; width: 12px; height: 12px; opacity: .7; transition: transform .14s ease; }
.pm.open .pm-chev { transform: rotate(180deg); }

/* The plain field look, for Time, Reminder and custom fields. */
.pm-field {
  width: 100%; height: 34px; padding: 0 10px;
  justify-content: space-between;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel-2); color: var(--text);
  font-size: 13px; text-align: left;
}
.pm:has(.pm-field) { display: flex; width: 100%; }
.pm-field:hover { border-color: color-mix(in srgb, var(--border) 55%, var(--text)); }
.pm.open .pm-field, .pm-field:focus-visible { border-color: var(--accent); outline: none; }

.pm-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 90;
  min-width: max(100%, 160px); width: max-content; max-width: 280px;
  max-height: 264px; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  animation: pmIn .12s ease-out;
}
.pm-pop.pm-right { left: auto; right: 0; }
.pm-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; min-height: 32px; padding: 0 8px 0 10px;
  border: 0; border-radius: 5px; background: none;
  color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.pm-item.active { background: var(--panel-2); }
.pm-item.on { font-weight: 600; }
.pm-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-check { flex: none; width: 14px; height: 14px; color: var(--accent); }
.pm-item.pm-high { color: var(--danger); }
.pm-item.pm-medium { color: var(--warn); }
@keyframes pmIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

/* ---------- date picker ---------- */
.dw-meta .dw-dates { width: 320px; padding: 10px; border-radius: 10px; }
.dp-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
  padding: 3px; margin: 0 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
}
.dp-tab {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 6px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.dp-tab span { font-size: 11px; color: var(--muted); }
.dp-tab strong { font-size: 13px; font-weight: 600; }
.dp-tab:hover { background: var(--panel-2); }
.dp-tab.on { background: var(--panel-2); box-shadow: none; }
.dp-tab.on span { color: var(--accent); }

.dp-cal { padding: 0 2px 4px; }
.dp-nav { padding: 0 0 8px; }
.dp-title { font-size: 13.5px; font-weight: 600; }
.dp-arrow { border-radius: 6px; }
.dp-weekdays span { font-size: 11px; font-weight: 500; }
.dp-day { height: 34px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.dp-day.outside { opacity: .4; }
.dp-day.today { box-shadow: none; color: var(--accent); font-weight: 700; }
.dp-day.selected { background: var(--accent-fill); color: #ffffff; }
.dp-day.today.selected { color: #ffffff; }

.dp-quick {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 0 12px; border-bottom: 1px solid var(--border);
}
.dp-quick .dw-link {
  height: 28px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: none; color: var(--text); font-size: 12.5px; font-weight: 500; text-decoration: none;
}
.dp-quick .dw-link:hover { background: var(--panel-2); color: var(--text); }

.dp-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 0 2px; }
.dp-row { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dp-row-label { font-size: 11.5px; font-weight: 500; color: var(--muted); }

.dw-dates .dp-clear {
  margin-top: 8px; padding: 6px 8px; margin-left: -8px;
  border-radius: 6px; color: var(--muted); font-size: 12.5px; text-decoration: none;
}
.dw-dates .dp-clear:hover { background: var(--danger-soft); color: var(--danger); text-decoration: none; }

/* ---------- dark ---------- */
[data-theme="dark"] .pm-pop { background: #262626; border-color: #454545; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); }
[data-theme="dark"] .pm-item.active { background: #333333; }
[data-theme="dark"] .pm-item.pm-high { color: #f2aaaa; }
[data-theme="dark"] .pm-item.pm-medium { color: #eeb77e; }
[data-theme="dark"] .pm-field { background: #1f1f1f; border-color: #454545; }
[data-theme="dark"] .pm-field:hover { border-color: #5a5a5a; }
[data-theme="dark"] .pm.open .pm-field { border-color: var(--accent); }

[data-theme="dark"] .dw-meta .dw-dates { background: #262626; border-color: #454545; }
[data-theme="dark"] .dp-tabs { border-color: #3d3d3d; background: #1f1f1f; }
[data-theme="dark"] .dp-tab { border: 0; }
[data-theme="dark"] .dp-tab:hover { background: #2b2b2b; }
[data-theme="dark"] .dp-tab.on { background: #333333; border: 0; }
[data-theme="dark"] .dp-day:hover, [data-theme="dark"] .dp-arrow:hover { background: #333333; }
[data-theme="dark"] .dp-day.between { background: #2b2d3a; }
[data-theme="dark"] .dp-day.ends { background: #2b2d3a; }
[data-theme="dark"] .dp-day.selected { background: #5062d6; }
[data-theme="dark"] .dp-day.selected:hover { background: #5b6ee1; }
[data-theme="dark"] .dp-quick { border-bottom-color: #3d3d3d; }
[data-theme="dark"] .dp-quick .dw-link { border-color: #454545; }
[data-theme="dark"] .dp-quick .dw-link:hover { background: #333333; }
[data-theme="dark"] .dw-dates .dp-clear:hover { background: #3a2222; color: #f2aaaa; }

[data-theme="dark"] .notif-menu { background: #262626; }
[data-theme="dark"] .notif-head { border-bottom-color: #3d3d3d; }
[data-theme="dark"] .notif-seg { border-color: #3d3d3d; background: #1f1f1f; }
[data-theme="dark"] .notif-seg button.on { background: #333333; }
[data-theme="dark"] .notif-markall:hover,
[data-theme="dark"] .notif-item:hover { background: #2e2e2e; }
[data-theme="dark"] .notif-icon.is-reminder,
[data-theme="dark"] .notif-icon.is-share { background: #333333; }
[data-theme="dark"] .notif-item.unread .notif-icon.is-reminder { color: #f2c78f; }

@media (prefers-reduced-motion: reduce) {
  .pm-pop { animation: none; }
  .pm-chev { transition: none; }
}

/* Not enough room below: the list opens upward instead. */
.pm-pop.pm-up { top: auto; bottom: calc(100% + 4px); animation-name: pmInUp; }
@keyframes pmInUp {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* The compact look, for toolbars and table rows. */
.pm-inline {
  height: 30px; padding: 0 8px 0 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel-2); color: var(--text);
  font-size: 12.5px;
}
.pm-inline:hover { border-color: color-mix(in srgb, var(--border) 55%, var(--text)); }
.pm.open .pm-inline, .pm-inline:focus-visible { border-color: var(--accent); outline: none; }
.pm-btn:disabled { opacity: .5; cursor: default; }
.pm-group {
  padding: 8px 10px 4px;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.pm-group:first-child { padding-top: 4px; }
[data-theme="dark"] .pm-inline { background: #1f1f1f; border-color: #454545; }
[data-theme="dark"] .pm-inline:hover { border-color: #5a5a5a; }
[data-theme="dark"] .pm.open .pm-inline { border-color: var(--accent); }
