/* ==========================================================================
   Apple iOS HIG Design System — Groot Telegram Mini App
   ========================================================================== */

:root {
  color-scheme: light dark;
  /* System Colors */
  --ios-blue: #007AFF;
  --ios-green: #34C759;
  --ios-red: #FF3B30;
  --ios-orange: #FF9500;
  --ios-purple: #AF52DE;
  --ios-teal: #5AC8FA;
  --ios-gray: #8E8E93;
  --ios-gray-light: #C7C7CC;
  
  /* Light Theme Defaults */
  --bg-primary: #F2F2F7;
  --bg-card: #FFFFFF;
  --bg-card-elevated: #FFFFFF;
  --text-primary: #000000;
  --text-secondary: #8E8E93;
  --text-tertiary: #C7C7CC;
  --separator: rgba(60, 60, 67, 0.12);
  --bar-bg: rgba(249, 249, 249, 0.85);
  --fill-secondary: rgba(120, 120, 128, 0.12);
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --sheet-bg: #FFFFFF;
  --grabber-color: rgba(60, 60, 67, 0.3);
}

/* Dark Mode (Telegram or System) */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg-primary: #000000;
    --bg-card: #1C1C1E;
    --bg-card-elevated: #2C2C2E;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --text-tertiary: #48484A;
    --separator: rgba(84, 84, 88, 0.36);
    --bar-bg: rgba(28, 28, 30, 0.85);
    --fill-secondary: rgba(120, 120, 128, 0.24);
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    --sheet-bg: #1C1C1E;
    --grabber-color: rgba(235, 235, 245, 0.3);
  }
}

html.theme-dark,
body.theme-dark {
  color-scheme: dark;
  --bg-primary: #000000;
  --bg-card: #1C1C1E;
  --bg-card-elevated: #2C2C2E;
  --text-primary: #FFFFFF;
  --text-secondary: #8E8E93;
  --text-tertiary: #48484A;
  --separator: rgba(84, 84, 88, 0.36);
  --bar-bg: rgba(28, 28, 30, 0.85);
  --fill-secondary: rgba(120, 120, 128, 0.24);
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  --sheet-bg: #1C1C1E;
  --grabber-color: rgba(235, 235, 245, 0.3);
}

/* Explicit light overrides the system dark media query */
html.theme-light,
body.theme-light {
  color-scheme: light;
  --bg-primary: #F2F2F7;
  --bg-card: #FFFFFF;
  --bg-card-elevated: #FFFFFF;
  --text-primary: #000000;
  --text-secondary: #8E8E93;
  --text-tertiary: #C7C7CC;
  --separator: rgba(60, 60, 67, 0.12);
  --bar-bg: rgba(249, 249, 249, 0.85);
  --fill-secondary: rgba(120, 120, 128, 0.12);
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --sheet-bg: #FFFFFF;
  --grabber-color: rgba(60, 60, 67, 0.3);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(136px + env(safe-area-inset-bottom, 16px));
}

/* Header */
.ios-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bar-bg);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-bottom: 0.5px solid var(--separator);
  padding: 12px 16px 8px 16px;
  transition: all 0.2s ease;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.header-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: -0.08px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  background: var(--fill-secondary);
  color: var(--ios-blue);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--ios-blue);
  color: #FFF;
}

.icon-btn-settings {
  font-size: 16px;
  color: var(--text-secondary);
}

#btn-open-notifications { position:relative; flex-shrink:0; }
#notifications-badge { position:absolute; right:-4px; top:-5px; min-width:18px; padding:2px 4px; border-radius:12px; font-size:11px; line-height:1.2; background:var(--text-primary); color:var(--bg-primary); }
.notifications-description { font-size:14px; color:var(--text-secondary); margin-bottom:12px; }
.notification-card { padding:16px; margin-top:12px; border:1px solid var(--separator); border-radius:12px; background:var(--bg-card); }
.notification-card.is-unread { border-left:4px solid var(--ios-blue); }
.notification-card p { white-space:pre-wrap; overflow-wrap:anywhere; margin:8px 0; }
.notification-card time { color:var(--text-secondary); font-size:12px; }
.notification-action { min-height:44px; border:1px solid var(--separator); border-radius:10px; padding:8px 12px; color:var(--ios-blue); background:var(--bg-card); }
.notification-action:disabled { opacity:.45; cursor:default; }
#notifications-status { margin:12px 0; color:var(--text-secondary); }

.icon-btn-help {
  font-size: 18px;
  font-weight: 700;
}

.profile-avatar-card { padding:20px; }
.product-resources-card { padding:20px; margin-bottom:16px; }
#product-resource-intro { white-space:pre-wrap; overflow-wrap:anywhere; margin-bottom:12px; }
#product-resource-links a { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:56px; padding:12px 0; border-top:1px solid var(--separator); color:var(--ios-blue); text-decoration:none; overflow-wrap:anywhere; }
#product-resource-links a > span:first-child { min-width:0; }
#product-resource-links small { display:block; margin-top:4px; color:var(--text-secondary); }
#product-resource-editor[hidden] { display:none !important; }
#product-resource-editor h3,#product-resource-editor p { margin-bottom:12px; }
#product-resource-editor textarea,#product-resource-editor input:not([type="checkbox"]) { display:block; width:100%; min-width:0; min-height:44px; margin:6px 0; padding:10px; border:1px solid var(--separator); border-radius:8px; background:var(--bg-primary); color:var(--text-primary); font:inherit; font-size:16px; }
.product-resource-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,2fr); gap:8px 12px; border-top:1px solid var(--separator); padding:16px 0; }
.product-resource-row-actions { grid-column:1/-1; display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.product-resource-row-actions label { display:flex; align-items:center; gap:8px; min-height:44px; margin-right:auto; }
.product-resource-editor-actions { display:flex; flex-wrap:wrap; gap:8px; }
#product-resource-editor button { min-height:44px; padding:8px 12px; border:1px solid var(--separator); border-radius:8px; background:var(--bg-card); color:var(--ios-blue); font:inherit; }
#product-resource-editor button:disabled { opacity:.5; }
@media(max-width:600px) { .product-resource-row { grid-template-columns:minmax(0,1fr); } }
#profile-avatar-preview { display:grid; place-items:center; width:80px; height:80px; margin:0 auto 12px; border-radius:50%; background:var(--ios-blue); color:var(--bg-primary); font-size:32px; overflow:hidden; }
#profile-current { text-align:center; margin-bottom:16px; }
.profile-avatar-actions { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; }
.profile-avatar-actions button,#profile-avatar-reload { min-height:44px; padding:8px 12px; border:1px solid var(--separator); border-radius:10px; color:var(--text-primary); background:var(--bg-card); font:inherit; }
.profile-avatar-actions button[aria-pressed="true"] { border-color:var(--ios-blue); color:var(--ios-blue); }
.profile-avatar-actions button:disabled { opacity:.5; }
.profile-has-photo { overflow:hidden; position:relative; }
.profile-has-photo img { display:block; width:100%; height:100%; object-fit:cover; border-radius:inherit; }
#btn-open-settings.profile-has-photo { border-radius:50%; }
#btn-open-settings.profile-has-photo img { position:absolute; inset:0; }
#btn-open-settings.profile-has-photo::after { content:none; }
html[data-design="taclen"] #btn-open-settings.profile-has-photo::after { content:none; }

.header-large-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.37px;
}

/* Content Container */
.ios-content {
  flex: 1;
  padding: 16px 16px 24px 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Offline Status Banner */
.offline-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.15) 0%, rgba(255, 179, 64, 0.12) 100%);
  border: 1px solid rgba(255, 149, 0, 0.35);
  border-radius: 12px;
  padding: 8px 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  animation: slideDownBanner 0.25s ease;
  transition: all 0.3s ease;
}

.offline-banner.synced {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.15) 0%, rgba(48, 209, 88, 0.12) 100%);
  border-color: rgba(52, 199, 89, 0.35);
}

.offline-banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.offline-icon {
  font-size: 15px;
}

