/* ══════════════════════════════════════
   TOKENS  — Payas design system
══════════════════════════════════════ */
:root {
  --bg-app:        #eeeae2;
  --bg-bar:        #ffffff;
  --bg-sidebar:    #f5f2eb;
  --bg-surface:    #ffffff;
  --bg-modal:      #ffffff;
  --bg-chip:       #f0ece3;
  --bg-hover:      #e8e4db;
  --bg-active:     #dedad1;
  --text-1:        #181816;
  --text-2:        #52504a;
  --text-3:        #90907e;
  --border:        #dbd7ce;
  --accent:        #2d6a4f;
  --accent-lt:     #52b788;
  --accent-dk:     #1b4332;
  --accent-dim:    rgba(45,106,79,.12);
  --shadow:        0 1px 5px rgba(0,0,0,.07);
  --shadow-lg:     0 16px 56px rgba(0,0,0,.14);
  --scrollbar:     #ccc8bc;
  --danger:        #dc2626;

  /* Legacy aliases — keep for calendar-specific classes */
  --pd-bg:              var(--bg-app);
  --pd-bg-secondary:    var(--bg-sidebar);
  --pd-bg-tertiary:     var(--bg-hover);
  --pd-surface:         var(--bg-surface);
  --pd-surface-hover:   var(--bg-hover);
  --pd-border:          var(--border);
  --pd-text:            var(--text-1);
  --pd-text-secondary:  var(--text-2);
  --pd-text-muted:      var(--text-3);
  --pd-accent:          var(--accent);
  --pd-accent-hover:    var(--accent-dk);
  --pd-accent-light:    var(--accent-dim);
  --pd-today-bg:        #eef8f3;
  --pd-today-text:      var(--accent);
  --pd-today-border:    var(--accent-lt);
  --pd-shadow:          var(--shadow);
  --pd-shadow-lg:       var(--shadow-lg);
  --pd-radius:          7px;
  --pd-radius-sm:       5px;
  --pd-radius-lg:       12px;
  --pd-navbar-h:        80px;   /* 44px titlebar + 36px tabsbar */
  --pd-font:            'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --pd-font-mono:       'JetBrains Mono', 'Fira Mono', monospace;
  --pd-font-brand:      'Fraunces', Georgia, serif;
  --pd-transition:      0.13s ease;
}

[data-theme="dark"] {
  --bg-app:        #0f0f0e;
  --bg-bar:        #191917;
  --bg-sidebar:    #141412;
  --bg-surface:    #161614;
  --bg-modal:      #222220;
  --bg-chip:       #1e1e1c;
  --bg-hover:      #242422;
  --bg-active:     #2e2e2c;
  --text-1:        #e8e4d6;
  --text-2:        #a4a099;
  --text-3:        #62605a;
  --border:        #2a2a28;
  --accent:        #52b788;
  --accent-lt:     #74c69d;
  --accent-dk:     #95d5b2;
  --accent-dim:    rgba(82,183,136,.12);
  --shadow:        0 1px 5px rgba(0,0,0,.4);
  --shadow-lg:     0 16px 56px rgba(0,0,0,.6);
  --scrollbar:     #333330;
  --danger:        #ef4444;

  --pd-today-bg:   #0d2118;
  --pd-today-text: var(--accent-lt);
}

/* ══════════════════════════════════════
   BASE
══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--pd-font);
  background: var(--bg-app);
  color: var(--text-1);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ══════════════════════════════════════
   HEADER SHELL
══════════════════════════════════════ */
.pd-header {
  background: var(--bg-bar);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 300;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   TITLEBAR  (44 px — matches Payas apps)
══════════════════════════════════════ */
.pd-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 44px;
  padding: 0 10px;
  gap: 6px;
}

