:root {
  color-scheme: dark;
  --bg: #0d0f13;
  --surface: #14171d;
  --surface-2: #1a1e26;
  --surface-3: #232938;
  --border: #272d39;
  --border-strong: #3b4455;
  --text: #eceff5;
  --text-2: #c0c7d2;
  --muted: #98a1b0;
  --accent: #6e9fff;
  --accent-strong: #8bb0ff;
  --accent-contrast: #0a1128;
  --accent-tint: rgba(110, 159, 255, 0.14);
  --danger: #ff7b73;
  --danger-tint: rgba(255, 107, 98, 0.14);
  --success: #4ac38b;
  --success-tint: rgba(74, 195, 139, 0.14);
  --warning: #f5b544;
  --warning-tint: rgba(245, 181, 68, 0.14);
  --deadline: #c39bff;
  --deadline-tint: rgba(195, 155, 255, 0.14);
  --user-0: #7da2ff;
  --user-1: #4ecf8e;
  --user-2: #f2c14e;
  --user-3: #ff8fa3;
  --user-4: #c39bff;
  --user-5: #56c8d8;
  --user-6: #ff9e64;
  --user-7: #a9dc76;
  --user-8: #ff7a7a;
  --user-9: #7ee0d0;
  --rank-1: #f5b544;
  --rank-2: #aeb6c2;
  --rank-3: #d0885a;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.3rem;
  --text-2xl: 1.6rem;
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.55);
  --dur: 140ms;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0ms !important;
    scroll-behavior: auto !important;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--text-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(110, 159, 255, 0.3);
}

img {
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
}

h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--sp-3);
}

h3 {
  font-size: var(--text-md);
  font-weight: 600;
  margin: 0 0 var(--sp-2);
}

p {
  margin: 0 0 var(--sp-3);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button,
summary,
label,
select,
[type="checkbox"],
[type="radio"] {
  touch-action: manipulation;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: translateY(0);
}

.icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: none;
  vertical-align: -0.2em;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

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

.app {
  min-height: 100dvh;
}

.sidebar {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 8px var(--sp-4);
  background: rgba(13, 15, 19, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(20, 23, 29, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar .nav-item {
  position: relative;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  min-height: 56px;
  padding: 6px 2px;
  border-radius: 0;
  font-size: 12px;
}

.tabbar .nav-item .icon {
  width: 22px;
  height: 22px;
}

.tabbar .nav-item[aria-current="page"] {
  background: transparent;
}

.tabbar .nav-badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 6px);
}

main {
  padding: var(--sp-4) var(--sp-4) calc(88px + env(safe-area-inset-bottom));
}

.page {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  min-width: 0;
}

.page-wide {
  max-width: 1180px;
}

.page-week {
  max-width: 1600px;
}

.page-narrow {
  max-width: 600px;
}

.page > h1 {
  margin-bottom: var(--sp-4);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
}

.page-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand .icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.brand:hover {
  text-decoration: none;
  color: var(--accent-strong);
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--text-md);
  font-weight: 500;
  text-decoration: none;
  min-height: 44px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.nav-item[aria-current="page"] {
  background: var(--accent-tint);
  color: var(--accent-strong);
}

.nav-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabbar .nav-label {
  flex: none;
}

.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #1a0605;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    padding: var(--sp-4) var(--sp-2);
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }
  .sidebar .brand {
    padding: var(--sp-1) var(--sp-2) var(--sp-4);
  }
  .sidebar .nav-item {
    gap: 8px;
    padding: 8px 10px;
    min-height: 40px;
    font-size: var(--text-sm);
  }
  .sidebar .nav-item .icon {
    width: 18px;
    height: 18px;
  }
  .sidebar .menu-button {
    min-height: 40px;
    padding: 6px 8px;
    font-size: var(--text-sm);
  }
  .sidebar .menu {
    margin-top: auto;
    padding-top: var(--sp-3);
  }
  .topbar,
  .tabbar {
    display: none;
  }
  main {
    padding: var(--sp-6) var(--sp-6) 56px;
  }
}

.menu {
  position: relative;
}

.menu-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

.menu-button::-webkit-details-marker {
  display: none;
}

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

.menu-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-button > .icon:last-child {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.menu[open] > .menu-button {
  background: var(--surface-2);
  color: var(--text);
}

.menu-panel {
  position: absolute;
  bottom: calc(100% + var(--sp-2));
  left: 0;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  z-index: 50;
}

.topbar .menu {
  flex: none;
}

.topbar .menu-button {
  width: auto;
}

.topbar .menu-panel {
  bottom: auto;
  top: calc(100% + var(--sp-2));
  left: auto;
  right: 0;
}

.menu-panel form {
  margin: 0;
}

.menu-panel .menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
}

[data-color="0"] {
  --user-color: var(--user-0);
}
[data-color="1"] {
  --user-color: var(--user-1);
}
[data-color="2"] {
  --user-color: var(--user-2);
}
[data-color="3"] {
  --user-color: var(--user-3);
}
[data-color="4"] {
  --user-color: var(--user-4);
}
[data-color="5"] {
  --user-color: var(--user-5);
}
[data-color="6"] {
  --user-color: var(--user-6);
}
[data-color="7"] {
  --user-color: var(--user-7);
}
[data-color="8"] {
  --user-color: var(--user-8);
}
[data-color="9"] {
  --user-color: var(--user-9);
}