.offline-sync-btn {
  background: #FF9500;
  color: #FFF;
  border: none;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.offline-sync-btn:active {
  transform: scale(0.95);
}

@keyframes slideDownBanner {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-view {
  display: none;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* iOS Grouped Cards */
.ios-card {
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  border: 0.5px solid var(--separator);
  margin-bottom: 16px;
  overflow: hidden;
}

.ios-section-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: -0.08px;
  margin: 18px 4px 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Hero Card */
.hero-card {
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero-left {
  flex: 1 1 auto;
  min-width: 0;
}

.hero-metric {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.hero-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.hero-progress-ring {
  width: 60px;
  height: 60px;
}

.ring-svg {
  transform: rotate(-90deg);
}

.ring-bg {
  stroke: var(--fill-secondary);
}

.ring-fill {
  stroke: var(--ios-green);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

/* Lists & Rows */
.list-card {
  display: flex;
  flex-direction: column;
}

.ios-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  transition: background-color 0.15s ease;
  position: relative;
}

.ios-row:active {
  background-color: var(--fill-secondary);
}

.ios-row:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 52px;
  right: 0;
  bottom: 0;
  height: 0.5px;
  background-color: var(--separator);
}

/* Custom Checkbox (Apple Reminders Style) */
.ios-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--ios-gray-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 14px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ios-checkbox.checked {
  background-color: var(--ios-blue);
  border-color: var(--ios-blue);
}

.ios-checkbox.checked::after {
  content: "";
  width: 6px;
  height: 10px;
  border: solid #FFFFFF;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.row-body {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.row-title.completed {
  text-decoration: line-through;
  color: var(--text-secondary);
}

/* Keep personal task lists compact without truncating the stored title. */
.ios-row[data-task-id] .row-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

html[data-task-titles="full"] .ios-row[data-task-id] .row-title {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}

.row-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-badge {
  color: var(--ios-blue);
  font-weight: 600;
}

.note-row-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-row-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.note-row-date {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.note-row-snippet {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  font-size: 13px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  flex-shrink: 0;
}

.edit-btn, .copy-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  padding: 6px;
  font-size: 15px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, color 0.15s ease;
}

.edit-btn:active, .copy-btn:active {
  transform: scale(1.15);
  color: var(--ios-blue);
}

.delete-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  padding: 6px;
  font-size: 15px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, color 0.15s ease;
}

.delete-btn:active {
  transform: scale(1.15);
  color: var(--ios-red);
}

/* Empty State */
.empty-state {
  padding: 36px 16px;
  text-align: center;
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Pills and Segmented Controls */
.pill-btn {
  background: var(--fill-secondary);
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn.active {
  background: var(--ios-blue);
  color: #FFF;
}

.pill-btn:active {
  transform: scale(0.96);
}

.action-pill {
  flex: 0 0 auto;
  align-self: center;
  background: var(--ios-blue);
  color: #FFF;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.15;
  border-radius: 10px;
  white-space: nowrap;
}

/* Folder Pills Bar (Notes) */
.folder-pills-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 8px;
  scrollbar-width: none;
}

.folder-pills-bar::-webkit-scrollbar {
  display: none;
}

.folder-pill {
  flex: 0 0 auto;
  background: var(--bg-card);
  border: 0.5px solid var(--separator);
  color: var(--text-primary);
  padding: 7px 16px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.folder-pill.active {
  background: var(--ios-blue);
  color: #FFF;
  border-color: var(--ios-blue);
}

/* Interactive Calendar */
.calendar-card {
  padding: 16px;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cal-title {
  font-size: 17px;
  font-weight: 600;
}

.cal-nav-btn {
  background: var(--fill-secondary);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-primary);
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
}

.cal-day-num {
  line-height: 1;
  pointer-events: none;
}

.cal-day.outside {
  color: var(--text-secondary);
  font-weight: 400;
}

.cal-day.outside.today:not(.selected) {
  background: transparent;
}

.cal-day.outside.today:not(.selected) .cal-day-num {
  color: var(--text-secondary);
  font-weight: 400;
}

.cal-day:active {
  background: var(--fill-secondary);
}

.cal-day.today {
  color: var(--ios-blue);
  font-weight: 700;
}

.cal-day.today:not(.selected) {
  background: rgba(10, 132, 255, 0.12);
}

.cal-day.today:not(.selected) .cal-day-num {
  color: var(--ios-blue);
}

.cal-day.selected {
  background-color: var(--ios-blue) !important;
  color: #FFFFFF !important;
  font-weight: 700;
}

.cal-day.selected .cal-day-num {
  color: #FFFFFF !important;
}

.cal-dot {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background-color: var(--ios-blue);
  pointer-events: none;
  transition: background-color 0.15s ease;
}

.cal-dot.completed {
  background-color: var(--ios-green);
}

.cal-day.selected .cal-dot {
  background-color: #FFFFFF !important;
}

.calendar-event-row .row-body {
  flex: 1;
  min-width: 0;
}

.event-open {
  flex: 0 0 auto;
  margin-left: 8px;
  border: 0;
  background: transparent;
  color: var(--ios-blue);
  font-size: 18px;
  line-height: 1;
  padding: 6px;
  text-decoration: none;
  cursor: pointer;
}

.cal-quick-pills {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 0.5px solid var(--separator);
}

/* Bottom Tab Bar (Cupertino Style) */
.ios-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: var(--bar-bg);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-top: 0.5px solid var(--separator);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 8px);
  z-index: 100;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s ease;
}

.tab-item.active {
  color: var(--ios-blue);
}

.tab-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
  margin-top: 2px;
}

/* Modals & Bottom Sheet */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.ios-sheet {
  background: var(--sheet-bg);
  width: 100%;
  max-width: 100%;
  max-height: 85vh;
  border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 16px)) 16px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal-backdrop.open .ios-sheet {
  transform: translateY(0);
}

.sheet-grabber {
  width: 36px;
  height: 5px;
  background: var(--grabber-color);
  border-radius: 3px;
  margin: 0 auto 12px auto;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 16px;
}

.sheet-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.sheet-action {
  flex: 0 0 auto;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  white-space: nowrap;
}

.sheet-cancel {
  color: var(--ios-blue);
  font-weight: 400;
}

.sheet-save {
  color: var(--ios-blue);
  font-weight: 600;
}

/* Form Inputs inside Sheet */
.form-card {
  padding: 0;
  margin-bottom: 14px;
}

.ios-input, .ios-textarea, .ios-date-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 14px 16px;
  font-size: 17px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
}

.ios-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--fill-secondary);
  color: var(--text-primary);
  border: 0.5px solid var(--separator);
  border-radius: 10px;
  padding: 7px 32px 7px 12px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all 0.15s ease;
}

.ios-select:focus {
  border-color: var(--ios-blue);
  background-color: rgba(0, 122, 255, 0.1);
}

.ios-select option {
  background-color: #242426;
  color: #FFFFFF;
  padding: 10px 14px;
  font-size: 15px;
}

body:not(.theme-dark) .ios-select option {
  background-color: #FFFFFF;
  color: #000000;
}

/* Chips selector inside note modal */
.folder-chips-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 14px 16px;
}

.folder-chip-item {
  padding: 6px 13px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-primary);
  border: 0.5px solid var(--separator);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.folder-chip-item:hover {
  border-color: var(--ios-blue);
  color: var(--text-primary);
}

.folder-chip-item.selected {
  background: var(--ios-blue);
  border-color: var(--ios-blue);
  color: #FFFFFF;
  font-weight: 600;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 12px 16px;
}

.reminder-times-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.reminder-times-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reminder-add-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--ios-blue);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  flex: 0 0 auto;
}

.reminder-times-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reminder-time-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.reminder-time-item .picker-value {
  margin-left: 0;
}

.reminder-time-item .picker-reset {
  display: none;
}

.reminder-time-remove {
  border: 0;
  background: transparent;
  color: var(--ios-red);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  padding: 4px 2px;
  cursor: pointer;
  flex: 0 0 auto;
}

.reminder-chip {
  flex-wrap: wrap;
  color: var(--ios-blue);
  font-weight: 600;
}

.form-divider {
  height: 0.5px;
  background-color: var(--separator);
  margin-left: 16px;
}

.row-label {
  font-size: 15px;
  color: var(--text-primary);
  min-width: 0;
}

.row-value {
  font-size: 15px;
  color: var(--text-secondary);
}

/* Toast */
.ios-toast {
  position: fixed;
  top: calc(var(--app-safe-top, 56px) + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(calc(-100% - var(--app-safe-top, 56px) - 32px));
  max-width: min(420px, calc(100vw - 24px));
  background: rgba(40, 40, 40, 0.9);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  backdrop-filter: blur(15px);
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ios-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Impersonation Banner */
.impersonation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.15), rgba(255, 204, 0, 0.15));
  border: 1px solid rgba(255, 149, 0, 0.35);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
}

.banner-icon {
  font-size: 16px;
}

.banner-text b {
  color: #FF9500;
}

.banner-reset-btn {
  background: rgba(255, 149, 0, 0.2);
  color: #FF9500;
  border: none;
  border-radius: 12px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.banner-reset-btn:active {
  background: rgba(255, 149, 0, 0.35);
}

/* Admin Badge in settings */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #FF9500;
  background: rgba(255, 149, 0, 0.12);
  padding: 4px 10px;
  border-radius: 8px;
}

.admin-title-row {
  padding-top: 14px;
  padding-bottom: 6px;
}

/* Row Action Buttons (Edit + Delete) */
.row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  flex-shrink: 0;
}

.edit-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  padding: 6px;
  font-size: 15px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, transform 0.1s ease;
}

.edit-btn:active {
  color: var(--ios-blue);
  transform: scale(0.9);
}

.row-body {
  cursor: pointer;
}

/* Native Apple iOS Switch Toggle */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--fill-secondary);
  transition: background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 31px;
}

.ios-switch-slider:before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: #FFFFFF;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
}

.ios-switch input:checked + .ios-switch-slider {
  background-color: var(--ios-green);
}

.ios-switch input:checked + .ios-switch-slider:before {
  transform: translateX(20px);
}

/* Danger Button inside Sheets */
.sheet-btn-danger {
  width: 100%;
  background: rgba(255, 59, 48, 0.12);
  color: var(--ios-red);
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  transition: background 0.15s ease;
}

.sheet-btn-danger:active {
  background: rgba(255, 59, 48, 0.24);
}

.folder-pill.folder-edit-pill {
  border: 1px dashed var(--ios-blue);
  color: var(--ios-blue);
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.folder-pill.folder-manage-pill {
  border: 1px solid var(--separator);
  color: var(--text-secondary);
  background: var(--fill-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.folder-pill.folder-manage-pill:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.folder-pill .pill-rename-icon {
  font-size: 12px;
  opacity: 0.8;
  margin-left: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s, background-color 0.15s;
}

.folder-pill .pill-rename-icon:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.15);
}

/* Manage Folders Modal List */
.manage-folders-list {
  display: flex;
  flex-direction: column;
}

.manage-folders-list .manage-folder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--separator);
}

.manage-folders-list .manage-folder-row:last-child {
  border-bottom: none;
}

