/* 滴答轻历 (dida-lite) — TickTick-inspired crisp modern UI */

:root {
  --primary: #4772fa;
  --primary-hover: #355ee6;
  --primary-soft: rgba(71, 114, 250, 0.11);
  --primary-tint: rgba(71, 114, 250, 0.18);

  --bg-app: #ffffff;
  --bg-sidebar: #f6f7fa;
  --bg-subtle: #f1f3f8;
  --bg-hover: #edf0f7;
  --border: #e6e9f0;
  --border-light: #eef0f5;

  --text: #1c2230;
  --text-secondary: #5a6478;
  --text-muted: #8b95a7;

  --p0: #94a3b8;
  --p1: #3b82f6;
  --p2: #f59e0b;
  --p3: #ef4444;
  --danger: #e5484d;
  --success: #16a34a;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 14px 38px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.08);

  --sidebar-w: 236px;
  --rail-w: 248px;
  --detail-w: 368px;
  --tabbar-h: 58px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-app);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
}

.hidden {
  display: none !important;
}

#app-root {
  height: 100%;
  width: 100%;
}

.boot-loader {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
}

/* ---------- Auth Screen ---------- */
.auth-page {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top left, #eef3ff 0%, #f7f8fa 55%, #ffffff 100%);
}

.auth-card {
  width: 100%;
  max-width: 390px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  margin-bottom: 10px;
}

.auth-brand h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
}

