.global-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  align-self: center;
  padding: 10px 14px;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.page-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.page-header-actions .header-auth-btn {
  min-height: 40px;
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

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

.page-header-card button.global-sync-indicator {
  appearance: none;
  margin: 0;
  font: inherit;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.page-header-card button.global-sync-indicator:hover {
  transform: none;
  filter: brightness(1.03);
}

.page-header-card button.global-sync-indicator:focus-visible {
  outline: 3px solid #0098eb;
  outline-offset: 3px;
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8a8f98;
  box-shadow: 0 0 0 4px rgba(138, 143, 152, 0.13);
}

.global-sync-indicator[data-state="saved"] .sync-dot {
  background: #107c41;
  box-shadow: 0 0 0 4px rgba(16, 124, 65, 0.13);
}

.global-sync-indicator[data-state="saving"] .sync-dot {
  background: #d97706;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.14);
  animation: sync-pulse 1.2s ease-in-out infinite;
}

.global-sync-indicator[data-state="error"] .sync-dot {
  background: #b42318;
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.13);
}

@keyframes sync-pulse {
  50% { opacity: 0.45; }
}

.display-settings {
  position: relative;
}

.display-settings > summary {
  list-style: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  background: var(--surface-2);
  color: inherit;
  cursor: pointer;
  font-weight: 700;
}

.display-settings > summary::-webkit-details-marker {
  display: none;
}

.display-settings > summary::after {
  content: "▾";
  margin-left: 9px;
}

.display-settings[open] > summary::after {
  transform: rotate(180deg);
}

.display-settings-panel {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  left: 0;
  min-width: 245px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  background: var(--surface-card);
  box-shadow: var(--panel-shadow);
}

.display-settings-panel > label {
  font-size: 12px;
  font-weight: 800;
}

.display-settings-panel .notify-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.date-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.date-quick-actions button {
  min-height: 40px;
}

.project-tools {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
}

.project-search {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
}

.quick-tasks {
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 12px;
}

.quick-tasks h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.quick-task-list {
  display: grid;
  gap: 7px;
}

.quick-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.quick-task-start {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-task-favorite {
  min-width: 42px;
  font-size: 18px;
}

.active-timer-dock {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 18px;
  width: min(680px, calc(100vw - 28px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--ui-border);
  border-radius: 18px;
  background: var(--surface-card);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px);
}

.active-timer-dock[hidden] {
  display: none;
}

.active-timer-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-timer-time {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.toast-region {
  position: fixed;
  z-index: 200;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  width: min(390px, calc(100vw - 36px));
}

.active-timer-dock:not([hidden]) ~ .toast-region {
  bottom: 92px;
}

.app-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  background: var(--surface-card);
  box-shadow: var(--panel-shadow);
}

.app-toast[data-tone="error"] {
  border-color: rgba(180, 35, 24, 0.45);
}

.app-toast button {
  flex: 0 0 auto;
}

.managed-modal {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.55);
}

.managed-modal[hidden] {
  display: none;
}

.managed-modal .modal-content {
  position: relative;
  width: min(650px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 24px;
  border-radius: 22px;
  background: var(--surface-card);
  color: inherit;
}

.modal-close-icon {
  position: sticky;
  z-index: 2;
  top: 0;
  float: right;
  min-width: 42px;
  min-height: 42px;
  margin: -8px -8px 4px 12px;
  border-radius: 50%;
  font-size: 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.sync-details-summary {
  display: grid;
  gap: 6px;
  margin: 16px 0 20px;
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  background: var(--surface-2);
}

.sync-details-summary strong,
.sync-details-summary span {
  display: block;
}

.sync-details-summary span,
.sync-details-empty,
.sync-details-privacy-note {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.45;
}

.sync-details-list,
.sync-history-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 20px;
  padding: 0;
  list-style: none;
}

.sync-details-list li,
.sync-history-list li {
  padding: 11px 12px;
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  background: var(--surface-2);
}

.sync-details-list strong,
.sync-history-time {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.sync-history-message {
  line-height: 1.4;
}

.week-review-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.week-review-stat {
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-2);
}

.week-review-stat span {
  display: block;
  margin-bottom: 5px;
  color: var(--text-soft);
  font-size: 12px;
}

.week-review-stat strong {
  font-size: 20px;
}

.week-review-list {
  margin: 0;
  padding-left: 20px;
}

.extra-function-card {
  color: inherit !important;
}

.extra-function-card .extra-desc {
  color: var(--text-soft) !important;
  opacity: 1;
}

input[aria-invalid="true"] {
  border-color: #b42318 !important;
  outline: 2px solid rgba(180, 35, 24, 0.18);
}

@media (max-width: 760px) {
  .page-header-card {
    padding: 14px 16px;
  }

  .page-subtitle {
    display: none;
  }

  .page-kicker {
    margin: 0;
  }

  .global-sync-indicator {
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
  }

  .page-header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .page-header-actions .global-sync-indicator {
    flex: 1 1 100%;
  }

  .page-header-actions .header-auth-btn {
    flex: 1 1 100%;
  }

  .button-container {
    position: static;
    justify-content: stretch;
  }

  .button-container > * {
    flex: 1 1 auto;
  }

  .display-settings-panel {
    position: fixed;
    inset: auto 14px 14px;
  }

  .date-picker input {
    min-width: 0;
    width: 100%;
  }

  .date-quick-actions {
    width: 100%;
    margin-left: 0;
  }

  .date-quick-actions button {
    flex: 1 1 150px;
  }

  .project-group {
    padding: 12px;
  }

  .project-group > h2 {
    font-size: 20px;
  }

  .timer {
    padding: 12px;
  }

  .active-timer-dock {
    bottom: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .active-timer-time {
    grid-column: 1;
  }

  .active-timer-dock button {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .managed-modal {
    align-items: stretch;
    padding: 8px;
  }

  .managed-modal .modal-content {
    max-height: calc(100vh - 16px);
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sync-dot {
    animation: none !important;
  }
}