.manage-folders-list .folder-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.manage-folders-list .folder-name-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-folders-list .manage-folder-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.manage-folders-list .btn-folder-action {
  background: var(--fill-secondary);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.manage-folders-list .btn-folder-action:hover {
  background: rgba(0, 122, 255, 0.15);
  color: var(--ios-blue);
}

.manage-folders-list .btn-folder-action.danger:hover {
  background: rgba(255, 59, 48, 0.15);
  color: var(--ios-red);
}

.btn-add-folder-block {
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px dashed var(--ios-blue);
  color: var(--ios-blue);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-add-folder-block:active {
  background: rgba(0, 122, 255, 0.1);
}

.form-time-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-time-range input {
  max-width: 100px;
}

/* ==========================================
   DRAG-AND-DROP & TASK IMPORTANCE
   ========================================== */
.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  padding: 4px 6px;
  margin-right: 4px;
  opacity: 0.45;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.drag-handle:active {
  cursor: grabbing;
  color: var(--ios-blue);
  opacity: 1;
}

.ios-row.dragging {
  opacity: 0.4;
  background: var(--fill-secondary);
  border: 1px dashed var(--ios-blue);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  transform: scale(0.99);
  z-index: 50;
}

.ios-row.drag-over {
  border-top: 2.5px solid var(--ios-blue);
}

.star-btn {
  background: transparent;
  border: none;
  font-size: 17px;
  cursor: pointer;
  padding: 4px;
  margin-right: 8px;
  opacity: 0.3;
  filter: grayscale(100%);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, filter 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}

.star-btn:active {
  transform: scale(1.25);
}

.star-btn.active {
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(255, 179, 0, 0.6));
  transform: scale(1.1);
}

.ios-row.important-task {
  border-left: 3.5px solid #FF9500;
  background: linear-gradient(90deg, rgba(255, 149, 0, 0.06) 0%, transparent 45%);
}

.ios-row.rolled-task {
  border-left: 3.5px solid var(--ios-purple);
  background: linear-gradient(90deg, rgba(175, 82, 222, 0.14) 0%, transparent 58%);
}

.ios-row.important-task.rolled-task {
  border-left: 3.5px solid #FF9500;
  background: linear-gradient(90deg, rgba(175, 82, 222, 0.16) 0%, rgba(255, 149, 0, 0.08) 40%, transparent 72%);
}

.rolled-chip {
  color: var(--ios-purple);
  font-weight: 600;
}

/* Confirm 4th Important Task Modal */
.confirm-sheet {
  border-radius: 24px 24px 0 0;
}

.confirm-body {
  padding: 8px 16px 24px;
  text-align: center;
}

.confirm-card {
  padding: 8px 8px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.confirm-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: pulseGentle 2s infinite ease-in-out;
}

@keyframes pulseGentle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.confirm-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.confirm-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.confirm-btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.confirm-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.confirm-btn:active {
  transform: scale(0.98);
}

.confirm-btn-primary {
  background: #FF9500;
  color: #FFFFFF;
}

.confirm-btn-danger {
  background: var(--ios-red, #FF3B30);
  color: #FFFFFF;
}

.confirm-btn-secondary {
  background: var(--fill-secondary);
  color: var(--text-primary);
}

.confirm-icon.delete-icon {
  animation: shakeWarning 0.7s ease-in-out;
}

@keyframes shakeWarning {
  0%, 100% { transform: scale(1) rotate(0deg); }
  20%, 60% { transform: scale(1.1) rotate(-6deg); }
  40%, 80% { transform: scale(1.1) rotate(6deg); }
}

/* ==========================================================================
   Note Format (.md / .txt), Reader Mode & Quick Copy Styles
   ========================================================================== */

/* Segmented Control (Apple style) */
.ios-segmented-control {
  display: inline-flex;
  background: var(--fill-secondary);
  padding: 2.5px;
  border-radius: 10px;
  gap: 3px;
  max-width: 100%;
}

.ios-segmented-control .segment-btn {
  background: transparent;
  border: none;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ios-segmented-control .segment-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1.5px 4px rgba(0, 0, 0, 0.12);
}

.ios-segmented-control.compact .segment-btn {
  padding: 4px 10px;
  font-size: 12px;
}

.form-row-theme {
  gap: 10px;
}

.form-row-theme .ios-segmented-control {
  flex-shrink: 0;
}

.weekday-picker-wrap {
  padding: 0 12px 12px;
}

.weekday-picker {
  display: flex;
  gap: 6px;
}

.weekday-btn {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--fill-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.weekday-btn.active {
  background: var(--ios-blue);
  color: #fff;
}

.form-row[hidden],
[hidden].form-row {
  display: none;
}

/* Format Badges (in list & reader) */
.note-format-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1;
}

.note-format-badge.badge-md {
  background: rgba(0, 122, 255, 0.12);
  color: var(--ios-blue);
  border: 0.5px solid rgba(0, 122, 255, 0.3);
}

.note-format-badge.badge-txt {
  background: var(--fill-secondary);
  color: var(--text-secondary);
  border: 0.5px solid var(--separator);
}

/* Note Sheet Header & Controls */
.note-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.note-sheet-header .sheet-action {
  font-size: 15px;
}

.sheet-center-switch {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.sheet-center-switch .ios-segmented-control {
  max-width: 100%;
}

.sheet-center-switch .segment-btn {
  padding: 4px 8px;
  font-size: 12px;
}

.sheet-header-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.sheet-action-icon {
  background: transparent;
  border: none;
  font-size: 19px;
  padding: 6px;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-primary);
  transition: transform 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sheet-action-icon:active {
  transform: scale(0.92);
  background: var(--fill-secondary);
}

/* Reader Mode (View Container) */
.note-reader-hero {
  padding: 4px 4px 14px 4px;
}

.note-reader-title-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.note-reader-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.25;
  word-break: break-word;
}

.note-reader-meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.note-reader-card {
  padding: 16px;
  min-height: 160px;
  max-height: 52vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.note-reader-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.reader-action-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.reader-action-btn:active {
  transform: scale(0.98);
}

.reader-action-btn.primary {
  background: var(--ios-blue);
  color: #FFF;
}

.reader-action-btn.secondary {
  background: var(--fill-secondary);
  color: var(--text-primary);
}

/* Text View (Plain Text notes) */
.note-text-view {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  user-select: text;
  -webkit-user-select: text;
}

/* Markdown View Typography */
.note-markdown-view {
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.note-markdown-view h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 16px 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 0.5px solid var(--separator);
  line-height: 1.3;
}

.note-markdown-view h1:first-child { margin-top: 0; }

.note-markdown-view h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 14px 0 6px 0;
  line-height: 1.3;
}

.note-markdown-view h2:first-child { margin-top: 0; }

.note-markdown-view h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 12px 0 4px 0;
}

.note-markdown-view p {
  margin: 8px 0;
}

.note-markdown-view ul, .note-markdown-view ol {
  padding-left: 22px;
  margin: 8px 0;
}

.note-markdown-view li {
  margin: 4px 0;
}

.note-markdown-view blockquote {
  margin: 12px 0;
  padding: 8px 14px;
  border-left: 3.5px solid var(--ios-blue);
  background: var(--fill-secondary);
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: var(--text-secondary);
}

.note-markdown-view hr {
  border: none;
  border-top: 0.5px solid var(--separator);
  margin: 16px 0;
}

.note-markdown-view a {
  color: var(--ios-blue);
  text-decoration: underline;
}

/* Inline code */
.note-markdown-view code {
  font-family: "SF Mono", Menlo, Consolas, Monaco, monospace;
  background: var(--fill-secondary);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13.5px;
}

/* Code Blocks with Copy button */
.note-code-wrapper {
  position: relative;
  margin: 12px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #18181B;
  border: 0.5px solid var(--separator);
}

.note-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}

.note-code-lang {
  font-size: 11px;
  font-weight: 600;
  color: #A1A1AA;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.note-code-copy-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 6px;
  color: #FFF;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.note-code-copy-btn:active {
  background: var(--ios-blue);
}

.note-markdown-view pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
}

.note-markdown-view pre code {
  background: transparent;
  color: #F4F4F5;
  padding: 0;
  border-radius: 0;
  display: block;
  font-size: 13px;
  line-height: 1.45;
}

/* Tables */
.note-markdown-view table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13.5px;
}

.note-markdown-view th, .note-markdown-view td {
  border: 0.5px solid var(--separator);
  padding: 7px 10px;
  text-align: left;
}

.note-markdown-view th {
  background: var(--fill-secondary);
  font-weight: 600;
}

/* Checklist / Task List */
.note-markdown-view .task-list-item {
  list-style-type: none;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0;
}

.note-markdown-view ul:has(.task-list-item) {
  padding-left: 2px;
}

.note-markdown-view .task-list-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--ios-blue);
  cursor: pointer;
  flex-shrink: 0;
}

/* Editor Wrapper & Formatting Toolbar */
.note-editor-wrapper {
  margin-bottom: 0;
}

.note-tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 8px 4px;
}

.note-quick-copy-btn {
  background: var(--fill-secondary);
  border: 0.5px solid var(--separator);
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.note-quick-copy-btn:active {
  background: var(--ios-blue);
  color: #FFF;
}

.note-formatting-toolbar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  max-width: 100%;
  padding: 6px 8px;
  background: var(--bg-card);
  border-radius: 12px 12px 0 0;
  border: 0.5px solid var(--separator);
  border-bottom: none;
  scrollbar-width: none;
}

.note-formatting-toolbar::-webkit-scrollbar {
  display: none;
}