.auth-brand p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.auth-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.auth-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.auth-tz-note {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

/* ---------- Buttons & Common Controls ---------- */
.btn-primary-lg {
  width: 100%;
  padding: 11px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: background 0.15s;
}
.btn-primary-lg:hover { background: var(--primary-hover); }
.btn-primary-lg:disabled { opacity: 0.65; cursor: wait; }

.btn-primary-sm {
  padding: 6px 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.btn-primary-sm:hover { background: var(--primary-hover); }

.btn-outline-sm {
  padding: 5px 11px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.btn-outline-sm:hover { background: var(--bg-subtle); border-color: #d2d8e4; }

.btn-outline-full {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-weight: 500;
  text-align: center;
}
.btn-outline-full:hover { background: var(--bg-subtle); }

.btn-ghost-sm {
  padding: 6px 12px;
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.btn-ghost-sm:hover { background: var(--bg-subtle); color: var(--text); }

.btn-danger-full {
  width: 100%;
  margin-top: 10px;
  padding: 9px 14px;
  border: 1px solid #fecaca;
  color: #dc2626;
  background: #fff5f5;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.btn-danger-full:hover { background: #fee2e2; }

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 15px;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.active { background: var(--primary-soft); color: var(--primary); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--danger); }

.icon-btn-xs {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 14px;
}
.icon-btn-xs:hover { background: var(--bg-hover); color: var(--text); }

.segmented-sm {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 2px;
  border-radius: 8px;
  gap: 2px;
}
.segmented-sm.full {
  width: 100%;
}
.segmented-sm button {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
  flex: 1;
  white-space: nowrap;
}
.segmented-sm button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

/* ---------- App Layout ---------- */
.app-layout {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 12px;
  overflow-y: auto;
  user-select: none;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 6px;
}
.sb-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.sb-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}
.sb-user {
  font-size: 11.5px;
  color: var(--text-muted);
}

.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sb-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
}
.sb-nav-item:hover { background: var(--bg-hover); color: var(--text); }
.sb-nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sb-ico { font-size: 15px; }
.sb-lbl { flex: 1; text-align: left; }
.sb-badge {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-secondary);
}
.sb-nav-item.active .sb-badge {
  background: rgba(71, 114, 250, 0.16);
  color: var(--primary);
}

/* Mini Calendar in Sidebar */
.sb-minical {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 8px;
}
.minical-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 6px;
}
.minical-title {
  font-size: 12.5px;
  font-weight: 600;
}
.minical-arrows {
  display: flex;
  gap: 2px;
}
.minical-arrows button {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: var(--text-secondary);
}
.minical-arrows button:hover { background: var(--bg-hover); }

.minical-wds {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.minical-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.mc-day {
  position: relative;
  height: 26px;
  border-radius: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc-day:hover { background: var(--bg-hover); }
.mc-day.other { color: #c0c7d6; }
.mc-day.today { color: var(--primary); font-weight: 700; background: var(--primary-soft); }
.mc-day.selected { background: var(--primary); color: #fff; font-weight: 600; }
.mc-day i {
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}
.mc-day.selected i { background: #fff; }

/* Sidebar Timezone Card */
.sb-tz-card {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 11px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sb-tz-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(71, 114, 250, 0.12);
}
.sb-tz-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}
.sb-tz-name { font-weight: 600; font-size: 13px; }
.sb-tz-clock {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.sb-tz-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.sync-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
}
.sync-pill:hover { background: var(--bg-hover); }
.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}
.sync-pill.status-syncing .sync-dot { background: var(--primary); animation: pulse 1s infinite; }
.sync-pill.status-offline .sync-dot { background: var(--p2); }
.sync-pill.status-error .sync-dot { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.sb-footer-actions {
  display: flex;
  gap: 6px;
}
.sb-foot-btn {
  flex: 1;
  font-size: 12.5px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}
.sb-foot-btn:hover { color: var(--text); background: var(--bg-hover); }

/* ---------- Main Area ---------- */
.app-main {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- Checkboxes ---------- */
.check-circle {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.8px solid #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #fff;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.check-circle.xs { width: 15px; height: 15px; border-width: 1.6px; }
.check-circle.p1 { border-color: var(--p1); }
.check-circle.p2 { border-color: var(--p2); }
.check-circle.p3 { border-color: var(--p3); }
.check-circle:hover { transform: scale(1.08); }
.check-circle.checked { background: #475569; border-color: #334155; }
.check-circle.p1.checked { background: var(--p1); border-color: #2563eb; }
.check-circle.p2.checked { background: var(--p2); border-color: #d97706; }
.check-circle.p3.checked { background: var(--p3); border-color: #dc2626; }
.check-circle svg { width: 13px; height: 13px; }

/* ---------- Inbox View ---------- */
.inbox-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 12px;
}

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

.inbox-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.inbox-title-wrap h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.count-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.count-pill.sm { font-size: 11px; padding: 1px 7px; }

.tz-inline-pill {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 4px 9px;
  border-radius: 99px;
}
.tz-inline-pill:hover { background: var(--bg-hover); color: var(--text); }

.inbox-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box input {
  width: 170px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-sidebar);
  outline: none;
  transition: width 0.15s, background 0.15s, border-color 0.15s;
}
.search-box input:focus {
  width: 210px;
  background: #fff;
  border-color: var(--primary);
}

.inbox-composer {
  position: relative;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.inbox-composer:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.composer-main {
  display: flex;
  align-items: center;
  gap: 8px;
}
.composer-plus {
  font-size: 20px;
  color: var(--primary);
  font-weight: 500;
  line-height: 1;
}
#inbox-quick-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-size: 14.5px;
  padding: 5px 0;
  background: transparent;
}
.composer-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tool-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--text-muted);
}
.tool-icon-btn:hover { background: var(--bg-subtle); color: var(--text); }
.tool-icon-btn.has-value { background: var(--primary-soft); color: var(--primary); }
.pri-btn.p1 { color: var(--p1); }
.pri-btn.p2 { color: var(--p2); }
.pri-btn.p3 { color: var(--p3); }

.composer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.composer-chips:empty { margin-top: 0; }

.nlp-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 500;
}
.nlp-chip small {
  font-size: 10.5px;
  opacity: 0.78;
}
.nlp-chip button {
  font-size: 14px;
  line-height: 1;
  color: var(--primary);
  padding: 0 2px;
}

.pri-chip {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 99px;
  font-weight: 500;
}
.pri-chip.p1 { background: rgba(59, 130, 246, 0.12); color: var(--p1); }
.pri-chip.p2 { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.pri-chip.p3 { background: rgba(239, 68, 68, 0.12); color: var(--p3); }

.composer-date-pop {
  position: absolute;
  right: 12px;
  top: calc(100% + 6px);
  z-index: 40;
  width: 288px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-date-row {
  display: flex;
  gap: 6px;
}
.quick-date-row button {
  flex: 1;
  padding: 5px 6px;
  font-size: 12px;
  background: var(--bg-subtle);
  border-radius: 6px;
  font-weight: 500;
}
.quick-date-row button:hover { background: var(--primary-soft); color: var(--primary); }
.quick-date-row button.muted { color: var(--text-muted); }

.date-pop-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
}
.date-pop-fields input[type="date"],
.date-pop-fields input[type="time"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}
.time-range-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.date-pop-footer {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.inbox-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 40px;
}

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inbox-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.inbox-row:hover { background: var(--bg-sidebar); }
.inbox-row.is-selected { background: var(--primary-soft); border-color: rgba(71, 114, 250, 0.28); }
.inbox-row.is-done .inbox-row-title { text-decoration: line-through; color: var(--text-muted); }

.inbox-row-body {
  flex: 1;
  min-width: 0;
}
.inbox-row-title {
  font-size: 14.5px;
  color: var(--text);
  word-break: break-word;
}
.inbox-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  flex-wrap: wrap;
}
.meta-date {
  font-size: 12px;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.meta-date.is-overdue { color: var(--danger); font-weight: 500; }
.meta-chip { font-size: 11.5px; color: var(--text-muted); }

.inbox-row-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}
.inbox-row:hover .inbox-row-actions,
.inbox-row.is-selected .inbox-row-actions { opacity: 1; }

.row-mini-btn {
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 5px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
.row-mini-btn:hover { background: var(--primary-soft); color: var(--primary); }
.row-mini-btn.danger:hover { background: #fee2e2; color: var(--danger); }

.completed-section {
  margin-top: 18px;
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}
.completed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 6px;
}
.completed-toggle:hover { background: var(--bg-subtle); }
.caret { display: inline-block; transition: transform 0.15s; }
.caret.open { transform: rotate(90deg); }

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}
.empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-sub { font-size: 13px; }

/* ---------- Calendar Shell ---------- */
.cal-shell {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.cal-inbox-rail {
  width: var(--rail-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: #fbfbfd;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 12px 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.rail-quick-add {
  padding: 0 10px 10px;
}
.rail-quick-add input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 12.5px;
  outline: none;
}
.rail-quick-add input:focus { border-color: var(--primary); }

.rail-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rail-empty {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 28px 10px;
  line-height: 1.6;
}

.rail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--p0);
  border-radius: 7px;
  font-size: 13px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: transform 0.1s, box-shadow 0.12s, border-color 0.12s;
}
.rail-item.p1 { border-left-color: var(--p1); }
.rail-item.p2 { border-left-color: var(--p2); }
.rail-item.p3 { border-left-color: var(--p3); }
.rail-item:hover { box-shadow: var(--shadow-sm); border-color: #d6dce8; }
.rail-item.is-dragging { opacity: 0.45; }
.rail-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Calendar Main & Toolbar ---------- */
.cal-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.cal-toolbar-left,
.cal-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-arrows {
  display: inline-flex;
  gap: 2px;
}

.cal-period-title {
  margin: 0 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tz-switcher-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.tz-switcher-pill:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.tz-pill-offset {
  color: var(--text-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.tz-pill-sec {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.zoom-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.cal-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- Time Grid (Day / 3-Day / Week) ---------- */
.timegrid-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  user-select: none;
}

.tg-header-row {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  background: #fff;
  flex-shrink: 0;
}

.tg-gutter-head,
.tg-gutter-allday,
.tg-gutter {
  width: 58px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-light);
}

.tg-gutter-head.has-secondary,
.tg-gutter-allday.has-secondary,
.tg-gutter.has-secondary {
  width: 108px;
}

.tg-gutter-head {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 4px;
  padding: 4px 6px 6px;
}

.tz-axis-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.tz-axis-tag.pri { color: var(--primary); }

.tg-day-heads {
  flex: 1;
  display: grid;
  padding-right: 8px; /* scrollbar compensation feel */
}

.tg-day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 4px;
  gap: 2px;
  cursor: pointer;
}
.tg-wd {
  font-size: 11.5px;
  color: var(--text-muted);
}
.tg-day-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tg-day-head.is-today .tg-wd { color: var(--primary); font-weight: 600; }
.tg-day-head.is-today .tg-day-num {
  background: var(--primary);
  color: #fff;
}

/* All-day Strip */
.tg-allday-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: #fcfdff;
  flex-shrink: 0;
  max-height: 110px;
  overflow-y: auto;
}
.tg-gutter-allday {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
}
.tg-allday-cols {
  flex: 1;
  display: grid;
  padding-right: 8px;
}
.tg-allday-cell {
  min-height: 32px;
  padding: 3px 4px;
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}
.tg-allday-cell:first-child { border-left: none; }
.tg-allday-cell:hover { background: rgba(71, 114, 250, 0.03); }
.tg-allday-cell.drop-hover { background: var(--primary-soft); }

.allday-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(71, 114, 250, 0.13);
  border-left: 3px solid var(--primary);
  color: #1f3a8a;
  font-size: 12px;
  font-weight: 500;
  min-width: 0;
}
.allday-chip.p1 { background: rgba(59, 130, 246, 0.14); border-left-color: var(--p1); color: #1d4ed8; }
.allday-chip.p2 { background: rgba(245, 158, 11, 0.16); border-left-color: var(--p2); color: #92400e; }
.allday-chip.p3 { background: rgba(239, 68, 68, 0.15); border-left-color: var(--p3); color: #991b1b; }
.allday-chip.is-done {
  background: #eef2f6;
  border-left-color: #94a3b8;
  color: #64748b;
  text-decoration: line-through;
}
.allday-chip.is-selected { box-shadow: 0 0 0 1.5px var(--primary); }

.chip-check {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.6px solid currentColor;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  position: relative;
}
.chip-check.checked {
  background: #475569;
  border-color: #334155;
}
.chip-check.checked::after {
  content: "✓";
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}
.chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 24-Hour Scrollable Body */
.cal-grid-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.tg-body {
  display: flex;
  position: relative;
}

.tg-gutter {
  position: relative;
  background: #fff;
}

.tg-hour-label {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
  padding-right: 7px;
  transform: translateY(-7px);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.pri-clock { color: var(--text-muted); font-weight: 500; }
.sec-clock { color: #a7b0c2; font-size: 10.5px; }
.sec-clock sup { font-size: 9px; color: var(--primary); margin-left: 1px; }

.tg-columns {
  flex: 1;
  display: grid;
  position: relative;
}

.tg-day-col {
  position: relative;
  border-left: 1px solid var(--border-light);
  cursor: crosshair;
}
.tg-day-col:first-child { border-left: none; }
.tg-day-col.is-today { background: rgba(71, 114, 250, 0.018); }

.tg-hour-cell {
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.tg-hour-cell::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed rgba(226, 232, 240, 0.65);
  pointer-events: none;
}

/* Current Time Red Indicator */
.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ef4444;
  z-index: 15;
  pointer-events: none;
}
.now-dot {
  position: absolute;
  left: -4px;
  top: -3.5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
}

/* Timed Event Block */
.cal-event {
  position: absolute;
  z-index: 5;
  border-radius: 7px;
  background: #edf2ff;
  border-left: 3.5px solid var(--primary);
  color: #1e3a8a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  cursor: grab;
  overflow: hidden;
  transition: box-shadow 0.12s, opacity 0.12s;
}
.cal-event:hover { box-shadow: 0 3px 10px rgba(71, 114, 250, 0.18); z-index: 8; }
.cal-event.p1 { background: #eff6ff; border-left-color: var(--p1); color: #1e40af; }
.cal-event.p2 { background: #fffbeb; border-left-color: var(--p2); color: #92400e; }
.cal-event.p3 { background: #fef2f2; border-left-color: var(--p3); color: #991b1b; }
.cal-event.is-done {
  background: #eef2f6;
  border: 1px solid #d5dde7;
  border-left: 3.5px solid #94a3b8;
  color: #64748b;
}
.cal-event.is-done .ev-title {
  text-decoration: line-through;
  color: #64748b;
}
.cal-event.is-done .ev-time {
  color: #7c899c;
}
.cal-event.is-selected { box-shadow: 0 0 0 2px var(--primary); z-index: 10; }
.cal-event.is-drag-source { opacity: 0.35; }
.cal-event.is-resizing { z-index: 20; box-shadow: 0 4px 16px rgba(71, 114, 250, 0.3); }

.cal-event-inner {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 4px 6px;
  height: 100%;
  overflow: hidden;
}
.cal-event.is-compact .cal-event-inner {
  align-items: center;
  padding: 1px 5px;
}

.ev-check {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  border-radius: 50%;
  border: 1.6px solid currentColor;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
}
.cal-event:hover .ev-check,
.cal-event.is-done .ev-check,
.cal-event.is-selected .ev-check {
  display: inline-flex;
}
.cal-event.is-compact .ev-check { margin-top: 0; }
.ev-check.checked {
  background: #475569;
  border-color: #334155;
  color: #ffffff;
}
.ev-check.p1.checked { background: var(--p1); border-color: #2563eb; }
.ev-check.p2.checked { background: var(--p2); border-color: #d97706; }
.ev-check.p3.checked { background: var(--p3); border-color: #dc2626; }
.cal-event.is-done .ev-check.checked {
  background: #475569;
  border-color: #1e293b;
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.ev-content {
  min-width: 0;
  flex: 1;
}
.ev-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.cal-event.is-compact .ev-title {
  -webkit-line-clamp: 1;
}
.ev-time {
  font-size: 10.5px;
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ev-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  cursor: ns-resize;
}
.ev-resize-handle:hover {
  background: rgba(71, 114, 250, 0.22);
}

/* Slot Selection Preview & Drag Ghost */
.cal-slot-preview,
.cal-event-ghost {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 18;
  border-radius: 7px;
  background: rgba(71, 114, 250, 0.22);
  border: 1.5px solid var(--primary);
  color: #1d4ed8;
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.cal-slot-preview.is-drop {
  border-style: dashed;
  background: rgba(71, 114, 250, 0.16);
}
.cal-event-ghost {
  box-shadow: var(--shadow-lg);
  background: rgba(71, 114, 250, 0.88);
  color: #fff;
}

/* ---------- Month View ---------- */
.month-grid-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.month-wd-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
}
.month-wd-cell {
  text-align: center;
  padding: 7px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.month-cells {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  overflow: hidden;
}
.month-cell {
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 4px 5px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
}
.month-cell:hover { background: rgba(71, 114, 250, 0.025); }
.month-cell.drop-hover { background: var(--primary-soft); }
.month-cell.is-other { background: #fafbfd; color: var(--text-muted); }
.month-cell-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 3px;
}
.month-day-num {
  font-size: 12px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}
.month-cell.is-today .month-day-num {
  background: var(--primary);
  color: #fff;
}
.month-cell-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.month-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  background: rgba(71, 114, 250, 0.12);
  color: #1e3a8a;
  overflow: hidden;
  white-space: nowrap;
}
.month-chip.p2 { background: rgba(245, 158, 11, 0.16); color: #92400e; }
.month-chip.p3 { background: rgba(239, 68, 68, 0.15); color: #991b1b; }
.month-chip.is-done { opacity: 0.52; text-decoration: line-through; }
.mchip-time { font-variant-numeric: tabular-nums; font-weight: 600; opacity: 0.85; }
.mchip-title { overflow: hidden; text-overflow: ellipsis; }
.month-more-btn {
  text-align: left;
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  padding: 1px 4px;
}

/* ---------- Floating Quick-Add Popover ---------- */
.cal-popover-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
}
.cal-quick-popover {
  position: fixed;
  width: 324px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qpop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.qpop-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: 99px;
}
.qpop-title-input {
  width: 100%;
  border: none;
  border-bottom: 1.5px solid var(--border);
  padding: 6px 2px;
  font-size: 15px;
  font-weight: 500;
  outline: none;
}
.qpop-title-input:focus { border-bottom-color: var(--primary); }
.qpop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.qpop-row input[type="date"],
.qpop-row input[type="time"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 13px;
}
.qpop-dur {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-left: auto;
}
.qpop-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}
.qpop-pri-group {
  display: flex;
  gap: 4px;
}
.qpri {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--p0);
}
.qpri.p1 { color: var(--p1); }
.qpri.p2 { color: var(--p2); }
.qpri.p3 { color: var(--p3); }
.qpri.active { background: var(--bg-subtle); box-shadow: inset 0 0 0 1.5px currentColor; }
.qpop-btns { display: flex; gap: 6px; }

/* ---------- Detail Drawer ---------- */
.detail-drawer-root {
  display: none;
}
.detail-drawer-root.open {
  display: block;
}
.detail-backdrop {
  display: none;
}
.detail-panel {
  width: var(--detail-w);
  height: 100%;
  border-left: 1px solid var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}
.detail-top-left {
  display: flex;
  align-items: center;
  gap: 9px;
}
.detail-status-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.detail-top-right { display: flex; gap: 4px; }

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.detail-title-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  padding: 2px 0;
}
.detail-title-input.is-done { text-decoration: line-through; color: var(--text-muted); }

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.detail-tz-hint {
  font-size: 11px;
  color: var(--primary);
}

.priority-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.pri-pill {
  padding: 6px;
  border-radius: 7px;
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}
.pri-pill.p1 { color: var(--p1); }
.pri-pill.p2 { color: #d97706; }
.pri-pill.p3 { color: var(--p3); }
.pri-pill.active {
  background: var(--primary-soft);
  border-color: currentColor;
  font-weight: 600;
}

.detail-date-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-sidebar);
  padding: 10px;
  border-radius: var(--radius-sm);
}
.detail-date-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}
.detail-date-grid input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  font-size: 13px;
}
.detail-time-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.detail-origin-tz {
  font-size: 11.5px;
  color: var(--text-muted);
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.checklist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: var(--bg-sidebar);
  border-radius: 6px;
}
.checklist-row.done .cl-text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.cl-text { flex: 1; font-size: 13px; word-break: break-word; }
.cl-del { color: var(--text-muted); font-size: 15px; padding: 0 4px; }
.cl-del:hover { color: var(--danger); }

.checklist-add-row input {
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 13px;
  outline: none;
}
.checklist-add-row input:focus { border-style: solid; border-color: var(--primary); }

#detail-notes {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  resize: vertical;
  min-height: 110px;
  outline: none;
  font-size: 13.5px;
  line-height: 1.55;
}
#detail-notes:focus { border-color: var(--primary); }

.detail-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-light);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 86vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
.modal-search:focus { border-color: var(--primary); }

.tz-quick-bar {
  display: flex;
  justify-content: flex-start;
}

.tz-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
}
.tz-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border-radius: 8px;
  text-align: left;
  border: 1px solid transparent;
}
.tz-option:hover { background: var(--bg-sidebar); }
.tz-option.active {
  background: var(--primary-soft);
  border-color: rgba(71, 114, 250, 0.35);
}
.tz-opt-name { font-weight: 600; font-size: 13.5px; }
.tz-opt-id { font-size: 11.5px; color: var(--text-muted); }
.tz-opt-right { display: flex; align-items: center; gap: 8px; }
.tz-opt-clock { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.tz-check { color: var(--primary); font-weight: 700; }

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.setting-group:last-child { border-bottom: none; padding-bottom: 0; }
.setting-group h4 {
  margin: 0 0 2px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
}
.setting-row select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  background: #fff;
}
.btn-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.file-btn {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.pw-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pw-form input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

.install-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--bg-sidebar);
  border-radius: var(--radius-md);
}
.install-icon { width: 52px; height: 52px; border-radius: 12px; }
.install-name { font-weight: 700; font-size: 16px; }
.install-sub { font-size: 12.5px; color: var(--text-secondary); }
.install-steps { display: flex; flex-direction: column; gap: 10px; }
.install-platform {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 13px;
}
.install-platform.highlight {
  border-color: var(--primary);
  background: #f5f8ff;
}
.install-platform ol {
  margin: 6px 0 0;
  padding-left: 18px;
  line-height: 1.7;
}

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}
.toast-card {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: #1e2433;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
}
.toast-action-btn {
  color: #7aa2ff;
  font-weight: 600;
}
.toast-action-btn:hover { text-decoration: underline; }

/* ---------- Mobile Navigation & Responsive ---------- */
.mobile-tabbar,
.mobile-fab {
  display: none;
}

@media (max-width: 1120px) {
  .cal-inbox-rail { width: 210px; }
}

@media (max-width: 767px) {
  .app-sidebar,
  .cal-inbox-rail,
  .rail-toggle-btn,
  .zoom-group {
    display: none !important;
  }

  .app-main {
    padding-top: var(--safe-top);
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  }

  .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 50;
  }

  .mtab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 11px;
    color: var(--text-muted);
  }
  .mtab-ico { font-size: 18px; line-height: 1.1; }
  .mtab.active { color: var(--primary); font-weight: 600; }

  .mobile-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 16px;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 28px;
    font-weight: 400;
    box-shadow: 0 8px 22px rgba(71, 114, 250, 0.38);
    z-index: 48;
  }

  .inbox-view {
    padding: 12px 14px 8px;
  }
  .inbox-header { margin-bottom: 12px; }
  .inbox-title-wrap h1 { font-size: 19px; }
  .search-box input { width: 130px; }
  .inbox-row-actions { opacity: 1; }

  .cal-toolbar {
    padding: 8px 10px;
    gap: 6px;
  }
  .cal-period-title { font-size: 14.5px; }
  .tz-pill-offset { display: none; }

  .tg-gutter-head,
  .tg-gutter-allday,
  .tg-gutter {
    width: 44px;
  }
  .tg-gutter-head.has-secondary,
  .tg-gutter-allday.has-secondary,
  .tg-gutter.has-secondary {
    width: 82px;
  }
  .tg-gutter.has-secondary .tg-hour-label {
    padding: 0 4px 0 3px;
    gap: 3px;
    font-size: 9.5px;
  }
  .tg-gutter.has-secondary .sec-clock {
    font-size: 9px;
  }
  .cal-event-inner {
    padding: 3px 4px;
    gap: 3px;
  }
  .cal-event:hover .ev-check,
  .cal-event.is-selected .ev-check {
    display: none;
  }
  .ev-title {
    font-size: 11px;
  }

  /* Detail Drawer becomes bottom sheet on mobile */
  .detail-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 70;
  }
  .detail-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 86vh;
    border-left: none;
    border-radius: 18px 18px 0 0;
    z-index: 75;
    box-shadow: var(--shadow-lg);
    padding-bottom: var(--safe-bottom);
  }

  /* Quick add popover becomes bottom sheet on mobile */
  .cal-popover-overlay {
    background: rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: flex-end;
  }
  .cal-quick-popover {
    position: static;
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 16px 16px calc(18px + var(--safe-bottom));
  }

  .toast-host {
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  }
}


