* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Themes: each one sets the same list of colours, fonts and shapes */
[data-theme="feminine"] {
  --bg: #fdf6f4;
  --surface: #fff;
  --sidebar-bg: #fff;
  --border: #f3dfe0;
  --text: #5a3f47;
  --text-muted: #a1838a;
  --topbar-bg: #fff;
  --topbar-border: #f3dfe0;
  --logo-color: #c06c84;
  --heading-color: #c06c84;
  --plan-task: #d77a93;
  --plan-meeting: #9b6fb5;
  --plan-plan: #e8a87c;
  --plan-other: #7fb7a4;
  --logo-style: italic;
  --logo-case: none;
  --logo-spacing: 0;
  --nav-text: #9b7f86;
  --nav-hover-bg: #fdf0f2;
  --nav-active-bg: #fbe4e8;
  --nav-active-text: #b0566f;
  --accent: #d77a93;
  --button-bg: #d77a93;
  --button-hover: #c4627d;
  --button-text: #fff;
  --button-border: transparent;
  --stop-bg: #a14e67;
  --stop-hover: #8a3f56;
  --radius: 14px;
  --button-radius: 22px;
  --shadow: 0 2px 10px rgba(192, 108, 132, 0.12);
  --font-body: "Nunito", sans-serif;
  --font-heading: "Playfair Display", serif;
  --font-numbers: "Nunito", sans-serif;
  --numbers-weight: 700;
}

[data-theme="old-money"] {
  --bg: #f6f1e6;
  --surface: #fffdf8;
  --sidebar-bg: #1b2a47;
  --border: #ddd0ae;
  --text: #1f2a3c;
  --text-muted: #7a7462;
  --topbar-bg: #14213a;
  --topbar-border: #b89b5e;
  --logo-color: #d4b876;
  --heading-color: #14213a;
  --plan-task: #b89b5e;
  --plan-meeting: #6e1f2b;
  --plan-plan: #2f5d50;
  --plan-other: #7a7462;
  --logo-style: normal;
  --logo-case: uppercase;
  --logo-spacing: 3px;
  --nav-text: #b9c0cf;
  --nav-hover-bg: #22335a;
  --nav-active-bg: #22335a;
  --nav-active-text: #f6f1e6;
  --accent: #b89b5e;
  --button-bg: #14213a;
  --button-hover: #22335a;
  --button-text: #f6f1e6;
  --button-border: #b89b5e;
  --stop-bg: #6e1f2b;
  --stop-hover: #571822;
  --radius: 0;
  --button-radius: 0;
  --shadow: none;
  --font-body: "Lato", sans-serif;
  --font-heading: "Bodoni Moda", serif;
  --font-numbers: "Bodoni Moda", serif;
  --numbers-weight: 800;
}

[data-theme="neutral"] {
  --bg: #f3f1ea;
  --surface: #fff;
  --sidebar-bg: #e7e5da;
  --border: #dcdccd;
  --text: #2f3527;
  --text-muted: #7d826f;
  --topbar-bg: #4b5a32;
  --topbar-border: #4b5a32;
  --logo-color: #eef0e2;
  --heading-color: #4b5a32;
  --plan-task: #6b7d47;
  --plan-meeting: #8a5a3b;
  --plan-plan: #c2a878;
  --plan-other: #4a90a4;
  --logo-style: normal;
  --logo-case: none;
  --logo-spacing: 0;
  --nav-text: #616a52;
  --nav-hover-bg: #dedcce;
  --nav-active-bg: #d6dcc4;
  --nav-active-text: #3a4626;
  --accent: #6b7d47;
  --button-bg: #6b7d47;
  --button-hover: #5a6b3a;
  --button-text: #fff;
  --button-border: transparent;
  --stop-bg: #8a5a3b;
  --stop-hover: #74492f;
  --radius: 6px;
  --button-radius: 6px;
  --shadow: none;
  --font-body: "DM Sans", sans-serif;
  --font-heading: "DM Sans", sans-serif;
  --font-numbers: "DM Sans", sans-serif;
  --numbers-weight: 700;
}

/* Dark versions: same themes, night colours */
[data-mode="dark"] {
  color-scheme: dark;
}