.tool-btn {
  background: var(--fill-secondary);
  border: none;
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.tool-btn:active {
  background: var(--ios-blue);
  color: #FFF;
  transform: scale(0.94);
}

.note-content-card {
  margin-bottom: 0 !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

.note-format-card {
  margin-bottom: 0;
}

.note-format-card .form-row {
  flex-wrap: wrap;
  align-items: center;
}

.note-format-card .ios-segmented-control {
  display: flex;
  flex: 1 1 160px;
  min-width: 0;
  max-width: 100%;
}

.note-format-card .segment-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
  text-align: center;
}

/* Home Screen & Interactive Form Rows */
.form-row-interactive {
  transition: background-color 0.15s ease;
  user-select: none;
}

.form-row-interactive:active {
  background-color: var(--fill-tertiary, rgba(120, 120, 128, 0.16));
}

.row-arrow {
  font-size: 20px;
  color: var(--text-tertiary, #8E8E93);
  font-weight: 300;
  margin-left: 8px;
}

.guide-banner {
  text-align: center;
  padding: 16px 12px;
  margin-bottom: 12px;
  background: var(--fill-tertiary, rgba(120, 120, 128, 0.1));
  border-radius: 14px;
}

.guide-banner-icon {
  font-size: 38px;
  margin-bottom: 6px;
}

.guide-banner-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.guide-banner-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.guide-card {
  padding: 14px 16px !important;
  font-size: 14px;
  line-height: 1.5;
}

.guide-step {
  margin: 0 0 10px 0;
  color: var(--text-primary);
}

.guide-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
}

.guide-list li {
  margin-bottom: 8px;
}

.guide-list li:last-child {
  margin-bottom: 0;
}

.guide-list code {
  background: var(--fill-tertiary, rgba(120, 120, 128, 0.2));
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
}

/* ==========================================================================
   Recycle Bin (Trash) Styles
   ========================================================================== */

.section-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.task-board {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-section-card {
  border-left: 4px solid var(--section-tone, var(--ios-gray));
}

.task-section-card.tone-teal { --section-tone: var(--ios-teal); }
.task-section-card.tone-blue { --section-tone: var(--ios-blue); }
.task-section-card.tone-purple { --section-tone: var(--ios-purple); }
.task-section-card.tone-orange { --section-tone: var(--ios-orange); }
.task-section-card.tone-green { --section-tone: var(--ios-green); }
.task-section-card.tone-pink { --section-tone: #FF2D55; }
.task-section-card.tone-plain { --section-tone: var(--ios-gray); }

.task-section-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 6px;
  background: color-mix(in srgb, var(--section-tone) 16%, transparent);
}

.task-section-card.is-collapsed .task-section-list {
  display: none;
}

.task-section-card.is-section-dragging {
  opacity: 0.55;
}

.task-section-toggle {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.task-section-card.is-collapsed .task-section-toggle {
  transform: rotate(-90deg);
}

.section-drag-handle {
  margin-right: 0;
  flex: 0 0 auto;
}

.task-section-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.task-section-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.task-section-add {
  border: none;
  background: var(--bg-card);
  color: var(--section-tone);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.task-section-empty {
  padding: 12px 16px 14px;
  color: var(--text-secondary);
  font-size: 13px;
}

.task-section-card.drag-target {
  outline: 2px solid var(--section-tone);
}

.section-color-row {
  display: flex;
  gap: 8px;
  padding: 8px 12px 4px;
}

.section-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.section-color-dot.selected {
  border-color: var(--text-primary);
}

.section-color-dot.tone-teal { background: var(--ios-teal); }
.section-color-dot.tone-blue { background: var(--ios-blue); }
.section-color-dot.tone-purple { background: var(--ios-purple); }
.section-color-dot.tone-orange { background: var(--ios-orange); }
.section-color-dot.tone-green { background: var(--ios-green); }
.section-color-dot.tone-pink { background: #FF2D55; }

.task-template-row {
  padding: 12px 14px;
}

.task-template-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-template-name {
  flex: 1;
  font-weight: 600;
}

.task-template-toggles {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.task-template-toggles .pill-btn {
  flex: 1;
}

.section-sheet-note {
  margin: 4px 8px 12px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.35;
}

.section-trash-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 8px;
  text-transform: none;
  letter-spacing: normal;
  transition: all 0.15s ease;
}

.section-trash-btn:hover {
  background: var(--fill-secondary);
  color: var(--ios-red);
}

.section-trash-btn:active {
  transform: scale(0.95);
}

.sheet-danger-action {
  color: var(--ios-red) !important;
  font-weight: 600 !important;
}

.sheet-danger-action:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.trash-tabs-bar {
  margin-bottom: 14px;
}

.trash-notice-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--fill-secondary);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.trash-notice-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.trash-notice-text b {
  color: var(--text-primary);
}

.trash-list-card {
  min-height: 120px;
}

.trash-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--separator);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.trash-item-row:last-child {
  border-bottom: none;
}

.trash-item-row:active {
  background-color: var(--fill-secondary);
}

.trash-item-main {
  flex: 1;
  min-width: 0;
  margin-right: 10px;
}

.trash-item-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.trash-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.trash-countdown-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 149, 0, 0.15);
  color: var(--ios-orange);
}

.trash-countdown-badge.urgent {
  background: rgba(255, 59, 48, 0.15);
  color: var(--ios-red);
}

.trash-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.trash-action-btn {
  background: var(--fill-secondary);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.trash-action-btn.restore:hover {
  background: rgba(0, 122, 255, 0.15);
  color: var(--ios-blue);
}

.trash-action-btn.delete:hover {
  background: rgba(255, 59, 48, 0.15);
  color: var(--ios-red);
}

.trash-action-btn:active {
  transform: scale(0.92);
}

/* Trash Item Detail Viewer Sheet */
.trash-detail-hero {
  padding: 8px 4px 14px 4px;
}

.trash-detail-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.trash-type-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 122, 255, 0.15);
  color: var(--ios-blue);
}

.trash-timer-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 149, 0, 0.15);
  color: var(--ios-orange);
}

.trash-detail-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 6px;
}

.trash-detail-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.trash-detail-content-card {
  padding: 16px;
  max-height: 45vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
}

.trash-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 16px;
}

/* Task Detail & Markdown View */
.task-desc-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  font-size: 13px;
  opacity: 0.85;
  vertical-align: middle;
}

.task-detail-header-card {
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: 14px;
  margin-bottom: 12px;
}

.task-detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.task-detail-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  flex: 1;
  word-break: break-word;
}

.task-detail-title.completed {
  text-decoration: line-through;
  opacity: 0.5;
}

.task-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.task-detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--fill-secondary);
  color: var(--text-secondary);
}

.task-detail-badge.star-badge {
  background: rgba(255, 204, 0, 0.15);
  color: #D97706;
}

.task-detail-badge.rolled-badge {
  background: rgba(175, 82, 222, 0.16);
  color: var(--ios-purple);
}

.task-detail-badge.overdue,
.deadline-chip.overdue {
  color: var(--ios-red);
  font-weight: 600;
}