/* ── Brand ── */
.pd-brand {
  font-family: var(--pd-font-brand);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -.3px;
  user-select: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  padding: 3px 7px;
  border-radius: 5px;
  transition: background var(--pd-transition);
  flex-shrink: 0;
}
.pd-brand:hover { background: var(--bg-hover); }
.pd-brand i { font-size: 14px; opacity: .8; }
.pd-brand-sub {
  font-style: italic;
  font-weight: 400;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--pd-font-brand);
}

/* ── Date navigation ── */
.pd-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.pd-arrow-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 5px;
  color: var(--text-3);
  cursor: pointer;
  font-size: 12px;
  transition: background var(--pd-transition), color var(--pd-transition), transform .09s;
  flex-shrink: 0;
}
.pd-arrow-btn:hover { background: var(--bg-hover); color: var(--text-1); }
.pd-arrow-btn:active { transform: scale(.91); }

.pd-date-display {
  padding: 3px 12px;
  background: none;
  border: none;
  border-radius: 5px;
  font-family: var(--pd-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  cursor: pointer;
  transition: background var(--pd-transition), color var(--pd-transition);
  white-space: nowrap;
  letter-spacing: -.01em;
}
.pd-date-display:hover { background: var(--bg-hover); }

/* ── Right action buttons ── */
.pd-topbar-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

/* shared icon/text button — matches mbar-btn / tb-btn */
.pd-action-btn {
  height: 28px;
  padding: 0 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  border-radius: 5px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--pd-font);
  text-decoration: none;
  transition: background var(--pd-transition), color var(--pd-transition), transform .09s;
  white-space: nowrap;
  flex-shrink: 0;
}
.pd-action-btn:hover { background: var(--bg-hover); color: var(--text-1); }
.pd-action-btn:active { transform: scale(.91); }
.pd-action-btn.active { background: var(--accent-dim); color: var(--accent); }
.pd-action-label {
  font-size: 12.5px;
  font-weight: 500;
  display: none;
}
@media (min-width: 1280px) { .pd-action-label { display: inline; } }

/* theme icon spin */
.pd-theme-icon { display: flex; transition: transform .3s ease; }
.pd-theme-btn:hover .pd-theme-icon { transform: rotate(22deg); }

/* vertical divider */
.pd-vdivider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 3px;
  flex-shrink: 0;
}

.pd-page-links { display: flex; align-items: center; gap: 1px; }

/* ══════════════════════════════════════
   TABSBAR  (36 px — matches editor tabbar)
══════════════════════════════════════ */
.pd-tabsbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: 36px;
  padding: 0 8px;
  border-top: 1px solid var(--border);
  background: var(--bg-app);
  overflow: hidden;
}

.pd-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  height: 100%;
}

/* view tab — matches .tab-item / sb-tab style */
.pd-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 11px;
  height: 100%;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  font-family: var(--pd-font);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--pd-transition), border-color var(--pd-transition), background var(--pd-transition);
  user-select: none;
}
.pd-view-btn i { font-size: 11px; }
.pd-view-btn:hover { color: var(--accent); background: var(--bg-hover); }
.pd-view-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* today pill */
.pd-tabs-right { display: flex; align-items: center; }
.pd-today-pill {
  height: 24px;
  padding: 0 11px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: var(--pd-font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--pd-transition);
  white-space: nowrap;
}
.pd-today-pill:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--text-3); }

/* ══════════════════════════════════════
   MOBILE SLIDE-DOWN MENU
══════════════════════════════════════ */
.pd-mobile-menu {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .24s cubic-bezier(.4,0,.2,1), opacity .18s ease;
  background: var(--bg-bar);
  border-top: 1px solid var(--border);
}
.pd-mobile-menu.open { max-height: 280px; opacity: 1; }
.pd-mobile-nav { padding: 6px; }
.pd-mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-1);
  transition: background var(--pd-transition);
}
.pd-mobile-nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.pd-mobile-nav-item.active { color: var(--accent); background: var(--accent-dim); }
.pd-mobile-nav-icon {
  width: 30px;
  height: 30px;
  background: var(--bg-chip);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-2);
  flex-shrink: 0;
}
.pd-mobile-nav-label { font-size: 13.5px; font-weight: 500; flex: 1; }
.pd-mobile-nav-arrow { font-size: 10px; color: var(--text-3); }
#mobileMenuIcon { transition: transform .2s ease; }
.pd-menu-btn.open #mobileMenuIcon { transform: rotate(90deg); }