[data-theme="feminine"][data-mode="dark"] {
  --bg: #1f1418;
  --surface: #2a1c22;
  --sidebar-bg: #241820;
  --border: #3d2a32;
  --text: #f3e4e8;
  --text-muted: #b8939d;
  --topbar-bg: #2a1c22;
  --topbar-border: #3d2a32;
  --logo-color: #e89aae;
  --heading-color: #e89aae;
  --plan-task: #e88aa3;
  --plan-meeting: #b48ac9;
  --plan-plan: #e8a87c;
  --plan-other: #7fb7a4;
  --nav-text: #c7a3ad;
  --nav-hover-bg: #33222a;
  --nav-active-bg: #40262f;
  --nav-active-text: #f4b6c6;
  --accent: #e88aa3;
  --button-bg: #d77a93;
  --button-hover: #e38ea5;
  --button-text: #fff;
  --stop-bg: #c75d7c;
  --stop-hover: #d66f8d;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

[data-theme="old-money"][data-mode="dark"] {
  --bg: #0d1424;
  --surface: #141d31;
  --sidebar-bg: #0f1729;
  --border: #2a3550;
  --text: #ece4d2;
  --text-muted: #a39b86;
  --topbar-bg: #0a1020;
  --topbar-border: #b89b5e;
  --logo-color: #d4b876;
  --heading-color: #d4b876;
  --plan-task: #c9ad6e;
  --plan-meeting: #b04a5a;
  --plan-plan: #4f8f7c;
  --plan-other: #a39b86;
  --nav-text: #9aa3b8;
  --nav-hover-bg: #1a2540;
  --nav-active-bg: #1e2a47;
  --nav-active-text: #f6f1e6;
  --accent: #c9ad6e;
  --button-bg: #b89b5e;
  --button-hover: #c9ad6e;
  --button-text: #0d1424;
  --button-border: #b89b5e;
  --stop-bg: #8a2a38;
  --stop-hover: #a03444;
}

[data-theme="neutral"][data-mode="dark"] {
  --bg: #1a1d16;
  --surface: #23271e;
  --sidebar-bg: #1f2219;
  --border: #363b2d;
  --text: #e9ead9;
  --text-muted: #a0a58e;
  --topbar-bg: #2c3522;
  --topbar-border: #2c3522;
  --logo-color: #e9ead9;
  --heading-color: #b7c49a;
  --plan-task: #9aae6b;
  --plan-meeting: #b07a52;
  --plan-plan: #c9b285;
  --plan-other: #6fa9bd;
  --nav-text: #a9ae96;
  --nav-hover-bg: #2b3024;
  --nav-active-bg: #333b28;
  --nav-active-text: #d6dcc4;
  --accent: #9aae6b;
  --button-bg: #7d9150;
  --button-hover: #8ea25f;
  --button-text: #fff;
  --stop-bg: #a86b45;
  --stop-hover: #b97b54;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
}

/* Top bar */
.topbar {
  height: 56px;
  background: var(--topbar-bg);
  border-bottom: 2px solid var(--topbar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.user-name {
  color: var(--logo-color);
  font-size: 14px;
  font-weight: 700;
}

.logo {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  font-style: var(--logo-style);
  text-transform: var(--logo-case);
  letter-spacing: var(--logo-spacing);
  color: var(--logo-color);
}

/* Sidebar + content */
.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidebar {
  width: 200px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding-top: 10px;
}

.nav-item {
  display: block;
  padding: 12px 20px;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--nav-hover-bg);
}

.nav-item.active {
  color: var(--nav-active-text);
  border-left-color: var(--accent);
  background: var(--nav-active-bg);
  font-weight: 700;
}

.content {
  flex: 1;
  padding: 30px;
}

/* Timer bar */
.timer-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 16px;
}

#description {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 8px;
  outline: none;
}

.clock {
  font-family: var(--font-numbers);
  font-weight: var(--numbers-weight);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  min-width: 140px;
  text-align: right;
}

.start-button {
  background: var(--button-bg);
  color: var(--button-text);
  border: 1px solid var(--button-border);
  border-radius: var(--button-radius);
  padding: 10px 28px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
}

.start-button:hover {
  background: var(--button-hover);
}

.start-button.running {
  background: var(--stop-bg);
}

.start-button.running:hover {
  background: var(--stop-hover);
}

/* Entries */
.entries {
  margin-top: 30px;
}