.user-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: var(--radius-full);
  background: var(--user-color, var(--accent));
}

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: color-mix(in srgb, var(--user-color, var(--accent)) 18%, var(--surface-2));
  color: var(--user-color, var(--accent));
  font-weight: 600;
  user-select: none;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 26px;
  height: 26px;
  font-size: 11px;
}
.avatar-sm .icon {
  width: 14px;
  height: 14px;
}
.avatar-md {
  width: 34px;
  height: 34px;
  font-size: 13px;
}
.avatar-md .icon {
  width: 18px;
  height: 18px;
}
.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 18px;
}
.avatar-lg .icon {
  width: 26px;
  height: 26px;
}
.avatar-xl {
  width: 96px;
  height: 96px;
  font-size: 32px;
}
.avatar-xl .icon {
  width: 48px;
  height: 48px;
}

.toast-region {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  width: max-content;
  max-width: min(92vw, 480px);
  pointer-events: none;
}

.toast-region:empty {
  display: none;
}

@media (max-width: 899.98px) {
  .toast-region {
    bottom: calc(72px + env(safe-area-inset-bottom));
  }
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--sp-3) 10px var(--sp-4);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  box-shadow: var(--shadow-3);
}

.toast > .icon {
  color: var(--success);
}

.toast-error {
  border-color: rgba(255, 107, 98, 0.5);
  padding-right: var(--sp-4);
}

.toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

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

@media (prefers-reduced-motion: no-preference) {
  .toast:not(.toast-error) {
    animation: toast-hide 320ms var(--ease) 5s forwards;
  }
}

@keyframes toast-hide {
  to {
    opacity: 0;
    transform: translateY(8px);
    visibility: hidden;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn:hover {
  background: var(--surface-3);
  border-color: var(--muted);
  text-decoration: none;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

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

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--text);
}

.btn-danger {
  background: var(--danger-tint);
  border-color: rgba(255, 107, 98, 0.4);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(255, 107, 98, 0.24);
  border-color: var(--danger);
}

.btn-sm {
  min-height: 40px;
  padding: 0 14px;
}

.btn-icon {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.btn-icon .icon {
  width: 18px;
  height: 18px;
}

.btn.is-current {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-strong);
}

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="submit"]):not([type="button"]), textarea, select) {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color var(--dur) var(--ease);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

select {
  width: auto;
  max-width: 100%;
}

.field :is(input, select, textarea) {
  width: 100%;
}

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="submit"]):not([type="button"]), textarea, select):hover {
  border-color: var(--muted);
}

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="submit"]):not([type="button"]), textarea, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

[aria-invalid="true"] {
  border-color: var(--danger) !important;
}

input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex: none;
}

input[type="file"] {
  width: 100%;
  padding: var(--sp-2);
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--text-sm);
}

input[type="file"]::file-selector-button {
  margin-right: var(--sp-3);
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 var(--sp-4);
  min-width: 0;
}

.field > label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-2);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 var(--sp-4);
}

.field-error {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--danger);
}

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

.hint-inline {
  color: var(--muted);
  font-weight: 400;
  font-size: var(--text-xs);
  margin-left: 4px;
}

.form-error {
  margin: 0 0 var(--sp-4);
  padding: 10px var(--sp-3);
  border: 1px solid rgba(255, 107, 98, 0.45);
  border-radius: var(--radius-sm);
  background: var(--danger-tint);
  color: var(--danger);
  font-size: var(--text-sm);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

.input-row {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}

.input-row > input {
  flex: 1;
  min-width: 0;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  margin: 0 0 var(--sp-4);
  min-inline-size: 0;
}

legend {
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0 4px;
}

.routine-form fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 var(--sp-5);
}

.routine-form legend {
  padding: 0;
  margin: 0 0 var(--sp-2);
}

.routine-form:has(input[name="kind"][value="weekdays"]:checked) .when-count,
.routine-form:has(input[name="kind"][value="count"]:checked) .when-weekdays,
.routine-form:has(input[name="duration"][value="forever"]:checked) .when-iterations,
.routine-form:has(input[name="duration"][value="forever"]:checked) .when-end-date,
.routine-form:has(input[name="duration"][value="iterations"]:checked) .when-end-date,
.routine-form:has(input[name="duration"][value="end_date"]:checked) .when-iterations {
  display: none;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  margin: 0 0 var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  max-width: 100%;
}

.routine-form fieldset.segmented {
  padding: 3px;
  margin: 0 0 var(--sp-4);
}