/* ══════════════════════════════════════
   SEARCH BAR  (matches find-bar)
══════════════════════════════════════ */
.pd-search-bar {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .2s cubic-bezier(.4,0,.2,1), opacity .16s ease;
  background: var(--bg-bar);
  border-top: 1px solid var(--border);
  position: relative;
}
.pd-search-bar.open { max-height: 400px; opacity: 1; }
.pd-search-inner {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
}
.pd-search-ico { color: var(--text-3); font-size: 12.5px; flex-shrink: 0; }
.pd-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--pd-font);
  font-size: 12.5px;
  color: var(--text-1);
}
.pd-search-input::placeholder { color: var(--text-3); }
.pd-search-close { color: var(--text-3); }
.pd-search-results {
  background: var(--bg-bar);
  border-top: 1px solid var(--border);
  max-height: 320px;
  overflow-y: auto;
}
.pd-search-result-item {
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--pd-transition);
  font-size: 13px;
}
.pd-search-result-item:hover { background: var(--bg-hover); }
.pd-search-result-item:last-child { border-bottom: none; }

/* ══════════════════════════════════════
   SHARED MODAL BUTTONS
   Override Bootstrap .btn/.btn-sm specificity with !important on layout props
══════════════════════════════════════ */
.pd-btn-ghost {
  height: 28px !important;
  padding: 0 10px !important;
  background: none !important;
  border: 1px solid var(--border) !important;
  border-radius: 5px !important;
  font-family: var(--pd-font) !important;
  font-size: 12.5px !important;
  color: var(--text-2) !important;
  cursor: pointer;
  transition: background var(--pd-transition), color var(--pd-transition);
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px;
  box-shadow: none !important;
  line-height: 1 !important;
}
.pd-btn-ghost:hover { background: var(--bg-hover) !important; color: var(--text-1) !important; }
.pd-btn-ghost:focus { box-shadow: none !important; }

.pd-btn-primary {
  height: 28px !important;
  padding: 0 12px !important;
  background: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  border-radius: 5px !important;
  font-family: var(--pd-font) !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  color: #fff !important;
  cursor: pointer;
  transition: background var(--pd-transition), border-color var(--pd-transition);
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px;
  box-shadow: none !important;
  line-height: 1 !important;
}
.pd-btn-primary:hover { background: var(--accent-dk) !important; border-color: var(--accent-dk) !important; }
.pd-btn-primary:focus { box-shadow: none !important; }

.pd-btn-danger {
  height: 28px !important;
  padding: 0 10px !important;
  background: none !important;
  border: 1px solid var(--danger) !important;
  border-radius: 5px !important;
  font-family: var(--pd-font) !important;
  font-size: 12.5px !important;
  color: var(--danger) !important;
  cursor: pointer;
  transition: background var(--pd-transition);
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px;
  box-shadow: none !important;
  line-height: 1 !important;
}
.pd-btn-danger:hover { background: rgba(220,38,38,.08) !important; }
.pd-btn-danger:focus { box-shadow: none !important; }

/* icon-only alias used in popovers */
.pd-btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 5px;
  color: var(--text-3);
  cursor: pointer;
  font-size: 13px;
  transition: background var(--pd-transition), color var(--pd-transition), transform .09s;
}
.pd-btn-icon:hover { background: var(--bg-hover); color: var(--text-1); }
.pd-btn-icon:active { transform: scale(.91); }

/* ══════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════ */
.pd-main {
  height: calc(100vh - var(--pd-navbar-h));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

.pd-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  animation: pdFadeIn .14s ease;
}