.entries h2 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.entry-list {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.entry-list:empty {
  display: none;
}

.entry {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.entry:last-child {
  border-bottom: none;
}

.entry-description {
  flex: 1;
}

.entry-description.no-description {
  color: var(--text-muted);
}

.entry-times {
  color: var(--text-muted);
}

.entry-duration {
  min-width: 90px;
  text-align: right;
  font-family: var(--font-numbers);
  font-weight: var(--numbers-weight);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

/* Welcome screen */
.welcome {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 16px;
}

.welcome[hidden] {
  display: none;
}

.welcome-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
  text-align: center;
}

.welcome-logo {
  font-family: var(--font-heading);
  font-size: 44px;
  font-weight: 700;
  font-style: var(--logo-style);
  text-transform: var(--logo-case);
  letter-spacing: var(--logo-spacing);
  color: var(--heading-color);
}

.slogan {
  font-family: var(--font-heading);
  font-size: 17px;
  color: var(--text-muted);
  margin: 6px 0 32px;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin: 18px 0 8px;
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  text-align: center;
}

.text-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.choices {
  display: flex;
  gap: 8px;
}

.choice {
  flex: 1;
  position: relative;
}

.choice input {
  position: absolute;
  opacity: 0;
}

.choice span {
  display: block;
  padding: 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  font-size: 14px;
  cursor: pointer;
}

.choice input:checked + span {
  background: var(--button-bg);
  border-color: var(--button-border);
  color: var(--button-text);
  font-weight: 700;
}

.choice input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

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

.welcome-card .start-button {
  width: 100%;
}

/* Animations */
.theme-changing,
.theme-changing * {
  transition:
    background-color 0.8s ease,
    color 0.8s ease,
    border-color 0.8s ease,
    border-radius 0.8s ease,
    box-shadow 0.8s ease !important;
}

.welcome:not([hidden]) .welcome-card {
  animation: card-in 1.4s ease both;
}

.welcome.leaving {
  animation: fade-out 1.2s ease forwards;
}

.welcome.leaving .welcome-card {
  animation: card-out 1.2s ease forwards;
}

.app-entering .topbar,
.app-entering .layout {
  animation: app-in 1.4s ease 0.6s both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes card-out {
  to {
    opacity: 0;
    transform: translateY(-16px) scale(0.97);
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

@keyframes app-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* People who turn off animations in their system settings get none */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Pages */
.view[hidden] {
  display: none;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 24px 24px;
  max-width: 560px;
}

.panel .text-input {
  text-align: left;
  max-width: 320px;
}

/* Settings */
.theme-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  padding: 14px 12px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
}

.theme-option.selected {
  border-color: var(--accent);
  font-weight: 700;
}

.swatches {
  display: flex;
  gap: 4px;
}

.swatches i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.secondary-button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  padding: 9px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: var(--accent);
}

.clock-fraction {
  font-size: 0.7em;
  opacity: 0.75;
  margin-left: 1px;
}

/* Timer bar controls */
.timer-bar {
  flex-wrap: wrap;
}

.picker {
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  max-width: 200px;
}

.mode-fields {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-fields[hidden] {
  display: none;
}

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

.mode-button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  padding: 3px 5px;
  cursor: pointer;
  border-radius: 4px;
}

.mode-button.selected {
  color: var(--accent);
  background: var(--bg);
}

/* Tag picker dropdown */
.tag-picker {
  position: relative;
}

.tag-picker summary {
  list-style: none;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  background: var(--bg);
  font-size: 13px;
  cursor: pointer;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-picker summary::-webkit-details-marker {
  display: none;
}

.tag-menu {
  position: absolute;
  z-index: 10;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  padding: 6px;
}

.tag-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
}

.tag-menu-empty {
  padding: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Entry list grouped by day */
.week-header,
.day-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.week-total {
  font-family: var(--font-numbers);
  font-weight: var(--numbers-weight);
  color: var(--text-muted);
  font-size: 14px;
}

.day-group {
  margin-bottom: 18px;
}

.day-header {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.day-total {
  font-family: var(--font-numbers);
  font-weight: var(--numbers-weight);
}

.entry-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry.is-break {
  opacity: 0.7;
  font-style: italic;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  font-style: normal;
}

.project-chip {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}

.dot.big {
  width: 14px;
  height: 14px;
}

.type-chip,
.tag-chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: var(--button-radius);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
}

.type-chip.type-meeting {
  border-color: var(--accent);
  color: var(--accent);
}

.entry-actions {
  display: flex;
  gap: 2px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.entry:hover .entry-actions,
.entry-actions:focus-within {
  opacity: 1;
}

.icon-button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
}

.icon-button:hover {
  background: var(--bg);
  color: var(--accent);
}

/* Projects page */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px;
  max-width: none;
  margin-bottom: 16px;
}

.inline-form .text-input {
  flex: 1;
  min-width: 160px;
}

.text-input.small {
  flex: 0 1 150px;
  min-width: 120px;
  padding: 7px 10px;
  font-size: 13px;
}

.color-input {
  width: 42px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  background: var(--bg);
  padding: 2px;
  cursor: pointer;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  cursor: pointer;
}

.project-list {
  display: grid;
  gap: 12px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.project-card.archived {
  opacity: 0.6;
}

.project-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.project-name {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
}

.project-tracked {
  margin-left: auto;
  font-family: var(--font-numbers);
  font-weight: var(--numbers-weight);
  font-size: 15px;
}

.budget {
  display: flex;
  align-items: center;
  gap: 10px;
}

.budget-bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.budget-fill {
  height: 100%;
  background: var(--accent);
}

.budget-fill.over {
  background: var(--stop-bg);
}

.budget-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.chip-remove:hover {
  color: var(--stop-bg);
}

.inline-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.secondary-button.small {
  padding: 6px 12px;
  font-size: 12px;
}

.secondary-button.danger {
  color: var(--stop-bg);
}

.section-title {
  margin-top: 36px;
}

/* Edit dialog */
.dialog {
  margin: auto;
  width: min(560px, calc(100% - 32px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.dialog .text-input {
  text-align: left;
}

.dialog-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.dialog-row .picker {
  max-width: none;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

.spacer {
  flex: 1;
}

/* Pomodoro */
.pomodoro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.pomo-display {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 150px;
}

.pomo-phase {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
}

.pomo-phase.on-break {
  color: var(--stop-bg);
}

.pomo-time {
  font-family: var(--font-numbers);
  font-weight: var(--numbers-weight);
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.pomo-settings {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.pomo-settings .checkbox-row {
  margin: 0;
}

.pomo-presets {
  display: flex;
  gap: 6px;
}

.pomo-preset {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
}

.pomo-preset.selected {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.pomo-custom {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-muted);
}

.picker.tiny {
  width: 62px;
}

.pomo-controls {
  display: flex;
  gap: 8px;
}

/* Settings lists */
.settings-list {
  display: grid;
  gap: 12px;
  padding: 20px 24px;
}

.settings-list .checkbox-row {
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.setting-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Pop-up messages */
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100% - 32px));
}

.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  font-size: 14px;
  animation: card-in 0.4s ease both;
}

.toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.start-button.small {
  padding: 6px 14px;
  font-size: 12px;
}

/* Plan colours */
.plan-task {
  --plan-color: var(--plan-task);
}

.plan-meeting {
  --plan-color: var(--plan-meeting);
}

.plan-plan {
  --plan-color: var(--plan-plan);
}

.plan-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--plan-color);
}

.mini-line {
  display: block;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--text-muted);
  opacity: 0.6;
}

/* Time Tracker page: main column + mini calendar on the right */
.tracker-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .tracker-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.mini-cal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  position: sticky;
  top: 16px;
}

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

.mini-month {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--heading-color);
  font-size: 15px;
}

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

.mini-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
}

.mini-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  height: 44px;
  padding-top: 5px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--button-radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
}