.task-detail-badge.soon,
.deadline-chip.soon {
  color: var(--ios-orange, #ff9f0a);
  font-weight: 600;
}

.task-detail-badge.overdue {
  background: rgba(255, 59, 48, 0.12);
}

.task-detail-badge.soon {
  background: rgba(255, 159, 10, 0.14);
}

.task-description-card {
  padding: 14px 16px;
  min-height: 100px;
  max-height: 48vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.task-description-header {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 0.5px solid var(--separator);
}

.task-desc-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.empty-task-desc {
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 1.5;
  padding: 6px 0;
}

/* ==========================================================================
   Teams workspace
   ========================================================================== */
.teams-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.team-selector {
  flex: 1;
  max-width: none;
  min-width: 0;
  height: 36px;
}

#team-task-search { width:180px; min-width:100px; flex:1 1 140px; max-width:260px; padding:8px 12px; border:1px solid var(--separator); border-radius:10px; }
.team-board-controls { display:flex; gap:8px; align-items:center; margin-bottom:10px; min-width:0; }
.team-board-controls .team-view-switch { flex-shrink:0; margin:0; }
.team-board-controls .team-filters { flex:1; min-width:0; margin:0; }
.team-board-controls > .team-add-task-btn { flex-shrink:0; min-height:38px; }
@media (max-width:700px) { .team-board-controls { flex-wrap:wrap; } .team-board-controls .team-filters { flex-basis:100%; order:2; } .team-board-controls > .team-add-task-btn { margin-left:auto; } }
.team-card-discussion { display:flex; align-items:center; gap:8px; margin-top:10px; color:var(--text-secondary); font-size:12px; }
.team-message-count { border:0; border-radius:8px; background:var(--fill-secondary); color:var(--text-secondary); padding:5px 8px; cursor:pointer; }
.team-unread-count { background:var(--ios-blue); color:var(--accent-on-blue,#fff); border-radius:12px; padding:2px 6px; font-size:12px; }
.team-task-description-block summary { cursor:pointer; padding:8px 0; color:var(--text-secondary); font-size:14px; }
.team-task-tabs { display:flex; gap:8px; border-bottom:1px solid var(--separator); flex-shrink:0; }
.team-task-tabs button { flex:1; min-height:42px; border:0; border-bottom:3px solid transparent; background:transparent; color:var(--text-secondary); cursor:pointer; }
.team-task-tabs button[aria-selected="true"] { color:var(--ios-blue); border-bottom-color:var(--ios-blue); font-weight:600; }
#modal-team-task.has-task .ios-sheet { display:flex; flex-direction:column; height:94dvh; max-height:94dvh; overflow:hidden; }
#modal-team-task.has-task .sheet-header { flex-shrink:0; margin-bottom:10px; }
#modal-team-task.has-task .sheet-body { flex:1; min-height:0; gap:8px; overflow-y:auto; }
#modal-team-task.has-task .sheet-body > :not(#team-task-conversation) { flex-shrink:0; }
#modal-team-task .team-task-title-card .ios-input { font-size:21px; font-weight:700; }
#modal-team-task.has-task .form-card { padding:8px 10px; }
#modal-team-task.has-task .form-row { padding:4px 2px; min-height:40px; }
#modal-team-task.has-task .ios-date-input { width:auto; max-width:65%; padding:6px 0; font-size:14px; }
#modal-team-task.has-task .team-task-title-card .ios-input { padding:6px 2px; }
#modal-team-task.has-task .team-workflow-card { padding:6px 10px; }
#modal-team-task.has-task #btn-delete-team-task { align-self:flex-end; order:10; width:auto; padding:3px; font-size:12px; }
#team-task-conversation { display:flex; flex-direction:column; flex:1 0 280px; min-height:280px; }
#team-task-discussion { display:flex; flex-direction:column; flex:1; min-height:0; }
#team-chat-messages { flex:1; min-height:100px; overflow-y:auto; overscroll-behavior:contain; padding:12px 2px; overflow-anchor:none; }
.team-chat-message { margin:0 0 18px; padding:0 6px; overflow-wrap:anywhere; }
.team-chat-message-head { display:flex; align-items:baseline; flex-wrap:wrap; gap:8px; font-size:13px; margin-bottom:6px; }
.team-chat-message-head time { color:var(--text-secondary); font-size:11px; }
.team-chat-message-head > span { color:var(--ios-blue); font-size:11px; }
.team-chat-message p { display:block; width:fit-content; max-width:100%; margin:0; padding:10px 12px; border-radius:4px 14px 14px; background:var(--fill-secondary); white-space:pre-wrap; line-height:1.45; font-size:14px; }
.team-chat-message.is-mine p { border-left:2px solid var(--ios-blue); }
.team-chat-message.is-mentioned p { outline:1px solid var(--ios-blue); }
.team-chat-quote { display:block; width:100%; text-align:left; color:var(--text-secondary); background:var(--fill-secondary); border:0; border-left:2px solid var(--separator); padding:7px; font-size:12px; cursor:pointer; }
.team-chat-reply-button { border:0; background:transparent; color:var(--text-secondary); font-size:11px; padding:4px 0; cursor:pointer; }
.team-chat-image { display:block; width:180px; max-width:100%; height:130px; object-fit:cover; border:1px solid var(--separator); border-radius:10px; margin-top:6px; cursor:zoom-in; }
.team-chat-unread-line { color:var(--ios-blue); text-align:center; border-top:1px solid var(--separator); font-size:12px; margin:12px 0; padding-top:8px; }
#team-chat-form { flex-shrink:0; border-top:1px solid var(--separator); padding-top:8px; padding-bottom:env(safe-area-inset-bottom,0px); }
.team-chat-compose { display:flex; align-items:center; gap:8px; }
#team-chat-input { flex:1; min-width:0; resize:none; border:1px solid var(--separator); border-radius:12px; padding:10px; background:var(--input-bg,var(--fill-secondary)); color:var(--text-primary); font:inherit; font-size:14px; }
.team-chat-attach, #team-chat-send { display:grid; place-items:center; flex-shrink:0; width:40px; height:42px; border:0; border-radius:10px; cursor:pointer; font-size:22px; }
.team-chat-attach { background:var(--fill-secondary); color:var(--text-primary); }
#team-chat-send { background:var(--ios-blue); color:var(--taclen-button-text,#fff); }
#team-chat-send:disabled { opacity:.5; }
#team-chat-mention { width:auto; max-width:100%; font-size:12px; margin-top:4px; }
#team-chat-reply, #team-chat-attachment { display:flex; align-items:center; gap:8px; font-size:12px; padding:6px; color:var(--text-secondary); }
#team-chat-reply span { flex:1; overflow-wrap:anywhere; }
#team-chat-attachment img { width:44px; height:36px; object-fit:cover; border-radius:6px; }
#team-chat-reply button, #team-chat-attachment button { margin-left:auto; border:0; background:transparent; color:var(--text-primary); font-size:20px; cursor:pointer; }
#team-chat-error { color:var(--ios-red); font-size:12px; padding:5px; }
#team-chat-status { font-size:12px; color:var(--text-secondary); }
#team-chat-new { align-self:center; margin:4px; }
.team-message-count svg { width:14px; height:14px; vertical-align:-3px; }
.team-photo-count { display:inline-flex; align-items:center; gap:4px; }
.team-photo-count svg { width:14px; height:14px; }
#team-task-detail-status { color:var(--text-secondary); font-size:12px; }
#team-task-detail-status button { border:0; background:transparent; color:var(--ios-blue); cursor:pointer; margin-left:6px; }
#team-task-detail-status[hidden] { display:none; }
#team-task-assignees-block summary { padding:8px 2px; color:var(--text-secondary); cursor:pointer; font-size:14px; }
#team-task-assignees { border:0; margin:0; padding:0; max-height:170px; overflow-y:auto; }
#team-task-assignees label { display:flex; align-items:center; gap:8px; min-height:36px; font-size:14px; }
#team-task-assignees input { accent-color:var(--ios-blue); width:18px; height:18px; }
.team-task-people-hint { font-size:12px; color:var(--text-secondary); margin:4px 0; }
#team-task-files, #team-task-history-tab { overflow:auto; padding:12px 0; }
#team-chat-files { margin-top:12px; }
#team-task-conversation [hidden], #team-task-conversation[hidden], .team-unread-count[hidden] { display:none !important; }
@media (max-width:1023px) {
  #modal-team-task.has-task { top:var(--tg-safe-area-inset-top,0px); bottom:var(--tc-keyboard-bottom,0px); padding:0; align-items:stretch; }
  #modal-team-task.has-task .ios-sheet { height:100%; max-height:100%; border-radius:0; padding:10px 12px; }
  #modal-team-task.has-task .sheet-grabber { display:none; }
  #btn-expand-team-task { display:none; }
  body.tc-keyboard #modal-team-task.has-task .sheet-body > :not(#team-task-conversation):not(.team-task-title-card) { display:none; }
  body.tc-keyboard #modal-team-task.has-task #team-task-conversation { flex-basis:200px; min-height:200px; }
}

.teams-toolbar .pill-btn {
  flex-shrink: 0;
}

.teams-toolbar .pill-btn:disabled,
.team-add-task-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.team-summary-card {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team-summary-title {
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text-primary);
}

.team-summary-meta {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.team-add-task-btn {
  flex-shrink: 0;
}

.team-view-switch {
  display: flex;
  gap: 8px;
  margin: 0 0 8px;
}

.team-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 2px 8px;
  scrollbar-width: thin;
}

body.team-board-mode {
  overflow: hidden;
}

#view-teams.team-board-mode .team-workspace-label,
body.team-board-mode #view-teams .team-workspace-label {
  display: none;
}

.team-board-host {
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: hidden;
  margin-bottom: 0;
  min-height: 0;
}

.team-board {
  display: flex;
  flex: 1;
  gap: 12px;
  min-height: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.team-board::-webkit-scrollbar {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .team-board {
    scrollbar-width: thin;
  }

  .team-board::-webkit-scrollbar {
    display: block;
    height: 8px;
  }

  .team-board::-webkit-scrollbar-thumb {
    background: var(--separator);
    border-radius: 8px;
  }
}

.team-board.is-card-dragging {
  scroll-snap-type: none;
}

.team-board-column {
  flex: 0 0 calc(100% - 40px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  height: auto;
  max-height: 100%;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg-card) 88%, var(--column-accent, var(--ios-purple)) 12%);
  border: 0.5px solid var(--separator);
  border-top: 6px solid var(--column-accent, var(--ios-purple));
  border-radius: 16px;
  padding: 10px 10px 8px;
}

.team-board-column.tone-purple { --column-accent: var(--ios-purple); }
.team-board-column.tone-blue { --column-accent: var(--ios-blue); }
.team-board-column.tone-teal { --column-accent: var(--ios-teal); }
.team-board-column.tone-orange { --column-accent: var(--ios-orange); }
.team-board-column.tone-green { --column-accent: var(--ios-green); }
.team-board-column.tone-pink { --column-accent: #FF2D55; }

.team-board-column.drag-target {
  outline: 2px solid var(--ios-blue);
}

.team-board-column-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.team-column-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-column-title[data-action="rename-column"] {
  cursor: text;
}

.team-column-rename,
.team-column-create-form input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--fill-tertiary, rgba(120, 120, 128, 0.16));
  color: var(--text-primary);
  font: inherit;
}

.team-column-icon,
.team-column-create {
  border: none;
  background: transparent;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.team-column-create {
  width: auto;
  height: auto;
  color: var(--ios-blue);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  padding: 8px 2px;
}

.team-board-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-bottom: 8px;
}

.team-board-card {
  display: block;
  width: 100%;
  flex: 0 0 auto;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--separator);
  border-radius: 12px;
  background: var(--bg-card-elevated, var(--bg-card));
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.06);
  color: inherit;
  cursor: grab;
  touch-action: pan-x pan-y;
}

