:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --r: 8px;
  --r-lg: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--r);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: 0.85; }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { opacity: 0.85; }
.btn-sm   { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { width: 30px; height: 30px; padding: 0; border-radius: 6px; font-size: 15px; justify-content: center; }
.error-msg { color: var(--danger); font-size: 13px; margin-bottom: 8px; }
.success-msg { color: var(--success); font-size: 13px; margin-bottom: 8px; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-60px);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 10px 20px; border-radius: var(--r); font-size: 13px; font-weight: 600;
  z-index: 9999; pointer-events: none; opacity: 0;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  transition: none; white-space: nowrap;
}
.toast-success { background: var(--success); color: #fff; }
.toast-info    { background: var(--primary); color: #fff; }
.toast-warning { background: var(--warning); color: #1e293b; }
.toast-error   { background: var(--danger); color: #fff; }
.toast-show {
  opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-hide {
  opacity: 0; transform: translateX(-50%) translateY(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* ---- Action toast (bottom-left) ---- */
.toast-action {
  position: fixed; bottom: 24px; left: 280px; z-index: 9999;
  display: flex; align-items: center; gap: 12px;
  background: rgba(30, 32, 44, 0.72);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 12px 18px; border-radius: var(--r);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
  opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: none;
}
.toast-action-show {
  opacity: 1; transform: translateY(0); pointer-events: auto;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-action-hide {
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.toast-action-msg {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.toast-action-btn {
  background: var(--primary); color: #fff; border: none; border-radius: 6px;
  padding: 6px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.15s; white-space: nowrap;
}
.toast-action-btn:hover { background: var(--primary-hover); }
.toast-close {
  background: none; border: none; color: inherit; opacity: 0.6; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 2px 4px; margin-left: 4px;
  border-radius: 4px; transition: opacity 0.15s, background 0.15s;
}
.toast-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }
@media (max-width: 768px) {
  .toast-action { left: 16px; right: 16px; }
}

/* ---- Move task to workspace ---- */
.move-ws-list { display: flex; flex-direction: column; gap: 4px; }
.move-ws-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: var(--r); cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--text); background: var(--bg); transition: background 0.12s;
}
.move-ws-item:hover { background: var(--border); }
.move-ws-item svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }

/* ===== SITE NAVBAR ===== */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.site-nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
}
.site-nav-logo { color: #e85d04; font-weight: 800; font-size: 1.2rem; text-decoration: none; letter-spacing: -0.3px; display: flex; align-items: center; gap: 6px; }
.site-logo-img { height: 1.3em; width: auto; filter: brightness(0) saturate(100%) invert(47%) sepia(99%) saturate(617%) hue-rotate(349deg) brightness(107%); }
.site-nav-links { display: flex; align-items: center; gap: 8px; }
.site-nav-links > a:not(.btn) {
  color: rgba(255,255,255,0.7); font-size: 13px; text-decoration: none; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; transition: color 0.15s, background 0.15s;
}
.site-nav-links > a:not(.btn):hover { color: #fff; background: rgba(255,255,255,0.06); }
.btn-nav-login {
  background: transparent !important; border: 1px solid rgba(255,255,255,0.2) !important;
  color: #fff !important; text-decoration: none; font-size: 12px !important; padding: 6px 14px !important; border-radius: 8px;
}
.btn-nav-login:hover { background: rgba(255,255,255,0.08) !important; border-color: rgba(255,255,255,0.35) !important; }
.btn-nav-register {
  background: #e85d04 !important; color: #fff !important; text-decoration: none;
  font-size: 12px !important; padding: 6px 14px !important; border-radius: 8px; font-weight: 700;
}
.btn-nav-register:hover { background: #d45503 !important; }
.site-nav-burger {
  display: none; flex-direction: column; gap: 4px; background: none; border: none;
  cursor: pointer; padding: 6px; border-radius: 6px;
}
.site-nav-burger span { display: block; width: 20px; height: 2px; background: rgba(255,255,255,0.7); border-radius: 2px; transition: 0.2s; }
.site-nav-burger:hover span { background: #fff; }
.site-nav-menu {
  display: none; flex-direction: column; padding: 8px 16px 16px;
  background: rgba(15, 23, 42, 0.95); border-bottom: 1px solid rgba(255,255,255,0.08);
}
.site-nav-menu.open { display: flex; }
.site-nav-menu a {
  color: rgba(255,255,255,0.7); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 10px 8px; border-radius: 8px; transition: 0.15s;
}
.site-nav-menu a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.site-nav-menu hr { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 6px 0; }
@media (max-width: 640px) {
  .site-nav-links > a { display: none; }
  .site-nav-burger { display: flex; }
}

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding-top: 56px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
    #0f172a;
  position: relative; overflow: hidden;
}
.login-page::before,
.login-page::after {
  content: ''; position: absolute; border-radius: 50%;
  filter: blur(100px); pointer-events: none;
}
.login-page::before {
  width: 550px; height: 550px;
  background: radial-gradient(circle, rgba(232, 93, 4, 0.5) 0%, rgba(232, 93, 4, 0) 70%);
  top: -10%; left: -10%;
  animation: meshFloat1 35s ease-in-out infinite;
}
.login-page::after {
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.45) 0%, rgba(99, 102, 241, 0) 70%);
  bottom: -10%; right: -10%;
  animation: meshFloat2 40s ease-in-out infinite;
}
@keyframes meshFloat1 {
  0%   { transform: translate(0, 0) scale(1); }
  15%  { transform: translate(35vw, 20vh) scale(1.1); }
  30%  { transform: translate(60vw, 55vh) scale(0.9); }
  50%  { transform: translate(40vw, 75vh) scale(1.15); }
  70%  { transform: translate(10vw, 50vh) scale(0.95); }
  85%  { transform: translate(-5vw, 25vh) scale(1.05); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes meshFloat2 {
  0%   { transform: translate(0, 0) scale(1); }
  15%  { transform: translate(-30vw, -15vh) scale(1.05); }
  30%  { transform: translate(-55vw, -40vh) scale(1.1); }
  50%  { transform: translate(-35vw, -65vh) scale(0.9); }
  70%  { transform: translate(-10vw, -45vh) scale(1.12); }
  85%  { transform: translate(5vw, -20vh) scale(0.95); }
  100% { transform: translate(0, 0) scale(1); }
}
.login-container {
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px; padding: 40px; width: 390px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255,255,255,0.08);
  position: relative; z-index: 1;
  animation: loginSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.site-nav { animation: navFadeIn 0.4s ease-out both; }
@keyframes loginSlideUp {
  from { opacity: 0; transform: translateY(32px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes navFadeIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-logo { text-align: center; margin-bottom: 28px; animation: loginFadeIn 0.7s 0.15s ease-out both; }
.login-logo h1 { font-size: 22px; font-weight: 800; }
.login-logo p  { color: rgba(255,255,255,0.45); font-size: 13px; }
.login-container form { animation: loginFadeIn 0.7s 0.25s ease-out both; }
.login-hint { text-align: center; color: rgba(255,255,255,0.4); font-size: 12px; margin-top: 14px; animation: loginFadeIn 0.7s 0.35s ease-out both; }
.login-hint a { color: #e85d04 !important; transition: color 0.15s; }
.login-hint a:hover { color: #ff7b2e !important; }
.login-legal {
  text-align: center; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px; color: rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  animation: loginFadeIn 0.7s 0.45s ease-out both;
}
.login-legal a { color: rgba(255,255,255,0.4); text-decoration: none; transition: color 0.15s; }
.login-legal a:hover { color: rgba(255,255,255,0.7); }
@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-page .form-group label { color: rgba(255,255,255,0.6); }
.login-page .form-group input {
  background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12);
  color: #f1f5f9; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.login-page .form-group input::placeholder { color: rgba(255,255,255,0.25); }
.login-page .form-group input:focus {
  border-color: #e85d04;
  box-shadow: 0 0 0 3px rgba(232,93,4,0.2);
  background: rgba(255,255,255,0.08);
}
.login-page .error-msg { color: #fca5a5; }
.login-page .btn-primary {
  background: #e85d04; color: #fff;
  transition: background 0.2s, box-shadow 0.3s, transform 0.2s;
}
.login-page .btn-primary:hover:not(:disabled) {
  background: #d45503;
  box-shadow: 0 4px 20px rgba(232,93,4,0.5);
  transform: translateY(-2px);
}
.login-page .btn-primary:active:not(:disabled) {
  transform: translateY(0); box-shadow: 0 2px 8px rgba(232,93,4,0.3);
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700; color: var(--text);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r);
  font-size: 14px; outline: none; transition: border-color 0.15s;
  font-family: inherit; background: var(--surface); color: var(--text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-group textarea { resize: vertical; min-height: 72px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.duration-input { display: flex; align-items: center; gap: 6px; }
.duration-input input { width: 72px; text-align: center; }
.duration-input span { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.duration-subtask-hint {
  font-size: 11px; color: var(--warning); display: flex; align-items: center; gap: 4px; margin-top: 6px;
}
.duration-subtask-hint svg { width: 13px; height: 13px; }
.custom-repeat-row { display: flex; align-items: center; gap: 8px; }
.repeat-interval-input { width: 70px !important; text-align: center; }

/* ===== CUSTOM SELECT ===== */
.cs-wrap { position: relative; width: 100%; }
.cs-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--r);
  font-size: 14px; background: var(--surface); color: var(--text);
  cursor: pointer; transition: border-color 0.15s; font-family: inherit;
  text-align: left; user-select: none;
}
.cs-trigger:hover { border-color: var(--text-muted); }
.cs-trigger.open {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.cs-text { flex: 1; }
.cs-arrow { flex-shrink: 0; color: var(--text-muted); transition: transform 0.15s; }
.cs-trigger.open .cs-arrow { transform: rotate(180deg); }
.cs-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  display: inline-block;
}
.cs-icon { display: flex; align-items: center; color: var(--text-muted); flex-shrink: 0; }
.cs-icon svg { width: 15px; height: 15px; }
.cs-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg); z-index: 210;
  padding: 4px 0; max-height: 260px; overflow-y: auto;
  display: none;
  animation: csSlide 0.12s ease-out;
}
.cs-panel.open { display: block; }
@keyframes csSlide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.cs-option {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; font-size: 13px; cursor: pointer;
  transition: background 0.1s; color: var(--text);
}
.cs-option:hover { background: var(--bg); }
.cs-option.active {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary); font-weight: 600;
}
/* ===== DATE/TIME/DURATION PICKERS ===== */
.pk-wrap { position: relative; width: 100%; }
.pk-calendar {
  position: absolute; top: calc(100% + 4px); left: 0;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); z-index: 210;
  width: 290px; padding: 14px; display: none;
  animation: csSlide 0.12s ease-out;
}
.pk-calendar.open { display: block; }
.pk-cal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.pk-cal-title { font-size: 14px; font-weight: 800; }
.pk-cal-nav {
  width: 30px; height: 30px; border: none; background: var(--bg);
  border-radius: 8px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  color: var(--text-muted); transition: all 0.12s;
}
.pk-cal-nav:hover { background: var(--border); color: var(--text); }
.pk-cal-days {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; font-size: 11px; font-weight: 700;
  color: var(--text-muted); margin-bottom: 4px; letter-spacing: 0.3px;
}
.pk-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.pk-d {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; border-radius: 8px; cursor: pointer; transition: all 0.1s;
  font-weight: 500;
}
.pk-d:hover { background: var(--bg); }
.pk-d.other { color: var(--text-muted); opacity: 0.3; cursor: default; }
.pk-d.other:hover { background: transparent; }
.pk-d.today { font-weight: 800; color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.pk-d.sel { background: var(--primary); color: #fff !important; font-weight: 700; }
.pk-d.sel:hover { background: var(--primary-dark); }
.pk-cal-foot {
  display: flex; justify-content: space-between; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.pk-cal-btn {
  border: none; background: none; font-size: 12px; font-weight: 700;
  color: var(--text-muted); cursor: pointer; padding: 5px 10px;
  border-radius: 6px; transition: all 0.12s;
}
.pk-cal-btn:hover { background: var(--bg); color: var(--text); }
.pk-cal-primary { color: var(--primary); }
.pk-cal-primary:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.pk-list { max-height: 240px; }
.pk-time-none { color: var(--text-muted); font-style: italic; }
.pk-dur-row {
  display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--surface);
}
.pk-dur-in {
  flex: 1; padding: 7px 10px; border: 1.5px solid var(--border);
  border-radius: var(--r); font-size: 13px; background: var(--bg);
  color: var(--text); font-family: inherit; outline: none;
}
.pk-dur-in:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; height: 100vh;
  display: flex; flex-direction: column; z-index: 100;
}
.sidebar-logo {
  padding: 18px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-close-btn {
  display: none; margin-left: auto; background: none; border: none;
  color: var(--text-muted); cursor: pointer; padding: 4px;
  border-radius: var(--r); transition: color 0.15s, background 0.15s;
}
.sidebar-close-btn:hover { color: var(--text); background: var(--bg); }
.sidebar-close-btn svg { width: 20px; height: 20px; }
.logo-icon-sm {
  width: 34px; height: 34px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; color: #fff; letter-spacing: -0.5px;
}
.sidebar-logo-text h2 { font-size: 15px; font-weight: 800; }
.sidebar-logo-text p  { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-muted);
  padding: 4px 10px; margin: 8px 0 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r);
  cursor: pointer; transition: all 0.12s;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  user-select: none;
}
.nav-item:hover  { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.nav-item-icon   { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer  { padding: 14px 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
}
.user-avatar svg { width: 16px; height: 16px; stroke-width: 2; }
.user-name  { font-size: 13px; font-weight: 700; }
.user-email { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }

/* ACCOUNT SWITCHER */
.sidebar-settings-btn {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  margin-bottom: 6px;
}
.sidebar-settings-btn svg { width: 14px; height: 14px; }
.sidebar-footer-actions { display: flex; gap: 6px; }
.sidebar-footer-actions .btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; }
.sidebar-footer-actions .btn svg { width: 14px; height: 14px; }

/* ===== NOTIFICATIONS BELL ===== */
.notif-bell-btn {
  position: relative; width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all 0.15s; flex-shrink: 0;
}
.notif-bell-btn:hover { background: var(--border); color: var(--text); }
.notif-bell-btn svg { width: 16px; height: 16px; }
.notif-bell-badge {
  position: absolute; top: -3px; right: -3px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
}
/* Notifications panel */
.sidebar-footer { position: relative; }
.notif-panel {
  position: absolute; bottom: 100%; left: 0; right: 0;
  margin-bottom: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.25);
  max-height: 400px; display: flex; flex-direction: column;
  overflow: hidden; z-index: 200;
  animation: panelSlideUp 0.2s ease-out;
}
@keyframes panelSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.notif-panel-header {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 700; flex-shrink: 0; gap: 8px;
}
.notif-tabs { display: flex; gap: 2px; background: var(--bg); border-radius: 6px; padding: 2px; }
.notif-tab {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; transition: all 0.15s;
}
.notif-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.notif-tab:hover:not(.active) { color: var(--text); }
.notif-header-actions { display: flex; gap: 4px; }
.notif-header-btn {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 4px; border-radius: 4px; transition: all 0.15s; display: flex; align-items: center;
}
.notif-header-btn:hover { background: var(--border); color: var(--primary); }
.notif-header-btn svg { width: 16px; height: 16px; }
.notif-panel-body { flex: 1; overflow-y: auto; max-height: 340px; }
.notif-panel-body::-webkit-scrollbar { width: 4px; }
.notif-panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.notif-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px; color: var(--text-muted); text-align: center;
}
.notif-empty svg { width: 28px; height: 28px; margin-bottom: 8px; opacity: 0.3; }
.notif-empty p { margin: 0; font-size: 13px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px; cursor: pointer; transition: background 0.12s;
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.notif-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text-muted);
}
.notif-icon svg { width: 14px; height: 14px; }
.notif-body { flex: 1; min-width: 0; }
.notif-message { font-size: 12px; line-height: 1.4; word-break: break-word; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-archive-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 2px; border-radius: 4px; flex-shrink: 0; opacity: 0; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.notif-archive-btn svg { width: 14px; height: 14px; }
.notif-item:hover .notif-archive-btn { opacity: 1; }
.notif-archive-btn:hover { color: var(--primary); background: rgba(99,102,241,0.1); }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0; margin-top: 4px;
}

.account-switcher-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.3);
  z-index: 1000; backdrop-filter: blur(2px);
}
.account-switcher-panel {
  position: fixed; bottom: 70px; left: 16px;
  width: 240px; background: var(--surface);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  animation: switcherSlideUp 0.2s ease-out;
}
@keyframes switcherSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.account-switcher-header {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.account-switcher-header h3 { font-size: 13px; font-weight: 700; margin: 0; }
.account-switcher-list { padding: 6px 0; max-height: 240px; overflow-y: auto; }
.account-switcher-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; transition: background 0.12s;
  font-size: 13px; position: relative;
}
.account-switcher-item:hover { background: var(--bg); }
.account-switcher-item.active { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.account-switcher-item .user-avatar { width: 28px; height: 28px; font-size: 11px; }
.account-switcher-item-info { min-width: 0; flex: 1; }
.account-switcher-item-email {
  font-size: 12px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.account-switcher-item-label {
  font-size: 10px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-switcher-remove {
  width: 20px; height: 20px; border: none; background: transparent;
  cursor: pointer; color: var(--text-muted); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: all 0.12s; flex-shrink: 0; padding: 0;
}
.account-switcher-remove svg { width: 12px; height: 12px; }
.account-switcher-item:hover .account-switcher-remove { opacity: 1; }
.account-switcher-remove:hover { background: var(--danger); color: #fff; opacity: 1; }
.account-switcher-footer { padding: 8px 14px; border-top: 1px solid var(--border); }
.account-switcher-empty { padding: 14px; font-size: 12px; color: var(--text-muted); text-align: center; }
.account-switcher-switching { font-size: 11px; color: var(--primary); font-weight: 600; }
.account-switcher-active-badge { font-size: 10px; color: var(--success); font-weight: 700; flex-shrink: 0; }
.account-switcher-actions { display: flex; gap: 2px; margin-left: auto; flex-shrink: 0; }
.account-switcher-action {
  width: 26px; height: 26px; border: none; background: transparent;
  cursor: pointer; color: var(--text-muted); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: all 0.12s; padding: 0;
}
.account-switcher-action svg { width: 14px; height: 14px; }
.account-switcher-item:hover .account-switcher-action { opacity: 1; }
.account-switcher-action:hover { background: var(--bg-hover); color: var(--text); }
.account-switcher-action[data-logout]:hover { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.account-switcher-main-badge {
  font-size: 10px; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent);
  padding: 1px 6px; border-radius: var(--r-sm); display: inline-block; margin-top: 2px;
}
.account-switcher-item.main { cursor: pointer; border-bottom: 1px solid var(--border); }

/* SETTINGS */
.settings-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px; padding: 4px 0;
}
.settings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px 24px;
}
.settings-card h4 {
  font-size: 14px; font-weight: 700; margin: 0 0 16px 0;
  display: flex; align-items: center; gap: 8px;
}
.settings-card h4 svg { width: 16px; height: 16px; color: var(--primary); }
.settings-card-danger { border-color: rgba(239,68,68,0.3); }
.settings-card-danger h4 svg { color: var(--danger); }
.settings-hint { font-size: 12px; color: var(--text-muted); margin: 0 0 14px 0; }
/* Notification settings */
.notif-settings-list { display: flex; flex-direction: column; gap: 2px; }
.notif-setting-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: background 0.12s;
}
.notif-setting-item:hover { background: var(--bg); }
.notif-setting-item span { font-size: 13px; }
.notif-setting-item input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer;
}
/* Delete account toggle */
.delete-account-header { display: flex; align-items: center; justify-content: space-between; }
.delete-account-header h4 { margin-bottom: 0; }
.delete-account-hidden {
  filter: blur(4px); opacity: 0.3; pointer-events: none; user-select: none;
  max-height: 300px; overflow: hidden; transition: all 0.3s;
}
.delete-account-visible {
  filter: none; opacity: 1; pointer-events: auto; user-select: auto;
  margin-top: 16px; transition: all 0.3s;
}
.settings-theme-options { display: flex; gap: 8px; }
.settings-theme-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--r);
  background: var(--bg); color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.settings-theme-btn:hover { border-color: var(--primary); }
.settings-theme-btn.active {
  border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
}
.settings-theme-btn svg { width: 16px; height: 16px; }

/* ---- Avatar picker ---- */
.avatar-picker-preview {
  display: flex; align-items: center; gap: 14px; margin-bottom: 4px;
}
.avatar-preview-circle {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  background: #6366f1; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 26px; transition: background 0.2s;
}
.avatar-preview-circle svg { width: 26px; height: 26px; stroke-width: 2; }
.avatar-picker-panel {
  margin-top: 12px; padding: 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-lg);
}
.avatar-picker-section { margin-bottom: 12px; }
.avatar-picker-section:last-child { margin-bottom: 0; }
.avatar-picker-section > label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); display: block; margin-bottom: 8px; }
.avatar-icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px;
}
.avatar-icon-opt {
  width: 40px; height: 40px; border-radius: var(--r); border: 1.5px solid var(--border);
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s; color: var(--text);
}
.avatar-icon-opt:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.avatar-icon-opt.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.avatar-icon-opt svg { width: 20px; height: 20px; }
.avatar-color-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-color-opt {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 2.5px solid transparent; transition: all 0.15s; position: relative;
}
.avatar-color-opt:hover { transform: scale(1.15); }
.avatar-color-opt.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }

/* ---- Unsaved field highlight ---- */
.field-unsaved { border-color: var(--danger) !important; box-shadow: 0 0 0 2px rgba(239,68,68,0.2) !important; }
.field-unsaved-label { color: var(--danger) !important; }

/* ---- Custom themes grid ---- */
.custom-themes-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px; margin-top: 10px;
}
.custom-theme-card {
  position: relative; padding: 12px 10px; border: 1.5px solid var(--border);
  border-radius: var(--r); background: var(--bg); cursor: pointer;
  transition: all 0.15s; text-align: center;
}
.custom-theme-card:hover { border-color: var(--primary); }
.custom-theme-card.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.custom-theme-preview { display: flex; gap: 4px; justify-content: center; margin-bottom: 6px; }
.ctp-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); }
.custom-theme-name {
  font-size: 11px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.custom-theme-del {
  position: absolute; top: 4px; right: 4px; width: 18px; height: 18px;
  border: none; background: var(--danger); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; transition: opacity 0.15s; padding: 0;
}
.custom-theme-del svg { width: 12px; height: 12px; }
.custom-theme-card:hover .custom-theme-del { opacity: 1; }
.custom-theme-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--text-muted); border-style: dashed;
}
.custom-theme-add:hover { color: var(--primary); border-color: var(--primary); }
.custom-theme-add svg { width: 20px; height: 20px; }
.custom-theme-add span { font-size: 11px; font-weight: 600; }