.mini-day:hover {
  background: var(--bg);
}

.mini-day.other-month {
  opacity: 0.4;
}

.mini-day.today .mini-number {
  color: var(--accent);
  font-weight: 700;
}

.mini-day.selected {
  border-color: var(--accent);
  background: var(--bg);
}

.mini-dots {
  display: flex;
  gap: 2px;
  height: 6px;
}

.mini-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 10px 0 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.mini-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mini-line.legend {
  display: inline-block;
}

.mini-agenda {
  border-top: 1px solid var(--border);
  margin-top: 10px;
  padding-top: 10px;
}

.mini-day-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}

.mini-day-list {
  list-style: none;
  display: grid;
  gap: 6px;
}

.mini-plan {
  display: grid;
  padding: 6px 10px;
  border-left: 3px solid var(--plan-color);
  background: color-mix(in srgb, var(--plan-color) 12%, var(--surface));
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.mini-plan-time {
  font-size: 11px;
  color: var(--text-muted);
}

.mini-empty {
  font-size: 13px;
  color: var(--text-muted);
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

/* Calendar page */
.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.cal-title {
  margin: 0;
  min-width: 220px;
}

.cal-nav,
.cal-views {
  display: flex;
  gap: 4px;
}

.cal-toolbar .checkbox-row {
  margin: 0;
}

.cal-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.cal-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.week-head,
.week-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
}

.week-head {
  border-bottom: 1px solid var(--border);
}

.week-day-head {
  display: grid;
  justify-items: center;
  padding: 8px 4px;
  border-left: 1px solid var(--border);
}

.week-day-name {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.week-day-number {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
}

.week-day-head.today .week-day-number {
  color: var(--accent);
}

.week-day-planned {
  font-size: 11px;
  color: var(--text-muted);
}

.week-scroll {
  height: 620px;
  overflow-y: auto;
}

.hour-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  padding-right: 8px;
  transform: translateY(-7px);
}

.day-col {
  position: relative;
  border-left: 1px solid var(--border);
  background-image: linear-gradient(var(--border) 1px, transparent 1px);
  background-size: 100% 48px;
  cursor: copy;
}

.day-col.today {
  background-color: color-mix(in srgb, var(--accent) 5%, transparent);
}

.tracked-strip {
  position: absolute;
  left: 2px;
  width: 4px;
  border-radius: 2px;
  background: var(--text-muted);
  opacity: 0.5;
}

.plan-block {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 3px 6px;
  overflow: hidden;
  border-left: 3px solid var(--plan-color);
  background: color-mix(in srgb, var(--plan-color) 18%, var(--surface));
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.plan-block:hover {
  background: color-mix(in srgb, var(--plan-color) 28%, var(--surface));
}

.plan-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-time,
.plan-project {
  font-size: 11px;
  color: var(--text-muted);
}

.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--stop-bg);
  pointer-events: none;
}

.month-head,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-head span {
  padding: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.month-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 110px;
  padding: 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.month-cell:hover {
  background: var(--bg);
}

.month-cell.other-month {
  opacity: 0.45;
}

.month-date {
  font-weight: 700;
  font-size: 13px;
}

.month-cell.today .month-date {
  color: var(--accent);
}

.month-chip {
  text-align: left;
  padding: 2px 6px;
  border: none;
  border-left: 3px solid var(--plan-color);
  background: color-mix(in srgb, var(--plan-color) 15%, var(--surface));
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.month-more {
  font-size: 11px;
  color: var(--text-muted);
}

.month-cell .mini-line {
  margin-top: auto;
}

.text-input.notes {
  text-align: left;
  resize: vertical;
}

.plan-block > * {
  flex-shrink: 0;
}

.week-scroll .week-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

.plan-other {
  --plan-color: var(--plan-other);
}

.plan-kind {
  align-self: flex-start;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--plan-color);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#plan-other-row[hidden] {
  display: none;
}

.plan-color-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.link-button[hidden] {
  display: none;
}

/* Reports */
.report-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  max-width: none;
  margin-bottom: 14px;
}