.segmented legend {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.segmented label {
  position: relative;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:hover {
  color: var(--text);
}

.segmented label:has(input:checked) {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.chip:hover {
  border-color: var(--muted);
  color: var(--text);
  text-decoration: none;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip:has(input:checked) {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.chip:has(input:focus-visible),
a.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip[aria-current="page"],
.chip.is-active {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.chips .chip {
  padding: 0 14px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--sp-3);
}

.card-header h2 {
  margin: 0;
}

.card-header h2 label {
  cursor: pointer;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: var(--sp-5) 0 var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title:first-child {
  margin-top: 0;
}

.section-title.danger {
  color: var(--danger);
}

.section-title .icon {
  width: 16px;
  height: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.pill .icon {
  width: 13px;
  height: 13px;
}

.pill-done {
  background: var(--success-tint);
  color: var(--success);
}

.pill-open {
  background: var(--warning-tint);
  color: var(--warning);
}

.pill-missed {
  background: var(--danger-tint);
  color: var(--danger);
}

.pill-planned {
  background: var(--surface-3);
  color: var(--text-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #1a0605;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: 32px var(--sp-4);
  text-align: center;
  color: var(--muted);
}

.empty p {
  margin: 0;
}

.empty .icon {
  width: 28px;
  height: 28px;
  opacity: 0.8;
}

.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--sp-6) var(--sp-4);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
}

.auth-card h1 {
  margin: var(--sp-4) 0 var(--sp-1);
  font-size: var(--text-xl);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--accent-tint);
  color: var(--accent);
}

.brand-mark .icon {
  width: 26px;
  height: 26px;
}

.tagline {
  margin: 0 0 var(--sp-6);
  color: var(--muted);
  font-size: var(--text-sm);
}

.auth-card form,
.auth-card .field {
  text-align: left;
}

.auth-alt {
  margin: var(--sp-5) 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.auth-card button[type="submit"] {
  width: 100%;
}

.date-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.date-form {
  display: inline-flex;
  margin: 0;
}

.date-form input[type="date"] {
  width: auto;
  min-width: 150px;
}

.onboarding {
  border-color: rgba(110, 159, 255, 0.4);
  background: linear-gradient(var(--accent-tint), var(--accent-tint)), var(--surface);
}

.onboarding-dismiss {
  display: inline-flex;
  margin: 0 0 0 auto;
}

.onboarding-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.onboarding-step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.onboarding-step .icon {
  color: var(--muted);
}

.onboarding-step.done {
  color: var(--muted);
}

.onboarding-step.done .icon {
  color: var(--success);
}

.step-label {
  flex: 1;
  min-width: 0;
}

.day-layout {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.day-layout .card {
  margin: 0;
}

.day-side {
  display: contents;
}

.todo-region {
  display: contents;
}

.day-main {
  order: 1;
  min-width: 0;
}

.overdue {
  order: 0;
}

.deadlines {
  order: 2;
}

.todos {
  order: 3;
}

.note-card {
  order: 4;
}

@media (min-width: 1100px) {
  .day-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
    gap: var(--sp-6);
  }
  .day-side {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
    min-width: 0;
  }
  .day-main,
  .overdue,
  .deadlines,
  .todos,
  .note-card {
    order: 0;
  }
}

.schedule-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.schedule-head h2 {
  margin: 0;
}

.progress-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text-2);
  font-size: var(--text-sm);
}

.progress {
  width: 120px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 1%);
  border-radius: inherit;
  background: var(--success);
  transition: width 240ms var(--ease);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.task {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: start;
  column-gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-md);
}

.task.task-timed {
  grid-template-columns: 52px 44px minmax(0, 1fr) auto;
}

.task.status-completed {
  border-left-color: var(--success);
}

.task.status-missed {
  border-left-color: var(--danger);
}

.task-time {
  padding-top: 10px;
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: right;
}

.task-main {
  min-width: 0;
  padding-top: 6px;
}

.task-title {
  display: inline-block;
  max-width: 100%;
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.task-title:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.task.status-completed .task-title {
  color: var(--text-2);
}

.task-sub {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.task-aside {
  padding-top: 10px;
}

.task > .proof {
  grid-column: 1 / -1;
  margin-top: var(--sp-2);
}

.now-divider {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: 2px 0;
  color: var(--danger);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.now-divider::before,
.now-divider::after {
  content: "";
  height: 2px;
  background: var(--danger);
  opacity: 0.7;
}

.now-divider::before {
  width: 12px;
  border-radius: 2px;
}

.now-divider::after {
  flex: 1;
}

.tick-form {
  display: inline-flex;
  flex: none;
  margin: 0;
}

.tick-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
}

.tick-btn::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.tick-btn .icon {
  position: relative;
  width: 16px;
  height: 16px;
  stroke-width: 3;
}

.tick-btn:hover::before {
  border-color: var(--success);
  background: var(--success-tint);
}

.tick-btn:hover {
  color: var(--success);
}

.tick-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius-full);
}

.tick-btn.is-done {
  color: #07150e;
}

.tick-btn.is-done::before {
  border-color: var(--success);
  background: var(--success);
}

.tick-btn.is-done:hover::before {
  background: color-mix(in srgb, var(--success) 75%, #000);
}

.tick-btn.is-done:hover {
  color: #07150e;
}

.tick-btn.htmx-request {
  opacity: 0.5;
}

.proof {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.proof > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

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

.proof > summary:hover {
  color: var(--text);
  background: var(--surface-2);
}

.proof > summary .icon {
  width: 16px;
  height: 16px;
}

.proof[open] > summary {
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.proof-form {
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
}

.proof-form .field:last-of-type {
  margin-bottom: var(--sp-3);
}

.proof-loading {
  padding: var(--sp-3) var(--sp-4);
  color: var(--muted);
  font-size: var(--text-sm);
}

.pin {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
}

.pin p {
  margin: 0;
  font-weight: 600;
}

.pin ul {
  margin: 0;
  padding-left: 18px;
  font-size: var(--text-sm);
}

.pin a {
  overflow-wrap: anywhere;
}

.pin-photos {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.pin img {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
}

.pin-view {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: 6px;
  min-width: 0;
  color: var(--text-2);
  font-size: var(--text-sm);
}

.pin-view > .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.pin-view a:has(.thumb) {
  display: inline-flex;
}

.thumb {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  object-fit: cover;
}

.pin-summary {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pin-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.pin-link .icon {
  width: 14px;
  height: 14px;
}

.todo-form {
  margin-bottom: var(--sp-4);
}

.todo-extra {
  display: grid;
  gap: 0;
  margin-top: var(--sp-3);
}

.todo-extra .field {
  margin-bottom: var(--sp-3);
}

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

.todo {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.todo:last-child {
  border-bottom: 0;
}

.todo-toggle {
  display: inline-flex;
  flex: none;
  margin: 0;
}

.todo-body {
  flex: 1;
  min-width: 0;
  padding-top: 10px;
}

.todo-title {
  display: block;
  overflow-wrap: anywhere;
}

.todo-due {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.todo-due .icon {
  width: 14px;
  height: 14px;
}

.todo-notes {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.todo.done .todo-title {
  text-decoration: line-through;
  color: var(--muted);
}

.todo.overdue .todo-title {
  color: var(--danger);
  font-weight: 600;
}

.todo.overdue .todo-due {
  color: var(--danger);
}

.todo-delete-form {
  display: inline-flex;
  flex: none;
  margin: 0;
}

.todo-delete {
  color: var(--muted);
}

.todo-delete:hover {
  color: var(--danger);
}

.note-textarea {
  min-height: 140px;
}

.save-state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--success);
  font-size: var(--text-sm);
  font-weight: 600;
}

.save-state .icon {
  width: 14px;
  height: 14px;
}

.note-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--sp-2);
}

.week-filter {
  margin-bottom: var(--sp-5);
}

.week {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.week-day {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.week-day.is-today {
  border-color: rgba(110, 159, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(110, 159, 255, 0.25);
}

.week-day-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.week-day.is-today .week-day-head {
  background: var(--accent-tint);
}

.week-day-link {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 32px;
  align-items: center;
  color: var(--text);
  font-weight: 700;
}

.week-day-link:hover {
  color: var(--accent-strong);
  text-decoration: none;
}

.week-day-name {
  color: var(--text-2);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.week-day-num {
  font-size: var(--text-xl);
}

.week-day-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--sp-2);
  padding: var(--sp-3);
  align-items: start;
}

@media (min-width: 900px) {
  .week-day {
    grid-template-columns: 112px minmax(0, 1fr);
  }
  .week-day-head {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 6px;
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }
}

.week-empty {
  margin: 0;
  padding: 6px var(--sp-1);
  color: var(--muted);
  font-size: var(--text-sm);
}

.entry {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: start;
  column-gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-md);
}

.entry.status-completed {
  border-left-color: var(--success);
}

.entry.status-missed {
  border-left-color: var(--danger);
}

.entry.is-planned {
  border-left-style: dashed;
  border-left-color: var(--border-strong);
}

.entry-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--muted);
}

.entry-main {
  min-width: 0;
  padding-top: 6px;
}

.entry-title {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.entry.status-completed .entry-title {
  color: var(--text-2);
}

.entry-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 2px var(--sp-3);
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.entry-sub .owner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.entry > .pill {
  margin-top: 10px;
}

.entry > .proof {
  grid-column: 1 / -1;
  margin: var(--sp-2) 0 var(--sp-1) var(--sp-2);
}

.routine-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-5);
  padding: 0;
  list-style: none;
}

.routine-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-4);
  margin: 0;
  padding: var(--sp-4) var(--sp-5);
}

.routine-item-main {
  flex: 1 1 240px;
  min-width: 0;
}

.routine-item h2 {
  margin: 0 0 2px;
  overflow-wrap: anywhere;
}

.routine-item h2 a {
  color: var(--text);
}

.routine-item h2 a:hover {
  color: var(--accent-strong);
}

.routine-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.routine-actions form {
  margin: 0;
}

.sched {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.archived > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

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

.archived > summary .icon {
  width: 16px;
  height: 16px;
  transition: transform var(--dur) var(--ease);
}

.archived[open] > summary .icon {
  transform: rotate(180deg);
}

.archived > summary:hover {
  color: var(--text);
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.rank-card {
  display: grid;
  grid-template-columns: 32px auto minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.rank-card:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  text-decoration: none;
}

.rank-num {
  text-align: center;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--muted);
}

.rank-card.top-1 {
  border-color: rgba(245, 181, 68, 0.5);
}
.rank-card.top-1 .rank-num {
  color: var(--rank-1);
}
.rank-card.top-2 .rank-num {
  color: var(--rank-2);
}
.rank-card.top-3 .rank-num {
  color: var(--rank-3);
}

.rank-body {
  min-width: 0;
}

.rank-name {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--sp-2);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--muted);
}

.bar-label {
  width: 28px;
  flex: none;
}

.bar {
  flex: 1;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  width: calc(var(--v, 0) * 1%);
  border-radius: inherit;
  background: var(--bar-color, var(--accent));
}

.bar-val {
  width: 44px;
  flex: none;
  text-align: right;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.rank-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--muted);
}

.rank-meta .icon {
  width: 15px;
  height: 15px;
}

.streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--warning);
}