/* ==========================================================================
   v1.1.0 Upgrades: Time-Axis Handles, Multi-Day Dropdown, Dual-TZ Pills,
   2-Digit Time Steppers, Recurrence, Rich Content/Attachments,
   Centered Detail Modal & QR Share Card Modal
   ========================================================================== */

/* Multi-day dropdown trigger inside segmented switcher */
.multiday-btn-wrap {
  display: inline-flex;
  position: relative;
}
.multiday-main {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
.md-caret {
  font-size: 10px;
  opacity: 0.72;
  padding-left: 1px;
}

.floating-dropdown {
  position: fixed;
  z-index: 95;
  min-width: 118px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 5px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fd-item {
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  transition: background 0.12s;
}
.fd-item:hover {
  background: var(--bg-subtle);
}
.fd-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* Left Time-Axis Visible Range Handles (TickTick style) */
.tg-gutter {
  position: relative;
}
.tg-range-handle {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 22px;
  padding: 0 4px;
  border-radius: 7px;
  border: 1px solid #d5dff5;
  background: rgba(239, 244, 255, 0.96);
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: ns-resize;
  user-select: none;
  touch-action: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.tg-range-handle.top {
  top: 2px;
}
.tg-range-handle.bottom {
  bottom: 2px;
}
.tg-range-handle:hover,
.tg-range-handle.is-dragging {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(71, 114, 250, 0.35);
}
.tg-range-handle .rh-grip {
  opacity: 0.7;
  font-size: 11px;
}
.tg-range-handle .rh-arr {
  font-size: 10px;
  opacity: 0.85;
}

.tg-hidden-banner {
  width: 100%;
  padding: 5px 12px;
  background: #f4f7ff;
  border-bottom: 1px solid #dce6ff;
  color: #365be0;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.tg-hidden-banner.bottom {
  border-bottom: none;
  border-top: 1px solid #dce6ff;
}
.tg-hidden-banner:hover {
  background: #e8efff;
}

.hour-range-pop {
  min-width: 236px;
  padding: 12px;
  gap: 10px;
}
.hrp-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}
.hrp-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.hrp-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
}
.hrp-row select {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 6px;
  background: #fff;
  font-size: 12.5px;
}
.hrp-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.hrp-presets button {
  padding: 5px 4px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.hrp-presets button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.ev-meta-ico {
  font-size: 10.5px;
  margin-right: 2px;
  margin-left: 2px;
  opacity: 0.82;
}

/* Dual-Timezone Pill Bar (Active Highlighted + Smaller Secondary) */
.dual-tz-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.dtz-pill {
  border-radius: 999px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: all 0.14s;
}
.dtz-pill.active {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(71, 114, 250, 0.25);
}
.dtz-pill.secondary {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.dtz-pill.secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* Custom 2-Digit Hour (±1) & 2-Digit Minute (±15) Time Stepper */
.ts-picker {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #ffffff;
}
.ts-unit {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.ts-num {
  width: 28px;
  border: none !important;
  padding: 2px 0 !important;
  text-align: center;
  font-size: 15px !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: transparent !important;
  outline: none;
}
.ts-arrows {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ts-btn {
  width: 18px;
  height: 14px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 8px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ts-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.ts-colon {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 15px;
  padding: 0 1px;
}
.stepper-dash {
  color: var(--text-muted);
  font-weight: 600;
}

/* Upgraded Quick-Create Modal */
.cal-popover-overlay.centered {
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cal-quick-popover.upgraded {
  position: static;
  width: 100%;
  max-width: 490px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px;
  gap: 12px;
  border-radius: 18px;
}
.qpop-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.qpop-title-tag {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.qpop-row.wrap {
  flex-wrap: wrap;
}
.qpop-rec-select {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  margin-left: auto;
}
.qpop-stepper-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-sidebar);
  border-radius: 10px;
}
.qpop-content-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fafbfd;
}
.qpop-content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.qpop-content-area textarea {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
  background: #ffffff;
  outline: none;
}
.qpop-content-area textarea:focus {
  border-color: var(--primary);
}
.qpop-att-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.qatt-thumb {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.qatt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.qatt-thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}
.qatt-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 12px;
}
.qatt-file button {
  color: var(--text-muted);
  font-weight: 700;
}

/* Centered Task Detail Modal (replaces right-side drawer on all viewports) */
.detail-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 72;
  background: rgba(15, 23, 42, 0.44);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.detail-modal-card {
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-rec-tag {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
}
.btn-share-top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  margin-right: 4px;
  cursor: pointer;
}
.btn-share-top:hover {
  background: #365be0;
}
.detail-stepper-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-stepper-row .stepper-dash {
  padding-bottom: 10px;
}
.stepper-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stepper-lbl {
  font-size: 11.5px;
  color: var(--text-secondary);
}
.rec-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}
.rec-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}
.rec-field select,
.rec-field input {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 8px;
  background: #fff;
  font-size: 13px;
}

/* Rich Content + Images + Attachments inside Detail Modal */
.content-tools {
  display: inline-flex;
  gap: 6px;
}
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tool-chip.sm {
  padding: 2px 8px;
  font-size: 11.5px;
}
.tool-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.rich-content-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafbfd;
  transition: border-color 0.15s, background 0.15s;
}
.rich-content-box.drag-file-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.rich-content-box #detail-notes {
  border: 1px solid var(--border-light);
  background: #ffffff;
  min-height: 92px;
}
.att-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
}
.att-img-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  aspect-ratio: 4 / 3;
}
.att-img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.att-rm-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.att-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.att-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid var(--border);
}
.att-file-link {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
}
.att-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.att-file-size {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.shared-indicator {
  color: #059669;
  font-weight: 600;
}

/* Share Card Preview Modal */
.share-modal {
  max-width: 520px;
}
.share-loading {
  text-align: center;
  padding: 36px 12px;
  color: var(--text-muted);
  font-size: 14px;
}
.share-preview-wrap {
  background: #e9eff7;
  border-radius: 14px;
  padding: 10px;
  max-height: 52vh;
  overflow-y: auto;
  display: flex;
  justify-content: center;
}
.share-preview-img {
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
}
.share-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
}
.share-link-text {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.danger-text {
  color: var(--danger);
  margin-left: auto;
}

@media (max-width: 767px) {
  .detail-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .detail-modal-card {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 18px 18px 0 0;
    padding-bottom: var(--safe-bottom);
  }
  .cal-popover-overlay.centered {
    align-items: flex-end;
    padding: 0;
  }
  .cal-quick-popover.upgraded {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 18px 18px 0 0;
    padding: 16px 14px calc(18px + var(--safe-bottom));
  }
  .tg-range-handle {
    font-size: 9.5px;
    padding: 0 2px;
  }
  .tg-range-handle .rh-grip {
    display: none;
  }
}


/* ==========================================================================
   v1.2.0 Upgrades: Share Validity (3d/7d/15d/30d/Permanent), Active Share
   Indicators & Dedicated "分享中" Management View
   ========================================================================== */

.sb-badge.share-count {
  background: rgba(5, 150, 105, 0.14);
  color: #059669;
  font-weight: 700;
}
.sb-nav-item.active .sb-badge.share-count {
  background: rgba(71, 114, 250, 0.16);
  color: var(--primary);
}

.btn-share-top.is-active {
  background: #059669;
}
.btn-share-top.is-active:hover {
  background: #047857;
}

.shared-indicator-btn {
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  transition: background 0.12s;
}
.shared-indicator-btn:hover {
  background: #d1fae5;
}

.meta-share-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  padding: 1px 7px;
  border-radius: 999px;
}

