.form-label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 4px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-main);
  background-color: var(--bg-surface);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }

.year-filter-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mini-select {
  border: 1px solid var(--border-strong);
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-radius: 6px;
  padding: 3px 24px 3px 7px;
  font-size: 11.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.search-scope-select, .form-select, .mini-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px !important;
}

.toast {
  position: fixed;
  bottom: 18px;
  left: 18px;
  top: auto;
  background: #0f172a;
  color: #fff;
  padding: 9px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2500;
}
.toast.toast-error { bottom: 68px; top: auto; background: #9f1239; border: 1px solid #fb7185; color: #fff; }
.thread-messages-switcher {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.thread-switcher-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.thread-switcher-title { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.thread-switcher-nav { display: flex; align-items: center; gap: 6px; }
.btn-thread-prev, .btn-thread-next { padding: 2px 8px; font-size: 11.5px; }
.thread-switcher-list { display: flex; flex-direction: column; gap: 6px; }
.thread-switcher-item {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.thread-switcher-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.thread-switcher-item.active { border-color: var(--primary); background: var(--primary-soft); }
.thread-switcher-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.thread-switcher-item-meta { display: flex; align-items: center; gap: 6px; min-width: 0; }
.thread-switcher-idx { font-size: 11px; font-weight: 700; color: var(--primary); }
.thread-switcher-star { font-size: 12px; color: var(--amber); }
.thread-switcher-sender { font-size: 12.5px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-switcher-badge { font-size: 10px; padding: 1px 6px; }
.thread-switcher-date { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.thread-switcher-snippet { font-size: 12px; color: var(--text-secondary); line-height: 1.35; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.mobile-quick-btn, .btn-tool.mobile-quick-btn, .btn-tool.btn-primary.mobile-quick-btn { display: none; padding: 5px 10px; font-size: 12px; }
.reading-toolbar-hint { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

/* RIGHT-CLICK CONTEXT MENU */
.ctx-menu-backdrop { position: fixed; inset: 0; z-index: 1600; background: transparent; }
.ctx-menu {
  position: fixed;
  z-index: 1610;
  min-width: 215px;
  max-width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  user-select: none;
}
.ctx-menu-header {
  padding: 6px 10px 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctx-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}
.ctx-menu-item:hover { background: var(--bg-subtle); color: var(--primary); }
.ctx-menu-item.danger { color: var(--rose); }
.ctx-menu-item.danger:hover { background: var(--rose-soft); color: var(--rose); }
.ctx-menu-item-left { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-menu-shortcut { font-size: 10.5px; color: var(--text-muted); font-family: var(--font-mono); flex-shrink: 0; }
.ctx-menu-sep { height: 1px; background: var(--border); margin: 3px 4px; }

@media (max-width: 1180px) {
  .reading-toolbar-hint { display: none; }
}

/* CALENDAR TOOLBAR REFINED CONTROLS & SEGMENTED SWITCHER */
.cal-controls-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-filter-dropdown-wrap { position: relative; display: inline-flex; }
.cal-dropdown-btn { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.cal-dropdown-backdrop { position: fixed; inset: 0; z-index: 1050; background: transparent; }
.cal-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 1060;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.12s ease;
}
.cal-dropdown-item:hover { background: var(--bg-subtle); color: var(--primary); }
.cal-dropdown-item.active { background: rgba(2, 132, 199, 0.15); color: var(--primary); font-weight: 600; }
.cal-dropdown-check { font-weight: 700; color: var(--primary); }
.cal-toolbar-divider { width: 1px; height: 22px; background: var(--border-strong); margin: 0 4px; flex-shrink: 0; }
.cal-view-group { display: inline-flex; align-items: center; gap: 6px; }
.cal-view-label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.cal-view-segmented {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.cal-segment-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.cal-segment-btn:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.06); }
.cal-segment-btn.active { background: var(--primary); color: #ffffff; font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }

/* CALENDAR LIST VIEW (AGENDA) */
.cal-list-view { display: flex; flex-direction: column; gap: 16px; padding: 16px; overflow-y: auto; height: 100%; }
.cal-list-date-group { display: flex; flex-direction: column; gap: 8px; }
.cal-list-date-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid var(--border-strong); }
.cal-list-event-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.12s ease;
}
.cal-list-event-card:hover { background: var(--bg-subtle); border-color: var(--primary); }
.cal-list-event-card.selected { border-color: var(--primary) !important; background: rgba(2, 132, 199, 0.08) !important; box-shadow: 0 0 0 1px var(--primary); }
.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.cal-nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cal-header-title {
  display: inline-block;
  width: 196px;
  min-width: 196px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.cal-year-selector {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.cal-year-label {
  display: inline-block;
  width: 44px;
  min-width: 44px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.cal-events-badge {
  min-width: 84px;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 480px) {
  .cal-header-title {
    width: 172px;
    min-width: 172px;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