.rank-pending {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--danger);
}

.profile-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-6);
}

.profile-header > div {
  flex: 1 1 220px;
  min-width: 0;
}

.profile-header h1 {
  overflow-wrap: anywhere;
}

.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  margin-top: 6px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.profile-stats b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.heatmap {
  display: grid;
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  width: 100%;
  max-width: 420px;
}

.hm-cell {
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 3px;
  background: var(--surface-3);
}

.hm-cell[data-l="1"] {
  background: color-mix(in srgb, var(--accent) 30%, var(--surface-3));
}
.hm-cell[data-l="2"] {
  background: color-mix(in srgb, var(--accent) 55%, var(--surface-3));
}
.hm-cell[data-l="3"] {
  background: color-mix(in srgb, var(--accent) 75%, var(--surface-3));
}
.hm-cell[data-l="4"] {
  background: var(--accent);
}

.hm-cell.is-future {
  background: transparent;
  border: 1px dashed var(--border);
}

.profile-routines {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-routines li {
  display: flex;
  flex-direction: column;
  padding: var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.profile-routines .routine-title {
  font-weight: 600;
}

.pin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-3);
}

.pin-card {
  display: block;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
}

.pin-card:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

.pin-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.pin-caption {
  display: block;
  padding: var(--sp-2) 10px 2px;
  font-size: var(--text-sm);
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.pin-date {
  display: block;
  padding: 0 10px var(--sp-2);
  font-size: var(--text-xs);
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-5);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--sp-4);
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.tabs a:hover {
  color: var(--text);
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.tabs a .badge {
  margin-left: 6px;
}

.penalty-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.penalty-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-3);
}