.team-column-count {
  flex: 0 0 auto;
  min-width: 24px;
  padding: 3px 6px;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.team-column-add-task {
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  padding: 8px 4px;
  background: transparent;
  color: var(--ios-blue);
  text-align: left;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.team-column-add-task:hover {
  background: var(--bg-card);
}

.team-card-heading {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.team-card-heading .row-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.team-card-drag-handle {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  height: 32px;
  margin: -5px -5px 0 0;
  color: var(--text-secondary);
  font-size: 22px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.team-card-state {
  flex: 0 0 18px;
  height: 18px;
  margin-top: 2px;
  border: 1.5px solid var(--text-secondary);
  border-radius: 50%;
  font-size: 12px;
  line-height: 15px;
  text-align: center;
}

.team-board-card.is-completed .team-card-state {
  color: var(--bg-card);
  background: var(--ios-green);
  border-color: var(--ios-green);
}

.team-board-card.is-completed .row-title {
  color: var(--text-secondary);
}

.team-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.team-card-badge {
  max-width: 100%;
  padding: 4px 6px;
  border-radius: 7px;
  background: var(--fill-tertiary, rgba(120, 120, 128, 0.12));
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.team-card-badge.status-progress,
.team-card-badge.status-review {
  color: var(--ios-blue);
  background: color-mix(in srgb, var(--bg-card) 86%, var(--ios-blue) 14%);
}

.team-card-badge.status-done {
  color: var(--ios-green);
  background: color-mix(in srgb, var(--bg-card) 86%, var(--ios-green) 14%);
}

.team-card-badge.deadline-overdue {
  color: var(--ios-red);
  background: color-mix(in srgb, var(--bg-card) 86%, var(--ios-red) 14%);
}

.team-card-badge.deadline-soon {
  color: var(--ios-orange);
  background: color-mix(in srgb, var(--bg-card) 86%, var(--ios-orange) 14%);
}

.team-card-labor {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.team-card-assignee {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.team-card-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  height: 24px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg-card) 80%, var(--column-accent) 20%);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 700;
}

body.team-board-mode .team-filters {
  padding: 5px;
  border: 1px solid var(--separator);
  border-radius: 12px;
  background: var(--bg-card);
}

.team-board-card.dragging {
  opacity: 0.45;
  pointer-events: none;
  cursor: grabbing;
}

.team-board-empty {
  font-size: 13px;
  opacity: 0.6;
}

.team-board-add-column {
  border-style: dashed;
  background: transparent;
}

.team-column-menu {
  position: relative;
  flex: 0 0 auto;
}

.team-column-menu-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.team-column-menu-pop {
  position: absolute;
  top: 30px;
  right: 0;
  z-index: 3;
  min-width: 120px;
  background: var(--bg-card);
  border: 0.5px solid var(--separator);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
}

.team-column-menu-pop button {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ios-red);
  text-align: left;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
}

.team-column-create-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.team-column-create-form[hidden] {
  display: none;
}

.team-column-create-actions {
  display: flex;
  gap: 6px;
}

.team-filters .pill-btn {
  white-space: nowrap;
}

.team-task-row {
  align-items: flex-start;
}

.team-task-row .row-subtitle {
  flex-wrap: wrap;
  align-items: flex-start;
  row-gap: 2px;
  column-gap: 0;
  min-width: 0;
}

.team-task-meta {
  display: inline;
  min-width: 0;
  overflow-wrap: anywhere;
}

.team-task-meta:not(:last-child)::after {
  content: "·";
  margin: 0 6px;
  color: var(--text-tertiary);
}

.team-task-row .edit-btn {
  flex-shrink: 0;
  margin-top: 2px;
}

.team-task-row .ios-checkbox,
.team-task-row .team-status-mark {
  margin-top: 1px;
}

.team-task-row .ios-checkbox {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  background: transparent;
}

.team-task-row .ios-checkbox.checked {
  background-color: var(--ios-blue);
}

.team-invite-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}

.team-invite-row:not(:last-child) {
  border-bottom: 0.5px solid var(--separator);
}

.team-invite-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.invite-action {
  border: none;
  border-radius: 9px;
  padding: 7px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.invite-action.accept {
  background: var(--ios-blue);
  color: #fff;
}

.invite-action.decline {
  background: var(--fill-secondary);
  color: var(--ios-red);
}

.team-task-permission {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.team-member-avatar {
  width: 36px;
  height: 36px;
  margin-right: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(0, 122, 255, 0.14);
  color: var(--ios-blue);
  font-size: 15px;
  font-weight: 700;
}

.team-form-hint {
  padding: 0 8px;
  line-height: 1.4;
}

.team-due-overdue {
  color: var(--ios-red);
  font-weight: 600;
}

.team-due-soon {
  color: var(--ios-orange, #ff9f0a);
  font-weight: 600;
}

.team-status-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: 0 0 22px;
  margin-right: 4px;
  background: var(--ios-blue);
}

.team-status-mark.paused { background: var(--ios-orange, #ff9f0a); }
.team-status-mark.review { background: #ffd60a; }
.team-status-mark.rework,
.team-status-mark.overdue { background: var(--ios-red); }
.team-status-mark.done { background: var(--ios-green, #34c759); }
.team-status-mark.progress { background: var(--ios-green, #34c759); }

.team-workflow-card {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.team-workflow-status {
  font-size: 16px;
  font-weight: 600;
}

.team-workflow-meta,
.team-workflow-history {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.team-workflow-comment {
  margin-top: 12px;
}

.team-workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.team-workflow-btn {
  flex: 1 1 140px;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 600;
  background: var(--ios-blue);
  color: #fff;
  cursor: pointer;
}

.team-workflow-btn.secondary {
  background: var(--fill-secondary);
  color: var(--text-primary);
}

.team-workflow-btn.danger {
  background: rgba(255, 59, 48, 0.12);
  color: var(--ios-red);
}

.tab-item {
  position: relative;
}

.tab-badge {
  position: absolute;
  top: 1px;
  left: calc(50% + 7px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 2px solid var(--bar-bg);
  border-radius: 9px;
  background: var(--ios-red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
}

body.guest-only .tab-item:not([data-tab="teams"]),
body.guest-only #btn-open-settings,
body.guest-only .ai-fab,
body.sheet-open .ai-fab {
  display: none;
}

body.guest-only .tab-item[data-tab="teams"] {
  flex: 0 0 100%;
}

.guest-upgrade {
  margin: 12px 16px 0;
  padding: 16px;
}

.guest-upgrade h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.guest-upgrade p {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 14px;
}

.guest-upgrade button {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--ios-blue);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

@media (max-width: 430px) {
  .ios-tab-bar .tab-label {
    font-size: 9px;
  }

  .teams-toolbar {
    flex-wrap: wrap;
  }

  .team-selector {
    flex-basis: 100%;
  }
}

.vault-lock {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-primary);
}

.vault-lock[hidden] {
  display: none;
}

.vault-card {
  width: min(420px, 100%);
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}

.vault-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.vault-card p {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.vault-card input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--separator);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
}

.vault-card button {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--ios-blue);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.vault-card button.vault-bio {
  margin-bottom: 12px;
}

.vault-card a.browser-login-open {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ios-blue);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.browser-login-wait {
  margin: 0;
  text-align: center;
}

#browser-login-link[hidden],
#browser-login-wait[hidden],
#browser-login-retry[hidden],
#browser-logout-header[hidden],
#browser-logout-card[hidden] {
  display: none !important;
}

#vault-biometric[hidden],
#vault-biometric-enroll[hidden],
#bio-settings-header[hidden],
#bio-settings-card[hidden] {
  display: none !important;
}

.vault-enroll {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
}

.vault-card .vault-enroll input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  padding: 0;
}

.vault-card button.vault-help-link {
  display: block;
  width: 100%;
  margin: 14px 0 0;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--ios-blue);
  font-size: 15px;
  font-weight: 600;
}

.vault-help-answer {
  margin-top: 12px;
  text-align: left;
}

.vault-help-answer p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.45;
}

.help-section-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.help-section-btn:active {
  opacity: 0.7;
}

.help-article {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
}

.help-article p {
  margin: 0 0 12px;
}

.help-article ul,
.help-article ol {
  margin: 0 0 12px;
  padding-left: 20px;
}

.help-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.vault-card p.vault-error {
  min-height: 1.2em;
  margin: 0 0 12px;
  color: var(--ios-red);
  font-size: 14px;
  font-weight: 500;
}

.photo-attach {
  margin-top: 0;
}

.photo-attach-head {
  margin-bottom: 0;
}

.photo-grid:empty {
  display: none;
}

.photo-grid:not(:empty) {
  border-top: 0.5px solid var(--separator);
  padding: 12px 16px 14px;
}

.photo-add-btn {
  color: var(--ios-blue);
  font-weight: 600;
  cursor: pointer;
}

.photo-add-btn input {
  display: none;
}

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ios-fill, #f2f2f7);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 22px;
  padding: 0;
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.92);
  touch-action: none;
}

.photo-viewer[hidden] {
  display: none;
}

.photo-viewer-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px 12px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
}

.photo-viewer-zoom {
  display: flex;
  gap: 8px;
}

.photo-viewer-btn {
  border: 0;
  border-radius: 16px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.photo-viewer-stage {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.photo-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}

.note-photo-count {
  margin-left: 6px;
}

.sheet-body,
#note-edit-container,
#note-view-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.sheet-body > *,
#note-edit-container > *,
#note-view-container > * {
  margin-top: 0;
  margin-bottom: 0;
  min-width: 0;
  max-width: 100%;
}

input.ios-date-input.picker-native {
  display: none;
}

.picker-value {
  margin-left: auto;
  border: 0;
  background: var(--fill-secondary);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  max-width: 68%;
}

.picker-value.is-empty {
  color: var(--text-secondary);
  font-weight: 500;
}

.form-row:has(.picker-reset) {
  flex-wrap: wrap;
}

.picker-reset {
  flex: 1 0 100%;
  border: 0;
  background: transparent;
  color: var(--ios-red);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-align: right;
  padding: 0;
  cursor: pointer;
}

.picker-reset[hidden] {
  display: none;
}

.picker-clear {
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 59, 48, 0.12);
  color: var(--ios-red);
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  padding: 12px 16px;
  cursor: pointer;
}

.picker-clear[hidden] {
  display: none;
}

.picker-clear:active {
  background: rgba(255, 59, 48, 0.24);
}

.field-picker {
  position: fixed;
  inset: 0;
  z-index: 4500;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.field-picker[hidden] {
  display: none;
}

.field-picker-sheet {
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--sheet-bg);
  color: var(--text-primary);
  border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 12px));
}

.cal-head,
.year-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cal-title {
  font-size: 17px;
  font-weight: 600;
  text-transform: capitalize;
}

.cal-nav {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 18px;
  background: var(--fill-secondary);
  color: var(--ios-blue);
  font-size: 20px;
  line-height: 36px;
  font-family: inherit;
  cursor: pointer;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-dow {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 0;
}

.cal-day {
  height: 40px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
}

.cal-day.is-out {
  color: var(--text-secondary);
  font-weight: 400;
}

.cal-day.is-today {
  color: var(--ios-blue);
  font-weight: 700;
}

.cal-day.is-on,
.cal-day.is-on.is-today {
  background: var(--ios-blue);
  color: #fff;
  font-weight: 600;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.month-chip {
  border: 0;
  border-radius: 12px;
  padding: 12px 8px;
  background: var(--fill-secondary);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-transform: capitalize;
}

.month-chip.is-on {
  background: var(--ios-blue);
  color: #fff;
  font-weight: 600;
}

.wheels-wrap {
  position: relative;
  margin-top: 12px;
}

.wheels-wrap::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(220px, 70%);
  height: 44px;
  transform: translate(-50%, -50%);
  background: var(--fill-secondary);
  border-radius: 12px;
  pointer-events: none;
}

.wheels {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.wheel {
  width: 84px;
  height: 220px;
  overflow-y: auto;
  scrollbar-width: none;
  touch-action: none;
  overscroll-behavior: contain;
  cursor: grab;
  user-select: none;
}

.wheel:active {
  cursor: grabbing;
}

.wheel::-webkit-scrollbar {
  display: none;
}

.wheel-pad {
  height: 88px;
}

.wheel-item {
  display: block;
  width: 100%;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  font-family: inherit;
  cursor: pointer;
}

.wheel-item.is-on {
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
}

.wheel-colon {
  font-size: 22px;
  font-weight: 700;
}

.ai-fab {
  position: fixed;
  z-index: 110;
  right: 16px;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 26px;
  background: var(--ios-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.35);
  cursor: pointer;
}

.modal-backdrop.ai-backdrop {
  top: var(--ai-sheet-top, 0px);
  bottom: auto;
  height: var(--ai-sheet-height, 100%);
  align-items: stretch;
  padding-top: 0;
}

.ai-backdrop .ai-sheet {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  padding-top: 12px;
}

.ai-sheet .sheet-header {
  margin-bottom: 10px;
}

.ai-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  flex: 0 0 auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.ai-tabs::-webkit-scrollbar {
  display: none;
}

.ai-tab {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  max-width: 168px;
  border-radius: 999px;
  background: var(--fill-secondary);
  color: var(--text-secondary);
  padding: 4px 6px 4px 10px;
}

.ai-tab.active {
  background: var(--ios-blue);
  color: #fff;
}

.ai-tab-label {
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  padding: 4px 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ai-tab-close,
.ai-tab-add {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-tab-close {
  width: 22px;
  height: 22px;
  border-radius: 11px;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.ai-tab.active .ai-tab-close:active,
.ai-tab-close:active {
  background: rgba(255, 255, 255, 0.2);
}

.ai-tab:not(.active) .ai-tab-close:active {
  background: var(--separator);
}

.ai-tab-add {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--fill-secondary);
  color: var(--ios-blue);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}

.ai-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
}

.ai-empty {
  margin: auto 12px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.4;
}

.ai-bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1.35;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.ai-bubble p {
  margin: 0 0 8px;
}

.ai-bubble p:last-child {
  margin-bottom: 0;
}

.ai-bubble-user {
  align-self: flex-end;
  background: var(--ios-blue);
  color: #fff;
  white-space: pre-wrap;
  border-bottom-right-radius: 6px;
}

.ai-bubble-bot {
  align-self: flex-start;
  background: var(--fill-secondary);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
}

.ai-typing {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-typing::before, #tc-compose[aria-busy="true"] #tc-compose-status::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ai-working 0.9s linear infinite;
}
@keyframes ai-working { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ai-typing::before, #tc-compose[aria-busy="true"] #tc-compose-status::before { animation: none; }
}

.ai-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 0.5px solid var(--separator);
}

.ai-composer textarea {
  min-width: 0;
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  border: none;
  border-radius: 18px;
  background: var(--fill-secondary);
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
  line-height: 1.3;
  padding: 10px 14px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.ai-send {
  flex: 0 0 auto;
  border: none;
  background: none;
  color: var(--ios-blue);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 8px 4px;
  cursor: pointer;
}

.ai-send:disabled {
  opacity: 0.4;
}

.goal-block:not(:last-child) {
  border-bottom: 0.5px solid var(--separator);
}

.goal-block:not(.is-open) > .ios-row::after {
  content: none;
}

.goal-chevron {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 22px;
  line-height: 1;
  padding: 4px 2px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.goal-block.is-open .goal-chevron {
  transform: rotate(90deg);
}

.goal-block:not(.is-open) .goal-panel {
  display: none;
}

.goal-panel {
  padding: 4px 16px 14px 54px;
}

.goal-cal-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.goal-cal-caption,
.check-empty {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 4px 0 8px;
}

.goal-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.goal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-bottom: 2px;
}

.goal-day {
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: var(--fill-secondary);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.goal-day.is-pad {
  background: transparent;
  pointer-events: none;
}

.goal-day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--ios-blue);
}

.goal-day.is-done,
.goal-day.is-done.is-today {
  background: #34c759;
  color: #fff;
  box-shadow: none;
}

.goal-day.is-miss,
.goal-day.is-miss.is-today {
  background: var(--ios-red);
  color: #fff;
  box-shadow: none;
}

.goal-day.is-partial,
.goal-day.is-partial.is-today {
  background: var(--ios-orange);
  color: #fff;
  box-shadow: none;
}

.goal-checks {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.check-row .ios-checkbox,
#view-task-checkbox {
  margin-right: 0;
}

button.ios-checkbox {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  margin-right: 0;
  background: transparent;
  font: inherit;
  line-height: 1;
}

button.ios-checkbox.checked {
  background-color: var(--ios-blue);
  border-color: var(--ios-blue);
}

#view-task-checklist {
  overflow: hidden;
  padding: 14px 16px 12px;
}

#view-task-checklist .ios-input {
  user-select: text;
  -webkit-user-select: text;
}

#view-task-checklist .checklist-add {
  margin-top: 8px;
}

#view-task-checklist .checklist-add .ios-input {
  width: auto;
  padding: 9px 12px;
  background: var(--fill-secondary);
  border-radius: 12px;
  font-size: 16px;
}