/* Share Modal TTL Picker */
.share-ttl-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
}
.share-ttl-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.share-live-badge {
  font-size: 12px;
  font-weight: 600;
  color: #059669;
}
.share-live-badge.soon {
  color: #d97706;
}
.share-ttl-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.share-ttl-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.ttl-pill-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ttl-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.12s;
}
.ttl-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.ttl-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.ttl-pill:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Active Shares Management View ("分享中") */
.shares-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 12px;
}
.shares-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.shares-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
}
.shares-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.share-mgmt-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.share-mgmt-card:hover {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}
.share-mgmt-card.p1 { border-left-color: var(--p1); }
.share-mgmt-card.p2 { border-left-color: var(--p2); }
.share-mgmt-card.p3 { border-left-color: var(--p3); }
.share-mgmt-card.is-done { border-left-color: #94a3b8; }

.smc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.smc-title-area {
  flex: 1;
  min-width: 200px;
  cursor: pointer;
}
.smc-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.smc-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}
.smc-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
}
.smc-title-area:hover .smc-title {
  color: var(--primary);
}
.smc-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}
.smc-tag.done { background: #eef2f6; color: #64748b; }
.smc-tag.rec { background: #eef2ff; color: #4338ca; }

.smc-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 5px;
}
.share-exp-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  white-space: nowrap;
}
.share-exp-pill.permanent {
  background: #ecfdf5;
  color: #059669;
}
.share-exp-pill.soon {
  background: #fffbeb;
  color: #b45309;
}

