:root {
  color-scheme: light;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-2: #cbd5e1;

  --brand-1: #4f46e5;
  --brand-2: #06b6d4;
  --brand-3: #22c55e;

  --prio-high: #ef4444;
  --prio-med: #f59e0b;
  --prio-low: #10b981;

  --q-do: #ef4444;
  --q-schedule: #4f46e5;
  --q-delegate: #f59e0b;
  --q-delete: #10b981;

  --radius: 12px;
  --radius-sm: 10px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 24px;

  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.20);

  --cal-slot: 48px;
  --cal-time-col: 64px;
  --cal-day-min: 140px;
}

/* Force hide elements with hidden attribute */
[hidden] {
  display: none !important;
}

body.dark {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #0f172a;
  --surface-2: #111c33;
  --text: #e5e7eb;
  --muted: rgba(229, 231, 235, 0.65);
  --border: #1f2a44;
  --border-2: #2a3960;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.40);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
  background:
    radial-gradient(900px 420px at 10% 0%, rgba(79, 70, 229, 0.10), transparent 55%),
    radial-gradient(900px 420px at 100% 10%, rgba(6, 182, 212, 0.08), transparent 52%),
    radial-gradient(900px 420px at 50% 100%, rgba(34, 197, 94, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
  max-width: 100vw;
}

body.modalOpen {
  overflow: hidden;
}


.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.sidebar {
  padding: var(--space-4);
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
}

body.dark .sidebar {
  background: rgba(15, 23, 42, 0.65);
}

.sidebarBrand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  cursor: pointer;
}

.sidebarBrand:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
}

.sidebarBrand:active {
  transform: scale(0.98);
}

.brandIcon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  animation: pulse 3s ease-in-out infinite;
  color: #0f172a;
}

body.dark .brandIcon {
  color: #e5e7eb;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

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

.brandName {
  font-family: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans,
    Helvetica, Arial;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 18px;
  color: var(--text);
}

.tagline {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.nav {
  margin-top: var(--space-4);
  display: grid;
  gap: var(--space-2);
}

.navItem {
  text-decoration: none;
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.navItem:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.18);
}

.navItem.isActive {
  background: rgba(79, 70, 229, 0.12);
  border-color: rgba(79, 70, 229, 0.28);
}

.sidebarFooter {
  margin-top: var(--space-4);
}

.content {
  flex: 1;
  padding: var(--space-5);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.view {
  margin-top: var(--space-3);
}

/* Login view: centered */
body[data-view="login"] .content {
  max-width: 860px;
  display: grid;
  grid-template-rows: auto 1fr;
}

body[data-view="login"] .topbar {
  justify-content: center;
}

body[data-view="login"] .topbarBrand {
  margin: 0 auto;
}

body[data-view="login"] .topbarBrandText {
  text-align: center;
}

body[data-view="login"] #viewLogin {
  align-self: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  min-height: 64px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.topbarBrand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Menu Horizontal Desktop */
.topbarNav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  justify-content: center;
  max-width: 600px;
}

.topbarNavItem {
  text-decoration: none;
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 15px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.topbarNavItem:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.18);
  color: var(--primary);
}

.topbarNavItem.isActive {
  background: rgba(79, 70, 229, 0.12);
  border-color: rgba(79, 70, 229, 0.28);
  color: var(--primary);
  font-weight: 600;
}

.topbarBrandIcon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  animation: pulse 3s ease-in-out infinite;
  color: #0f172a;
}

body.dark .topbarBrandIcon {
  color: #e5e7eb;
}

.topbarBrandText {
  display: grid;
  gap: 2px;
}

.topbarBrandName {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans,
    Helvetica, Arial;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 16px;
  color: var(--text);
}

.topbarView {
  font-size: 12px;
  color: var(--muted);
}

.topbarActions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

.btnIcon {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
  width: 40px;
  height: 40px;
}

.btnIcon:hover {
  background: var(--surface);
  border-color: var(--border-2);
}

.btnIcon svg {
  width: 20px;
  height: 20px;
  display: block;
}

#themeToggle .iconSun {
  display: block;
}

#themeToggle .iconMoon {
  display: none;
}

body.dark #themeToggle .iconSun {
  display: none;
}

body.dark #themeToggle .iconMoon {
  display: block;
}

.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  padding: 8px;
  z-index: 1000;
}

.dropdownUserInfo {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  word-break: break-word;
}

.dropdownItem {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropdownItem:hover {
  background: var(--surface-2);
}

.dropdownItemUpgrade {
  appearance: none;
  width: 100%;
  border: 0;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  padding: 12px 16px;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.dropdownItemUpgrade:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.dropdownItemUpgrade:active {
  transform: translateY(0);
}

.dropdownItemUpgrade .dropdownItemIcon {
  width: 20px;
  height: 20px;
  opacity: 1;
  stroke-width: 2;
}

.dropdownItemToggle {
  justify-content: space-between;
}

.dropdownItemLabel {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdownItemIcon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.dropdownItemStatus {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
}

.brandText {
  display: grid;
  gap: 2px;
}





.field {
  display: grid;
  gap: var(--space-1);
}

.field > span {
  font-size: 12px;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

@media (max-width: 720px) {
  input,
  select {
    font-size: 16px;
  }
}

input,
select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

input:disabled,
select:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

input::placeholder {
  color: var(--muted);
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

button {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: var(--border-2);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btnPrimary {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  color: #ffffff;
  border-color: transparent;
  font-weight: 700;
}

.btnPrimary:hover {
  filter: brightness(0.95);
}

.btnGhost {
  background: transparent;
}

.buttons {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  grid-column: 1 / -1;
}

.matrix {
  margin-top: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-1);
}

.cell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  min-height: 180px;
  height: clamp(240px, 34vh, 380px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
}

.cell .list {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

.cell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
  background: var(--border-2);
}

.cell[data-quadrant="DO"]::before {
  background: var(--q-do);
}

.cell[data-quadrant="SCHEDULE"]::before {
  background: var(--q-schedule);
}

.cell[data-quadrant="DELEGATE"]::before {
  background: var(--q-delegate);
}

.cell[data-quadrant="DELETE"]::before {
  background: var(--q-delete);
}

.cell h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.qCount {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
}

.qCountNumber {
  position: absolute;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  z-index: 2;
}

.progressRing {
  transform: rotate(-90deg);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.05));
}

.progressRingBg {
  fill: none;
  stroke: var(--border);
  stroke-width: 3;
}

.progressRingProgress {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  stroke-dasharray: 113.097;
  stroke-dashoffset: 113.097;
}

.cell[data-quadrant="DO"] .progressRingProgress {
  stroke: var(--q-do);
}

.cell[data-quadrant="SCHEDULE"] .progressRingProgress {
  stroke: var(--q-schedule);
}

.cell[data-quadrant="DELEGATE"] .progressRingProgress {
  stroke: var(--q-delegate);
}

.cell[data-quadrant="DELETE"] .progressRingProgress {
  stroke: var(--q-delete);
}

.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5);
  text-align: center;
  opacity: 0.6;
  min-height: 120px;
}

.emptyIcon {
  font-size: 32px;
  line-height: 1;
  filter: grayscale(0.3);
}

.emptyText {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.emptyTitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.emptyHint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.matrixItem {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.35));
  padding: 10px;
  display: grid;
  gap: 8px;
  cursor: grab;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 720px) {
  .matrixItem {
    padding: 12px;
    gap: 10px;
  }
}