.penalty-list .penalty-card {
  margin-bottom: 0;
}

.penalty-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.penalty-desc {
  flex-basis: 100%;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.penalty-actions {
  display: flex;
  gap: var(--sp-2);
  margin-left: auto;
  align-items: center;
}

.penalty-actions form {
  margin: 0;
}

.penalty-meta {
  font-size: var(--text-sm);
  color: var(--muted);
}

.history-list {
  display: flex;
  flex-direction: column;
}

.history-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

.history-item:last-child {
  border-bottom: 0;
}

.history-main {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  min-width: 0;
}

.history-source {
  color: var(--muted);
  font-size: var(--text-sm);
}

.history-title {
  color: var(--text);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.history-date {
  margin-left: auto;
  font-size: var(--text-sm);
  color: var(--muted);
}

.assign-form,
.catalog-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
}

.assign-form .field,
.catalog-form .field {
  margin: 0;
  flex: 1 1 200px;
}

.assign-form select {
  width: 100%;
}

.assign-form .assign-custom {
  display: none;
}

.assign-form:has(select[name="catalog_id"] option[value=""]:checked) .assign-custom {
  display: flex;
}

.assign-form .btn,
.catalog-form .btn {
  flex: none;
}

.catalog-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.catalog-item:last-child {
  border-bottom: 0;
}

.catalog-item .title {
  font-weight: 600;
}

.catalog-desc {
  flex: 1 1 200px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.catalog-item.is-inactive .title {
  color: var(--muted);
}

.catalog-item form {
  margin: 0 0 0 auto;
}

.avatar-current {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.avatar-current .hint {
  flex: 1;
}

.card > form + form {
  margin-top: var(--sp-4);
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: var(--sp-2);
  width: 100%;
}

.avatar-option {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.avatar-option:hover {
  border-color: var(--muted);
}

.avatar-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent-strong);
}

.avatar-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  width: 100%;
}

.swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--user-color, var(--accent));
  cursor: pointer;
}

.swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.swatch:has(input:checked) {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.swatch:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.settings-form {
  max-width: 440px;
}

@media (max-width: 899.98px) {
  .card {
    padding: var(--sp-4);
    border-radius: var(--radius-md);
  }
  .page-head h1 {
    font-size: var(--text-xl);
  }
  .task.task-timed {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    column-gap: var(--sp-2);
  }
  .task.task-timed .task-time {
    grid-column: 1 / -1;
    padding: 0 0 0 var(--sp-2);
    text-align: left;
    font-size: var(--text-xs);
    color: var(--muted);
    order: -1;
  }
  .task.task-timed .task-time::after {
    content: "";
  }
  .progress {
    width: 96px;
  }
  .routine-item {
    padding: var(--sp-4);
  }
}

@media (max-width: 480px) {
  main {
    padding-left: var(--sp-3);
    padding-right: var(--sp-3);
  }
  .date-form input[type="date"] {
    min-width: 0;
  }
  .assign-form .btn,
  .catalog-form .btn {
    flex: 1 1 100%;
  }
  .auth-card {
    padding: var(--sp-6) var(--sp-4);
  }
}

.heatmap-legend {
  margin-top: var(--sp-3);
}

.journal-filter {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.journal-filter .input-row input {
  min-height: 44px;
}

.journal-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
}

.journal-custom .field {
  margin: 0;
  flex: 1 1 150px;
}

.journal {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.journal-day {
  margin: 0;
}

.journal-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}

.journal-day-head h2 {
  margin: 0;
}

.journal-day-head h2 a {
  color: var(--text);
}

.journal-day-head h2 a:hover {
  color: var(--accent-strong);
}

.journal-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
}

.journal-proof-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.journal-proof {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-md);
}