/* ══════════════════════════════════════
   MONTH VIEW
══════════════════════════════════════ */
.pd-month-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  flex-shrink: 0;
}
.pd-month-grid-header > div {
  text-align: center;
  padding: 6px 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.pd-month-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  overflow-y: auto;
  background: var(--border);
  gap: 1px;
}
.pd-month-cell {
  background: var(--bg-surface);
  min-height: 96px;
  padding: 5px 6px;
  cursor: pointer;
  transition: background var(--pd-transition);
  overflow: hidden;
  position: relative;
}
.pd-month-cell:hover { background: var(--bg-hover); }
.pd-month-cell.other-month { background: var(--bg-sidebar); }
.pd-month-cell.other-month .pd-day-num { color: var(--text-3); opacity: .55; }
.pd-month-cell.today { background: var(--pd-today-bg); }
.pd-month-cell.selected { outline: 2px solid var(--accent); outline-offset: -2px; }

.pd-day-num {
  font-family: var(--pd-font-mono);
  font-size: 11.5px;
  color: var(--text-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-bottom: 2px;
  font-weight: 500;
}
.pd-month-cell.today .pd-day-num {
  background: var(--accent);
  color: #fff;
}

.pd-event-chip {
  display: block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 500;
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  transition: opacity var(--pd-transition);
  line-height: 1.5;
}
.pd-event-chip:hover { opacity: .82; }

.pd-more-chip {
  font-size: 10.5px;
  color: var(--text-3);
  cursor: pointer;
  padding: 1px 4px;
  font-family: var(--pd-font-mono);
}
.pd-more-chip:hover { color: var(--accent); }

/* ══════════════════════════════════════
   WEEK / DAY VIEW
══════════════════════════════════════ */
.pd-week-scroll-outer { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.pd-week-header {
  display: flex;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pd-week-header-cell {
  flex: 1;
  padding: 7px 5px;
  text-align: center;
  border-right: 1px solid var(--border);
  font-size: 11.5px;
}
.pd-week-header-cell:last-child { border-right: none; }
.pd-week-header-cell .day-name {
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  font-size: 10px;
}
.pd-week-header-cell .day-num {
  font-family: var(--pd-font-mono);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--pd-transition);
}
.pd-week-header-cell .day-num:hover { background: var(--bg-active); }
.pd-week-header-cell.today .day-num { background: var(--accent); color: #fff; }

.pd-week-body-wrap { flex: 1; overflow-y: auto; display: flex; position: relative; }
.pd-time-gutter {
  width: 52px;
  flex-shrink: 0;
  position: sticky;
  left: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  z-index: 5;
}
.pd-time-slot-label {
  height: 60px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 2px 8px 0 0;
  font-family: var(--pd-font-mono);
  font-size: 10px;
  color: var(--text-3);
  font-weight: 400;
}
.pd-week-body { flex: 1; display: flex; position: relative; min-height: 1440px; }
.pd-day-column { flex: 1; border-right: 1px solid var(--border); position: relative; min-height: 1440px; }
.pd-day-column:last-child { border-right: none; }
.pd-time-line { height: 60px; border-bottom: 1px solid var(--border); position: relative; }
.pd-time-line:nth-child(even) { background: rgba(0,0,0,.012); }
[data-theme="dark"] .pd-time-line:nth-child(even) { background: rgba(255,255,255,.012); }

.pd-week-event {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 10.5px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  z-index: 2;
  transition: opacity var(--pd-transition);
  border: none;
}
.pd-week-event:hover { opacity: .84; z-index: 3; }

.pd-now-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--accent-lt);
  z-index: 4;
}
.pd-now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-lt);
}

/* Day view header */
.pd-day-header {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  flex-shrink: 0;
}
.pd-day-header h2 {
  margin: 0;
  font-family: var(--pd-font);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
}
.pd-day-body { flex: 1; display: flex; min-height: 1440px; }