.matrixItem:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: rgba(79, 70, 229, 0.3);
}

.matrixItem:active {
  cursor: grabbing;
}

.matrixItem.dragging {
  opacity: 0.5;
  transform: scale(0.95);
  cursor: grabbing;
}

.matrixItem.completing {
  animation: celebrate 0.3s ease-out;
}

@keyframes celebrate {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); opacity: 0.8; }
  100% { transform: scale(0.95); opacity: 0; }
}

@media (prefers-color-scheme: dark) {
  .matrixItem {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  }
}

body.dark .matrixItem {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

body.dark .matrixItem:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.matrixTitle {
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  font-size: 14px;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 720px) {
  .matrixTitle {
    font-size: 16px;
    line-height: 1.3;
  }
}

.matrixTitle .recurrenceIcon {
  font-size: 12px;
  opacity: 0.6;
}

.matrixMetaRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.matrixMeta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.matrixSummary {
  margin-top: 2px;
}

/* Progress ring colors per quadrant */
.cell[data-quadrant="DO"] .progressRingProgress {
  stroke: var(--q-do);
}

.cell[data-quadrant="SCHEDULE"] .progressRingProgress {
  stroke: var(--q-schedule);
}

.cell[data-quadrant="DELEGATE"] .progressRingProgress {
  stroke: var(--q-delegate);
}

.cell[data-quadrant="DELETE"] .progressRingProgress {
  stroke: var(--q-delete);
}

.metaText {
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .metaText {
    font-size: 13px;
  }
}

.countdown {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

@media (max-width: 720px) {
  .countdown {
    font-size: 12px;
    padding: 4px 9px;
  }
}

.countdownUrgent {
  background: rgba(239, 68, 68, 0.12);
  color: rgb(220, 38, 38);
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

.countdownSoon {
  background: rgba(245, 158, 11, 0.12);
  color: rgb(217, 119, 6);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.countdownNormal {
  background: rgba(79, 70, 229, 0.08);
  color: rgba(79, 70, 229, 0.9);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.98); }
}

.prioPill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.03);
  font-size: 10px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .prioPill {
    font-size: 12px;
    padding: 4px 9px;
  }
}

@media (prefers-color-scheme: dark) {
  .prioPill {
    background: rgba(255, 255, 255, 0.03);
  }
}

body.dark .prioPill {
  background: rgba(255, 255, 255, 0.03);
}

body.dark .moveSelect {
  background: rgba(255, 255, 255, 0.03);
}

body.dark .iconBtn {
  color: rgba(229, 231, 235, 0.8);
}

body.dark .iconBtn:hover {
  background: rgba(99, 102, 241, 0.10);
  border-color: rgba(99, 102, 241, 0.18);
}

.prioDot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--border-2);
}

.prioDotHigh {
  background: var(--prio-high);
}

.prioDotMed {
  background: var(--prio-med);
}

.prioDotLow {
  background: var(--prio-low);
}

.matrixActions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.moveSelect {
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.03);
  color: var(--muted);
  padding: 0 8px;
  font-size: 10px;
  max-width: 104px;
}

.moveSelect:focus {
  outline: none;
  box-shadow: var(--ring);
}

@media (prefers-color-scheme: dark) {
  .moveSelect {
    background: rgba(255, 255, 255, 0.03);
  }
}

@media (max-width: 520px) {
  .moveSelect {
    max-width: 92px;
  }
}

.list.dragOver {
  background: rgba(79, 70, 229, 0.05);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.iconBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(15, 23, 42, 0.7);
  transition: all 0.15s ease;
}

.iconBtn:hover {
  background: rgba(79, 70, 229, 0.06);
  border-color: rgba(79, 70, 229, 0.12);
  transform: scale(1.05);
}

.iconBtn:active {
  transform: scale(0.95);
}

.iconBtnSnooze {
  color: rgba(245, 158, 11, 0.8);
}

.iconBtnSnooze:hover {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
  color: rgba(245, 158, 11, 0.95);
}

@media (prefers-color-scheme: dark) {
  .iconBtn {
    color: rgba(229, 231, 235, 0.8);
  }

  .iconBtn:hover {
    background: rgba(99, 102, 241, 0.10);
    border-color: rgba(99, 102, 241, 0.18);
  }
}


.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
}

.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.0);
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  z-index: 30;
}

.fab:hover {
  filter: brightness(0.98);
}

.fab:active {
  transform: translateY(1px);
}

.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 40;
}