.smc-ttl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-sidebar);
}
.smc-ttl-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.smc-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.smc-link-a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 767px) {
  .shares-view {
    padding: 12px 14px 8px;
  }
  .share-mgmt-card {
    padding: 12px;
  }
}


/* ==================== v1.3.0 Mailbox & Meeting Integration ==================== */

/* Sidebar badge for enabled meeting sources */
.sb-badge.mtg-count {
  background: #e0f2fe;
  color: #0369a1;
}

/* Calendar meeting cards subtle visual distinction */
.cal-event.is-meeting:not(.is-done) {
  background: #f0f9ff;
  border-left-color: #0284c7;
}
.allday-chip.is-meeting:not(.is-done) {
  background: #f0f9ff;
  border-left-color: #0284c7;
}
.month-chip.is-meeting:not(.is-done) {
  background: #e0f2fe;
  color: #0c4a6e;
}
.ev-src-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
  background: rgba(2, 132, 199, 0.14);
  color: #0369a1;
  vertical-align: middle;
}
.ev-meta-ico.mtg-ico {
  opacity: 1;
}

/* Inbox meeting meta pills & direct join link */
.meta-mtg-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #e0f2fe;
  color: #0369a1;
}
.meta-join-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #dcfce7;
  color: #15803d;
  text-decoration: none;
  border: 1px solid #86efac;
  transition: background 0.14s;
}
.meta-join-link:hover {
  background: #bbf7d0;
}