/* ══════════════════════════════════════
   AGENDA VIEW
══════════════════════════════════════ */
.pd-agenda-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}
.pd-agenda-day { margin-bottom: 22px; }
.pd-agenda-day-header {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 7px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.pd-agenda-day-header .day-num {
  font-family: var(--pd-font-mono);
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1;
  color: var(--text-1);
  min-width: 42px;
}
.pd-agenda-day-header .day-info { font-size: 12.5px; color: var(--text-2); }
.pd-agenda-day-header.today .day-num { color: var(--accent); }
.pd-agenda-event {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--pd-transition);
  margin-bottom: 3px;
}
.pd-agenda-event:hover { background: var(--bg-hover); }
.pd-agenda-color { width: 3px; border-radius: 2px; align-self: stretch; flex-shrink: 0; min-height: 18px; }
.pd-agenda-time {
  font-family: var(--pd-font-mono);
  font-size: 11px;
  color: var(--text-3);
  min-width: 78px;
  padding-top: 2px;
}
.pd-agenda-title { font-size: 13px; font-weight: 500; color: var(--text-1); }
.pd-agenda-subtitle { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.pd-agenda-empty { text-align: center; color: var(--text-3); padding: 48px 16px; font-size: 13px; }

/* ══════════════════════════════════════
   FAB
══════════════════════════════════════ */
.pd-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  box-shadow: 0 4px 14px rgba(45,106,79,.35);
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s, transform .18s, box-shadow .18s;
  cursor: pointer;
}
.pd-fab:hover {
  background: var(--accent-dk);
  color: #fff;
  transform: scale(1.07);
  box-shadow: 0 6px 20px rgba(45,106,79,.45);
}
[data-theme="dark"] .pd-fab { box-shadow: 0 4px 14px rgba(82,183,136,.28); }

/* ══════════════════════════════════════
   EVENT POPOVER
══════════════════════════════════════ */
.pd-event-popover {
  position: fixed;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--pd-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 296px;
  z-index: 1060;
  overflow: hidden;
  animation: pdFadeIn .1s ease;
}
.pd-popover-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
}
.pd-popover-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pd-popover-title { font-weight: 600; font-size: 13px; flex: 1; color: var(--text-1); }
.pd-popover-body { padding: 11px; font-size: 12.5px; color: var(--text-2); }
.pd-popover-row { display: flex; gap: 7px; align-items: flex-start; margin-bottom: 5px; }
.pd-popover-row i { color: var(--text-3); width: 14px; margin-top: 2px; font-size: 11px; }

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.pd-modal-content {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--pd-radius-lg);
  color: var(--text-1);
  box-shadow: var(--shadow-lg);
}
.pd-modal-header {
  border-bottom: 1px solid var(--border);
  padding: 13px 18px;
  background: var(--bg-sidebar);
  border-radius: var(--pd-radius-lg) var(--pd-radius-lg) 0 0;
}
.pd-modal-header .modal-title { font-weight: 600; font-size: 13.5px; color: var(--text-1); }
.pd-modal-footer {
  border-top: 1px solid var(--border);
  padding: 10px 18px;
  background: var(--bg-sidebar);
  border-radius: 0 0 var(--pd-radius-lg) var(--pd-radius-lg);
  display: flex;
  gap: 6px;
  align-items: center;
}
.pd-btn-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: .9rem;
  opacity: 1;
  filter: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background var(--pd-transition), color var(--pd-transition);
}
.pd-btn-close:hover { background: var(--bg-hover); color: var(--text-1); }

.pd-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 4px;
  display: block;
}