@media (prefers-color-scheme: dark) {
  .modalOverlay {
    background: rgba(0, 0, 0, 0.55);
  }
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: var(--space-4);
  z-index: 50;
}

@media (max-width: 720px) {
  .modal {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    padding: var(--space-3);
  }

  .modalHeader h2 {
    font-size: 15px;
  }
}

.modalHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.modalHeader h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.modalForm {
  display: grid;
  gap: var(--space-3);
}

.modalGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.fieldRecurrence {
  grid-column: 1 / -1;
}

.recurrenceInfo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.15);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--brand-1);
  margin-top: var(--space-2);
}

.recurrenceIcon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

body.dark .recurrenceInfo {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.2);
}

/* Search and Filters */
.searchBar {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

.searchIcon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.searchInput {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  transition: all 0.2s;
}

.searchInput:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.searchInput::placeholder {
  color: var(--muted);
}

.searchClear {
  position: absolute;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.searchClear svg {
  width: 16px;
  height: 16px;
}

.searchClear:hover {
  background: var(--surface-2);
  color: var(--text);
}

.filterBar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-2);
  width: 100%;
}

.filterSelect {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.filterSelect:hover {
  border-color: var(--brand-1);
}

.filterSelect:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.searchResults {
  padding: 8px 12px;
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.15);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
}

body.dark .searchResults {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.2);
}

.highlight {
  background: rgba(245, 158, 11, 0.25);
  color: inherit;
  font-weight: 600;
  padding: 1px 2px;
  border-radius: 2px;
}

body.dark .highlight {
  background: rgba(245, 158, 11, 0.35);
}

/* Notes Field */
.fieldNotes {
  grid-column: 1 / -1;
}

.fieldNotes textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  line-height: 1.5;
}

.fieldCounter {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
}

.fieldHint {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

/* Task Details Modal */
.taskDetails {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-top: var(--space-2);
}

.taskDetailsHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.taskDetailsTitle {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  flex: 1;
}

.taskDetailsMeta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.taskDetailsBadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.taskDetailsNotes {
  line-height: 1.6;
  color: var(--text);
}

.taskDetailsNotes strong {
  font-weight: 700;
}

.taskDetailsNotes em {
  font-style: italic;
}

.taskDetailsNotes ul {
  margin: 8px 0;
  padding-left: 20px;
}

.taskDetailsNotes li {
  margin: 4px 0;
}

.taskDetailsEmpty {
  color: var(--muted);
  font-style: italic;
  font-size: 14px;
}

.btnExpand {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-1);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  transition: opacity 0.15s;
}

.btnExpand:hover {
  opacity: 0.7;
}

.btnExpand svg {
  width: 14px;
  height: 14px;
}

.panelHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.panelHeaderStack {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.panel h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.cell h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.loginPanel {
  width: min(560px, 100%);
  margin: 28px auto 0;
}

.loginHero {
  display: grid;
  gap: 4px;
  margin-bottom: var(--space-3);
}

.loginPanel h2 {
  font-size: 18px;
}

.authFields {
  display: grid;
  gap: var(--space-3);
}

.fieldHint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.authActions {
  margin-top: var(--space-3);
  display: grid;
  gap: var(--space-2);
}

.btnFull {
  width: 100%;
}

.authDivider {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
  font-size: 12px;
  user-select: none;
}

.authDivider::before,
.authDivider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.loginUserRow {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.authBlock {
  margin-top: var(--space-2);
  display: grid;
  gap: var(--space-2);
}

.authRow {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: var(--space-2);
  align-items: center;
}

.authStatus {
  font-size: 12px;
  color: var(--muted);
}

.authUserRow {
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.authUserText {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.tasksAccountHint {
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--muted);
}


.taskListRoot {
  display: grid;
  gap: var(--space-3);
}

.dayGroup {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.dayHeader {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.dayHeader strong {
  font-size: 13px;
}

.dayHeader span {
  color: var(--muted);
  font-size: 12px;
}

.taskList {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

@media (max-width: 720px) {
  .taskList {
    gap: 8px;
  }
}

.item {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  max-width: 100%;
  overflow: hidden;
}

.taskRow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.timePill {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .timePill {
    font-size: 13px;
    padding: 5px 10px;
  }
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .badge {
    font-size: 12px;
    padding: 5px 10px;
  }
}

.badgeHigh {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: var(--prio-high);
}

.badgeMed {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
  color: var(--prio-med);
}

.badgeLow {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
  color: var(--prio-low);
}

.itemTitle {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  font-weight: 600;
}

@media (max-width: 720px) {
  .itemTitle {
    font-size: 16px;
  }
}

.itemCompleted {
  opacity: 0.72;
}

.itemCompleted .itemTitle {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.itemActions {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .itemActions {
    gap: var(--space-2);
  }
  
  .itemActions button {
    font-size: 14px;
    padding: 8px 12px;
  }
}

.btnEdit {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.btnEdit:hover {
  border-color: var(--brand-1);
  background: rgba(79, 70, 229, 0.05);
}

.btnEdit svg {
  width: 14px;
  height: 14px;
}

.empty {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  padding: 12px;
  border-radius: var(--radius-sm);
}

.calendar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  max-height: 72vh;
  max-height: 72dvh;
  overscroll-behavior: contain;
}

/* Mobile month calendar (Google Agenda-like) */
.calendar.calMobileMonth {
  max-height: none;
  overflow: visible;
  overflow-x: hidden;
  border: 0;
  border-radius: 0;
}

.calMonthPager {
  display: block;
  overflow: hidden;
  max-width: 100%;
  width: 100%;
  touch-action: pan-y;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.calMonthPage {
  padding: 12px;
  max-width: 100%;
  overflow: hidden;
}

.calMonthHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.calMonthTitle {
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: capitalize;
  text-align: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calWeekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
  max-width: 100%;
}

.calWeekday {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  text-transform: lowercase;
}

.calMonthGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-width: 100%;
}

.calDayCell {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 6px;
  min-height: 42px;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  position: relative;
}

.calDayCell:active {
  transform: translateY(1px);
}

.calDayNum {
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
}

.calDayCell.isOtherMonth {
  opacity: 0.45;
}

.calDayCell.isToday {
  border-color: var(--brand-1);
}

.calDayCell.isSelected {
  background: var(--surface);
  border-color: var(--brand-1);
}

.calDayDot {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--brand-1);
}

.calSelected {
  margin-top: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.calHeader {
  display: grid;
  grid-template-columns: var(--cal-time-col) repeat(7, minmax(var(--cal-day-min), 1fr));
  min-width: calc(var(--cal-time-col) + (7 * var(--cal-day-min)));
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 6;
}

.calHeaderCell {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-right: 1px solid var(--border);
  background: var(--surface-2);
}

.calHeaderCell:first-child {
  position: -webkit-sticky;
  position: sticky;
  left: 0;
  z-index: 7;
}

.calHeaderCell strong {
  display: block;
  color: var(--text);
  font-size: 12px;
}

.calGrid {
  display: grid;
  grid-template-columns: var(--cal-time-col) repeat(7, minmax(var(--cal-day-min), 1fr));
  min-width: calc(var(--cal-time-col) + (7 * var(--cal-day-min)));
}

.timeCol {
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  position: -webkit-sticky;
  position: sticky;
  left: 0;
  z-index: 5;
}

.timeLabel {
  height: var(--cal-slot);
  padding: 0 10px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.dayCol {
  position: relative;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(to bottom, var(--border) 1px, transparent 1px) 0 0 / 100% var(--cal-slot);
  min-height: calc(var(--cal-slot) * 16);
}

.event {
  position: absolute;
  left: 8px;
  right: 8px;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.eventTitle {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.eventMeta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.eventHigh {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.10);
}

.eventMed {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.10);
}

.eventLow {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.10);
}

@media (max-width: 720px) {
  :root {
    --cal-slot: 40px;
    --cal-time-col: 56px;
    --cal-day-min: 150px;
  }

  .filterBar {
    grid-template-columns: 1fr 1fr;
  }

  .searchInput {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .buttons {
    justify-content: stretch;
  }
  .buttons > button {
    flex: 1;
  }
  .matrix {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .cell {
    height: auto;
    min-height: 200px;
    max-height: 400px;
    padding: var(--space-3);
    gap: var(--space-2);
  }

  .topbar {
    padding: var(--space-2) var(--space-3);
    min-height: 56px;
    gap: var(--space-2);
  }
  
  .topbarNav {
    display: none; /* Hide horizontal menu on mobile */
  }

  .topbarBrandName {
    font-size: 15px;
  }

  .topbarActions {
    gap: var(--space-1);
  }

  .btnIcon {
    width: 36px;
    height: 36px;
    padding: 6px;
  }

  .btnIcon svg {
    width: 18px;
    height: 18px;
  }

  .dropdown {
    right: 0;
    left: auto;
    min-width: 200px;
    max-width: calc(100vw - 32px);
  }

  .content {
    padding: 0;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .view {
    padding: var(--space-2) var(--space-3);
  }

  /* Login view: center brand on mobile */
  body[data-view="login"] .topbar {
    justify-content: center;
  }

  body[data-view="login"] .topbarBrand {
    margin: 0 auto;
  }

  body[data-view="login"] .topbarBrandText {
    text-align: center;
  }

  body[data-view="login"] .topbarActions {
    position: absolute;
    right: var(--space-3);
  }

  .fab {
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .modalGrid {
    grid-template-columns: 1fr;
  }

  .authRow {
    grid-template-columns: 1fr;
  }

  .authRow > button {
    width: 100%;
  }

  button,
  .btnEdit {
    min-height: 44px;
    padding: 10px 12px;
  }

  .itemActions button {
    font-size: 13px;
  }

  .calHeaderCell {
    padding: 8px 10px;
    font-size: 11px;
  }

  .calHeaderCell strong {
    font-size: 11px;
  }

  .timeLabel {
    padding: 0 8px;
    font-size: 10px;
  }

  .event {
    left: 6px;
    right: 6px;
    padding: 6px 8px;
  }

  .eventTitle {
    font-size: 11px;
  }

  .eventMeta {
    font-size: 10px;
  }
}

@media (max-width: 420px) {
  :root {
    --cal-slot: 36px;
    --cal-time-col: 52px;
    --cal-day-min: 140px;
  }

  .calHeaderCell {
    padding: 8px 8px;
  }

  .timeLabel {
    padding: 0 6px;
  }
}

@media (max-width: 360px) {
  :root {
    --cal-slot: 34px;
    --cal-time-col: 48px;
    --cal-day-min: 132px;
  }

  .topbar {
    padding: var(--space-2);
  }

  .topbarBrandName {
    font-size: 14px;
  }

  .btnIcon {
    width: 32px;
    height: 32px;
    padding: 5px;
  }

  .btnIcon svg {
    width: 16px;
    height: 16px;
  }

  .calMonthPage {
    padding: 10px;
  }

  .calWeekdays {
    gap: 5px;
  }

  .calMonthGrid {
    gap: 5px;
  }

  .calDayCell {
    border-radius: 10px;
    padding: 4px;
    min-height: 36px;
  }

  .calDayNum {
    font-size: 12px;
  }

  .calWeekday {
    font-size: 10px;
  }

  h2 {
    font-size: 18px;
  }

  .modal {
    width: calc(100vw - 16px);
    padding: var(--space-2);
  }
}

.bottomNav {
  display: none;
}

@media (max-width: 720px) {
  .bottomNav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px;
    gap: 8px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    z-index: 20;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  body.dark .bottomNav {
    background: rgba(15, 23, 42, 0.85);
  }

  .bottomNavItem {
    text-decoration: none;
    color: var(--text);
    text-align: center;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    display: grid;
    place-items: center;
    min-height: 44px;
  }

  .bottomNavItem.isActive {
    border-color: rgba(79, 70, 229, 0.35);
    background: rgba(79, 70, 229, 0.10);
  }

  .navIcon {
    width: 22px;
    height: 22px;
    color: rgba(15, 23, 42, 0.85);
  }
}

@media (max-width: 720px) and (prefers-color-scheme: dark) {
  .bottomNav {
    background: rgba(15, 23, 42, 0.8);
  }

  .navIcon {
    color: rgba(229, 231, 235, 0.9);
  }
}

/* Mobile UX Enhancements - Larger text, better spacing, improved readability */
@media (max-width: 720px) {
  /* Increase font sizes for better legibility */
  .matrixTitle {
    font-size: 16px !important;
    line-height: 1.3;
  }

  .itemTitle {
    font-size: 16px !important;
  }

  .cellTitle {
    font-size: 15px !important;
  }

  .metaText {
    font-size: 13px !important;
  }

  .countdown {
    font-size: 12px !important;
    padding: 4px 9px;
  }

  .prioPill {
    font-size: 12px !important;
    padding: 4px 9px;
  }

  .timePill {
    font-size: 13px !important;
    padding: 5px 10px;
  }

  .badge {
    font-size: 12px !important;
    padding: 5px 10px;
  }

  /* Optimize spacing and density */
  .matrix {
    gap: 10px !important;
  }

  .cell {
    height: auto !important;
    min-height: 200px;
    max-height: 420px;
    padding: 14px !important;
    gap: 10px !important;
  }

  .matrixItem {
    padding: 12px !important;
    gap: 10px !important;
  }

  .view {
    padding: 10px 14px !important;
  }

  .taskList {
    gap: 8px !important;
  }

  .item {
    padding: 14px !important;
  }

  .itemActions {
    gap: 10px !important;
  }

  .itemActions button {
    font-size: 14px !important;
    padding: 8px 12px !important;
  }

  /* Larger touch targets */
  .btnEdit,
  .btnIcon {
    min-width: 44px;
    min-height: 44px;
  }

  /* Better empty states */
  .emptyIcon {
    font-size: 40px !important;
  }

  .emptyTitle {
    font-size: 15px !important;
  }

  .emptyHint {
    font-size: 13px !important;
  }

  /* Compact header - reduce wasted vertical space */
  .topbar {
    padding: 8px 14px !important;
    min-height: 48px !important;
    margin-bottom: 0 !important;
  }

  .topbarBrandName {
    font-size: 16px !important;
  }

  .topbarView {
    font-size: 12px !important;
  }

  .loginHero {
    margin-bottom: 8px !important;
    gap: 2px !important;
  }

  .loginHero h2 {
    font-size: 22px !important;
    font-weight: 800;
    margin: 0;
  }

  .loginHero .subtitle {
    font-size: 13px !important;
    line-height: 1.4;
  }

  .loginHero .matrixSummary {
    font-size: 12px !important;
    margin-top: 2px;
  }

  .loginPanel h2 {
    font-size: 22px !important;
  }

  /* Reduce panel padding */
  .panel {
    padding: 14px !important;
  }

  /* Mobile brand adjustments */
  .topbarBrandIcon {
    width: 28px !important;
    height: 28px !important;
  }

  .topbarBrandName {
    font-size: 15px !important;
  }

  .topbarView {
    font-size: 11px !important;
  }

  .brandIcon {
    width: 36px !important;
    height: 36px !important;
  }

  .brandName {
    font-size: 16px !important;
  }

  .tagline {
    font-size: 10px !important;
  }
}

/* ============= ONBOARDING & TOUR ============= */

/* Welcome Modal */
.welcomeModal {
  max-width: 640px;
  width: calc(100vw - 32px);
}

.welcomeContent {
  display: grid;
  gap: var(--space-4);
}

.welcomeText {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

.welcomeFeatures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

.welcomeFeature {
  text-align: center;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: all 0.2s;
}

.welcomeFeature:hover {
  border-color: var(--brand-1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.welcomeIcon {
  font-size: 32px;
  margin-bottom: var(--space-2);
  line-height: 1;
}

.welcomeFeature h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--text);
}

.welcomeFeature p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.welcomeActions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* Tour Tooltip */
.tourTooltip {
  position: fixed;
  z-index: 1000;
  background: var(--surface);
  border: 2px solid var(--brand-1);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(79, 70, 229, 0.25), var(--shadow);
  padding: var(--space-4);
  max-width: 360px;
  width: calc(100vw - 32px);
  animation: tourFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tourFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.tourClose {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}

.tourClose:hover {
  background: var(--border);
  color: var(--text);
  transform: rotate(90deg);
}

.tourContent {
  display: grid;
  gap: var(--space-3);
}

.tourStep {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tourStepNumber {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-1);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.tourTitle {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  line-height: 1.3;
}

.tourText {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

.tourActions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

.tourHighlight {
  position: relative;
  z-index: 999;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.4), 0 0 0 9999px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius);
  animation: tourPulse 2s ease-in-out infinite;
}

@keyframes tourPulse {
  0%, 100% { 
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.4), 0 0 0 9999px rgba(0, 0, 0, 0.5);
  }
  50% { 
    box-shadow: 0 0 0 8px rgba(79, 70, 229, 0.6), 0 0 0 9999px rgba(0, 0, 0, 0.5);
  }
}

@media (max-width: 720px) {
  .welcomeModal {
    max-height: calc(100dvh - 48px);
  }

  .welcomeFeatures {
    grid-template-columns: repeat(2, 1fr);
  }

  .welcomeActions {
    flex-direction: column;
  }

  .welcomeActions button {
    width: 100%;
  }

  .tourTooltip {
    bottom: calc(64px + env(safe-area-inset-bottom) + 16px) !important;
    left: 16px !important;
    right: 16px !important;
    top: auto !important;
    transform: none !important;
  }
}

/* ============= ANALYTICS DASHBOARD ============= */

.analyticsSection {
  background: var(--bgSecondary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.analyticsHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.analyticsHeader h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.btnSmall {
  padding: 4px 12px;
  font-size: 24px;
  line-height: 1;
  min-height: 32px;
}

.analyticsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.analyticsCard {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.analyticsCard:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.analyticsCardFull {
  grid-column: 1 / -1;
}

.analyticsCardHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.analyticsIcon {
  font-size: 24px;
  line-height: 1;
}

.analyticsCardHeader h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--textSecondary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.analyticsMetric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analyticsValue {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.analyticsLabel {
  font-size: 12px;
  color: var(--textSecondary);
  line-height: 1.4;
}

.analyticsProgress {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.analyticsProgressBar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primaryLight));
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chart Styles */
.analyticsChart {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chartBar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chartBarLabel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.chartQuadrant {
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.chartQuadrantDO {
  background: rgba(220, 38, 38, 0.1);
  color: rgb(220, 38, 38);
}

.chartQuadrantSCHEDULE {
  background: rgba(59, 130, 246, 0.1);
  color: rgb(59, 130, 246);
}

.chartQuadrantDELEGATE {
  background: rgba(234, 179, 8, 0.1);
  color: rgb(234, 179, 8);
}

.chartQuadrantDELETE {
  background: rgba(107, 114, 128, 0.1);
  color: rgb(107, 114, 128);
}

.chartCount {
  font-weight: 700;
  color: var(--text);
  font-size: 16px;
}

.chartBarTrack {
  width: 100%;
  height: 32px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.chartBarFill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.chartBarDO {
  background: linear-gradient(90deg, rgb(220, 38, 38), rgb(185, 28, 28));
}

.chartBarSCHEDULE {
  background: linear-gradient(90deg, rgb(59, 130, 246), rgb(37, 99, 235));
}

.chartBarDELEGATE {
  background: linear-gradient(90deg, rgb(234, 179, 8), rgb(202, 138, 4));
}

.chartBarDELETE {
  background: linear-gradient(90deg, rgb(107, 114, 128), rgb(75, 85, 99));
}

@media (max-width: 720px) {
  .analyticsSection {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 8px;
  }

  .analyticsHeader h2 {
    font-size: 18px;
  }

  .analyticsGrid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }

  .analyticsCard {
    padding: 14px;
  }

  .analyticsCardHeader h3 {
    font-size: 11px;
  }

  .analyticsIcon {
    font-size: 20px;
  }

  .analyticsValue {
    font-size: 28px;
  }

  .analyticsLabel {
    font-size: 11px;
  }

  .chartQuadrant {
    font-size: 12px;
    padding: 3px 8px;
  }

  .chartCount {
    font-size: 14px;
  }

  .chartBarTrack {
    height: 28px;
  }

  .chartBarFill {
    font-size: 13px;
    padding-right: 10px;
  }
}

/* ============= HELP MODAL ============= */

.helpModal {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.helpContent {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.helpSection {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.helpSection h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin: 0;
}

.helpSection p {
  margin: 0;
  line-height: 1.6;
  color: var(--text);
}

.helpSection ul {
  margin: 8px 0 0 0;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.helpSection li {
  line-height: 1.6;
  color: var(--textSecondary);
}

.helpSection code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
  color: var(--primary);
}

.helpActions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.helpActions button {
  flex: 1;
}

@media (max-width: 720px) {
  .helpModal {
    max-width: 100%;
    max-height: calc(100dvh - 48px);
    margin: 24px 16px;
  }

  .helpContent {
    padding: 16px;
    gap: 20px;
  }

  .helpSection h3 {
    font-size: 15px;
  }

  .helpActions {
    flex-direction: column;
  }

  .helpActions button {
    width: 100%;
  }
}

/* ============= FEEDBACK SYSTEM ============= */

/* Toast Notifications */
.toastContainer {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), var(--shadow);
  padding: 14px 18px;
  min-width: 300px;
  max-width: 420px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.toastExit {
  animation: toastSlideOut 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(120%);
  }
}

.toastIcon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.toastContent {
  flex: 1;
  min-width: 0;
}

.toastTitle {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 2px 0;
  line-height: 1.3;
}

.toastMessage {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  margin: 0;
}

.toastClose {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.toastClose:hover {
  background: var(--surface-2);
  color: var(--text);
}

.toastProgress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
  animation: toastProgressBar 4s linear forwards;
}

@keyframes toastProgressBar {
  from { width: 100%; }
  to { width: 0%; }
}

.toastSuccess {
  border-left: 4px solid var(--brand-3);
}

.toastError {
  border-left: 4px solid var(--prio-high);
}

.toastWarning {
  border-left: 4px solid var(--prio-med);
}

.toastInfo {
  border-left: 4px solid var(--brand-1);
}

/* Loading Overlay */
.loadingOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: grid;
  place-items: center;
  animation: fadeIn 0.2s;
}

.loadingOverlay[hidden] {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.loadingSpinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface);
  padding: var(--space-5);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--brand-1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loadingText {
  font-size: 14px;
  color: var(--text);
  margin: 0;
  font-weight: 600;
}

/* Confirm Dialog */
/* Paywall Modal */
.paywallModal {
  max-width: 800px;
  width: calc(100vw - 32px);
}

.paywallMessage {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 var(--space-6) 0;
  text-align: center;
}

.paywallPlans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.paywallPlan {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
}

.paywallPlanPro {
  border: 2px solid var(--primary);
  background: linear-gradient(135deg, var(--surface-2) 0%, rgba(99, 102, 241, 0.05) 100%);
}

.paywallBadge {
  position: absolute;
  top: -12px;
  right: var(--space-4);
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.paywallPlanHeader {
  margin-bottom: var(--space-4);
  text-align: center;
}

.paywallPlanHeader h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--space-2) 0;
}

.paywallPrice {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  margin: var(--space-2) 0;
}

.paywallPrice span {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
}

.paywallFeatures {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0;
}

.paywallFeatures li {
  padding: var(--space-2) 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.paywallFeatures li::before {
  content: '';
  flex-shrink: 0;
}

.paywallUpgradeBtn {
  width: 100%;
  margin-top: var(--space-4);
  font-size: 16px;
  padding: var(--space-3) var(--space-4);
}

/* Checkout Modal */
.checkoutModal {
  max-width: 600px;
  width: calc(100vw - 32px);
}

.checkoutSummary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}

.checkoutSummary h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-3) 0;
}

.checkoutItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  font-size: 15px;
  color: var(--text);
}

.checkoutTotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  margin-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.checkoutNote {
  font-size: 13px;
  color: var(--text-secondary);
  margin: var(--space-2) 0 0 0;
  text-align: center;
}

.checkoutForm {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.formRow {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-3);
}

.checkoutSubmit {
  margin-top: var(--space-2);
  font-size: 16px;
  padding: var(--space-3) var(--space-4);
}

/* Subscription Modal */
.subscriptionModal {
  max-width: 700px;
  width: calc(100vw - 32px);
}

.subscriptionStatus {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  border: 1px solid var(--border);
}

.subscriptionStatusTrial {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, rgba(251, 191, 36, 0.05) 100%);
  border-color: rgba(251, 191, 36, 0.3);
}

.subscriptionStatusPro {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
  border-color: rgba(99, 102, 241, 0.3);
}

.subscriptionStatusExpired {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
  border-color: rgba(239, 68, 68, 0.3);
}

.subscriptionStatusCancelled {
  background: linear-gradient(135deg, rgba(156, 163, 175, 0.1) 0%, rgba(156, 163, 175, 0.05) 100%);
  border-color: rgba(156, 163, 175, 0.3);
}

.subscriptionStatusFree {
  background: var(--surface-2);
}

.subscriptionStatusIcon {
  font-size: 32px;
  flex-shrink: 0;
}

.subscriptionStatusText strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

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

.subscriptionDetails {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.subscriptionInfo {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.subscriptionInfoItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.subscriptionLabel {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.subscriptionValue {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.subscriptionValuePro {
  color: var(--primary);
}

.subscriptionLimits h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-3) 0;
}

.subscriptionLimitItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  font-size: 14px;
  color: var(--text);
}

.subscriptionLimitValue {
  font-weight: 600;
  color: var(--text);
}

.subscriptionLimitWarning {
  color: var(--prio-high);
}

.subscriptionLimitBlocked {
  color: var(--text-secondary);
}

.subscriptionActions {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.subscriptionNote {
  font-size: 14px;
  color: var(--text-secondary);
  margin: var(--space-3) 0 0 0;
  text-align: center;
}

/* Profile Badge */
.profilePlanBadge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: var(--space-2);
}

.profilePlanBadgeTrial {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
}

.profilePlanBadgePro {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
}

.dropdownUserInfo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

/* Trial Countdown */
.trialCountdown {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: rgba(251, 191, 36, 0.1);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}

.trialCountdownIcon {
  width: 18px;
  height: 18px;
  color: #f59e0b;
  flex-shrink: 0;
}

.trialCountdown strong {
  color: #f59e0b;
  font-weight: 700;
}

/* Trial Alert Banner */
.trialBanner {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.95) 0%, rgba(245, 158, 11, 0.95) 100%);
  color: white;
  padding: var(--space-3) var(--space-4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 64px;
  z-index: 998;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.trialBannerContent {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 1200px;
  margin: 0 auto;
}

.trialBannerIcon {
  font-size: 28px;
  flex-shrink: 0;
}

.trialBannerText {
  flex: 1;
  min-width: 0;
}

.trialBannerText strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.trialBannerText p {
  font-size: 14px;
  opacity: 0.95;
  margin: 0;
}

.trialBannerBtn {
  flex-shrink: 0;
  background: white;
  color: #f59e0b;
  border: none;
  padding: var(--space-2) var(--space-4);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.trialBannerBtn:hover {
  background: rgba(255, 255, 255, 0.9);
  color: #d97706;
}

.trialBannerClose {
  background: transparent;
  border: none;
  color: white;
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}

.trialBannerClose:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* FAB Limit Badge */
.fabLimitBadge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.fabLimitBadgeWarning {
  background: #f59e0b;
}

.fabLimitBadgeDanger {
  background: var(--prio-high);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Mobile adjustments for trial banner */
@media (max-width: 640px) {
  .trialBanner {
    padding: var(--space-2) var(--space-3);
    top: 56px;
  }
  
  .trialBannerContent {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  
  .trialBannerIcon {
    font-size: 24px;
  }
  
  .trialBannerText strong {
    font-size: 14px;
  }
  
  .trialBannerText p {
    font-size: 13px;
  }
  
  .trialBannerBtn {
    width: 100%;
    order: 3;
    flex-basis: 100%;
  }
  
  .trialBannerClose {
    position: absolute;
    top: 8px;
    right: 8px;
  }
}

/* Feature PRO Lock Overlay */
.featureProLock {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--radius-lg);
}

body.dark .featureProLock {
  background: rgba(15, 23, 42, 0.95);
}

.featureProLockContent {
  text-align: center;
  max-width: 400px;
  padding: var(--space-6);
}

.featureProLockIcon {
  font-size: 64px;
  margin-bottom: var(--space-4);
  animation: lockShake 0.5s ease-in-out;
}

@keyframes lockShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

.featureProLockContent h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--space-2) 0;
}

.featureProLockContent p {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 var(--space-5) 0;
  line-height: 1.5;
}

.featureProLockContent .btnPrimary {
  padding: var(--space-3) var(--space-5);
  font-size: 16px;
  font-weight: 600;
}

/* PRO Badges in Navigation */
.navProBadge,
.dropdownProBadge {
  display: inline-block;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: var(--space-2);
  vertical-align: middle;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.navItem .navProBadge {
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.navItem:hover .navProBadge {
  opacity: 1;
}

.dropdownProBadge {
  font-size: 8px;
  padding: 2px 5px;
  margin-left: auto;
}

/* Tooltip for PRO features */
[data-pro-feature] {
  position: relative;
}

[data-pro-feature]:not(.isActive):hover::after {
  content: "Feature PRO";
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  pointer-events: none;
}

/* Plans Comparison Modal */
.plansComparisonModal {
  max-width: 900px;
  width: calc(100vw - 32px);
}

.plansComparisonGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}

.planCard {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.planCard:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.planCardPro {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--surface-2) 0%, rgba(99, 102, 241, 0.05) 100%);
}

.planCardBadge {
  position: absolute;
  top: -12px;
  right: var(--space-4);
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.planCardHeader {
  text-align: center;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

.planCardHeader h3 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--space-3) 0;
}

.planCardPrice {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.planCardAmount {
  font-size: 42px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

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

.planCardFeatures {
  list-style: none;
  padding: 0;
  margin: 0;
}

.planFeature {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  font-size: 15px;
  line-height: 1.5;
}

.planFeatureIcon {
  font-weight: 700;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.planFeatureIncluded .planFeatureIcon {
  color: #10b981;
}

.planFeatureExcluded {
  opacity: 0.5;
}

.planFeatureExcluded .planFeatureIcon {
  color: var(--text-secondary);
}

.planFeaturePro {
  font-weight: 600;
  color: var(--primary);
}

.planCardBtn {
  width: 100%;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  font-size: 16px;
  font-weight: 600;
}

.plansNote {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin: var(--space-4) 0 0 0;
  padding: var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-md);
}

.plansNote strong {
  color: var(--primary);
}

/* Cancel Subscription Modal */
.cancelModal {
  max-width: 600px;
  width: calc(100vw - 32px);
}

.cancelWarning {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.cancelWarningIcon {
  font-size: 32px;
  flex-shrink: 0;
}

.cancelWarningText h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-2) 0;
}

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

.cancelFeaturesList {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4) 0;
}

.cancelFeaturesList li {
  padding: var(--space-2) var(--space-3);
  font-size: 15px;
  color: var(--text);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.cancelNote {
  padding: var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.cancelNote p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

.cancelNote strong {
  color: var(--text);
}

.cancelActions {
  display: flex;
  gap: var(--space-3);
  flex-direction: column;
}

.cancelDangerBtn {
  color: var(--prio-high);
  border-color: var(--prio-high);
}

.cancelDangerBtn:hover {
  background: var(--prio-high);
  color: white;
}

/* Subscription Footer */
.subscriptionFooter {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  text-align: center;
}

.btnLink {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: var(--space-2);
  transition: opacity 0.2s ease;
}

.btnLink:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.subscriptionActiveBox {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: center;
}

.subscriptionCancelledBox {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08) 0%, rgba(251, 191, 36, 0.03) 100%);
  border-radius: var(--radius-md);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.subscriptionNoteSmall {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
  line-height: 1.5;
}

.btnSmall {
  font-size: 13px;
  padding: var(--space-2) var(--space-3);
}

@media (max-width: 768px) {
  .plansComparisonGrid {
    grid-template-columns: 1fr;
  }
  
  .planCardAmount {
    font-size: 36px;
  }
  
  .cancelActions {
    flex-direction: column-reverse;
  }
}

.confirmDialog {
  max-width: 480px;
  width: calc(100vw - 32px);
}

.confirmMessage {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

.confirmActions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  margin-top: var(--space-4);
}

.confirmDanger {
  background: var(--prio-high);
  border-color: var(--prio-high);
}

.confirmDanger:hover {
  filter: brightness(0.9);
}

/* Loading Skeletons */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--border) 50%,
    var(--surface-2) 75%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeletonText {
  height: 16px;
  margin: 8px 0;
}

.skeletonTitle {
  height: 20px;
  width: 70%;
  margin-bottom: 12px;
}

.skeletonCard {
  height: 120px;
  margin-bottom: 12px;
}

/* Sync Indicator */
.syncIndicator {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  animation: syncSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes syncSlideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.syncIcon {
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
}

.syncSuccess .syncIcon {
  animation: none;
}

/* Transition animations */
.fadeIn {
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.slideUp {
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.scaleIn {
  animation: scaleIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 720px) {
  .toastContainer {
    top: auto;
    bottom: calc(64px + env(safe-area-inset-bottom) + 16px);
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: 0;
    max-width: 100%;
  }

  .syncIndicator {
    left: 16px;
    right: 16px;
    transform: none;
    justify-content: center;
  }

  .confirmActions {
    flex-direction: column;
  }

  .confirmActions button {
    width: 100%;
  }
}

/* ============= DESKTOP OPTIMIZATIONS ============= */
@media (min-width: 721px) {
  /* Ensure topbar navigation is visible on desktop */
  .topbarNav {
    display: flex !important;
  }
  
  /* Hide bottom navigation on desktop */
  .bottomNav {
    display: none !important;
  }
  
  /* Better FAB positioning for desktop */
  .fab {
    right: 40px;
    bottom: 40px;
    width: 60px;
    height: 60px;
    font-size: 28px;
  }
  
  /* Improve content max-width for readability on large screens */
  .content {
    max-width: 1400px;
    margin: 0 auto;
  }
  
  /* Matrix grid better spacing on desktop */
  .matrixGrid {
    gap: var(--space-4);
    padding: var(--space-5);
  }
  
  /* Task items more compact on desktop */
  .item {
    padding: var(--space-3);
  }
  
  /* Modal better centered on desktop */
  .modal {
    max-width: 600px;
  }
}

@media (min-width: 1024px) {
  /* Large desktop optimizations */
  .topbar {
    padding: var(--space-3) var(--space-8);
  }
  
  .matrixGrid {
    gap: var(--space-5);
    padding: var(--space-6) var(--space-8);
  }
  
  /* Better use of wide screens */
  .content {
    max-width: 1600px;
  }
  
  /* Larger modals on big screens */
  .modal {
    max-width: 720px;
  }
}

@media (min-width: 1440px) {
  /* Ultra-wide desktop */
  .content {
    max-width: 1800px;
  }
  
  .matrixGrid {
    padding: var(--space-6) 10%;
  }
}