.check-text {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  line-height: 1.3;
  word-break: break-word;
}

.check-text.completed {
  color: var(--text-secondary);
  text-decoration: line-through;
}

.checklist-add {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.checklist-add .ios-input {
  flex: 1;
  min-width: 0;
  width: auto;
}

.checklist-add-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 16px;
  background: var(--ios-blue);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#modal-settings .form-row-interactive {
  cursor: pointer;
}

#modal-settings .sheet-cancel,
#modal-settings .sheet-save {
  min-width: 84px;
}

#modal-settings .sheet-cancel {
  text-align: left;
}

#modal-settings .sheet-save {
  text-align: right;
}

#btn-save-settings.is-idle {
  visibility: hidden;
  pointer-events: none;
}

.settings-pane[hidden],
#settings-goal-details[hidden],
#settings-nav-admin-divider[hidden] {
  display: none !important;
}

.settings-footer {
  margin: 4px 16px 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-tertiary);
}

#settings-quiet-row.is-disabled {
  opacity: 0.4;
}

#settings-webdav-host {
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#modal-settings .ios-input {
  user-select: text;
  -webkit-user-select: text;
}

.goal-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 2px 8px;
  scrollbar-width: none;
}

.goal-filters::-webkit-scrollbar {
  display: none;
}

.goal-filters .pill-btn {
  white-space: nowrap;
}

.goal-kind-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.goal-kind-picker::-webkit-scrollbar {
  display: none;
}

.goal-kind-picker .pill-btn {
  white-space: nowrap;
}

.goal-kind-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--fill-secondary);
}

.goal-kind-badge.habit { background: color-mix(in srgb, var(--ios-green) 18%, transparent); }
.goal-kind-badge.goal { background: color-mix(in srgb, var(--ios-blue) 18%, transparent); }
.goal-kind-badge.numeric { background: color-mix(in srgb, var(--ios-orange) 18%, transparent); }
.goal-kind-badge.restriction { background: color-mix(in srgb, var(--ios-red) 18%, transparent); }

.goal-number-input {
  width: 96px;
  margin-left: auto;
  flex: 0 0 auto;
  border: 0;
  background: var(--fill-secondary);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  text-align: right;
  outline: none;
}

.goal-number-input::placeholder {
  color: var(--text-secondary);
  font-weight: 500;
}

.goal-row {
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
}

.goal-row .drag-handle {
  margin-right: 0;
  padding: 0 2px;
}

.goal-row:not(:last-child)::after {
  left: 104px;
}

.goal-row .row-title {
  line-height: 1.35;
}

.goal-row .row-subtitle {
  margin-top: 4px;
}

.goal-row.is-paused {
  opacity: 0.72;
}

.goal-why-input {
  min-height: 72px;
  resize: vertical;
  user-select: text;
  -webkit-user-select: text;
}

.goal-detail-title {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
  margin: 4px 0 12px;
}