/* Task Detail Modal: Meeting Join Banner & Clickable Body Links */
.detail-mtg-src-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  white-space: nowrap;
}

.meeting-join-card {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0f9ff 0%, #eff6ff 100%);
  border: 1px solid #bae6fd;
}
.meeting-join-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.meeting-join-info {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.meeting-join-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13.5px;
  font-weight: 700;
  color: #0c4a6e;
}
.meeting-join-meta {
  font-size: 12px;
  color: #334155;
  line-height: 1.4;
  word-break: break-word;
}
.meeting-join-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-join-meeting {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #0284c7;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.28);
  transition: background 0.14s, transform 0.12s;
  white-space: nowrap;
}
.btn-join-meeting:hover {
  background: #0369a1;
  transform: translateY(-1px);
}
.btn-copy-meeting {
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid #7dd3fc;
  background: #ffffff;
  color: #0369a1;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-copy-meeting:hover {
  background: #e0f2fe;
}

.mtg-badge-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: #0284c7;
  color: #ffffff;
}
.mtg-dir-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}
.mtg-dir-pill.is-sent {
  background: #ede9fe;
  color: #6d28d9;
}
.mtg-dir-pill.is-recv {
  background: #dcfce7;
  color: #15803d;
}
.mtg-past-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
}

/* Clickable Linkified Body View inside Task Detail */
.notes-linkified-view {
  width: 100%;
  min-height: 96px;
  max-height: 260px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: #ffffff;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.inline-meeting-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  margin: 2px 2px;
  border-radius: 8px;
  background: #0284c7;
  color: #ffffff !important;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  vertical-align: middle;
  transition: background 0.14s;
}
.inline-meeting-link:hover {
  background: #0369a1;
}
.inline-url-link {
  color: var(--primary);
  text-decoration: underline;
  word-break: break-all;
}
.tool-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ==================== Meetings Management View ==================== */