.journal-proof-title {
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

.journal-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin: 0;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.journal-proof .pin-photos img {
  width: 96px;
  height: 96px;
}

.journal-note + .journal-proofs {
  margin-top: var(--sp-4);
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.view-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  min-width: 68px;
  padding: 0 var(--sp-4);
  border-radius: 6px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

.view-switch a:hover {
  color: var(--text);
  text-decoration: none;
}

.view-switch a[aria-current="page"] {
  background: var(--accent-tint);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.add-details {
  margin-top: var(--sp-3);
}

.add-details > summary {
  list-style: none;
  cursor: pointer;
  width: fit-content;
}

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

.add-details[open] > summary {
  margin-bottom: var(--sp-4);
}

.deadlines h2 {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--deadline);
}

.deadlines {
  border-color: rgba(195, 155, 255, 0.3);
}

.todo.is-deadline .todo-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.todo.is-deadline .todo-title .icon {
  color: var(--deadline);
}

.countdown {
  margin-left: var(--sp-2);
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: var(--deadline-tint);
  color: var(--deadline);
  font-size: var(--text-xs);
  font-weight: 700;
}

.todo.overdue .countdown {
  background: var(--danger-tint);
  color: var(--danger);
}

.entry.kind-deadline {
  border-left-color: var(--deadline);
  background: linear-gradient(var(--deadline-tint), var(--deadline-tint)), var(--surface-2);
}

.entry.kind-deadline.status-completed {
  border-left-color: var(--success);
}

.entry.kind-deadline.status-missed {
  border-left-color: var(--danger);
}

.entry-title a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.entry-title a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.entry-title .icon {
  color: var(--deadline);
}

.tag-deadline {
  color: var(--deadline);
  font-weight: 700;
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
}

.month {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

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

.month-head {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.month-head span {
  padding: var(--sp-2) var(--sp-3);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.month-wk {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: var(--sp-3);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  text-decoration: none;
  border-right: 1px solid var(--border);
}

a.month-wk:hover {
  background: var(--accent-tint);
  color: var(--accent-strong);
  text-decoration: none;
}

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

.month-week:last-child {
  border-bottom: 0;
}

.month-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 132px;
  padding: 6px;
  border-right: 1px solid var(--border);
}

.month-cell:last-child {
  border-right: 0;
}

.month-cell.is-outside {
  background: rgba(0, 0, 0, 0.18);
}

.month-cell.is-outside .month-day {
  color: var(--muted);
}

.month-cell.is-today {
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.month-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.month-day:hover {
  background: var(--surface-3);
  text-decoration: none;
}

.month-cell.is-today .month-day > span:first-child {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-contrast);
}

.month-count {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.month-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.month-item {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 8px;
  border-left: 3px solid var(--warning);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-xs);
  text-decoration: none;
  overflow: hidden;
}

.month-item:hover {
  background: var(--surface-3);
  text-decoration: none;
}

.month-item.status-completed {
  border-left-color: var(--success);
  color: var(--text-2);
}

.month-item.status-completed .month-title {
  text-decoration: line-through;
}

.month-item.status-missed {
  border-left-color: var(--danger);
}

.month-item.is-planned {
  border-left-style: dashed;
  border-left-color: var(--border-strong);
}

.month-item.kind-deadline {
  border-left-color: var(--deadline);
  background: var(--deadline-tint);
  font-weight: 600;
}

.month-item .icon {
  width: 12px;
  height: 12px;
  color: var(--deadline);
}

.month-time {
  flex: none;
  color: var(--muted);
}

.month-title {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-more {
  display: flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  color: var(--accent-strong);
  font-size: var(--text-xs);
  font-weight: 600;
}

.month-dots {
  display: none;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--warning);
}

.dot-done {
  background: var(--success);
}

.dot-missed {
  background: var(--danger);
}

.dot-deadline {
  background: var(--deadline);
  border-radius: 2px;
}

@media (max-width: 899.98px) {
  .month-head,
  .month-week {
    grid-template-columns: 30px repeat(7, minmax(0, 1fr));
  }
  .month-head span {
    padding: var(--sp-2) 2px;
    text-align: center;
    font-size: 10px;
    letter-spacing: 0;
  }
  .month-cell {
    min-height: 68px;
    gap: 2px;
    padding: 2px;
    align-items: stretch;
  }
  .month-items,
  .month-count {
    display: none;
  }
  .month-day {
    justify-content: center;
    min-height: 34px;
    padding: 0;
  }
  .month-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
    flex: 1;
    padding: 2px;
  }
  .dot {
    width: 7px;
    height: 7px;
  }
  .view-switch a {
    min-width: 58px;
    padding: 0 var(--sp-3);
  }
  .head-actions {
    width: 100%;
    justify-content: space-between;
  }
}

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

.label-row label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-2);
}

.link-btn {
  min-height: 24px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.todo-due {
  flex-wrap: wrap;
  row-gap: 2px;
}

.countdown {
  white-space: nowrap;
}

.todo-extra .field-row,
.deadlines .field-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.picker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.picker {
  position: relative;
}

.picker-button {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-4) 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

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

.picker-button:hover,
.picker[open] > .picker-button {
  background: var(--surface-2);
  border-color: var(--accent);
}

.picker-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  max-height: 60vh;
  overflow-y: auto;
  margin: 0;
  padding: var(--sp-2);
  list-style: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.picker-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 44px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}

.picker-item span:not(.avatar) {
  flex: 1;
}

.picker-item:hover {
  background: var(--surface-3);
  text-decoration: none;
}

.picker-item.is-active {
  background: var(--accent-tint);
  color: var(--accent-strong);
}

.readonly-note {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--warning-tint);
  color: var(--warning);
  font-size: var(--text-sm);
  font-weight: 600;
}