.goal-kicker {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.goal-metric {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.goal-metric span {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
}

.goal-remain {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 14px;
}

.goal-progress-track {
  height: 8px;
  border-radius: 8px;
  background: var(--fill-secondary);
  overflow: hidden;
  margin: 12px 0;
}

.goal-progress-fill {
  height: 100%;
  border-radius: 8px;
  background: var(--ios-blue);
  width: 0;
}

.goal-progress-fill.habit { background: var(--ios-green); }
.goal-progress-fill.numeric { background: var(--ios-orange); }
.goal-progress-fill.restriction { background: var(--ios-red); }
.goal-progress-fill.goal { background: var(--ios-blue); }

.goal-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.goal-stat {
  background: var(--fill-secondary);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}

.goal-stat b {
  display: block;
  font-size: 18px;
}

.goal-stat span {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.goal-section-title {
  margin: 16px 0 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.goal-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.goal-cal-head button {
  border: 0;
  background: transparent;
  color: var(--ios-blue);
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
}

.goal-segment {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.goal-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.goal-history-row,
.goal-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  align-items: center;
  font-size: 15px;
}

.goal-history-row span,
.goal-detail-row span {
  color: var(--text-secondary);
}

.goal-menu-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 8px 0 16px;
}

.goal-stepper button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: var(--fill-secondary);
  color: var(--ios-blue);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.goal-stepper div {
  min-width: 72px;
  text-align: center;
  font-size: 40px;
  font-weight: 700;
}

.goal-result-now {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 8px;
}

.goal-result-chips,
.goal-result-tasks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.goal-result-task {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  font-size: 15px;
}

.goal-result-task span:last-child {
  margin-left: auto;
  color: var(--text-secondary);
  font-weight: 600;
}

#view-goal-body .reader-action-btn,
#view-goal-body .sheet-btn-danger,
.goal-menu-body .reader-action-btn,
.goal-menu-body .sheet-btn-danger,
#modal-goal-result .reader-action-btn {
  width: 100%;
  margin-top: 8px;
}

.goal-check-amount {
  width: 72px;
  flex: 0 0 auto;
}

#view-goal-body .ios-input,
#modal-goal-result .ios-input,
.goal-why-input {
  user-select: text;
  -webkit-user-select: text;
}

/* AI attachments stay visible until a successful response, so failures are retryable. */
.ai-attachments { padding: 0 12px; max-height: 120px; overflow-y: auto; }
.ai-attachment { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.ai-attachment span { flex: 1; overflow-wrap: anywhere; font-size: 13px; }
.ai-attachment button, #ai-attach { border: 0; border-radius: 8px; padding: 8px; cursor: pointer; }
.ai-upload-status { padding: 4px 12px; font-size: 13px; overflow-wrap: anywhere; }
.ai-voice-preview { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.ai-voice-preview[hidden] { display: none; }
.ai-voice-preview audio { flex: 1; min-width: 0; height: 36px; }
#ai-mic, #ai-voice-remove { border: 0; border-radius: 8px; padding: 8px; cursor: pointer; color: var(--text-primary); background: var(--fill-secondary); }
#ai-mic[aria-pressed="true"] { color: var(--ios-red); }
#ai-mic:disabled, #ai-voice-remove:disabled { opacity: 0.4; }
@media (max-width: 380px) { .ai-composer { gap: 4px; } .ai-send { font-size: 14px; } }

#auth-loading, #browser-login, #paywall { z-index: 12000; }


/* Wide-screen workspace. Narrow Telegram windows retain the mobile layout. */
.desktop-brand { display: none; }

@media (min-width: 1024px) {
  body {
    --desktop-nav-width: 224px;
    padding-left: var(--desktop-nav-width);
    padding-bottom: 32px;
  }

  .ios-tab-bar {
    inset: 0 auto 0 0;
    width: var(--desktop-nav-width);
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    padding: 32px 16px;
    border-top: 0;
    border-right: 1px solid var(--separator);
    overflow-y: auto;
  }

  .desktop-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 32px;
    font-size: 24px;
    font-weight: 750;
    letter-spacing: -0.5px;
  }

  .desktop-brand-icon { font-size: 30px; }
  .desktop-brand span:not(.desktop-brand-icon) {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
  }

  .ios-tab-bar .tab-item {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 12px;
    text-align: left;
  }

  .ios-tab-bar .tab-item.active {
    background: var(--fill-secondary);
    color: var(--ios-blue);
  }

  body.guest-only .ios-tab-bar .tab-item[data-tab="teams"] { flex: 0 0 auto; }

  .tab-label { margin: 0; font-size: 14px; font-weight: 600; }
  .tab-icon { flex: 0 0 24px; }
  .tab-badge { top: 6px; left: 30px; }

  .ios-header { padding: 24px 40px 20px; }
  .header-top { margin-bottom: 8px; }
  .header-large-title { font-size: 34px; }
  .header-actions { gap: 12px; }
  .icon-btn { width: 40px; height: 40px; }
  .ios-content { max-width: 1440px; padding: 28px 40px 48px; }

  #view-calendar.active {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    align-items: start;
    gap: 28px;
  }

  .calendar-sidebar, .calendar-agenda { min-width: 0; }
  .calendar-agenda > .ios-section-header:first-child { margin-top: 0; }
  #today-tasks-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 20px;
  }
  #today-tasks-container > .empty-state { grid-column: 1 / -1; }
  #today-tasks-container > .task-section-card { margin-bottom: 0; }

  .team-board { scroll-snap-type: x proximity; }
  .team-board-column { flex-basis: 300px; scroll-snap-stop: normal; }
  body.team-board-mode { padding-bottom: 0; }

  .modal-backdrop { align-items: center; justify-content: center; padding: 32px; }
  .modal-backdrop .ios-sheet {
    width: min(680px, 100%);
    max-width: 680px;
    max-height: calc(100dvh - 64px);
    border-radius: 20px;
    padding: 24px;
    transform: translateY(24px);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
  }
  .sheet-grabber { display: none; }
  .modal-backdrop.open .ios-sheet { transform: translateY(0); }
  .modal-backdrop.ai-backdrop { align-items: center; padding: 32px; }
  .ai-backdrop .ai-sheet {
    width: min(900px, 100%);
    max-width: 900px;
    height: 100%;
    max-height: 840px;
    border-radius: 20px;
  }
  .ai-fab { right: 32px; bottom: 28px; width: 56px; height: 56px; border-radius: 28px; }
  .field-picker { align-items: center; justify-content: center; padding: 32px; }
  .field-picker-sheet { max-width: 480px; border-radius: 20px; padding: 24px; }

  .tab-item:hover, .icon-btn:hover, .pill-btn:hover { background-color: var(--fill-secondary); }
  :is(button, a, input, textarea, select):focus-visible {
    outline: 2px solid var(--ios-blue);
    outline-offset: 3px;
  }
  :is(.row-title, .row-subtitle, .task-description-card, .ai-bubble, .note-text-view, .note-markdown-view) {
    user-select: text;
    -webkit-user-select: text;
  }
}

/* SortableJS uses a body-level copy so overflow containers cannot clip the drag. */
.sort-placeholder { opacity: 0.25; }
.sort-chosen { cursor: grabbing; }
.sortable-fallback { pointer-events: none !important; opacity: 0.95 !important; z-index: 10000 !important; }
.task-section-list { min-height: 48px; }

.task-selection-toolbar { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0; }
:is(.task-selection-toolbar,.task-selection-dock) button,.task-select-group { min-height:40px; border:1px solid var(--separator); border-radius:10px; padding:8px 12px; color:var(--text-primary); background:var(--bg-card); font:inherit; cursor:pointer; }
.task-selection-toolbar [aria-pressed="true"] { color:var(--ios-blue); border-color:var(--ios-blue); }
.task-selection-dock { position:fixed; bottom:calc(85px + env(safe-area-inset-bottom,0px)); z-index:110; box-sizing:border-box; display:flex; align-items:center; flex-wrap:wrap; gap:10px; padding:12px; border:1px solid var(--separator); border-radius:14px; background:var(--bg-card); box-shadow:0 4px 20px #0002; }
.task-selection-dock[hidden],.task-selection-toolbar [hidden],.task-select-group[hidden] { display:none !important; }
.task-selection-dock label { display:flex; flex-direction:column; gap:4px; flex:1; min-width:130px; font-size:12px; color:var(--text-secondary); }
.task-selection-dock select { width:100%; min-height:40px; max-width:100%; font:inherit; font-size:15px; color:var(--text-primary); background:var(--bg-card); border:1px solid var(--separator); border-radius:8px; padding:6px; }
.task-selection-dock [data-select-move] { color:white; background:var(--ios-blue); }
.task-selection-dock [data-select-error] { flex-basis:100%; color:var(--ios-red); overflow-wrap:anywhere; }
.task-selection-dock [data-select-count] { font-size:14px; }
.task-selection-dock button:disabled,.task-selection-toolbar button:disabled { opacity:.45; cursor:default; }
.task-select-box { display:none; }
.task-selecting { padding-bottom:200px; }
.task-selecting .task-select-box { display:block; flex:0 0 24px; width:24px; height:24px; margin:4px; accent-color:var(--ios-blue); cursor:pointer; }
.task-selecting .ios-row:has(.task-select-box:checked) { background:color-mix(in srgb,var(--ios-blue) 12%,var(--bg-card)) !important; }
.task-selecting :is(.ios-checkbox,.drag-handle,.row-actions,.star-btn,.edit-btn,.delete-btn,.tc-task-menu,.task-section-add) { display:none !important; }
body:has(.task-selecting) #btn-ai-chat { display:none !important; }
.task-select-group { font-size:12px; padding:6px 8px; }
@media(min-width:1024px) { .task-selection-dock { bottom:20px; } }
@media(max-width:480px) { .task-selection-dock [data-select-count] { flex-basis:100%; } .task-section-bar:has(.task-select-group:not([hidden])) { flex-wrap:wrap; } }
html[data-design="taclen"] .task-selection-dock { background:var(--tc-surface); }
html[data-design="taclen"] .task-selection-dock [data-select-move] { color:var(--tc-on-accent); }
@media(max-width:1023px) {
 html[data-design="taclen"] .task-selection-dock { bottom:calc(170px + env(safe-area-inset-bottom,0px)); }
 html[data-design="taclen"] body:has(.task-selecting) .tc-compose { display:none; }
 html[data-design="taclen"] body:has(.task-selecting) .task-selection-dock { bottom:calc(75px + env(safe-area-inset-bottom,0px)); }
}

.task-create-preview { padding: 14px 16px; opacity: .65; border-bottom: 1px solid var(--separator); }

/* Task renderers preserve their own visible row. Native scroll anchoring must
   not add a second adjustment when background content above the plan changes. */
html:has(#view-today.active),
html:has(#view-calendar.active) {
  overflow-anchor: none;
}

button[aria-busy="true"] { cursor: progress; opacity: .7; }