.meetings-view {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.meetings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.meetings-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.meetings-title-row h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.meetings-sub {
  margin: 6px 0 8px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.meetings-sub code {
  background: var(--bg-subtle);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
}
.meetings-sec-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 12px;
  font-weight: 600;
}
.meetings-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mtg-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.mtg-preset-card {
  text-align: left;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.12s;
}
.mtg-preset-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(71, 114, 250, 0.1);
  transform: translateY(-1px);
}
.mtg-preset-card.active {
  border-color: var(--primary);
  background: #f8faff;
  box-shadow: 0 0 0 3px rgba(71, 114, 250, 0.14);
}
.mtg-preset-card.subtle {
  background: #fafbfd;
}
.mtg-preset-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.mtg-preset-ico {
  font-size: 20px;
}
.mtg-preset-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
.mtg-preset-tag.is-rec {
  background: #dbeafe;
  color: #1d4ed8;
}
.mtg-preset-tag.is-done {
  background: #dcfce7;
  color: #15803d;
}
.mtg-preset-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.mtg-preset-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.mtg-form-card {
  padding: 18px 20px;
  border-radius: 16px;
  border: 1.5px solid #bfdbfe;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mtg-form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.mtg-form-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.mtg-form-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.mtg-guide {
  padding: 10px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.mtg-guide summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.mtg-guide ol {
  margin: 8px 0 2px 18px;
  padding: 0;
}
.mtg-guide a {
  color: var(--primary);
  font-weight: 600;
}
.mtg-guide code {
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
}

.mtg-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.mtg-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.mtg-form-grid label.span-2,
.mtg-form-grid .span-2 {
  grid-column: 1 / -1;
}
.mtg-form-grid input[type='text'],
.mtg-form-grid input[type='email'],
.mtg-form-grid input[type='url'],
.mtg-form-grid input[type='password'],
.mtg-form-grid input[type='number'] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 13.5px;
  background: #ffffff;
  color: var(--text);
}
.mtg-form-grid input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(71, 114, 250, 0.14);
}
.mtg-form-grid label.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
  padding-top: 6px;
}
.mtg-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.mtg-test-banner {
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
}
.mtg-test-banner.is-ok {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}
.mtg-test-banner.is-err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.mtg-device-box {
  padding: 16px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1.5px solid #93c5fd;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.mtg-device-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #1e3a8a;
}
.mtg-device-code {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 5px;
  color: #1d4ed8;
  background: #ffffff;
  padding: 8px 20px;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.mtg-device-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.mtg-device-hint {
  font-size: 12px;
  color: #1e40af;
}

.mtg-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mtg-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.mtg-section-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.mtg-section-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.mtg-empty-card {
  padding: 18px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: #fafbfd;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.mtg-sources-list,
.mtg-events-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mtg-source-row {
  padding: 14px 16px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.mtg-source-row.is-disabled {
  opacity: 0.68;
  background: #f8fafc;
}
.mtg-source-main {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mtg-source-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
}
.src-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.src-status-dot.status-ok {
  background: #22c55e;
}
.src-status-dot.status-error {
  background: #ef4444;
}
.src-type-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
}
.src-paused-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fef3c7;
  color: #b45309;
}
.mtg-source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.mtg-source-err {
  font-size: 12px;
  color: #dc2626;
  background: #fef2f2;
  padding: 5px 8px;
  border-radius: 7px;
}
.mtg-source-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-outline-xs {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-outline-xs:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.btn-outline-xs.danger:hover {
  border-color: #ef4444;
  color: #dc2626;
  background: #fef2f2;
}

.mtg-event-card {
  padding: 13px 16px;
  border-radius: 13px;
  border: 1px solid var(--border);
  border-left: 4px solid #0284c7;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  cursor: pointer;
  transition: box-shadow 0.14s, border-color 0.14s;
}
.mtg-event-card:hover {
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.06);
  border-color: #7dd3fc;
}
.mtg-event-card.is-past {
  opacity: 0.72;
  border-left-color: #94a3b8;
}
.mtg-event-body {
  flex: 1;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mtg-event-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.mtg-event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
}
.mtg-event-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-join-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #0284c7;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.btn-join-sm:hover {
  background: #0369a1;
}