.tick-btn.is-static {
  pointer-events: none;
}

.note-readonly {
  margin: 0;
  white-space: pre-wrap;
  color: var(--text-2);
}

.month-week {
  grid-template-rows: auto 1fr;
}

.month-week > .month-wk {
  grid-row: 1 / span 2;
}

.month-bars {
  grid-column: 2 / -1;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 6px 6px 0;
  list-style: none;
}

.month-week > .month-cell {
  grid-row: 2;
}

.month-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 12px 0 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
}

.month-bar:hover {
  background: var(--surface-3);
  text-decoration: none;
}

.month-bar .icon {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.bar-pips {
  display: inline-flex;
  gap: 4px;
}

.pip {
  display: inline-block;
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--muted);
  border-radius: var(--radius-full);
}

.pip.is-done {
  border-color: var(--success);
  background: var(--success);
}

.bar-count {
  color: var(--muted);
}

.month-bar.status-completed {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-tint);
}

.month-bar.status-completed .icon {
  color: var(--success);
}

.month-bar.status-missed {
  border-color: var(--danger);
  background: var(--danger-tint);
}

.month-bar.status-missed .pip:not(.is-done) {
  border-color: var(--danger);
}

.month-bar.status-open .pip:not(.is-done) {
  border-color: var(--warning);
}

@media (max-width: 899.98px) {
  .month-bars {
    padding: 4px 2px 0;
  }
  .month-bar {
    min-height: 28px;
    padding: 0 8px 0 6px;
    gap: 5px;
    max-width: 100%;
  }
  .bar-title {
    max-width: 14ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.bar-days {
  padding-left: 8px;
  border-left: 1px solid var(--border-strong);
  color: var(--text-2);
  font-weight: 500;
}

.week-goals {
  margin-bottom: var(--sp-4);
}

.week-goals h2 {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.week-goals .month-bars {
  grid-column: auto;
  padding: 0;
}

.entry-title .icon {
  width: 14px;
  height: 14px;
}

.locked-note {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
  color: var(--muted);
  font-size: var(--text-sm);
}

.locked-note .icon {
  width: 14px;
  height: 14px;
}

.tick-btn.is-sm {
  width: 28px;
  height: 28px;
}

.tick-btn.is-sm::before {
  inset: 3px;
}

.tick-btn.is-sm .icon {
  width: 12px;
  height: 12px;
}

.wk-grid {
  --gutter: 60px;
  --hour-h: 56px;
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.wk-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

@media (min-width: 1100px) {
  .wk-grid {
    display: block;
  }
  .wk-list {
    display: none;
  }
}

.wk-row {
  display: grid;
  grid-template-columns: var(--gutter) repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.wk-row:last-child {
  border-bottom: 0;
}

.wk-gutter {
  border-right: 1px solid var(--border);
}

.wk-label {
  padding: var(--sp-2) 6px;
  color: var(--muted);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: right;
  white-space: nowrap;
}

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

.wk-dayhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2) var(--sp-1);
  border-right: 1px solid var(--border);
  color: var(--text);
}

.wk-dayhead:last-child,
.wk-cell:last-child,
.wk-col:last-child {
  border-right: 0;
}

.wk-dayhead:hover {
  text-decoration: none;
  background: var(--surface-3);
}

.wk-dow {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wk-num {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  font-size: var(--text-lg);
  font-weight: 700;
}

.wk-dayhead.is-today .wk-dow {
  color: var(--accent-strong);
}

.wk-dayhead.is-today .wk-num {
  background: var(--accent);
  color: var(--accent-contrast);
}

.wk-dayhead.is-past .wk-num {
  color: var(--muted);
}

.wk-span {
  grid-column: 2 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
}

.wk-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 6px 4px;
  border-right: 1px solid var(--border);
}

.wk-cell.is-today,
.wk-col.is-today {
  background: rgba(110, 159, 255, 0.05);
}

.wk-cell.is-past,
.wk-col.is-past {
  background: rgba(0, 0, 0, 0.18);
}

.wk-body {
  height: calc(var(--hours) * var(--hour-h));
}

.wk-hours {
  position: relative;
}

.wk-hours span {
  position: absolute;
  right: 8px;
  color: var(--muted);
  font-size: 0.6875rem;
  line-height: 1;
  transform: translateY(-50%);
}

.wk-col {
  position: relative;
  min-width: 0;
  border-right: 1px solid var(--border);
  background-image:
    repeating-linear-gradient(
      to bottom,
      var(--border) 0,
      var(--border) 1px,
      transparent 1px,
      transparent var(--hour-h)
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--hour-h) / 2),
      rgba(255, 255, 255, 0.025) calc(var(--hour-h) / 2),
      rgba(255, 255, 255, 0.025) calc(var(--hour-h) / 2 + 1px),
      transparent calc(var(--hour-h) / 2 + 1px),
      transparent var(--hour-h)
    );
}

.wk-col > .wk-ev {
  position: absolute;
  min-height: 22px;
  box-sizing: border-box;
  z-index: 1;
}

.wk-col > .wk-ev:hover,
.wk-col > .wk-ev:focus-within {
  z-index: 5 !important;
}

.wk-col > .wk-ev + .wk-ev {
  box-shadow: -2px 0 0 var(--surface);
}

.wk-ev.is-short {
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

.wk-ev.is-short .wk-ev-main {
  padding-top: 0;
}

.wk-ev.is-short .tick-btn.is-sm,
.wk-ev.is-short .wk-ev-mark {
  width: 22px;
  height: 22px;
}

.wk-ev.is-short .tick-btn.is-sm::before {
  inset: 2px;
}

.wk-now {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 6;
  height: 2px;
  background: var(--danger);
  pointer-events: none;
}

.wk-now::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--danger);
}