/* ---- Theme creator modal ---- */
.ctc-colors { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.ctc-color-row label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; display: block; }
.ctc-color-pick { display: flex; align-items: center; gap: 8px; }
.ctc-swatch {
  width: 36px; height: 36px; border: 2px solid var(--border); border-radius: 8px;
  cursor: pointer; flex-shrink: 0; position: relative; transition: border-color 0.15s;
}
.ctc-swatch:hover { border-color: var(--text); }
.ctc-swatch::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  opacity: 0; transition: opacity 0.15s;
}
.ctc-swatch:hover::after { opacity: 0.2; }
.ctc-hex {
  width: 90px; font-family: monospace; font-size: 13px; font-weight: 700;
  padding: 6px 10px; border: 1.5px solid var(--border); border-radius: var(--r);
  background: var(--bg); color: var(--text);
}

/* PHONE PREFIX SELECTOR */
.phone-input-wrap {
  display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap;
}
.phone-input-wrap input[type="tel"] { flex: 1; min-width: 120px; }
.phone-prefix-select { position: relative; flex-shrink: 0; }
.phone-prefix-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 9px 10px; border: 1.5px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s; white-space: nowrap; height: 100%;
  min-width: fit-content;
}
.phone-prefix-btn:hover, .phone-prefix-btn:focus { border-color: var(--primary); }
.phone-prefix-btn svg { width: 12px; height: 12px; color: var(--text-muted); flex-shrink: 0; }
#phonePrefixFlag { font-size: 16px; line-height: 1; }
#phonePrefixCode { font-size: 12px; }
.phone-prefix-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0;
  width: 280px; max-height: 300px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-md); z-index: 200; display: flex; flex-direction: column;
  animation: switcherSlideUp 0.15s ease-out;
}
.phone-prefix-search-wrap {
  padding: 8px; border-bottom: 1px solid var(--border);
}
.phone-prefix-search-wrap input {
  width: 100%; padding: 7px 10px; border: 1.5px solid var(--border);
  border-radius: var(--r); font-size: 13px; outline: none;
  background: var(--bg); color: var(--text); font-family: inherit;
}
.phone-prefix-search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.phone-prefix-list {
  overflow-y: auto; max-height: 240px; padding: 4px 0;
}
.phone-prefix-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; cursor: pointer; font-size: 13px;
  transition: background 0.1s;
}
.phone-prefix-item:hover { background: var(--bg); }
.phone-prefix-item.active { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.phone-prefix-item-flag { font-size: 16px; flex-shrink: 0; }
.phone-prefix-item-country { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-prefix-item-code { font-weight: 700; color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.phone-prefix-empty { padding: 12px; text-align: center; font-size: 12px; color: var(--text-muted); }

/* MAIN */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.topbar-title   { font-size: 17px; font-weight: 800; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.content-area   { flex: 1; padding: 24px; }
.section-view        { display: none; }
.section-view.active { display: block; }

/* ===== STATS ===== */
.stats-bar { display: flex; gap: 12px; margin-bottom: 20px; }
.stat-card {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 18px;
}
.stat-value { font-size: 26px; font-weight: 900; color: var(--primary); line-height: 1; margin-bottom: 3px; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }

/* ===== TASKS ===== */
.tasks-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-chip {
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border); cursor: pointer; transition: all 0.12s;
  background: var(--surface); color: var(--text-muted); user-select: none;
  display: inline-flex; align-items: center; position: relative; overflow: hidden;
}
.filter-chip-label { white-space: nowrap; }
.filter-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 0; opacity: 0; overflow: hidden;
  font-size: 15px; font-weight: 700; line-height: 1;
  color: var(--text-muted); border-radius: 50%;
  transition: width 0.25s cubic-bezier(.4,0,.2,1), opacity 0.2s ease, color 0.15s ease, background 0.15s ease;
  flex-shrink: 0; cursor: pointer; margin-left: 0;
}
.filter-chip:hover .filter-chip-x {
  width: 18px; opacity: 1; margin-left: 4px;
}
.filter-chip-x:hover {
  color: var(--danger, #ef4444); background: rgba(239,68,68,0.12);
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.filter-chip.filter-add {
  border-style: dashed; font-size: 16px; padding: 2px 10px; line-height: 1;
  color: var(--text-muted); font-weight: 400; overflow: visible;
}
.filter-chip.filter-add .filter-chip-x { display: none; }
.filter-chip.filter-add:hover { color: var(--primary); border-color: var(--primary); }

/* Context menu */
.ctx-menu {
  position: fixed; z-index: 999; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 4px 0; min-width: 160px;
  max-height: 300px; overflow-y: auto;
}
.ctx-item {
  padding: 8px 16px; font-size: 13px; cursor: pointer; transition: background 0.1s;
}
.ctx-item:hover { background: var(--bg); }
.ctx-item.ctx-delete { color: var(--danger); }
.ctx-item.ctx-delete:hover { background: #fee2e2; }

.tasks-grid { display: flex; flex-direction: column; gap: 8px; }
.task-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: all 0.15s;
}
.task-card:hover { box-shadow: var(--shadow-md); border-color: #c7d2fe; }
.task-card.priority-high-card   { border-left: 3px solid #ef4444; }
.task-card.priority-medium-card { border-left: 3px solid #f59e0b; }
.task-card.priority-low-card    { border-left: 3px solid #10b981; }
.task-card.overdue { border-left-color: var(--danger) !important; }

/* Completed task card - green */
.task-card.completed { border-left-color: var(--success) !important; background: #f0fdf4; }
.task-card.completed:hover { border-color: #86efac; }

.task-check {
  width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 5px;
  flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.12s; margin-top: 2px; font-size: 11px; color: #fff;
}
.task-check:hover  { border-color: var(--primary); }
.task-check.checked { background: var(--success); border-color: var(--success); }

.task-body  { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 700; margin-bottom: 5px; line-height: 1.3; }
.task-card.completed .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-meta  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-meta-item { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); }
.overdue-badge { color: var(--danger); font-weight: 700; }

.priority-badge { padding: 1px 7px; border-radius: 4px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.priority-high   { background: #fee2e2; color: #dc2626; }
.priority-medium { background: #fef3c7; color: #d97706; }
.priority-low    { background: #dcfce7; color: #16a34a; }

.task-tags   { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.tag-badge   { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.task-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: flex-start; flex-direction: column; }
.task-actions-row { display: flex; gap: 4px; }

.timer-btn {
  padding: 4px 9px; border-radius: 5px; font-size: 11px; font-weight: 700;
  border: none; cursor: pointer; transition: all 0.12s; white-space: nowrap;
}
.timer-btn.start { background: #dcfce7; color: #16a34a; }
.timer-btn.stop  { background: #fee2e2; color: #dc2626; animation: pulse 1.5s infinite; }
.timer-display   { font-size: 11px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; text-align: right; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

.repeat-icon { font-size: 12px; }

/* Privacy badge */
.privacy-badge {
  padding: 1px 7px; border-radius: 4px; font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.privacy-badge.public { background: #dbeafe; color: #2563eb; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state-icon { font-size: 44px; margin-bottom: 14px; }
.empty-state h3   { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.empty-state p    { color: var(--text-muted); margin-bottom: 20px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px); padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--r-lg);
  width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}
.modal-sm { max-width: 420px; }
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 800; }
.modal-header-actions { display: flex; align-items: center; gap: 6px; }
.modal-close {
  width: 30px; height: 30px; border: none; background: var(--bg);
  border-radius: 6px; cursor: pointer; font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all 0.12s;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body   { padding: 20px 22px; }

/* Legal modal progress bar */
.legal-modal-progress {
  height: 3px; background: var(--border); flex-shrink: 0;
}
.legal-modal-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #e85d04, #f97316);
  border-radius: 0 2px 2px 0;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(232,93,4,0.4);
}
/* Legal content inside modal */
#legalModalBody h1 { font-size: 1.4rem; font-weight: 900; margin-bottom: 6px; }
#legalModalBody .legal-subtitle { color: var(--text-muted); font-size: 12px; margin-bottom: 24px; }
#legalModalBody h2 { color: #e85d04; font-size: 1rem; font-weight: 700; margin-top: 24px; margin-bottom: 8px; }
#legalModalBody p, #legalModalBody li { font-size: 13px; line-height: 1.8; color: var(--text-muted); margin-bottom: 6px; }
#legalModalBody ul { padding-left: 20px; }
#legalModalBody li { margin-bottom: 3px; }
#legalModalBody a { color: #e85d04; }

.modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  position: sticky; bottom: 0; background: var(--surface);
}
.modal-footer .left { margin-right: auto; }

/* Complete button dropdown */
.complete-btn-wrap { position: relative; display: inline-flex; }
.complete-dropdown {
  position: absolute; bottom: calc(100% + 4px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-md);
  min-width: 200px; z-index: 10; overflow: hidden;
}
.complete-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px; border: none; background: none;
  font-size: 13px; font-weight: 500; color: var(--text);
  cursor: pointer; text-align: left;
}
.complete-dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
.complete-dropdown-item svg { width: 15px; height: 15px; }

/* Tags selector in modal — dropdown */
.tags-selector-wrap { position: relative; }
.tag-dropdown { position: relative; }
.tag-dropdown-trigger {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--border); border-radius: var(--r);
  padding: 8px 12px; min-height: 42px; cursor: pointer;
  transition: border-color 0.15s;
}
.tag-dropdown-trigger:hover { border-color: var(--primary); }
.tag-dropdown-placeholder { font-size: 13px; color: var(--text-muted); }
.tag-dropdown-chevron { width: 16px; height: 16px; margin-left: auto; color: var(--text-muted); flex-shrink: 0; }
.tag-clear-btn {
  background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer;
  padding: 0 2px; line-height: 1; transition: color 0.15s;
}
.tag-clear-btn:hover { color: var(--danger); }
.tag-dropdown-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45); overflow: hidden;
}
.tag-search-input {
  width: 100%; padding: 10px 12px; border: none; border-bottom: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 13px; outline: none;
}
.tag-search-input::placeholder { color: var(--text-muted); }
.tag-dropdown-list { max-height: 180px; overflow-y: auto; padding: 4px; }
.tag-dropdown-item {
  display: flex; align-items: center; padding: 7px 10px; border-radius: 6px;
  cursor: pointer; transition: background 0.12s;
}
.tag-dropdown-item:hover { background: rgba(255,255,255,0.05); }
.tag-dropdown-item.active { background: rgba(99,102,241,0.15); }
.no-tags-hint { font-size: 12px; color: var(--text-muted); padding: 8px 12px; }

/* Section divider */
.section-divider { border-top: 1px solid var(--border); margin: 16px 0; }
.section-label   { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 10px; }

/* Timer status in modal */
.timer-status-box {
  background: var(--bg); border-radius: var(--r); padding: 12px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; border: 1px solid var(--border);
}
.timer-status-time { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--primary); }
.time-log-list { display: flex; flex-direction: column; gap: 4px; }
.time-log-item {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; padding: 5px 8px; border-radius: 5px; background: var(--bg);
}
.time-log-duration { font-weight: 700; color: var(--primary); }
.time-total { font-size: 13px; font-weight: 800; margin-top: 8px; color: var(--text); }

/* ===== CALENDAR ===== */
.calendar-controls {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
}
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-nav h2 { font-size: 19px; font-weight: 800; min-width: 220px; text-align: center; }
.cal-toggles {
  display: flex; gap: 10px; align-items: center;
}
.cal-view-toggle {
  display: flex; background: var(--bg); border-radius: var(--r);
  padding: 3px; border: 1px solid var(--border);
}
.cal-source-btn {
  padding: 5px 14px; border: none; background: transparent;
  border-radius: 6px; font-size: 12px; font-weight: 700;
  cursor: pointer; color: var(--text-muted); transition: all 0.12s;
}
.cal-source-btn.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.cal-friends-wrap { position: relative; display: flex; align-items: center; }
.cal-friends-dropdown-btn, .cal-timetable-dropdown-btn {
  padding: 2px 5px; border: none; background: transparent; border-radius: 4px;
  font-size: 10px; cursor: pointer; color: var(--text-muted); transition: all 0.12s;
  margin-left: -2px; line-height: 1; opacity: 0.6;
}
.cal-friends-dropdown-btn:hover, .cal-timetable-dropdown-btn:hover {
  color: var(--primary); opacity: 1;
}
.cal-friends-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  min-width: 260px; z-index: 50; padding: 8px 0;
}
.cal-friends-dropdown.hidden { display: none; }
.cal-friend-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  cursor: pointer; font-size: 13px; transition: background 0.12s;
  border-radius: 6px; margin: 0 6px;
}
.cal-friend-item:hover { background: var(--bg); }
.cal-friend-item input[type="checkbox"] { accent-color: var(--primary); }
.cal-friend-info {
  display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1;
}
.cal-friend-item .friend-name {
  font-weight: 600; font-size: 13px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-friend-item .friend-email {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-view-btn {
  padding: 5px 14px; border: none; background: transparent;
  border-radius: 6px; font-size: 12px; font-weight: 700;
  cursor: pointer; color: var(--text-muted); transition: all 0.12s;
}
.cal-view-btn.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* Month grid */
.cal-month { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--border); overflow: hidden; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--bg); border-bottom: 1px solid var(--border); }
.cal-weekday  { padding: 8px; text-align: center; font-size: 11px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.cal-days     { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day {
  min-height: 108px; padding: 7px 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.other-month   { background: #fafafa; }
.cal-day.today .cal-day-num {
  background: var(--primary); color: #fff; border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
}
.cal-day-num {
  font-size: 12px; font-weight: 700; margin-bottom: 4px;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
}
.cal-tasks      { display: flex; flex-direction: column; gap: 2px; }
.cal-task-pill  {
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  transition: opacity 0.12s;
}
.cal-task-pill:hover {
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  /* Do NOT use white-space:normal / overflow:visible — they expand cells and break layout */
}
.cal-task-pill.done  { opacity: 0.4; text-decoration: line-through; }
.cal-task-pill.friend-pill { border-left: 3px solid #2563eb; }
.cal-more { font-size: 10px; color: var(--text-muted); padding: 1px 5px; }

/* Week timeline */
.cal-week { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--border); overflow: auto; }
.cal-week-head {
  display: flex; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 10;
}
.cal-time-gutter { width: 56px; flex-shrink: 0; border-right: 1px solid var(--border); padding: 8px; font-size: 10px; color: var(--text-muted); font-weight: 700; }
.cal-day-head {
  flex: 1; padding: 8px 4px; text-align: center;
  border-right: 1px solid var(--border); font-size: 12px; font-weight: 700;
}
.cal-day-head:last-child { border-right: none; }
.cal-day-head.is-today   { background: var(--primary-light); color: var(--primary); }
.cal-day-head .wday { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.cal-day-head.is-today .wday { color: var(--primary); }
.cal-day-head .wnum { font-size: 16px; font-weight: 900; line-height: 1.2; }

.cal-week-body   { display: flex; }
.cal-time-col    { width: 56px; flex-shrink: 0; border-right: 1px solid var(--border); }
.cal-hour-label  { height: 56px; padding: 2px 6px 0 0; font-size: 10px; color: var(--text-muted); text-align: right; border-bottom: 1px solid #f1f5f9; }
.cal-days-cols   { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day-col     { border-right: 1px solid var(--border); position: relative; }
.cal-day-col:last-child { border-right: none; }
.cal-day-col.is-today   { background: rgba(99,102,241,0.02); }
.cal-hour-cell   { height: 56px; border-bottom: 1px solid #f1f5f9; }
.cal-event {
  position: absolute; border-radius: 4px;
  padding: 2px 5px; font-size: 10px; font-weight: 700;
  overflow: hidden; cursor: pointer; z-index: 5;
  transition: box-shadow 0.15s, z-index 0s;
  line-height: 1.3; min-height: 18px; box-sizing: border-box;
}
.cal-event:hover { z-index: 20; box-shadow: 0 2px 12px rgba(0,0,0,0.28); }
.cal-event[data-drag-task-id] { cursor: grab; }
.cal-event[data-drag-task-id]:active { cursor: grabbing; }
.cal-event.friend-event { border-left: 3px solid #2563eb; }
.cal-drag-ghost {
  position: absolute; left: 0; right: 0; z-index: 15;
  background: var(--primary); opacity: 0.18;
  border: 2px dashed var(--primary); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--primary);
  pointer-events: none; box-sizing: border-box;
}
.cal-event-notime {
  border-left: 3px dashed var(--text-muted);
  background-image: repeating-linear-gradient(
    -45deg, transparent, transparent 4px,
    rgba(255,255,255,0.06) 4px, rgba(255,255,255,0.06) 8px
  ) !important;
  font-style: italic;
}

/* All-day row (above timeline in week & day views) */
.cal-allday-row {
  display: flex; border-bottom: 1px solid var(--border);
  background: var(--bg); min-height: 32px;
}
.cal-allday-row-day {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 1px solid var(--border);
}
.cal-allday-label {
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; text-transform: uppercase;
  color: var(--text-muted); letter-spacing: 0.3px; line-height: 1.2;
  text-align: center;
}
.cal-allday-cell {
  flex: 1; padding: 4px 3px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; min-height: 28px;
}
.cal-allday-cell:last-child { border-right: none; }
.cal-allday-cell.is-today { background: rgba(99,102,241,0.04); }
.cal-allday-cell.is-single { flex: 1; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 6px 8px; }
.cal-allday-pill {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: opacity 0.12s;
}
.cal-allday-pill:hover { opacity: 0.75; }
.cal-allday-pill.done { opacity: 0.4; text-decoration: line-through; }
.cal-allday-pill.friend-pill { border-left: 3px solid #2563eb; }

/* Pill popover (mobile event details) */
.cal-pill-popover {
  position: fixed;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  padding: 12px 14px;
  min-width: 180px;
  max-width: 260px;
  animation: popoverIn 0.15s ease-out;
}
@keyframes popoverIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cal-pill-popover-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  word-break: break-word;
  line-height: 1.3;
}
.cal-pill-popover-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.cal-pill-popover-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

/* No-date tasks section */
.cal-nodate-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 10px 14px; margin-bottom: 12px;
}
.cal-nodate-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--text-muted); margin-bottom: 8px;
}
.cal-nodate-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-nodate-pill {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 4px;
  white-space: nowrap; cursor: pointer; transition: opacity 0.12s, box-shadow 0.15s;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
.cal-nodate-pill:hover { opacity: 0.8; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.cal-nodate-pill.friend-pill { border-left: 3px solid #2563eb; }

/* Live time indicator */
.cal-time-line {
  position: absolute; left: 0; right: 0; z-index: 8;
  height: 2px; background: #ef4444; pointer-events: none;
}
.cal-time-line-dot {
  position: absolute; left: -5px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #ef4444;
}

/* ===== TAGS PAGE ===== */
.tags-sticky-top {
  position: sticky; top: var(--topbar-h); z-index: 10;
  background: var(--bg); padding-bottom: 16px;
  margin: -24px -24px 0; padding: 24px 24px 16px;
}
.tags-header    { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.tags-header h2 { font-size: 19px; font-weight: 800; }
.tags-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tag-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 16px;
  display: flex; align-items: center; gap: 10px; transition: all 0.15s;
}
.tag-card:hover { box-shadow: var(--shadow-md); }
.tag-dot        { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.tag-info       { flex: 1; }
.tag-info-name  { font-size: 14px; font-weight: 700; }
.tag-info-count { font-size: 11px; color: var(--text-muted); }

/* Color picker */
.color-picker  { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch  {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: all 0.12s;
}
.color-swatch:hover    { transform: scale(1.1); }
.color-swatch.selected { border-color: var(--text); }

/* ===== COLOR PICKER ===== */
.color-picker-wrap { display: flex; flex-direction: column; gap: 10px; }
.color-swatches {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px;
  padding: 4px; margin: -4px;
}
#tagModal .modal { overflow: visible; }
.color-swatch {
  width: 100%; aspect-ratio: 1; border-radius: 8px; cursor: pointer;
  border: 2.5px solid transparent; transition: all 0.12s;
  position: relative;
}
.color-swatch:hover { transform: scale(1.15); z-index: 1; }
.color-swatch.active {
  border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text);
  transform: scale(1.1);
}
.color-custom-row { display: flex; align-items: center; gap: 8px; }
.color-preview {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  border: 1.5px solid var(--border);
}
.color-custom-row input[type="text"] {
  flex: 1; font-family: monospace; font-size: 13px; text-transform: lowercase;
}
.color-preview { cursor: pointer; position: relative; }
.color-preview::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  opacity: 0; transition: opacity 0.15s;
}
.color-preview:hover::after { opacity: 0.25; }

/* ===== TIMER HISTORY COLLAPSIBLE ===== */
.time-total { font-size: 13px; font-weight: 800; margin: 8px 0 4px; color: var(--text); }
#timeHistoryDetails {
  margin-top: 8px; border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
}
.time-history-toggle {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  padding: 8px 12px; cursor: pointer; user-select: none;
  background: var(--bg); list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.time-history-toggle::before { content: '▶'; font-size: 9px; transition: transform 0.15s; }
#timeHistoryDetails[open] .time-history-toggle::before { transform: rotate(90deg); }
#timeHistoryDetails .time-log-list { padding: 0 12px 10px; }

/* Timer running animation */
.timer-running { color: var(--success) !important; animation: pulse 1.5s infinite; }

/* Duration bar in calendar pill */
.cal-task-duration { font-size: 9px; opacity: 0.75; }

/* ===== SUBTASKS ===== */
.subtasks-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.subtask-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: var(--r);
  background: var(--bg); margin-bottom: 6px; border: 1px solid var(--border);
  transition: border-color 0.15s;
}
.subtask-row:focus-within { border-color: var(--primary); }
.subtask-row:has(.subtask-check.checked) { background: #f0fdf4; border-color: var(--success); }
[data-theme="dark"] .subtask-row:has(.subtask-check.checked) { background: #052e16; }
[data-theme="contrast"] .subtask-row:has(.subtask-check.checked) { background: #002200; }
.subtask-check {
  width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 5px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; flex-shrink: 0; margin-top: 1px;
  transition: all 0.15s; user-select: none;
}
.subtask-check:hover   { border-color: var(--primary); }
.subtask-check.checked { background: var(--primary); border-color: var(--primary); }
.subtask-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.subtask-title-input {
  width: 100%; border: none; background: transparent; font-size: 13px;
  outline: none; padding: 2px 4px; color: var(--text);
  resize: none; overflow: hidden; min-height: 20px;
  line-height: 1.5; font-family: inherit;
}
.subtask-title-input.done  { text-decoration: line-through; color: var(--text-muted); }
.subtask-dur { display: flex; align-items: center; gap: 4px; opacity: 0.75; }
.subtask-dur input {
  width: 38px; text-align: center; border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 5px; font-size: 11px; background: var(--surface);
  outline: none; font-family: inherit; color: var(--text);
}
.subtask-dur input:focus { border-color: var(--primary); }
.subtask-dur span { font-size: 10px; color: var(--text-muted); font-weight: 600; }
.subtask-del { opacity: 0; transition: opacity 0.15s; flex-shrink: 0; }
.subtask-row:hover .subtask-del,
.subtask-row:focus-within .subtask-del { opacity: 1; }
.subtask-progress { font-size: 12px; font-weight: 700; color: var(--primary); }
.subtask-progress.done-all { color: var(--success); }
/* auto-resize textarea in form */
#taskTitle { resize: none; overflow: hidden; min-height: 52px; }

/* ===== FRIENDS ===== */
.badge-count {
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: auto;
}

.add-friend-form {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.friend-email-input {
  flex: 1; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r);
  font-size: 14px; outline: none; font-family: inherit;
  background: var(--surface); color: var(--text);
}
.friend-email-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.friend-msg {
  font-size: 13px; font-weight: 600; padding: 8px 12px;
  border-radius: var(--r); margin-bottom: 12px;
}
.friend-msg.success { background: #dcfce7; color: #16a34a; }
.friend-msg.error   { background: #fee2e2; color: #dc2626; }

.friend-section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  margin: 20px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.friend-card,
.friend-request-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px; transition: all 0.15s;
}
.friend-card:hover,
.friend-request-card:hover { box-shadow: var(--shadow-md); }

.friend-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px;
}

.friend-info { flex: 1; font-size: 14px; font-weight: 600; }
.friend-status { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.friend-actions { display: flex; gap: 6px; }

/* Friends toggle in calendar */
.friend-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
  cursor: pointer; user-select: none; transition: all 0.12s;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-muted);
}
.friend-toggle .toggle-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); transition: background 0.12s;
}
.friend-toggle.active { border-color: #3b82f6; color: #2563eb; background: #dbeafe; }
.friend-toggle.active .toggle-dot { background: #2563eb; }

/* Friend settings panel */
.friend-card-wrap { margin-bottom: 8px; }
.friend-card { cursor: pointer; }
.friend-name { font-weight: 700; font-size: 14px; }
.friend-email { font-size: 12px; color: var(--text-muted); }
.friend-settings-panel {
  background: var(--bg); border: 1.5px solid var(--border);
  border-top: none; border-radius: 0 0 var(--r-lg) var(--r-lg);
  padding: 14px 16px; animation: fadeSlideIn .2s;
}
.friend-settings-title {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: .5px;
}
.friend-setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.friend-setting-row:last-child { border-bottom: none; }

/* Toggle switch (iOS style) */
.toggle-switch {
  position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 22px; cursor: pointer; transition: .2s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 16px; height: 16px;
  left: 3px; bottom: 3px; background: #fff;
  border-radius: 50%; transition: .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Assignees selector - dropdown */
.assignees-selector-wrap { position: relative; }
.assignee-trigger {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; font-size: 13px; color: var(--text); transition: border-color .15s;
}
.assignee-trigger:hover { border-color: var(--primary); }
.assignee-trigger .text-muted { color: var(--text-muted); }
.assignee-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25); z-index: 20;
  max-height: 240px; overflow-y: auto; padding: 4px 0;
}
.assignee-dd-section {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); padding: 8px 12px 4px; user-select: none;
}
.assignee-dd-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  font-size: 13px; transition: background .1s; cursor: default;
}
.assignee-dd-item.available { cursor: pointer; }
.assignee-dd-item.available:hover { background: var(--bg); }
.assignee-dd-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignee-status-icon { width: 16px; height: 16px; flex-shrink: 0; }
.assignee-dd-item.pending .assignee-status-icon { color: var(--warning, #f59e0b); }
.assignee-dd-item.accepted .assignee-status-icon { color: var(--success, #22c55e); }
.assignee-add-btn {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: all .15s; flex-shrink: 0;
}
.assignee-add-btn svg { width: 14px; height: 14px; }
.assignee-dd-item:hover .assignee-add-btn { opacity: 1; }
.assignee-add-btn:hover { background: var(--primary); color: #fff; opacity: 1; }
.assignee-remove-btn {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: all .15s; flex-shrink: 0; margin-left: 4px;
}
.assignee-remove-btn svg { width: 14px; height: 14px; }
.assignee-dd-item:hover .assignee-remove-btn { opacity: 1; }
.assignee-remove-btn:hover { background: var(--danger, #ef4444); color: #fff; opacity: 1; }
.assignee-dd-empty { padding: 16px 12px; text-align: center; color: var(--text-muted); font-size: 12px; }
.assignee-avatar {
  width: 24px; height: 24px; border-radius: 50%; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; flex-shrink: 0;
}
.assignee-progress {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--primary);
}
.assignee-progress.done-all { color: var(--success); }
.assignee-progress svg.lucide { width: 13px; height: 13px; }
.privacy-badge.assigned {
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary);
}

/* ===== CUSTOM LISTS ===== */
.lists-toolbar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.lists-empty {
  text-align: center; padding: 48px 20px;
}
.list-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 14px 16px;
  margin-bottom: 8px; cursor: pointer; transition: all 0.15s;
}
.list-card:hover { box-shadow: var(--shadow-md); border-color: #c7d2fe; }
.list-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.list-card-name { font-size: 15px; font-weight: 700; }
.list-card-count { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.list-card-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.list-filter-chip {
  padding: 1px 8px; border-radius: 4px; font-size: 10px; font-weight: 700;
  background: var(--bg); color: var(--text-muted); border: 1px solid var(--border);
}
.list-tasks-preview { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.list-modal-filters { display: flex; flex-direction: column; gap: 10px; }
.list-filter-row {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center;
}
.list-filter-chip.list-filter-op {
  background: var(--primary); color: #fff; border-color: var(--primary); font-size: 9px; letter-spacing: .5px;
}
.filter-operator-toggle {
  display: flex; justify-content: center; gap: 6px; padding: 2px 0;
}
.filter-op-label {
  padding: 2px 12px; border-radius: 20px; font-size: 11px; font-weight: 700;
  cursor: pointer; border: 1.5px solid var(--border); color: var(--text-muted);
  background: var(--bg); transition: all .15s;
}
.filter-op-label:hover { border-color: var(--primary); color: var(--primary); }
.filter-op-label.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ===== NESTED FILTER BLOCKS (Scratch-like) ===== */
.filter-group {
  border-left: 3px solid var(--primary);
  background: rgba(99,102,241,0.06);
  border-radius: var(--r);
  padding: 8px 10px 10px;
  margin: 4px 0;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.filter-group.logic-or {
  border-left-color: #e85d04;
  background: rgba(232,93,4,0.06);
}
.filter-group-header {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
/* Logic toggle switch – wide thumb with text inside */
.filter-logic-switch {
  position: relative; display: inline-flex; flex-shrink: 0; user-select: none;
}
.filter-logic-switch input { display: none; }
.filter-logic-track {
  position: relative; width: 96px; height: 30px; border-radius: 15px;
  background: rgba(255,255,255,0.08); border: 1.5px solid rgba(255,255,255,0.12);
  cursor: pointer; overflow: hidden;
}
/* Background labels (dimmed, visible behind thumb) */
.filter-logic-bg {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; pointer-events: none;
}
.filter-logic-bg-and, .filter-logic-bg-or {
  font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
  color: rgba(255,255,255,0.25); transition: color 0.3s;
}
/* Sliding thumb with active label */
.filter-logic-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 48px; height: 26px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary);
  transition: left 0.3s cubic-bezier(0.4,0,0.2,1), background 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  pointer-events: none; z-index: 1;
}
.filter-logic-thumb-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.5px; color: #fff;
}
/* Checked = OR */
.filter-logic-switch input:checked + .filter-logic-track .filter-logic-thumb {
  left: 46px;
  background: #e85d04;
}
/* Dragging state – no transition for instant feedback */
.filter-logic-track.dragging .filter-logic-thumb {
  transition: background 0.15s;
}

/* Separator between children */
.filter-separator {
  display: flex; align-items: center; gap: 8px; padding: 2px 0;
}
.filter-separator::before, .filter-separator::after {
  content: ''; flex: 1; height: 1px; background: var(--border); opacity: 0.5;
}
.filter-separator-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
  padding: 1px 10px; border-radius: 10px;
}
.filter-separator.sep-and .filter-separator-label {
  background: rgba(99,102,241,0.15); color: var(--primary);
}
.filter-separator.sep-or .filter-separator-label {
  background: rgba(232,93,4,0.15); color: #e85d04;
}

.filter-group-children {
  padding-left: 6px; display: flex; flex-direction: column; gap: 4px;
}
.filter-group-actions {
  margin-left: auto; display: flex; gap: 4px; align-items: center;
}
.filter-group-actions .btn { font-size: 11px; padding: 2px 8px; }
.filter-group-empty {
  font-size: 11px; color: var(--text-muted); padding: 6px 8px; font-style: italic;
}

/* Leaf filter block */
.filter-block {
  display: grid; grid-template-columns: 20px 1fr 1fr auto; gap: 8px; align-items: center;
  padding: 6px 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  transition: box-shadow 0.15s, opacity 0.15s;
}
.filter-drag-handle {
  color: var(--text-muted); cursor: grab; display: flex; align-items: center; font-size: 14px;
}
.filter-drag-handle:active { cursor: grabbing; }

/* Drag feedback */
.filter-block-dragging, .filter-group-dragging { opacity: 0.3; }
.filter-drop-before { box-shadow: inset 0 2px 0 0 var(--primary) !important; }
.filter-drop-after { box-shadow: inset 0 -2px 0 0 var(--primary) !important; }
.filter-drop-into { box-shadow: 0 0 0 2px var(--primary), 0 0 10px rgba(99,102,241,0.3) !important; }

/* ===== DAY VIEW ===== */
.cal-day-view {
  display: grid; grid-template-columns: 1fr 300px; gap: 20px;
  background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--border);
  overflow: hidden;
}
.cal-day-timeline { overflow: auto; max-height: 70vh; }
.cal-day-sidebar {
  border-left: 1px solid var(--border); padding: 0;
  overflow-y: auto; max-height: 70vh;
}
.day-sidebar-header {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg); position: sticky; top: 0; z-index: 5;
}
.day-task-item {
  display: flex; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 0.12s;
}
.day-task-item:hover { background: var(--bg); }
.day-task-item.friend { cursor: default; border-left: 3px solid #2563eb; }
.day-task-time {
  font-size: 12px; font-weight: 700; color: var(--primary);
  min-width: 44px; flex-shrink: 0; padding-top: 1px;
}
.day-task-info { flex: 1; min-width: 0; }
.day-task-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.day-task-dur { font-size: 11px; color: var(--text-muted); }
.day-task-owner { font-size: 11px; color: #2563eb; font-weight: 600; }

/* ===== SUMMARY SECTION ===== */
.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.summary-grid.small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.summary-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: all 0.15s;
}
.summary-card:hover { box-shadow: var(--shadow-md); }
.summary-card-icon { font-size: 28px; flex-shrink: 0; line-height: 1; }
.summary-card-data { flex: 1; min-width: 0; }
.summary-card-value { font-size: 24px; font-weight: 900; line-height: 1.1; margin-bottom: 3px; }
.summary-card-label { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 2px; }
.summary-card-sub { font-size: 11px; color: var(--text-muted); }

/* Summary accent colors */
.summary-card.accent-primary .summary-card-value { color: var(--primary); }
.summary-card.accent-primary { border-left: 3px solid var(--primary); }
.summary-card.accent-success .summary-card-value { color: var(--success); }
.summary-card.accent-success { border-left: 3px solid var(--success); }
.summary-card.accent-warning .summary-card-value { color: #d97706; }
.summary-card.accent-warning { border-left: 3px solid #f59e0b; }
.summary-card.accent-danger .summary-card-value { color: var(--danger); }
.summary-card.accent-danger { border-left: 3px solid var(--danger); }
.summary-card.accent-blue .summary-card-value { color: #2563eb; }
.summary-card.accent-blue { border-left: 3px solid #3b82f6; }

.summary-section-title {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  margin: 24px 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Priority distribution bar */
.prio-bar-wrap { margin-bottom: 24px; }
.prio-bar {
  height: 14px; border-radius: 7px; overflow: hidden;
  display: flex; background: var(--bg); border: 1px solid var(--border);
}
.prio-seg { height: 100%; min-width: 2px; transition: width 0.3s; }
.prio-seg.high   { background: #ef4444; }
.prio-seg.medium { background: #f59e0b; }
.prio-seg.low    { background: #10b981; }
.prio-legend {
  display: flex; gap: 16px; margin-top: 8px; font-size: 12px; font-weight: 600;
  color: var(--text-muted);
}
.prio-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.prio-dot.high   { background: #ef4444; }
.prio-dot.medium { background: #f59e0b; }
.prio-dot.low    { background: #10b981; }

/* Upcoming tasks list */
.upcoming-list {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.upcoming-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.12s;
}
.upcoming-item:last-child { border-bottom: none; }
.upcoming-item:hover { background: var(--bg); }
.upcoming-title { flex: 1; font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-meta { font-size: 11px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }

/* ===== LUCIDE ICONS ===== */
svg.lucide {
  display: inline-block;
  vertical-align: middle;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.empty-state-icon svg.lucide { width: 44px; height: 44px; }
.summary-card-icon svg.lucide { width: 28px; height: 28px; }
.task-meta-item svg.lucide { width: 14px; height: 14px; }
.task-check svg.lucide { width: 12px; height: 12px; }
.subtask-check svg.lucide { width: 12px; height: 12px; }
.btn-icon svg.lucide { width: 14px; height: 14px; }
.timer-btn svg.lucide { width: 12px; height: 12px; }
.nav-item-icon svg.lucide { width: 18px; height: 18px; }
.voice-icon svg.lucide { width: 18px; height: 18px; }
.modal-close svg.lucide { width: 18px; height: 18px; }
.subtask-progress svg.lucide { width: 13px; height: 13px; }
.cal-nav .btn svg.lucide { width: 16px; height: 16px; }

/* ===== TASKS VIEW TOGGLE ===== */
.tasks-filters-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 4px;
}
.tasks-filters-row .tasks-filters { flex: 1; margin-bottom: 0; }
.tasks-view-toggle {
  display: flex; gap: 2px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r); padding: 3px; flex-shrink: 0;
}
.view-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 28px; border: none; border-radius: 5px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: all 0.15s;
}
.view-toggle-btn:hover { color: var(--text); background: var(--border); }
.view-toggle-btn.active { background: var(--primary); color: #fff; }
.view-toggle-btn svg.lucide { width: 16px; height: 16px; }

/* ===== TASK SEARCH BAR ===== */
.task-search-wrap {
  display: flex; align-items: center; gap: 6px; flex: 1; position: relative;
}
.task-search-input-wrap {
  position: relative; flex: 1; min-width: 0;
}
.task-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-muted); pointer-events: none;
  opacity: 0.6; transition: opacity 0.15s;
}
.task-search-input-wrap:focus-within .task-search-icon { opacity: 1; color: var(--primary); }
.task-search-input {
  width: 100%; padding: 6px 30px 6px 32px;
  border: 1.5px solid var(--border); border-radius: 20px;
  background: var(--bg); color: var(--text);
  font-size: 13px; height: 34px; outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}
.task-search-input:focus {
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}
.task-search-input::placeholder { color: var(--text-muted); font-weight: 400; }
.task-search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: var(--border); border: none; color: var(--text-muted); cursor: pointer;
  font-size: 13px; line-height: 1; width: 18px; height: 18px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.task-search-clear:hover { background: var(--text-muted); color: var(--surface); }
.task-search-filter-btn {
  display: flex; align-items: center; justify-content: center; position: relative;
  width: 34px; height: 34px; border: 1.5px solid var(--border); border-radius: 50%;
  background: var(--bg); color: var(--text-muted); cursor: pointer;
  transition: all 0.2s ease; flex-shrink: 0;
}
.task-search-filter-btn:hover {
  border-color: var(--primary); color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.task-search-filter-btn.has-filters {
  border-color: var(--primary); color: #fff; background: var(--primary);
}
.task-search-filter-btn svg { width: 15px; height: 15px; }
.task-search-badge {
  position: absolute; top: -4px; right: -4px; background: var(--danger);
  color: #fff; font-size: 9px; font-weight: 800; width: 16px; height: 16px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface); line-height: 1;
}
.task-search-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 100;
  width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 18px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  animation: searchPanelIn 0.15s ease;
}
@keyframes searchPanelIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.sf-group { margin-bottom: 14px; }
.sf-group:last-of-type { margin-bottom: 0; }
.sf-group > label {
  display: block; font-size: 10px; font-weight: 800; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.5px;
}
.sf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sf-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--bg); color: var(--text-muted);
  cursor: pointer; transition: all 0.15s; user-select: none; white-space: nowrap;
}
.sf-chip:hover { border-color: var(--primary); color: var(--text); }
.sf-chip.active {
  border-color: var(--chip-color, var(--primary));
  background: color-mix(in srgb, var(--chip-color, var(--primary)) 14%, transparent);
  color: var(--text);
}
.sf-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sf-chip svg { opacity: 0.5; }
.sf-chip.active svg { opacity: 1; color: var(--chip-color, var(--primary)); }
.sf-tags-opts { max-height: 140px; overflow-y: auto; padding-right: 4px; }
.sf-date-row { display: flex; align-items: center; gap: 8px; }
.sf-date-row input[type="date"] {
  flex: 1; padding: 6px 10px; border: 1.5px solid var(--border);
  border-radius: 20px; background: var(--bg); color: var(--text);
  font-size: 12px; font-family: inherit; transition: all 0.15s; height: 32px;
}
.sf-date-row input[type="date"]:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.sf-date-sep { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.section-toolbar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}

/* ===== TASKS BOARD (KANBAN) ===== */
.tasks-board {
  display: flex; gap: 16px;
  overflow-x: auto; padding-bottom: 8px;
  min-height: 200px;
}
.board-column {
  min-width: 280px; max-width: 320px; flex: 0 0 280px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); display: flex; flex-direction: column;
}
.board-column-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1.5px solid var(--border);
}
.board-column-header .tag-badge { font-size: 12px; padding: 3px 10px; }
.board-column-count {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  background: var(--border); border-radius: 10px;
  padding: 1px 8px; min-width: 22px; text-align: center;
}
.board-column-body {
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
  flex: 1; overflow-y: auto; max-height: 60vh;
}
.board-empty {
  font-size: 12px; color: var(--text-muted); text-align: center;
  padding: 20px 8px; font-style: italic;
}

/* Board card */
.board-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r); padding: 10px 12px;
  transition: transform 0.15s, box-shadow 0.15s;
  animation: cardIn 0.25s ease-out both;
  position: relative;
}
.board-card-actions { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity 0.15s; z-index: 2; }
.board-card:hover .board-card-actions { opacity: 1; }
.btn-xs { width: 22px; height: 22px; padding: 0; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.btn-xs svg { width: 14px; height: 14px; }
.board-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.board-card.completed { background: #f0fdf4; border-left: 3px solid var(--success) !important; }
.board-card.completed .board-card-title { text-decoration: line-through; color: var(--text-muted); }
.board-card.overdue { border-left: 3px solid var(--danger); }
.board-card-top { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.board-card-title { font-size: 13px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.board-card .task-check { flex-shrink: 0; margin-top: 1px; }
.board-card-meta {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  font-size: 11px;
}
.board-card-meta .task-meta-item { font-size: 11px; }
.board-card-meta .priority-badge { font-size: 10px; padding: 1px 6px; }
.board-card-meta .subtask-progress { font-size: 11px; }
.board-priority-label { font-size: 13px; font-weight: 700; }

/* ===== BOARD COLUMN DRAG & DROP ===== */
.board-column[draggable="true"] { cursor: grab; }
.board-column[draggable="true"]:active { cursor: grabbing; }
.board-col-ghost { opacity: 0.35; border-style: dashed; }
.board-col-drop-before { box-shadow: -3px 0 0 0 var(--primary); }
.board-col-drop-after { box-shadow: 3px 0 0 0 var(--primary); }
.board-col-dragging .board-card:hover { transform: none; box-shadow: none; }

/* ===== TAGS GROUPED TASKS ===== */
.tags-tasks-grouped {
  margin-top: 20px; display: flex; flex-direction: column; gap: 16px;
}
.tag-group {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.tag-group-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1.5px solid var(--border);
  background: var(--bg);
}
.tag-group-count {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.tag-add-btn {
  margin-left: auto; width: 26px; height: 26px; border-radius: 6px;
  border: 1.5px solid var(--border); background: transparent; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.tag-add-btn svg { width: 14px; height: 14px; }
.tag-add-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.tag-group-tasks {
  padding: 6px 0; min-height: 40px; transition: background 0.15s;
}
/* Drag-drop: highlight whole tag group */
.tag-group.tag-drop-active {
  outline: 2.5px solid var(--primary); outline-offset: -2px;
  background: rgba(99,102,241,0.06);
  box-shadow: 0 0 20px rgba(99,102,241,0.25);
}
.tag-group-empty {
  font-size: 13px; color: var(--text-muted); font-style: italic;
  padding: 12px 16px;
}
/* Task drag states */
.tag-task-item.task-dragging, .board-card.task-dragging {
  opacity: 0.4;
}
/* Drag-drop: highlight whole board column */
.board-column.tag-drop-active {
  outline: 2.5px solid var(--primary); outline-offset: -2px;
  background: rgba(99,102,241,0.06);
  box-shadow: 0 0 20px rgba(99,102,241,0.25);
}
.tag-task-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; transition: background 0.12s;
}
.tag-task-item:hover { background: var(--bg); }
.tag-task-item.completed { background: #f0fdf4; }
.tag-task-item.completed .tag-task-title { text-decoration: line-through; color: var(--text-muted); }
.tag-task-item.overdue { border-left: 3px solid var(--danger); }
.tag-task-info { flex: 1; min-width: 0; }
.tag-task-title {
  font-size: 13px; font-weight: 600; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tag-task-meta {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 2px; font-size: 12px; color: var(--text-muted);
}
.tag-task-meta i { width: 12px; height: 12px; }

/* ===== THEME SWITCHER ===== */
.theme-switcher {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.theme-switcher-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  text-align: center; margin-bottom: 8px;
}
.theme-track {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  position: relative;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 4px;
}
.theme-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / 3);
  background: var(--primary); border-radius: 9px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.35s ease, box-shadow 0.35s ease;
  z-index: 0;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.theme-thumb[data-pos="-1"] { opacity: 0; }
.theme-thumb[data-pos="0"] { transform: translateX(0); }
.theme-thumb[data-pos="1"] { transform: translateX(100%); }
.theme-thumb[data-pos="2"] { transform: translateX(200%); }
[data-theme="dark"] .theme-thumb { background: #6366f1; box-shadow: 0 2px 8px rgba(99,102,241,0.4); }
[data-theme="contrast"] .theme-thumb { background: #ffd700; box-shadow: 0 2px 8px rgba(255,215,0,0.4); }
.theme-btn {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 0; padding: 8px 4px; border: none; background: transparent;
  border-radius: 9px; cursor: pointer; color: var(--text-muted);
  position: relative; z-index: 1;
  transition: color 0.25s ease, transform 0.15s ease;
  font-size: 0;
}
.theme-btn:hover { color: var(--text); transform: scale(1.1); }
.theme-btn:active { transform: scale(0.95); }
.theme-btn.active { color: #fff; }
[data-theme="contrast"] .theme-btn.active { color: #000; }
.theme-btn svg.lucide { width: 18px; height: 18px; }

/* ===== DARK THEME ===== */
[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary-light: #312e81;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
}
[data-theme="dark"] .priority-high   { background: #451a1a; color: #fca5a5; }
[data-theme="dark"] .priority-medium { background: #451a00; color: #fcd34d; }
[data-theme="dark"] .priority-low    { background: #052e16; color: #86efac; }
[data-theme="dark"] .task-card.completed { background: #052e16; }
[data-theme="dark"] .task-card.completed:hover { border-color: #166534; }
[data-theme="dark"] .board-card.completed { background: #052e16; }
[data-theme="dark"] .tag-task-item.completed { background: #052e16; }
[data-theme="dark"] .cal-day.other-month { background: #0b1120; }
[data-theme="dark"] .cal-hour-cell { border-bottom-color: #1e293b; }
[data-theme="dark"] .cal-hour-label { border-bottom-color: #1e293b; }
[data-theme="dark"] .privacy-badge.public { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .friend-msg.success { background: #052e16; color: #86efac; }
[data-theme="dark"] .friend-msg.error   { background: #451a1a; color: #fca5a5; }
[data-theme="dark"] .prio-bar { background: #1e293b; }
[data-theme="dark"] .timer-btn.start { background: #052e16; color: #86efac; }
[data-theme="dark"] .timer-btn.stop  { background: #451a1a; color: #fca5a5; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}
[data-theme="dark"] .cs-trigger { background: var(--surface); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .cs-trigger.open { box-shadow: 0 0 0 3px rgba(99,102,241,0.25); }
[data-theme="dark"] .cs-panel { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .cs-option:hover { background: var(--bg); }
[data-theme="dark"] .pk-calendar { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .pk-cal-nav { background: var(--bg); }
[data-theme="dark"] .pk-d:hover { background: var(--bg); }
[data-theme="dark"] .pk-dur-in { background: var(--bg); border-color: var(--border); color: var(--text); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; }

/* ===== HIGH CONTRAST THEME ===== */
[data-theme="contrast"] {
  --bg: #000000;
  --surface: #111100;
  --border: #ffd700;
  --text: #ffff00;
  --text-muted: #cccc00;
  --primary: #ffd700;
  --primary-dark: #ccac00;
  --primary-light: #332d00;
  --success: #00ff00;
  --warning: #ffa500;
  --danger: #ff4444;
  --shadow: 0 1px 3px rgba(255,215,0,0.2);
  --shadow-md: 0 4px 12px rgba(255,215,0,0.15);
}
[data-theme="contrast"] .priority-high   { background: #440000; color: #ff6666; border: 1px solid #ff4444; }
[data-theme="contrast"] .priority-medium { background: #442200; color: #ffaa00; border: 1px solid #ffa500; }
[data-theme="contrast"] .priority-low    { background: #003300; color: #00ff00; border: 1px solid #00ff00; }
[data-theme="contrast"] .task-card.completed { background: #002200; }
[data-theme="contrast"] .board-card.completed { background: #002200; }
[data-theme="contrast"] .tag-task-item.completed { background: #002200; }
[data-theme="contrast"] .task-card { border-width: 2px; }
[data-theme="contrast"] .cal-day.other-month { background: #0a0a00; }
[data-theme="contrast"] .privacy-badge.public { background: #002244; color: #66aaff; border: 1px solid #4488ff; }
[data-theme="contrast"] .friend-msg.success { background: #003300; color: #00ff00; }
[data-theme="contrast"] .friend-msg.error   { background: #440000; color: #ff6666; }
[data-theme="contrast"] .timer-btn.start { background: #003300; color: #00ff00; }
[data-theme="contrast"] .timer-btn.stop  { background: #440000; color: #ff6666; }
[data-theme="contrast"] .btn-primary { color: #000; }
[data-theme="contrast"] .user-avatar { background: linear-gradient(135deg, #ffd700, #ccac00); color: #000; }
[data-theme="contrast"] .logo-icon-sm { background: linear-gradient(135deg, #ffd700, #ccac00); color: #000; }
[data-theme="contrast"] .task-check.checked { background: #00ff00; border-color: #00ff00; }
[data-theme="contrast"] .subtask-check.checked { background: #ffd700; border-color: #ffd700; color: #000; }
[data-theme="contrast"] .prio-bar { background: #111100; }
[data-theme="contrast"] input, [data-theme="contrast"] select, [data-theme="contrast"] textarea {
  background: #111100; color: #ffff00; border-color: #ffd700;
}
[data-theme="contrast"] .form-group input:focus,
[data-theme="contrast"] .form-group select:focus,
[data-theme="contrast"] .form-group textarea:focus {
  box-shadow: 0 0 0 3px rgba(255,215,0,0.3);
}
[data-theme="contrast"] .theme-btn.active { color: #000; }
[data-theme="contrast"] ::-webkit-scrollbar-thumb { background: #ffd700; }
[data-theme="contrast"] .nav-item.active { background: #332d00; color: #ffd700; }
[data-theme="contrast"] .filter-chip.active { background: #332d00; border-color: #ffd700; color: #ffd700; }

/* ===== CUSTOM THEME ===== */
[data-theme="custom"] input, [data-theme="custom"] select, [data-theme="custom"] textarea {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
[data-theme="custom"] .form-group input:focus,
[data-theme="custom"] .form-group select:focus,
[data-theme="custom"] .form-group textarea:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}
[data-theme="custom"] .cs-trigger { background: var(--surface); color: var(--text); border-color: var(--border); }
[data-theme="custom"] .cs-panel { background: var(--surface); border-color: var(--border); }
[data-theme="custom"] .cs-option:hover { background: var(--bg); }
[data-theme="custom"] .pk-calendar { background: var(--surface); border-color: var(--border); }
[data-theme="custom"] .pk-cal-nav { background: var(--bg); }
[data-theme="custom"] .pk-d:hover { background: var(--bg); }
[data-theme="custom"] .pk-dur-in { background: var(--bg); border-color: var(--border); color: var(--text); }
[data-theme="custom"] .cal-hour-cell { border-bottom-color: var(--border); }
[data-theme="custom"] .cal-hour-label { border-bottom-color: var(--border); }
[data-theme="custom"] ::-webkit-scrollbar-thumb { background: var(--border); }

/* ===== THEME TRANSITION ===== */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition: background-color 0.4s ease, border-color 0.3s ease,
              color 0.25s ease, box-shadow 0.3s ease,
              background 0.4s ease !important;
}

/* ===== RESCHEDULE OPTIONS ===== */
.reschedule-options { display: flex; flex-direction: column; gap: 6px; }
.reschedule-options .btn { justify-content: flex-start; }

/* ===== TASK INVITES PANEL ===== */
.task-invites-btn { position: relative; }
.invite-count-badge {
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0 5px; margin-left: 4px;
}
.task-invites-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 12px; margin-bottom: 12px; box-shadow: var(--shadow-md);
}
.task-invites-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 700; margin-bottom: 10px;
}
.task-invites-header span { display: flex; align-items: center; gap: 6px; }
.task-invite-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px; border-radius: var(--r); background: var(--bg);
  border: 1px solid var(--border); margin-bottom: 6px;
}
.task-invite-item:last-child { margin-bottom: 0; }
.task-invite-title { font-size: 13px; font-weight: 700; }
.task-invite-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.task-invite-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===== MODAL WITH COMMENTS PANEL ===== */
.modal-with-panel {
  display: flex; align-items: flex-start; gap: 12px;
  max-height: 90vh; width: 100%; justify-content: center;
}
.modal-with-panel > .modal { flex-shrink: 0; }

/* ===== COMMENTS SIDE PANEL ===== */
.comments-panel {
  background: var(--surface); border-radius: var(--r-lg);
  width: 360px; max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25); overflow: hidden;
  animation: panelSlideIn 0.25s ease-out;
  border: 1px solid var(--border);
}
@keyframes panelSlideIn {
  from { opacity: 0; transform: translateX(-16px) scale(0.97); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
.comments-panel-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 800; flex-shrink: 0;
  background: var(--surface);
}
.comments-panel-header span {
  display: flex; align-items: center; gap: 8px;
  letter-spacing: 0.2px;
}
.comments-panel-header svg { width: 18px; height: 18px; color: var(--primary); }
.comments-panel-body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.comments-panel-body::-webkit-scrollbar { width: 4px; }
.comments-panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.comments-panel-footer {
  padding: 14px 16px; border-top: 1px solid var(--border);
  flex-shrink: 0; background: var(--surface);
}

/* Comment input */
.comment-input-wrap {
  display: flex; align-items: center; gap: 0;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 24px; padding: 4px 4px 4px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.comment-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.comment-input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 13px; color: var(--text); padding: 6px 0;
  font-family: inherit;
}
.comment-input::placeholder { color: var(--text-muted); opacity: 0.6; }
.comment-send-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; transition: all 0.15s; flex-shrink: 0;
}
.comment-send-btn:hover { background: var(--primary-hover, #4f46e5); transform: scale(1.05); }
.comment-send-btn:active { transform: scale(0.95); }
.comment-send-btn svg { width: 15px; height: 15px; }

/* Empty state */
.comments-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; color: var(--text-muted); text-align: center; flex: 1;
}
.comments-empty svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.3; }
.comments-empty p { margin: 0; font-size: 14px; font-weight: 600; }
.comments-empty .text-muted { font-size: 12px; opacity: 0.6; margin-top: 6px; font-weight: 400; }

/* Comment items */
.comment-item {
  padding: 12px 14px; border-radius: 10px; background: var(--bg);
  border: 1px solid var(--border); transition: all 0.15s;
}
.comment-item:hover { border-color: color-mix(in srgb, var(--border) 80%, var(--primary)); }
.comment-item.comment-mine { border-left: 3px solid var(--primary); }
.comment-item.comment-starred { background: color-mix(in srgb, var(--bg) 92%, #f59e0b); border-left: 3px solid #f59e0b; }
.comment-item.comment-mine.comment-starred { border-left: 3px solid #f59e0b; }
.comment-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.comment-author {
  font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary); padding: 1px 8px; border-radius: 10px;
}
.comment-date { font-size: 11px; color: var(--text-muted); opacity: 0.7; }
.comment-actions { display: flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity 0.15s; }
.comment-item:hover .comment-actions { opacity: 1; }
.comment-action-btn {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 4px; border-radius: 6px; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.comment-action-btn:hover { background: var(--border); color: var(--text); }
.comment-action-btn.starred { color: #f59e0b; }
.comment-action-btn.starred svg { fill: #f59e0b; }
.comment-action-btn.delete:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.comment-action-btn svg { width: 14px; height: 14px; }
.comment-content {
  font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  color: var(--text); padding-top: 2px;
}

/* Comments button active state */
#commentsPanelBtn { position: relative; }
#commentsPanelBtn.active {
  background: var(--primary); color: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

/* Unread comments badge on button */
.comment-unread-dot {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
  animation: dotPulse 0.3s ease-out;
}
@keyframes dotPulse { from { transform: scale(0); } to { transform: scale(1); } }

/* Unread badge on task cards */
.unread-comments-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px;
}
.unread-comments-badge svg { width: 12px; height: 12px; }

/* Responsive: stack vertically on small screens */
@media (max-width: 960px) {
  .modal-with-panel { flex-direction: column; align-items: center; }
  .comments-panel { width: 100%; max-width: 580px; max-height: 50vh; }
}

/* ===== ANIMATIONS ===== */

/* Section fade-slide */
.section-view.active { animation: fadeSlideIn 0.3s ease-out; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Task cards staggered entrance */
.task-card { animation: cardIn 0.3s ease-out both; }
.task-card:nth-child(1)  { animation-delay: 0s; }
.task-card:nth-child(2)  { animation-delay: 0.04s; }
.task-card:nth-child(3)  { animation-delay: 0.08s; }
.task-card:nth-child(4)  { animation-delay: 0.12s; }
.task-card:nth-child(5)  { animation-delay: 0.16s; }
.task-card:nth-child(6)  { animation-delay: 0.20s; }
.task-card:nth-child(7)  { animation-delay: 0.24s; }
.task-card:nth-child(8)  { animation-delay: 0.28s; }
.task-card:nth-child(9)  { animation-delay: 0.32s; }
.task-card:nth-child(10) { animation-delay: 0.36s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Card hover lift */
.task-card { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.task-card:hover { transform: translateY(-2px); }

/* Stat cards pop-in */
.stat-card { animation: statPop 0.35s ease-out both; }
.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.18s; }
@keyframes statPop {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* Summary cards entrance */
.summary-card { animation: cardIn 0.35s ease-out both; }
.summary-card:nth-child(1) { animation-delay: 0s; }
.summary-card:nth-child(2) { animation-delay: 0.06s; }
.summary-card:nth-child(3) { animation-delay: 0.12s; }
.summary-card:nth-child(4) { animation-delay: 0.18s; }

/* Tag / list / friend cards */
.tag-card, .list-card, .friend-card, .friend-request-card {
  animation: cardIn 0.25s ease-out both;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.tag-card:hover, .list-card:hover, .friend-card:hover { transform: translateY(-2px); }

/* Modal animation */
.modal-overlay:not(.hidden) { animation: overlayFadeIn 0.2s ease-out; }
@keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay:not(.hidden) .modal {
  animation: modalBounceIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalBounceIn {
  from { opacity: 0; transform: scale(0.88) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Nav item smooth transitions */
.nav-item { transition: background 0.2s ease, color 0.2s ease; }

/* Filter chips */
.filter-chip { transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.15s ease; }
.filter-chip:active { transform: scale(0.95); }

/* Buttons micro-interaction */
.btn { transition: all 0.15s ease; }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }

/* ===== CUSTOM CHECKBOXES (calendar dropdown) ===== */
.cal-friend-item input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s;
  background: var(--surface);
}
.cal-friend-item input[type="checkbox"]:hover {
  border-color: var(--primary);
}
.cal-friend-item input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.cal-friend-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 1px; left: 5px;
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ===== CONFIRM DIALOG ===== */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.confirm-overlay:not(.hidden) { animation: confirmFadeIn 0.15s ease-out; }
.confirm-dialog {
  background: var(--surface); border-radius: var(--r-lg);
  padding: 28px 32px; text-align: center; max-width: 340px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.confirm-overlay:not(.hidden) .confirm-dialog { animation: confirmPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.confirm-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: #fee2e2; color: var(--danger);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.confirm-icon svg.lucide { width: 24px; height: 24px; }
.confirm-primary .confirm-icon { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.confirm-dialog h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.confirm-dialog p { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
@keyframes confirmPop {
  from { opacity: 0; transform: scale(0.88) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes confirmFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== PROMPT DIALOG ===== */
.prompt-icon {
  background: rgba(99, 102, 241, 0.12) !important;
  color: var(--primary) !important;
}
.prompt-dialog-input {
  width: 100%; padding: 10px 14px; margin-bottom: 6px;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  background: var(--bg); color: var(--text);
  font-size: 14px; outline: none; transition: border-color 0.15s;
}
.prompt-dialog-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.prompt-dialog-error {
  color: var(--danger); font-size: 12px; margin-bottom: 12px; text-align: left;
}
.prompt-dialog .confirm-actions { margin-top: 16px; }

/* ===== WORKSPACE SIDEBAR ===== */
.ws-section-header {
  display: flex; align-items: center; justify-content: space-between;
}
.ws-add-btn {
  width: 22px; height: 22px; border: none; background: none;
  cursor: pointer; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: all 0.12s; padding: 0;
}
.ws-add-btn:hover { background: var(--primary-light); color: var(--primary); }
.ws-add-btn svg.lucide { width: 14px; height: 14px; }

/* Add menu dropdown */
.ws-add-wrap { position: relative; }
.ws-add-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 50;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-md);
  min-width: 180px; padding: 4px;
}
.ws-add-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  color: var(--text); transition: background 0.12s;
}
.ws-add-menu-item:hover { background: var(--bg); }
.ws-add-menu-item svg.lucide { width: 14px; height: 14px; color: var(--text-muted); }

/* Group header in sidebar */
.ws-sidebar-group { margin-bottom: 2px; }
.ws-group-header {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: var(--r);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted); cursor: pointer; user-select: none;
  transition: color 0.12s;
}
.ws-group-header:hover { color: var(--text); }
.ws-group-header .nav-item-icon svg.lucide { width: 12px; height: 12px; }
.ws-group-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-group-count {
  font-size: 9px; color: var(--text-muted); background: var(--bg);
  border-radius: 8px; padding: 1px 5px; font-weight: 700; min-width: 16px; text-align: center;
}
.ws-group-manage-btn {
  width: 20px; height: 20px; border: none; background: none;
  cursor: pointer; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: all 0.12s; padding: 0;
  opacity: 0;
}
.ws-group-header:hover .ws-group-manage-btn { opacity: 1; }
.ws-group-manage-btn:hover { background: var(--primary-light); color: var(--primary); }

/* Active folder highlight */
.ws-group-active > .ws-group-header {
  color: var(--folder-color, var(--primary));
}
.ws-group-active > .ws-group-header .ws-folder-icon { filter: brightness(1.1); }

/* Colored folder children — tinted left border + subtle background */
.ws-group-colored .ws-group-children {
  border-left: 2px solid var(--folder-color, var(--primary));
  margin-left: 18px; padding-left: 12px;
  border-radius: 0 0 0 6px;
}
.ws-group-colored .ws-group-children .ws-header.nav-item {
  border-radius: var(--r); transition: background 0.12s, color 0.12s;
}
.ws-group-colored .ws-group-children .ws-active > .ws-header {
  color: var(--folder-color, var(--primary));
}
.ws-group-colored .ws-group-children .ws-subnav-item.active {
  background: color-mix(in srgb, var(--folder-color) 14%, transparent);
  color: var(--folder-color, var(--primary));
}
.ws-group-colored .ws-group-children .ws-subnav-item:hover {
  color: var(--folder-color, var(--text));
}

/* Group manager dropdown */
.ws-group-dropdown {
  position: fixed; z-index: 100;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-md);
  min-width: 200px; padding: 4px;
}
.ws-gdd-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  color: var(--text); transition: background 0.12s;
}
.ws-gdd-item:hover { background: var(--bg); }
.ws-gdd-danger { color: var(--danger); }
.ws-gdd-danger:hover { background: rgba(239,68,68,0.08); }
.ws-gdd-sep { height: 1px; background: var(--border); margin: 4px 8px; }
.ws-gdd-label {
  padding: 6px 12px 4px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.03em;
}
.ws-gdd-ws {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 6px;
  font-size: 12px; cursor: pointer; transition: background 0.12s;
}
.ws-gdd-ws:hover { background: var(--bg); }
.ws-gdd-ws input[type="checkbox"] { accent-color: var(--primary); }

/* Folder icon */
.ws-folder-icon { display: inline-flex; align-items: center; flex-shrink: 0; }

/* Grouped workspace children indent */
.ws-group-children { padding-left: 14px; }

/* Color picker in group dropdown */
.ws-gdd-colors {
  display: flex; align-items: center; gap: 6px; padding: 4px 12px 6px;
  flex-wrap: wrap;
}
.ws-gdd-color-dot {
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: all 0.12s;
  flex-shrink: 0;
}
.ws-gdd-color-dot:hover { transform: scale(1.15); }
.ws-gdd-color-dot.active {
  border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text);
  transform: scale(1.1);
}
/* Custom color row (swatch + hex input like theme creator) */
.ws-gdd-custom-color {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 6px;
}
.ws-gdd-custom-color .ctc-swatch { width: 28px; height: 28px; border-radius: 6px; }
.ws-gdd-custom-color .ctc-hex { width: 80px; font-size: 12px; padding: 4px 8px; }

/* Drag & drop */
.ws-item[draggable="true"], .ws-sidebar-group[draggable="true"] { cursor: grab; }
.ws-item[draggable="true"]:active, .ws-sidebar-group[draggable="true"]:active { cursor: grabbing; }
.ws-dragging { opacity: 0.35; }
.ws-drop-before { box-shadow: inset 0 2px 0 0 var(--primary); border-radius: var(--r); }
.ws-drop-after  { box-shadow: inset 0 -2px 0 0 var(--primary); border-radius: var(--r); }
.ws-group-drop-target > .ws-group-header {
  background: var(--primary-light); color: var(--primary); border-radius: var(--r);
}
.ws-ungrouped-zone { min-height: 4px; padding: 2px 0; transition: background 0.12s; border-radius: var(--r); }
.ws-ungrouped-zone.ws-drop-target { background: var(--primary-light); }

.ws-item { margin-bottom: 2px; }
.ws-header { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.ws-header .nav-item-icon { width: 16px; font-size: 14px; }
.ws-header .nav-item-icon svg.lucide { width: 14px; height: 14px; }
.ws-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-member-count {
  font-size: 10px; color: var(--text-muted); background: var(--bg);
  border-radius: 8px; padding: 1px 6px; font-weight: 700; min-width: 18px; text-align: center;
}
.ws-active > .ws-header { color: var(--primary); }

.ws-subnav { padding-left: 18px; margin-bottom: 4px; }
.ws-subnav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: var(--r);
  cursor: pointer; font-size: 12px; font-weight: 500;
  color: var(--text-muted); transition: all 0.12s; user-select: none;
}
.ws-subnav-item:hover { background: var(--bg); color: var(--text); }
.ws-subnav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.ws-subnav-item .nav-item-icon { font-size: 13px; width: 16px; }
.ws-subnav-item .nav-item-icon svg.lucide { width: 13px; height: 13px; }

.ws-settings-item { color: var(--text-muted); opacity: 0.7; }
.ws-settings-item:hover { opacity: 1; }

.ws-invite-item { color: var(--warning) !important; font-weight: 600 !important; font-size: 13px; }
.ws-invite-item .badge-count {
  background: var(--warning); color: #fff; font-size: 10px;
  padding: 1px 6px; border-radius: 8px; margin-left: auto;
}

/* ===== WORKSPACE SETTINGS PANEL ===== */
.ws-settings-panel { max-width: 600px; }
.ws-settings-panel h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.ws-settings-panel h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text-muted); }
.ws-settings-section { background: var(--surface); border-radius: var(--r-lg); padding: 16px; border: 1px solid var(--border); }

.ws-members-list { display: flex; flex-direction: column; gap: 6px; }
.ws-member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r); background: var(--bg);
}
.ws-member-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.ws-member-name { font-weight: 600; font-size: 13px; }
.ws-member-email { color: var(--text-muted); font-size: 12px; flex: 1; }
.ws-member-role {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  color: var(--primary); background: var(--primary-light);
  padding: 2px 8px; border-radius: 4px;
}

.ws-invite-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--border); margin-bottom: 8px;
}
.ws-add-member-row {
  display: flex; gap: 8px; align-items: center; margin-top: 12px;
  padding: 10px 12px; background: var(--bg); border-radius: var(--r);
}
.ws-add-member-row input[type="email"] {
  flex: 1; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; background: var(--surface); color: var(--text);
  font-family: inherit; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.ws-add-member-row input[type="email"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.ws-add-member-row .btn { flex-shrink: 0; height: 38px; }

/* ===== PRICING PAGE ===== */
.pricing-page {
  text-align: center; padding: 40px 20px; max-width: 1100px;
  margin: 0 auto; position: relative; z-index: 1;
}
.pricing-page h1 { font-size: 2rem; color: #fff; font-weight: 900; margin-bottom: 8px; animation: loginFadeIn 0.6s 0.1s ease-out both; }
.pricing-subtitle { color: rgba(255,255,255,0.7); margin-bottom: 32px; font-size: 15px; animation: loginFadeIn 0.6s 0.2s ease-out both; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 800px) { .pricing-grid { grid-template-columns: 1fr; } }
.pricing-card {
  background: rgba(255,255,255,0.05); border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 16px; padding: 28px 24px; text-align: left; color: #fff;
  backdrop-filter: blur(12px); transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  animation: pricingCardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.pricing-card:nth-child(1) { animation-delay: 0.15s; }
.pricing-card:nth-child(2) { animation-delay: 0.25s; }
.pricing-card:nth-child(3) { animation-delay: 0.35s; }
@keyframes pricingCardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.pricing-card:hover { transform: translateY(-6px); border-color: rgba(255,255,255,0.25); box-shadow: 0 16px 40px rgba(0,0,0,0.3); }
.pricing-card.featured { border-color: #e85d04; background: rgba(232,93,4,0.08); }
.pricing-card-name { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.pricing-card-price { font-size: 32px; font-weight: 900; margin: 12px 0; }
.pricing-card-price span { font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.6); }
.pricing-card-features { list-style: none; margin: 16px 0 24px; padding: 0; }
.pricing-card-features li {
  padding: 5px 0; font-size: 13px; color: rgba(255,255,255,0.8);
  display: flex; align-items: center; gap: 8px;
}
.pricing-card-features li::before { content: '\2713'; color: #10b981; font-weight: 700; }
.pricing-card-features li.feature-no::before { content: '\2717'; color: #ef4444; }
.pricing-card-features li.feature-no { color: rgba(255,255,255,0.4); }
.pricing-card .btn { width: 100%; justify-content: center; }
.pricing-footer { margin-top: 32px; color: rgba(255,255,255,0.5); font-size: 13px; }
.pricing-footer a { color: #e85d04; text-decoration: none; font-weight: 600; }

/* ===== LEGAL PAGES ===== */
/* Override login-page centering so legal content scrolls */
body.login-page:has(.legal-page) {
  display: block; align-items: initial; justify-content: initial;
  overflow-y: auto;
}
.legal-page {
  max-width: 800px; margin: 0 auto; padding: 80px 24px 60px; position: relative; z-index: 1;
  color: rgba(255,255,255,0.85);
  animation: loginFadeIn 0.6s cubic-bezier(0.16,1,0.3,1) both;
}
.legal-page h1 { color: #fff; font-weight: 900; font-size: 1.8rem; margin-bottom: 6px; }
.legal-page .legal-subtitle { color: rgba(255,255,255,0.5); font-size: 13px; margin-bottom: 32px; }
.legal-page h2 { color: #e85d04; font-size: 1.05rem; font-weight: 700; margin-top: 28px; margin-bottom: 10px; }
.legal-page p, .legal-page li { font-size: 13px; line-height: 1.8; color: rgba(255,255,255,0.7); margin-bottom: 8px; }
.legal-page ul { padding-left: 20px; }
.legal-page li { margin-bottom: 4px; }
.legal-page a { color: #e85d04; }

/* Reading progress bar */
.reading-progress {
  position: fixed; top: 56px; left: 0; width: 100%; height: 3px;
  z-index: 101; background: rgba(255,255,255,0.06);
}
.reading-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #e85d04, #f97316);
  border-radius: 0 2px 2px 0;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(232,93,4,0.5);
}

/* Back button on legal pages */
.legal-back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 36px; padding: 10px 22px;
  background: rgba(232,93,4,0.12); color: #e85d04;
  border-radius: 8px; font-size: 13px; font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
}
.legal-back-btn:hover {
  background: rgba(232,93,4,0.22); transform: translateX(-4px);
}

/* ===== BILLING SECTION (dashboard) ===== */
.billing-tier-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px;
  border-radius: 20px; font-size: 12px; font-weight: 700; text-transform: uppercase;
}
.tier-free { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.tier-pro { background: #fef3c7; color: #92400e; }
.tier-business { background: #e0e7ff; color: #3730a3; }
.tier-business-guest { background: #ede9fe; color: #5b21b6; }
.billing-plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 16px 0; }
.billing-plan-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; transition: border-color 0.2s;
}
.billing-plan-card.current { border-color: var(--primary); }
.billing-plan-card.recommended { border-color: #e85d04; }
.billing-plan-card .pricing-card-features { color: var(--text); }
.billing-plan-card .pricing-card-features li { color: var(--text); }
.billing-plan-card .pricing-card-features li::before { color: #10b981; }
.billing-plan-card .pricing-card-features li.feature-no::before { content: '\2717'; color: #ef4444; }
.billing-plan-card .pricing-card-features li.feature-no { color: var(--text-muted); }
.payment-history-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.payment-history-table th { text-align: left; padding: 8px; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.payment-history-table td { padding: 8px; border-bottom: 1px solid var(--border); }

/* ===== UPGRADE PROMPT (feature gating) ===== */
.upgrade-prompt {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 32px; text-align: center; color: var(--text-muted);
}
.upgrade-prompt-icon { font-size: 32px; }
.upgrade-prompt h3 { font-size: 16px; color: var(--text); margin: 0; }
.upgrade-prompt p { font-size: 13px; max-width: 400px; }

/* ===== CUSTOM COLOR PICKER ===== */
.ccp {
  position: fixed; z-index: 9999;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.05) inset;
  width: 244px;
  display: none;
  user-select: none;
  -webkit-user-select: none;
}
.ccp.ccp-open { display: block; animation: ccpIn 0.15s ease-out; }
@keyframes ccpIn { from { opacity: 0; transform: translateY(-6px) scale(0.97); } to { opacity: 1; transform: none; } }

.ccp-sv-wrap {
  position: relative; width: 220px; height: 220px;
  border-radius: 8px; overflow: hidden; cursor: crosshair;
}
.ccp-sv { display: block; width: 100%; height: 100%; border-radius: 8px; }
.ccp-sv-cursor {
  position: absolute; width: 14px; height: 14px;
  border: 2.5px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ccp-hue-wrap {
  position: relative; width: 220px; height: 14px;
  border-radius: 7px; overflow: hidden; cursor: pointer;
  margin-top: 10px;
}
.ccp-hue { display: block; width: 100%; height: 100%; border-radius: 7px; }
.ccp-hue-cursor {
  position: absolute; top: 50%; width: 6px; height: 18px;
  background: #fff; border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.25);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ccp-bottom {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px;
}
.ccp-preview {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  border: 1.5px solid var(--border);
}
.ccp-hex {
  flex: 1; font-family: monospace; font-size: 13px;
  font-weight: 700; text-transform: lowercase;
  padding: 6px 10px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); outline: none;
}
.ccp-hex:focus { border-color: var(--primary); }

/* =====================================================
   INTEGRATIONS MODULE
   ===================================================== */
.integration-page { padding: 0 4px; }
.integration-page-header { margin-bottom: 20px; }
.integration-page-subtitle {
  font-size: 14px; color: var(--text-muted); margin: 0; line-height: 1.5;
}
.integration-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.integration-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-left: 4px solid var(--integ-color, var(--primary));
  border-radius: 12px; padding: 20px; cursor: pointer;
  transition: all 0.15s ease;
}
.integration-card:hover {
  border-color: var(--integ-color, var(--primary));
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.integration-card-active {
  border-color: #16a34a;
  border-left-color: #16a34a;
  box-shadow: 0 0 0 1.5px #16a34a40, 0 2px 12px #16a34a20;
}
.integration-card-active:hover {
  border-color: #16a34a;
  box-shadow: 0 0 0 2px #16a34a50, 0 4px 16px #16a34a25;
}
.integration-card-top {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.integration-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 22px;
}
.integration-card-info { flex: 1; min-width: 0; }
.integration-card-name {
  font-size: 15px; font-weight: 700; color: var(--text); margin: 0;
}
.integration-card-category {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
}
.integration-card-desc {
  font-size: 13px; color: var(--text-muted); line-height: 1.5;
  margin: 0 0 12px;
}
.integration-card-footer {
  display: flex; align-items: center; justify-content: space-between;
}
.integration-card-arrow {
  color: var(--text-muted); transition: transform 0.15s;
}
.integration-card:hover .integration-card-arrow { transform: translateX(3px); }

/* Status badge */
.integration-status-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; white-space: nowrap; text-transform: uppercase;
  letter-spacing: 0.3px;
}
.integration-status-badge.active {
  background: #dcfce7; color: #16a34a;
}
.integration-status-badge.inactive {
  background: var(--bg); color: var(--text-muted);
}

/* Tier lock badge */
.integration-tier-lock {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; color: var(--primary);
  background: var(--primary-light); padding: 3px 10px;
  border-radius: 20px;
}

/* Detail modal */
.integration-detail-hero {
  display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px;
}
.integration-detail-actions { margin-bottom: 20px; }

/* Upgrade banner */
.integration-upgrade-banner {
  display: flex; align-items: center; gap: 14px;
  background: var(--primary-light); border: 1.5px solid var(--primary);
  border-radius: var(--r); padding: 16px;
}
.integration-upgrade-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.integration-upgrade-banner > div { flex: 1; }
.integration-upgrade-banner strong { color: var(--text); font-size: 14px; }

/* WIP badge */
.integration-status-badge.wip {
  background: #f59e0b18; color: #f59e0b; border-color: #f59e0b40;
}

/* WIP integration card */
.integration-card-wip {
  cursor: default; opacity: .72;
}
.integration-card-wip:hover {
  box-shadow: none; border-color: var(--border); transform: none;
}
.integration-wip-hint {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-muted);
}

/* WIP banner */
.integration-wip-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; background: #f59e0b10; border: 1.5px solid #f59e0b30;
  border-radius: var(--r); margin-top: 16px;
}
.integration-wip-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: #f59e0b20; color: #f59e0b;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.integration-wip-banner > div { flex: 1; }
.integration-wip-banner strong { color: var(--text); font-size: 14px; }

/* Active bar */
.integration-active-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: #dcfce715; border: 1.5px solid #16a34a30;
  border-radius: var(--r);
}

/* Settings */
.integration-settings {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.integration-field-label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase;
  letter-spacing: 0.6px;
}
.integration-select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: var(--r); font-size: 14px; background: var(--surface);
  color: var(--text); outline: none; cursor: pointer;
}
.integration-select:focus { border-color: var(--primary); }
.integration-field-empty {
  font-size: 13px; color: var(--text-muted); padding: 8px 0; font-style: italic;
}
.integration-faculties-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 160px; overflow-y: auto; padding: 4px 0;
}
.integration-faculty-item {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--text); cursor: pointer; padding: 4px 0;
}
.integration-faculty-item input { accent-color: var(--primary); }

/* ── Timetable in Calendar ── */
.cal-timetable-wrap { position: relative; display: flex; align-items: center; }
.cal-timetable-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  min-width: 280px; max-height: 380px;
  z-index: 50; padding: 8px 0; overflow-y: auto;
}
.cal-timetable-dropdown.hidden { display: none; }
.cal-timetable-class-list { max-height: 200px; overflow-y: auto; }

/* Timetable background blocks in week view */
.cal-timetable-bg {
  position: absolute; left: 0; right: 0; z-index: 1;
  border-radius: 4px; padding: 2px 6px; pointer-events: none;
  overflow: hidden;
}
.cal-tt-bg-label {
  font-size: 10px; font-weight: 600; opacity: 0.6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}

/* Timetable columns in day view */
.cal-timetable-col {
  position: relative; border-left: 2px solid var(--border);
}
.cal-timetable-entry {
  position: absolute; left: 4px; right: 4px; z-index: 2;
  border-radius: 6px; padding: 4px 8px; overflow: hidden;
  font-size: 12px; pointer-events: none;
}
.cal-tt-subject {
  font-weight: 700; font-size: 11px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.cal-tt-meta {
  font-size: 10px; opacity: 0.7; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Day view column headers */
.cal-day-col-headers {
  display: flex; padding: 0; border-bottom: 1px solid var(--border);
}
.cal-day-col-headers .cal-time-gutter {
  flex: 0 0 54px;
}
.cal-col-header {
  flex: 1; text-align: center; padding: 8px 4px;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.cal-col-header-tt {
  color: #b80000; border-left: 2px solid var(--border);
}

/* =====================================================
   TOGGLE SWITCH
   ===================================================== */
.toggle-switch {
  position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 24px; transition: 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: #16a34a; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Integration toggle row */
.integration-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r); margin-bottom: 16px;
}
.integration-toggle-label {
  font-size: 14px; font-weight: 600; color: var(--text);
}

/* ── School cards ── */
.integration-schools-section { margin-top: 4px; }
.integration-schools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px;
}
.integration-school-card {
  padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: all 0.15s; background: var(--surface);
}
.integration-school-card:hover {
  border-color: var(--school-color, var(--primary));
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.integration-school-card.selected {
  border-color: var(--school-color, var(--primary));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--school-color, var(--primary)) 25%, transparent);
}
.integration-school-card.wip {
  opacity: 0.6; cursor: default;
}
.integration-school-card.wip:hover {
  border-color: var(--border); box-shadow: none;
}
.integration-school-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.integration-school-short {
  font-size: 12px; font-weight: 800; padding: 3px 10px;
  border-radius: 6px; letter-spacing: 0.5px;
}
.integration-school-name {
  font-size: 13px; color: var(--text-secondary); line-height: 1.4;
}

/* PUM group selects grid */
.pum-group-selects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px;
}
.pum-cat-select { font-size: 13px; }

/* PUM fakultety multiselect */
.pum-multiselect-chips {
  min-height: 38px; padding: 4px 8px; border: 1.5px solid var(--border);
  border-radius: var(--r); cursor: pointer; display: flex; flex-wrap: wrap;
  gap: 4px; align-items: center; background: var(--bg-card);
  transition: border-color 0.15s;
}
.pum-multiselect-chips:hover { border-color: var(--primary); }
.pum-multiselect-placeholder { font-size: 13px; color: var(--text-muted); padding: 2px 4px; }
.pum-multiselect-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  background: #8b5cf620; color: #8b5cf6; border-radius: 12px; font-size: 12px; font-weight: 600;
}
.pum-chip-remove {
  background: none; border: none; cursor: pointer; padding: 0; color: inherit;
  font-size: 14px; line-height: 1; opacity: 0.7;
}
.pum-chip-remove:hover { opacity: 1; }
.pum-multiselect-dropdown {
  margin-top: 4px; border: 1.5px solid var(--border); border-radius: var(--r);
  background: var(--bg-card); padding: 8px; max-height: 220px;
  overflow-y: auto; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.pum-multiselect-options { display: flex; flex-direction: column; gap: 2px; }
.pum-multiselect-option {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer; font-size: 13px; transition: background 0.1s;
}
.pum-multiselect-option:hover { background: var(--bg); }
.pum-multiselect-empty { font-size: 13px; color: var(--text-muted); padding: 6px 8px; }

/* Save row */
.integration-save-row {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.integration-unsaved-hint {
  font-size: 12px; color: #f59e0b; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
}
.integration-unsaved-hint::before {
  content: '●'; font-size: 8px;
}
.btn-disabled {
  opacity: 0.4; pointer-events: none;
}
.btn-ghost {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; padding: 4px 8px; border-radius: 6px;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ── Timetable calendar events ── */
.cal-event.timetable-event {
  border-left: 3px solid #1d4ed8;
  font-size: 11px;
}
.cal-task-pill.timetable-pill {
  border-left: 3px solid #1d4ed8;
}

/* =====================================================
   TIMETABLE DEDICATED PAGE
   ===================================================== */
.tt-page { padding: 0 4px; }
.tt-controls {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.tt-title { font-size: 16px; font-weight: 700; margin: 0; white-space: nowrap; }
.tt-view-btn {
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-muted); border-radius: 8px; cursor: pointer; transition: all 0.15s;
}
.tt-view-btn:first-child { border-radius: 8px 0 0 8px; }
.tt-view-btn:last-child { border-radius: 0 8px 8px 0; }
.tt-view-btn:not(:first-child) { margin-left: -1px; }
.tt-view-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Empty state */
.tt-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center;
}
.tt-empty-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-size: 24px;
}
.tt-empty h3 { font-size: 18px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.tt-empty p { font-size: 14px; color: var(--text-muted); margin: 0 0 20px; max-width: 360px; }
.tt-no-events {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-muted); text-align: center;
}
.tt-no-events i { width: 32px; height: 32px; margin-bottom: 8px; }

/* Timeline */
.tt-timeline {
  display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: var(--surface);
}
.tt-timeline-gutter { width: 54px; flex-shrink: 0; border-right: 1px solid var(--border); }
.tt-hour-label {
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 2px; font-size: 11px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.tt-timeline-body { flex: 1; }
.tt-hour-line { border-bottom: 1px solid var(--border); }

/* Week layout */
.tt-week { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.tt-week-header {
  display: flex; border-bottom: 1px solid var(--border);
}
.tt-week-gutter { width: 54px; flex-shrink: 0; border-right: 1px solid var(--border); }
.tt-week-col-header {
  flex: 1; text-align: center; padding: 8px 4px;
  font-size: 11px; color: var(--text-muted); border-right: 1px solid var(--border);
}
.tt-week-col-header:last-child { border-right: none; }
.tt-week-col-header.is-today { background: var(--primary-light); }
.tt-week-day-label { display: block; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.tt-week-day-num { display: block; font-size: 16px; font-weight: 700; color: var(--text); margin-top: 2px; }
.tt-week-body { display: flex; overflow-y: auto; max-height: 70vh; }
.tt-week-col {
  flex: 1; border-right: 1px solid var(--border);
}
.tt-week-col:last-child { border-right: none; }
.tt-week-col.is-today { background: var(--primary-light); }

/* Month (reuses .cal-month styles from calendar) */
.tt-month { }

/* Event blocks */
.tt-event {
  position: absolute; border-radius: 6px;
  padding: 4px 8px; overflow: hidden;
  background: #dbeafe; color: #1d4ed8;
  border-left: 3px solid #1d4ed8;
  font-size: 12px; z-index: 2; cursor: default;
}
.tt-event-title {
  font-weight: 700; font-size: 11px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.tt-event-meta {
  font-size: 10px; opacity: 0.75; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ===== SIDEBAR MOBILE TOGGLE ===== */
.sidebar-toggle {
  display: none; flex-direction: column; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 6px;
  border-radius: 6px; margin-right: 10px;
}
.sidebar-toggle span {
  display: block; width: 18px; height: 2px;
  background: var(--text); border-radius: 2px; transition: 0.2s;
}
.sidebar-toggle:hover span { background: var(--primary); }
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 199;
  opacity: 0; transition: opacity 0.25s ease;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ===== MOBILE WEEK CARDS (collapsible days) ===== */
.mcal-cards {
  display: flex; flex-direction: column; gap: 8px;
}
.mcal-day {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.mcal-day-today { border-color: var(--primary); box-shadow: 0 0 12px rgba(99,102,241,0.1); }
.mcal-day-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; cursor: pointer; user-select: none;
  transition: background 0.12s;
}
.mcal-day-header:hover { background: var(--bg); }
.mcal-day-name { font-weight: 700; font-size: 13px; }
.mcal-day-today .mcal-day-name { color: var(--primary); }
.mcal-day-date { font-size: 11px; color: var(--text-muted); }
.mcal-day-count {
  margin-left: auto; font-size: 11px; color: var(--text-muted);
  background: var(--bg); padding: 2px 8px; border-radius: 12px;
  font-weight: 600; border: 1px solid var(--border);
}
.mcal-chevron {
  color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0;
}
.mcal-collapsed .mcal-chevron { transform: rotate(-90deg); }
.mcal-day-body {
  padding: 0 10px 10px; display: flex; flex-direction: column; gap: 6px;
}
.mcal-card-empty {
  padding: 12px; text-align: center; font-size: 12px; color: var(--text-muted);
}
.mcal-item {
  background: var(--bg); border-radius: var(--r); padding: 10px 12px;
  border-left: 3px solid; cursor: pointer; transition: background 0.12s;
}
.mcal-item:active { background: var(--border); }
.mcal-item-time {
  font-size: 11px; font-weight: 600; color: var(--primary);
  margin-bottom: 3px; font-variant-numeric: tabular-nums;
}
.mcal-item-title { font-weight: 600; font-size: 13px; line-height: 1.3; }
.mcal-item-meta {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  /* Sidebar: offscreen by default, slide in */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .sidebar-close-btn { display: flex; }
  .main-content { margin-left: 0; }

  /* Topbar */
  .topbar { padding: 0 14px; }
  .topbar-title { font-size: 15px; }
  .content-area { padding: 16px; overflow-x: hidden; }

  /* Stats bar — 2x2 grid on mobile */
  .stats-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 10px 12px; }
  .stat-value { font-size: 18px; }

  /* Tasks filters */
  .tasks-filters { gap: 4px; }

  /* Calendar */
  .calendar-controls { flex-direction: column; gap: 10px; align-items: stretch; }
  .cal-nav { justify-content: center; }
  .cal-nav h2 { font-size: 15px; min-width: auto; }
  .cal-toggles { flex-wrap: wrap; justify-content: center; }

  /* Monthly view — stretch days to fill screen, smaller fonts */
  .cal-day {
    min-height: calc((100vh - 180px) / var(--cal-rows, 6));
    padding: 4px 3px;
  }
  .cal-day-num { font-size: 10px; width: 20px; height: 20px; }
  .cal-task-pill { font-size: 8px; padding: 1px 3px; }
  .cal-task-duration { display: none; }
  .cal-more { font-size: 8px; }
  .cal-weekday { padding: 4px; font-size: 9px; }

  /* Weekly/Day view — smaller hour rows & fonts */
  .cal-hour-label { height: 28px; }
  .cal-hour-cell  { height: 28px; }
  .cal-time-gutter { width: 32px; padding: 4px; font-size: 9px; }
  .cal-time-col { width: 32px; font-size: 9px; }
  .cal-days-cols { font-size: 9px; }
  .cal-day-head { font-size: 10px; padding: 4px 2px; }
  .cal-day-head .wnum { font-size: 12px; }
  .cal-day-head .wday { font-size: 8px; }
  .cal-event, .cal-event.timetable-event, .cal-event.friend-event { font-size: 5px; padding: 1px 2px; min-height: 10px; line-height: 1.1; overflow: hidden; }
  .cal-allday-pill { font-size: 8px; padding: 1px 4px; }
  .cal-allday-label { font-size: 7px; }

  /* Day view — hide timeline, show only task list */
  .cal-day-view { grid-template-columns: 1fr; gap: 0; }
  .cal-day-timeline { display: none; }
  .cal-day-sidebar { border-left: none; max-height: none; }

  /* Modals */
  .modal-overlay { padding: 10px; }
  .modal { max-width: 100%; border-radius: var(--r-lg); }
  .modal-sm { max-width: 100%; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .form-row { grid-template-columns: 1fr; }

  /* Kanban board */
  .tasks-board { flex-direction: column; }
  .board-column { min-width: auto; max-width: 100%; flex: 1; }

  /* Tags grid */
  .tags-grid { grid-template-columns: 1fr; }

  /* Toast action */
  .toast-action { left: 16px; right: 16px; bottom: 16px; }

  /* Friends dropdown */
  .cal-friends-dropdown { min-width: 200px; }

  /* Summary / charts */
  .summary-grid { grid-template-columns: 1fr !important; }

  /* Settings grid — single column on mobile */
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card { padding: 16px; }

  /* Billing / subscription — single column, no overflow */
  .billing-plans-grid { grid-template-columns: 1fr; }
  .billing-plan-card { padding: 16px; }
  .billing-plan-card div[style*="font-size:28px"] { font-size: 22px !important; }

  /* Integration grid — single column on mobile */
  .integration-grid { grid-template-columns: 1fr; }
  .integration-card { padding: 16px; }

  /* Workspace folder manage button — always visible on touch (no hover) */
  .ws-group-manage-btn { opacity: 1 !important; }
}

/* Small phones */
@media (max-width: 480px) {
  .login-container { width: 100%; padding: 28px 20px; }
  .login-page { padding-top: 20px; }
  .otp-input { width: 40px; height: 48px; font-size: 20px; }
  .otp-inputs { gap: 6px; }
  .topbar-actions .btn span { display: none; }
  .stat-value { font-size: 18px; }
}

/* ── OTP / Password Reset ── */
.otp-inputs {
  display: flex; gap: 8px; justify-content: center; margin: 16px 0;
}
.otp-input {
  width: 48px; height: 56px; text-align: center; font-size: 24px; font-weight: 700;
  border: 2px solid #e2e8f0; border-radius: 10px; background: #f8fafc;
  color: #1e1b4b; transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.otp-input:focus {
  border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.reset-timer {
  text-align: center; color: #888; font-size: .85rem; margin: 12px 0 4px;
}

/* ── Events section ── */
.events-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 16px; flex-wrap: wrap; gap: 10px;
}
.events-header h2 { margin: 0; font-size: 18px; font-weight: 700; }
.events-list { display: flex; flex-direction: column; gap: 8px; }

.event-card {
  display: flex; gap: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.event-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); border-color: #ec4899; }
.event-card-left { width: 4px; background: #ec4899; flex-shrink: 0; }
.event-card-body { padding: 10px 14px; flex: 1; min-width: 0; }
.event-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.event-card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.event-card-desc { font-size: 12px; color: var(--text-secondary); margin: 2px 0 6px; white-space: pre-line; }
.event-card-footer {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px;
}
.event-card-date { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 3px; }
.event-card-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 3px; }
.event-card-link { font-size: 11px; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 3px; }
.event-card-link:hover { text-decoration: underline; }

.event-type-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 100px;
}
.event-type-badge.allday { background: #fce7f3; color: #be185d; }
.event-type-badge.timed  { background: #ede9fe; color: #7c3aed; }
.event-preset-badge {
  font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 100px;
  background: var(--bg); color: var(--text-muted); border: 1px solid var(--border);
  text-transform: capitalize;
}

/* ── Preset tiles ── */
.preset-tiles-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px;
}
.preset-tile {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.preset-tile:hover { border-color: #ec4899; box-shadow: 0 2px 8px rgba(236,72,153,.1); }
.preset-tile-loaded { border-color: #16a34a; background: color-mix(in srgb,#16a34a 5%,transparent); }
.preset-tile-icon { font-size: 22px; }
.preset-tile-name { font-size: 13px; font-weight: 700; color: var(--text); }
.preset-tile-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.preset-tile-count { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.preset-tile-btn { margin-top: 8px; width: 100%; }

/* ── Settings version ── */
.settings-version {
  text-align: center; font-size: 11px; color: var(--text-muted);
  padding: 12px 0 4px; letter-spacing: 0.4px; opacity: .7;
}

/* ── Assignee chips (events modal) ── */
.assignee-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 100px;
  padding: 3px 8px 3px 5px; font-size: 12px; color: var(--text); margin: 3px;
}
.chip-avatar {
  width: 18px; height: 18px; border-radius: 50%; background: #6366f1; color: #fff;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chip-remove {
  background: none; border: none; padding: 0; cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; opacity: .7;
}
.chip-remove:hover { opacity: 1; }

/* ── Analytics Dashboard ───────────────────────────────── */
.analytics-dash { padding: 4px 0; }
.analytics-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; flex-wrap: wrap; gap: 16px; }
.analytics-header h2 { font-size: 22px; font-weight: 700; background: linear-gradient(135deg, #6366f1, #a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.analytics-controls { display: flex; gap: 6px; }
.a-period-btn { padding: 7px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text-muted); font-size: 13px; font-family: inherit; cursor: pointer; transition: all .2s; }
.a-period-btn.active { background: rgba(99,102,241,.15); border-color: rgba(99,102,241,.4); color: #a5b4fc; }
.a-period-btn:hover { border-color: var(--text-muted); color: var(--text); }

.a-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 28px; }
.a-kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 22px; position: relative; overflow: hidden; }
.a-kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, #6366f1, transparent); }
.a-kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.a-kpi-value { font-size: 30px; font-weight: 700; color: var(--text); }
.a-kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.a-kpi-change { font-size: 12px; margin-top: 4px; }
.a-kpi-change.up { color: #4ade80; }
.a-kpi-change.down { color: #f87171; }

.a-charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 20px; margin-bottom: 28px; }
.a-chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.a-chart-card h3 { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 14px; }
.a-chart-container { position: relative; height: 250px; }

.a-small-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-bottom: 28px; }
.a-small-chart { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.a-small-chart h3 { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 14px; }
.a-small-chart-container { position: relative; height: 210px; }

.a-table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; margin-bottom: 20px; }
.a-table-card h3 { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 14px; }
.a-table-card table { width: 100%; border-collapse: collapse; }
.a-table-card th { text-align: left; padding: 8px 10px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
.a-table-card td { padding: 8px 10px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,.03); color: var(--text); }
.a-table-card tr:hover td { background: rgba(255,255,255,.02); }

.a-live-dot { width: 8px; height: 8px; background: #4ade80; border-radius: 50%; display: inline-block; animation: aLivePulse 2s infinite; margin-right: 6px; vertical-align: middle; }
@keyframes aLivePulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.a-loading { text-align: center; padding: 80px 0; color: var(--text-muted); font-size: 14px; }

@media (max-width: 600px) {
  .a-charts-grid, .a-small-charts { grid-template-columns: 1fr; }
  .a-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .a-kpi-value { font-size: 22px; }
  .analytics-header { flex-direction: column; align-items: flex-start; }
}