.report-custom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.report-custom[hidden] {
  display: none;
}

.report-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.report-body {
  display: grid;
  gap: 16px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.stat-tile {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-numbers);
  font-weight: var(--numbers-weight);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.report-card {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.report-card-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--heading-color);
}

/* Column chart: one series, bars rounded at the top and anchored to the baseline */
.column-chart {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 200px;
  border-bottom: 1px solid var(--border);
}

.column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.column-value {
  height: 16px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.column-bar-area {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.column-bar {
  width: min(70%, 36px);
  min-height: 0;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
}

.column:hover .column-bar {
  filter: brightness(0.9);
}

.column-label {
  height: 18px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Bar list: horizontal bars on one shared scale */
.bar-list {
  display: grid;
  gap: 4px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr 80px 44px;
  align-items: center;
  gap: 12px;
  padding: 6px 4px;
  border-radius: 4px;
  font-size: 13px;
}

.bar-row:hover {
  background: var(--bg);
}

.bar-label {
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar-track {
  display: block;
  height: 10px;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.bar-fill.planned {
  background: var(--text-muted);
  opacity: 0.45;
}

.bar-pair {
  display: grid;
  gap: 2px;
}

.bar-value,
.bar-percent {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar-percent {
  color: var(--text-muted);
  font-size: 12px;
}

.bar-percent.over,
.num.over {
  color: var(--stop-bg);
  font-weight: 700;
}

.num.under {
  color: var(--text-muted);
}

.legend-row {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
}

.legend-swatch.planned {
  background: var(--text-muted);
  opacity: 0.45;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.report-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.report-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.report-table tfoot td {
  font-weight: 700;
  border-bottom: none;
}

.report-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.report-table .zero {
  color: var(--text-muted);
  opacity: 0.6;
}

.report-table .strong {
  font-weight: 700;
}

.report-table tr.clickable {
  cursor: pointer;
}

.report-table tr.clickable:hover td {
  background: var(--bg);
}

/* Chart tooltip */
.chart-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  padding: 6px 10px;
  background: var(--text);
  color: var(--surface);
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.chart-tip[hidden] {
  display: none;
}

.file-button {
  display: inline-flex;
  align-items: center;
}

/* Printing / saving as PDF: only the report, no menus */
@media print {
  .topbar,
  .sidebar,
  .tracker-side,
  .report-filters,
  .report-tabs,
  .cal-toolbar button,
  .toasts,
  .chart-tip {
    display: none !important;
  }

  .content {
    padding: 0;
  }

  .report-card,
  .stat-tile {
    box-shadow: none;
    break-inside: avoid;
  }
}

/* Logo with the changing hourglass */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mood-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  animation: card-in 0.5s ease both;
}

.day-tools {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.day-tools .link-button {
  opacity: 0;
  transition: opacity 0.2s;
}

.day-group:hover .day-tools .link-button,
.day-tools .link-button:focus-visible {
  opacity: 1;
}

#discard-timer[hidden] {
  display: none;
}

/* Our own confirmation window */
.confirm-dialog {
  width: min(420px, calc(100% - 32px));
}

.confirm-message {
  font-size: 15px;
  line-height: 1.5;
}

.confirm-dialog .dialog-actions {
  margin-top: 20px;
}

.appearance-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.appearance-option {
  padding: 8px 14px;
  font-size: 13px;
}

/* Project names use the normal text colour; the dot next to them shows the project colour */
.project-chip {
  color: var(--text) !important;
}

.hint.left {
  text-align: left;
  margin: 8px 0 0;
}

/* Language picker on the welcome screen */
.welcome-card {
  position: relative;
}

.welcome-language {
  position: absolute;
  top: 14px;
  right: 14px;
  max-width: 130px;
}

.language-select {
  min-width: 160px;
}

/* Right-to-left layout (Arabic) */
[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border);
}

[dir="rtl"] .nav-item {
  border-left: none;
  border-right: 3px solid transparent;
}

[dir="rtl"] .nav-item.active {
  border-right-color: var(--accent);
}

[dir="rtl"] .welcome-language {
  right: auto;
  left: 14px;
}

[dir="rtl"] .toasts {
  right: auto;
  left: 16px;
}

[dir="rtl"] .toast {
  border-left: 1px solid var(--border);
  border-right: 4px solid var(--accent);
}

[dir="rtl"] .mini-plan,
[dir="rtl"] .month-chip {
  border-left: none;
  border-right: 3px solid var(--plan-color);
  text-align: right;
}

[dir="rtl"] .report-table th,
[dir="rtl"] .bar-value,
[dir="rtl"] .bar-percent {
  text-align: right;
}

[dir="rtl"] .report-table .num {
  text-align: left;
}

[dir="rtl"] .dot {
  margin-right: 0;
  margin-left: 5px;
}

[dir="rtl"] .clock,
[dir="rtl"] .entry-duration {
  text-align: left;
}

[dir="rtl"] .hour-label {
  text-align: left;
  padding-right: 0;
  padding-left: 8px;
}

[dir="rtl"] .bar-fill {
  border-radius: 4px 0 0 4px;
}

[dir="rtl"] #mini-prev,
[dir="rtl"] #mini-next,
[dir="rtl"] #cal-prev,
[dir="rtl"] #cal-next {
  transform: scaleX(-1);
}

/* Account and syncing */
.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-badge {
  font-size: 16px;
  color: var(--logo-color);
  opacity: 0.85;
}

.sync-badge[data-status="syncing"] {
  animation: spin 1.2s linear infinite;
}

.sync-badge[data-status="offline"],
.sync-badge[data-status="error"] {
  color: var(--stop-bg);
}

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

#account-signed-out[hidden],
#account-signed-in[hidden],
#auth-email-row[hidden],
#auth-password-row[hidden],
#auth-intro[hidden],
.auth-message[hidden],
.auth-links .link-button[hidden] {
  display: none;
}

.account-email {
  font-weight: 700;
  font-size: 15px;
}

.auth-dialog {
  width: min(420px, calc(100% - 32px));
}

.auth-dialog .text-input {
  text-align: left;
}

.auth-message {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 13px;
  line-height: 1.5;
}

.auth-message.error {
  color: var(--stop-bg);
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
}

.welcome-login {
  display: block;
  margin: 16px auto 0;
}

/* ---------- Phones and small screens ---------- */
.nav-item::before {
  display: none;
}

html,
body {
  overflow-x: hidden;
}

.layout > *,
.tracker-layout > *,
.content {
  min-width: 0;
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 14px;
  }

  .logo {
    font-size: 20px;
  }

  .mood-icon {
    width: 30px;
    height: 30px;
  }

  /* The menu becomes a bar at the bottom of the screen */
  .layout {
    display: block;
    min-height: auto;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: auto;
    display: flex;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    border-right: none;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  }

  .nav-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    border-left: none;
    border-top: 3px solid transparent;
    border-radius: 8px;
    font-size: 10.5px;
    line-height: 1.2;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-item.active {
    border-top-color: var(--accent);
  }

  .nav-item::before {
    display: block;
    font-size: 20px;
    line-height: 1;
  }

  .nav-item[data-view="tracker"]::before { content: "⏱"; }
  .nav-item[data-view="calendar"]::before { content: "📅"; }
  .nav-item[data-view="reports"]::before { content: "📊"; }
  .nav-item[data-view="projects"]::before { content: "📁"; }
  .nav-item[data-view="settings"]::before { content: "⚙"; }

  [dir="rtl"] .sidebar {
    border-left: none;
  }

  [dir="rtl"] .nav-item {
    border-right: none;
  }

  .content {
    padding: 16px 12px calc(84px + env(safe-area-inset-bottom));
  }

  .toasts {
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 12px;
    width: calc(100% - 24px);
  }

  /* Timer bar: description, then pickers, then clock and button */
  .timer-bar {
    gap: 10px;
    padding: 12px;
  }

  #description {
    flex-basis: 100%;
    font-size: 16px;
    padding: 6px 4px;
  }

  .timer-bar > .picker,
  .timer-bar > .tag-picker {
    flex: 1 1 30%;
    min-width: 0;
    max-width: none;
  }

  .tag-picker summary {
    max-width: none;
  }

  .mode-fields {
    flex: 1 1 auto;
    flex-wrap: wrap;
  }

  #timer-fields {
    justify-content: space-between;
  }

  .clock {
    min-width: 0;
    text-align: left;
    font-size: 24px;
  }

  #manual-fields .picker {
    flex: 1 1 40%;
  }

  .mode-switch {
    flex-direction: row;
  }

  /* Pomodoro */
  .pomodoro {
    gap: 12px;
  }

  .pomo-controls {
    width: 100%;
  }

  .pomo-controls .start-button {
    flex: 1;
  }

  /* Entries: description on top, times and duration underneath */
  .entry {
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 12px;
  }

  .entry-main {
    flex-basis: 100%;
  }

  .entry-times {
    flex: 1;
    font-size: 12px;
  }

  .entry-duration {
    min-width: 0;
  }

  .entry-actions {
    opacity: 1;
  }

  .day-header {
    padding: 8px 4px;
  }

  .day-tools .link-button {
    opacity: 1;
  }

  .week-header {
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  /* Calendar: the week scrolls sideways instead of squeezing seven days */
  .cal-toolbar {
    gap: 8px;
  }

  .cal-title {
    min-width: 0;
    flex-basis: 100%;
    font-size: 20px;
  }

  .cal-toolbar .spacer {
    display: none;
  }

  .cal-body {
    overflow-x: auto;
  }

  .week-scroll {
    min-width: 680px;
    height: 70vh;
  }

  .month-head,
  .month-grid {
    min-width: 560px;
  }

  .month-cell {
    min-height: 80px;
  }

  .mini-cal {
    position: static;
  }

  /* Reports */
  .bar-row {
    grid-template-columns: minmax(80px, 1fr) 1.4fr 64px 36px;
    gap: 8px;
    font-size: 12px;
  }

  .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-value {
    font-size: 18px;
  }

  .report-card {
    padding: 14px;
  }

  /* Projects and settings */
  .inline-form .text-input,
  .inline-form .picker,
  .inline-form .start-button {
    flex: 1 1 100%;
  }

  .panel {
    padding: 8px 14px 16px;
  }

  .settings-list {
    padding: 16px;
  }

  .panel .text-input {
    max-width: none;
  }

  .theme-option {
    flex: 1 1 30%;
    min-width: 0;
  }

  /* Pop-up windows use the whole width */
  .dialog {
    width: calc(100% - 20px);
    max-height: calc(100% - 20px);
    padding: 18px;
  }

  .dialog-row > div {
    flex: 1 1 45%;
  }

  .dialog-row .picker {
    width: 100%;
  }

  .dialog-actions {
    flex-wrap: wrap;
  }

  .welcome-card {
    padding: 56px 20px 28px;
  }
}

/* Sharing */
#sharing-signed-out[hidden],
#sharing-signed-in[hidden],
#cal-shared-row[hidden] {
  display: none;
}