.pd-input {
  background: var(--bg-chip) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-1) !important;
  border-radius: 5px !important;
  box-shadow: none !important;
  font-family: var(--pd-font) !important;
  font-size: 13px !important;
  transition: border-color var(--pd-transition);
}
.pd-input:focus { border-color: var(--accent) !important; outline: none !important; }
.pd-input-title {
  font-size: 1rem !important;
  font-weight: 600 !important;
  padding: 9px 12px !important;
  background: none !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.pd-input-title:focus { border-bottom-color: var(--accent) !important; box-shadow: none !important; }

/* Bootstrap dark-mode colour-scheme interference override */
.pd-modal-content,
.pd-modal-content input,
.pd-modal-content select,
.pd-modal-content textarea {
  color-scheme: light;
}
[data-theme="dark"] .pd-modal-content,
[data-theme="dark"] .pd-modal-content input,
[data-theme="dark"] .pd-modal-content select,
[data-theme="dark"] .pd-modal-content textarea {
  color-scheme: dark;
}
.form-select.pd-input {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2390907e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
}

/* ══════════════════════════════════════
   COLOR PICKER
══════════════════════════════════════ */
.pd-color-picker { display: flex; gap: 7px; flex-wrap: wrap; }
.pd-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--pd-transition);
}
.pd-color-swatch:hover, .pd-color-swatch.active {
  border-color: var(--text-1);
  transform: scale(1.18);
}

/* ══════════════════════════════════════
   PAGE VIEWS  (Settings / About / License)
══════════════════════════════════════ */
.pd-page-view {
  flex: 1;
  overflow-y: auto;
  padding: 28px 16px;
  background: var(--bg-app);
}
.pd-page { max-width: 680px; margin: 0 auto; }
.pd-page h2 {
  font-family: var(--pd-font-brand);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-1);
}
.pd-page h3 {
  font-size: 10.5px;
  font-weight: 700;
  margin-top: 22px;
  margin-bottom: 8px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .09em;
}
.pd-page p, .pd-page li { color: var(--text-2); line-height: 1.7; font-size: 13.5px; }
.pd-page hr { border-color: var(--border); margin: 20px 0; }
.pd-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.pd-setting-label { font-weight: 500; font-size: 13.5px; }
.pd-setting-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ══════════════════════════════════════
   TAG CHIPS
══════════════════════════════════════ */
.pd-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-chip);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-2);
  font-family: var(--pd-font);
}
.pd-tag-chip .remove-tag { cursor: pointer; color: var(--text-3); font-size: 11px; }
.pd-tag-chip .remove-tag:hover { color: var(--danger); }

/* ══════════════════════════════════════
   ALL-DAY STRIP
══════════════════════════════════════ */
.pd-allday-strip {
  min-height: 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px 4px;
}

/* ══════════════════════════════════════
   IMPORT AREA
══════════════════════════════════════ */
.pd-import-area {
  border: 2px dashed var(--border);
  border-radius: var(--pd-radius);
  padding: 22px;
  text-align: center;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--pd-transition);
  font-size: 13px;
}
.pd-import-area:hover, .pd-import-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

/* ══════════════════════════════════════
   FORM ELEMENTS  (dark mode fix)
══════════════════════════════════════ */
.form-check-input {
  background-color: var(--bg-chip);
  border-color: var(--border);
}
.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 576px) {
  .pd-month-cell { min-height: 60px; padding: 3px; }
  .pd-day-num { font-size: 11px; width: 20px; height: 20px; }
  .pd-event-chip { font-size: 10px; padding: 1px 4px; }
  .pd-fab { bottom: 14px; right: 14px; width: 44px; height: 44px; font-size: 1rem; }
  .pd-time-gutter { width: 38px; }
  .pd-time-slot-label { font-size: 9.5px; padding-right: 4px; }
  .pd-agenda-list { padding: 12px 10px; }
}
@media (max-width: 480px) {
  .pd-brand-sub { display: none; }
  .pd-topbar { grid-template-columns: auto 1fr auto; gap: 2px; padding: 0 6px; }
  .pd-date-display { font-size: 12.5px; padding: 3px 8px; }
  .pd-view-btn span { display: none; }
  .pd-view-btn { padding: 0 9px; gap: 0; }
}
@media (max-width: 360px) {
  .pd-today-pill { display: none; }
}

/* ══════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }

/* ══════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════ */
@keyframes pdFadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}