.wk-ev {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 3px 6px 3px 4px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  line-height: 1.25;
}

.wk-ev .tick-form {
  margin-top: -1px;
}

.wk-ev.status-completed {
  border-left-color: var(--success);
  background: color-mix(in srgb, var(--success) 10%, var(--surface-2));
}

.wk-ev.status-missed {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface-2));
}

.wk-ev.is-planned {
  border-left-style: dashed;
  border-left-color: var(--border-strong);
  background: var(--surface);
}

.wk-ev.kind-deadline {
  border-left-color: var(--deadline);
  background: var(--deadline-tint);
}

.wk-ev.kind-deadline.status-completed {
  opacity: 0.7;
}

.wk-ev.kind-deadline.status-missed {
  border-left-color: var(--danger);
}

.wk-ev-mark {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--muted);
}

.wk-ev-mark .icon {
  width: 14px;
  height: 14px;
}

.wk-ev.status-completed .wk-ev-mark {
  color: var(--success);
}

.wk-ev.status-missed .wk-ev-mark {
  color: var(--danger);
}

.wk-ev-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: 3px;
}

.wk-ev.is-short .wk-ev-main {
  flex-direction: row;
  align-items: baseline;
  column-gap: 6px;
  overflow: hidden;
}

.wk-ev.is-short .wk-ev-title {
  flex: 0 1 auto;
}

.wk-ev.is-short .wk-ev-time {
  flex: none;
}

.wk-ev {
  container-type: inline-size;
}

.wk-col > .wk-ev.is-short .wk-ev-time {
  display: none;
}

@container (max-width: 120px) {
  .is-short > .wk-ev-main > .wk-ev-time {
    display: none;
  }
}

.wk-ev-title {
  overflow: hidden;
  color: var(--text);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wk-ev-title .icon {
  width: 12px;
  height: 12px;
  margin-right: 3px;
  vertical-align: -1px;
}

.wk-ev-title:hover {
  color: var(--accent-strong);
  text-decoration: none;
}

.wk-ev.status-completed .wk-ev-title {
  color: var(--text-2);
}

.wk-ev.status-missed .wk-ev-title {
  color: var(--text-2);
  text-decoration: line-through;
  text-decoration-color: rgba(255, 123, 115, 0.6);
}

.wk-ev-time {
  color: var(--muted);
  white-space: nowrap;
}

.wk-ev-time.owner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.goal-lane-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
}

.goal-lane-head:hover {
  text-decoration: none;
  color: var(--accent-strong);
}

.goal-lane-head > .icon {
  width: 14px;
  height: 14px;
  color: var(--deadline);
}

.goal-lane-count {
  color: var(--text-2);
}

.goal-lane-met,
.goal-lane-miss {
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
}

.goal-lane-met {
  background: var(--success-tint);
  color: var(--success);
}

.goal-lane-miss {
  background: var(--danger-tint);
  color: var(--danger);
}

.goal-slots {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.goal-slot {
  display: grid;
  grid-template-rows: auto 36px;
  justify-items: center;
  align-items: center;
  min-height: 36px;
}

.goal-slot > :last-child {
  grid-row: 2;
}

.goal-slot-dow {
  display: none;
  grid-row: 1;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
}

.goal-slot.is-today .goal-slot-dow {
  color: var(--accent-strong);
}

.goal-mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
}

.goal-mark .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.goal-slot.is-done .goal-mark {
  background: var(--success);
  color: #07150e;
}

.goal-slot.is-open .goal-mark {
  border: 2px dashed var(--border-strong);
}

.goal-slot.is-idle .goal-mark,
.goal-slot.is-today .goal-mark {
  width: 8px;
  height: 8px;
  background: var(--border-strong);
}

.goal-slot.is-off .goal-mark {
  width: 8px;
  height: 8px;
  opacity: 0.3;
  background: var(--border);
}

.goal-slot .tick-btn {
  width: 36px;
  height: 36px;
}

.goal-slot .tick-btn::before {
  inset: 4px;
}

.goal-slot .tick-btn:not(.is-done)::before {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.wk-goals-card h2 {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.wk-goals-card .goal-lane + .goal-lane {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.wk-goals-card .goal-lane-head {
  padding: 0;
}

.wk-goals-card .goal-slot-dow {
  display: block;
}

.wk-past {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.wk-past > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-4);
  color: var(--text-2);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

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

.wk-past > summary .icon {
  width: 16px;
  height: 16px;
  transition: transform var(--dur) var(--ease);
}

.wk-past[open] > summary .icon {
  transform: rotate(180deg);
}

.wk-past-count {
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
  font-size: var(--text-sm);
}

.wk-past > .week {
  padding: 0 var(--sp-3) var(--sp-3);
}

.week-day.is-past {
  opacity: 0.75;
}

.error-message {
  margin: 0 0 var(--sp-5);
  color: var(--text-2);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
}