.share-form {
  margin: 4px 0 8px;
}

.share-form .text-input {
  flex: 1;
  text-align: left;
}

.share-lists .field-label {
  margin-top: 14px;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.share-email {
  flex: 1;
  min-width: 160px;
  overflow-wrap: anywhere;
}

.share-buttons {
  display: flex;
  gap: 6px;
}

.badge.accepted {
  border-color: var(--accent);
  color: var(--accent);
}

/* Plans from someone else's calendar: striped and labelled with their name, view only */
.plan-block.shared,
.month-chip.shared,
.mini-plan.shared {
  border-left-style: dashed;
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--plan-color) 10%, transparent) 6px 12px);
  cursor: help;
}

.shared-name {
  align-self: flex-start;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--text);
  color: var(--surface);
  font-size: 10px;
  font-weight: 700;
}

.plan-dot.shared {
  background: transparent;
  border: 1.5px solid var(--plan-color);
  box-sizing: border-box;
}

/* Locked data: the vault window and support section */
#vault-recovery-row[hidden],
#vault-password-row[hidden],
#vault-show-row[hidden],
#vault-cancel[hidden],
#vault-link-a[hidden],
#vault-link-b[hidden],
#support-signed-out[hidden],
#support-signed-in[hidden],
#support-give[hidden],
#support-update[hidden],
#support-take-back[hidden] {
  display: none;
}