@media (max-width: 900px) {
  .mtg-presets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 767px) {
  .meetings-view {
    padding: 12px 14px 20px;
  }
  .mtg-presets-grid {
    grid-template-columns: 1fr;
  }
  .mtg-form-grid {
    grid-template-columns: 1fr;
  }
  .mtg-form-card {
    padding: 14px;
  }
  .meeting-join-card {
    padding: 10px 12px;
  }
}


/* Synced email meetings locked against drag/resize */
.cal-event.is-locked {
  cursor: pointer;
}
.cal-event.is-locked:active {
  cursor: pointer;
}
.detail-locked-time {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dlt-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text);
}
.dlt-tz {
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
}
.dlt-sub {
  font-size: 12px;
  color: var(--text-secondary);
}
.dlt-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}


/* ==================== v1.3.1 Dual-Timezone Axis Visual Distinction ==================== */

.tg-gutter-head.has-secondary,
.tg-gutter-allday.has-secondary,
.tg-gutter.has-secondary {
  width: 116px;
}

.tg-gutter-head.has-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  padding: 0;
  gap: 0;
}
.tg-gutter-head.has-secondary .tz-axis-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 6px 2px;
  font-size: 10.5px;
  letter-spacing: 0.2px;
}
.tg-gutter-head.has-secondary .tz-axis-tag.sec {
  background: #f1f5f9;
  color: #64748b;
  border-right: 1px solid #cbd5e1;
  font-weight: 500;
}
.tg-gutter-head.has-secondary .tz-axis-tag.pri {
  background: #eff6ff;
  color: var(--primary);
  font-weight: 700;
}

.tg-gutter.has-secondary {
  background: linear-gradient(90deg, #f8fafc 0%, #f8fafc calc(50% - 1px), #e2e8f0 calc(50% - 1px), #e2e8f0 50%, #ffffff 50%, #ffffff 100%);
}
.tg-gutter.has-secondary .tg-hour-label {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  padding: 0;
  gap: 0;
}
.tg-gutter.has-secondary .sec-clock {
  display: block;
  text-align: center;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 500;
  padding-right: 2px;
}
.tg-gutter.has-secondary .pri-clock {
  display: block;
  text-align: right;
  padding-right: 7px;
  color: #1e293b;
  font-size: 11.5px;
  font-weight: 700;
}
.tg-gutter:not(.has-secondary) .pri-clock {
  color: #334155;
  font-weight: 600;
}

@media (max-width: 767px) {
  .tg-gutter-head.has-secondary,
  .tg-gutter-allday.has-secondary,
  .tg-gutter.has-secondary {
    width: 88px;
  }
  .tg-gutter.has-secondary .tg-hour-label {
    padding: 0;
    gap: 0;
  }
  .tg-gutter.has-secondary .sec-clock {
    font-size: 9px;
  }
  .tg-gutter.has-secondary .pri-clock {
    font-size: 10px;
    padding-right: 4px;
  }
}