.recovery-input {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.recovery-key {
  margin: 14px 0 10px;
  padding: 14px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
  user-select: all;
  overflow-wrap: anywhere;
}

.saved-check {
  margin: 14px 0 0;
  color: var(--text);
  font-weight: 700;
}

.start-button.danger-button {
  background: var(--stop-bg);
}

.privacy-link {
  color: var(--text-muted);
  font-size: 13px;
}

.welcome-privacy {
  display: block;
  margin-top: 10px;
  font-size: 12px;
}

/* Upcoming page: events to tick off, and the timeline of finished ones */
.events-section {
  margin-top: 22px;
}

.events-section .report-card-title {
  margin-bottom: 6px;
}

.event-day {
  margin-bottom: 14px;
}

.event-day.missed .day-header {
  color: var(--stop-bg);
}

.event-list {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.event-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  border-left: 4px solid var(--plan-color);
}

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

.event-check {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: 2px solid var(--plan-color);
  border-radius: 50%;
  background: transparent;
  color: var(--surface);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.event-check:hover {
  background: color-mix(in srgb, var(--plan-color) 20%, transparent);
}

.event-row.done .event-check {
  background: var(--plan-color);
}

.event-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
  cursor: pointer;
}

.event-title {
  font-weight: 700;
  font-size: 15px;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Finished events: faded and crossed out, here and in the calendar */
.event-row.done .event-main {
  opacity: 0.5;
}

.event-row.done .event-title,
.plan-block.done .plan-title,
.month-chip.done,
.mini-plan.done .mini-plan-title {
  text-decoration: line-through;
}

.plan-block.done,
.month-chip.done,
.mini-plan.done {
  opacity: 0.5;
}

[dir="rtl"] .event-row {
  border-left: none;
  border-right: 4px solid var(--plan-color);
}

@media (max-width: 760px) {
  .nav-item[data-view="events"]::before { content: "✅"; }

  .event-row {
    padding: 12px;
  }
}

/* Tick-off circle in the mini calendar's day list */
.mini-plan {
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: center;
}

.mini-plan.shared {
  grid-template-columns: 1fr;
}

.mini-check {
  grid-row: span 2;
  width: 22px;
  height: 22px;
  border: 2px solid var(--plan-color);
  border-radius: 50%;
  background: transparent;
  color: var(--surface);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.mini-check:hover {
  background: color-mix(in srgb, var(--plan-color) 20%, transparent);
}

.mini-plan.done .mini-check {
  background: var(--plan-color);
}

#plan-done[hidden] {
  display: none;
}

/* Upcoming box on the home page */
.upcoming {
  margin-top: 26px;
}

.upcoming .week-header h2 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.upcoming-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.upcoming-title {
  flex: 1;
  min-width: 160px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 8px;
  outline: none;
}

.upcoming-empty {
  padding: 4px 16px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.event-day-title {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.event-day.missed .event-day-title {
  color: var(--stop-bg);
}

/* Finished events in "Your time": faded, with a tick */
.entry.from-event .entry-main,
.entry.from-event .entry-times,
.entry.from-event .entry-duration {
  opacity: 0.5;
}

.event-done-mark {
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 760px) {
  .upcoming-form {
    padding: 12px;
  }

  .upcoming-title {
    flex-basis: 100%;
    font-size: 16px;
  }

  .upcoming-form .picker {
    flex: 1 1 28%;
  }
}

/* What users type themselves (tasks, events, plans): bold, in a calm, discreet font */
.entry-description,
.event-title,
.plan-title,
.mini-plan-title,
.month-chip,
.share-email,
#description,
.upcoming-title,
.alarm-info > span:first-child {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

.entry-description,
.event-title,
.plan-title,
.mini-plan-title {
  font-weight: 700;
  letter-spacing: -0.1px;
}

.entry-description.no-description {
  font-weight: 500;
}

/* Notification banner */
.notify-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 14px;
}

.notify-banner span {
  flex: 1;
  min-width: 200px;
}

.notify-banner[hidden] {
  display: none;
}

/* Event options */
.upcoming-options {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 0 8px 2px;
}

.upcoming-options .checkbox-row {
  margin: 0;
}

.plan-option {
  margin: 12px 0 0;
  color: var(--text);
}

.reminder-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reminder-option {
  position: relative;
  cursor: pointer;
}

.reminder-option input {
  position: absolute;
  opacity: 0;
}

.reminder-option span {
  display: block;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  background: var(--bg);
  font-size: 12px;
}

.reminder-option input:checked + span {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.reminder-option input:focus-visible + span {
  outline: 2px solid var(--accent);
}

/* All-day events above the hours in the week view */
.all-day-list {
  display: grid;
  gap: 2px;
  width: 100%;
  margin-top: 4px;
}

.all-day-chip {
  width: 100%;
}

/* Alarms */
.alarms-card {
  margin-top: 16px;
  position: static;
}

.alarm-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.alarm-form .picker,
.alarm-form .text-input {
  flex: 1 1 45%;
  min-width: 0;
}

.alarm-list {
  list-style: none;
  display: grid;
  gap: 6px;
}

.alarm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.alarm-row.off {
  opacity: 0.5;
}

.alarm-time {
  font-family: var(--font-numbers);
  font-weight: var(--numbers-weight);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.alarm-info {
  flex: 1;
  min-width: 0;
  display: grid;
  font-size: 13px;
}

.alarm-repeat {
  font-size: 11px;
  color: var(--text-muted);
}

.alarm-switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.alarm-dialog {
  width: min(360px, calc(100% - 32px));
  text-align: center;
}

.alarm-ring-icon {
  font-size: 54px;
  animation: alarm-shake 0.5s ease-in-out infinite alternate;
}

.alarm-ring-time {
  font-family: var(--font-numbers);
  font-weight: var(--numbers-weight);
  font-size: 40px;
}

.alarm-ring-label {
  color: var(--text-muted);
  margin-bottom: 8px;
}

@keyframes alarm-shake {
  from { transform: rotate(-12deg); }
  to { transform: rotate(12deg); }
}

.nickname-input {
  flex: 0 1 150px;
  text-align: left;
}

/* Notification test and tips in Settings */
.notify-test-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notify-tips {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Settings: cards two by two (one column on small screens) */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
  max-width: 1120px;
}

.settings-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-card .section-title {
  margin-top: 28px;
}

/* Cards in the same row are the same height */
.settings-card .panel {
  flex: 1;
  max-width: none;
}

.settings-card .settings-list {
  align-content: start;
}

.settings-card .panel .text-input {
  max-width: 100%;
}

@media (max-width: 1000px) {
  .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Small cards stacked next to a tall one; the last one fills the rest */
.settings-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-stack .settings-card .panel {
  flex: none;
}

.settings-stack .settings-card:last-child {
  flex: 1;
}

.settings-stack .settings-card:last-child .panel {
  flex: 1;
}

/* Pause and continue */
.pause-button {
  padding: 9px 16px;
  font-size: 13px;
  white-space: nowrap;
}

.pause-button[hidden] {
  display: none;
}

.clock.paused {
  opacity: 0.55;
  animation: paused-blink 2s ease-in-out infinite;
}

@keyframes paused-blink {
  50% { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .clock.paused { animation: none; }
}

/* On a break */
.break-left {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.break-left[hidden] {
  display: none;
}

.clock.on-break {
  color: var(--plan-other);
}
