/*
 * HomeKeep - Warm Workshop Design System
 * A mobile-first design with warm, trustworthy aesthetics
 * Inspired by organized workshops and home craftsmanship
 */

/* ========================================
   CUSTOM FONTS
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ========================================
   CSS CUSTOM PROPERTIES
   ======================================== */
:root {
  /* Colors - Warm Workshop Palette */
  --color-forest: #1a4d3e;
  --color-forest-light: #2a6b57;
  --color-forest-dark: #0f2d25;
  --color-terracotta: #c66b3d;
  --color-terracotta-light: #e8956b;
  --color-terracotta-dark: #a04e26;
  --color-cream: #faf7f2;
  --color-cream-warm: #f5efe6;
  --color-charcoal: #2d2926;
  --color-charcoal-light: #4a4541;
  --color-stone: #8b8178;
  --color-stone-light: #b5aea5;
  --color-copper: #b87333;
  --color-sage: #9cae9c;
  --color-error: #c44536;
  --color-error-bg: #fdf2f1;
  --color-success: #4a7c4e;
  --color-success-bg: #f0f7f1;
  --color-warning: #d4a03a;
  --color-warning-bg: #fdf8ed;

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  /* Gap above every section heading (H2 and section wrappers). */
  --space-section: var(--space-xl);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(45, 41, 38, 0.06);
  --shadow-md: 0 4px 12px rgba(45, 41, 38, 0.08);
  --shadow-lg: 0 8px 24px rgba(45, 41, 38, 0.12);
  --shadow-inner: inset 0 2px 4px rgba(45, 41, 38, 0.06);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --container-max: 480px;
  --content-max: var(--container-max); /* width of .app-main's column */
  --content-max-wide: var(--content-max); /* .app-main-wide (two-pane pages) */
  --sidebar-width: 248px;
  --bottom-nav-height: 72px;
  /* Visible tab bar height including the home-indicator inset; anything that
     must clear the fixed tab bar should use this, not --bottom-nav-height. */
  --tab-bar-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  --header-height: 64px;
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

/* Make the hidden attribute win over component display rules (e.g. flex badges) */
[hidden] {
  display: none !important;
}

/* Turbo frames wrap block content (e.g. the asset detail pane) */
turbo-frame {
  display: block;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-charcoal);
  background-color: var(--color-cream);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Subtle texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.02;
  pointer-events: none;
  z-index: -1;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-charcoal);
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2rem;
  margin-bottom: var(--space-md);
}

h2 {
  font-size: 1.75rem;
  margin-bottom: var(--space-md);
}

/* A line of context under a page title (e.g. a property's address). */
.page-subtitle {
  margin-top: calc(-1 * var(--space-sm));
  margin-bottom: var(--space-lg);
  font-size: 0.9375rem;
  color: var(--color-stone);
}

/* Section headings never sit flush against the content (often a button) above. */
h2:not(:first-child) {
  margin-top: var(--space-section);
}

h3 {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-md);
}

a {
  color: var(--color-forest);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-forest-light);
}

small {
  font-size: 0.875rem;
  color: var(--color-stone);
}

/* ========================================
   LAYOUT COMPONENTS
   ======================================== */

/* App Shell */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  /* Never let a stray wide element widen the page. `clip` (unlike `hidden`)
     keeps the sticky header and sticky side columns working. */
  overflow-x: clip;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-cream);
  border-bottom: 1px solid var(--color-stone-light);
  padding: var(--space-md) var(--space-lg);
  backdrop-filter: blur(12px);
  background: rgba(250, 247, 242, 0.92);
}

.header-content {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--color-forest);
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-forest);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-cream);
  font-size: 1rem;
}

/* Main Content Area */
.app-main {
  flex: 1;
  padding: var(--space-lg);
  /* Clear the fixed tab bar (and the safe-area inset) so the last button on a
     page is always reachable. */
  padding-bottom: calc(var(--tab-bar-height) + var(--space-xl));
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}

.app-main-wide {
  max-width: var(--content-max-wide);
}

/* .app-main-fluid (with .app-main-wide): calendar grids take the full width from 768px,
   before the sidebar layout's wide column starts at 1024px. */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .app-main-fluid {
    max-width: none;
  }
}

/* Auth pages - centered content */
.auth-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-xl) var(--space-lg);
}

.auth-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: var(--container-max);
  margin: 0 auto;
  width: 100%;
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.auth-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-forest-light) 100%);
  border-radius: var(--radius-md);
  margin: 0 auto var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

.auth-logo svg {
  width: 36px;
  height: 36px;
  color: var(--color-cream);
}

.auth-title {
  color: var(--color-charcoal);
  margin-bottom: var(--space-xs);
}

.auth-subtitle {
  color: var(--color-stone);
  font-size: 1rem;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tab-bar-height);
  background: var(--color-cream);
  border-top: 1px solid var(--color-stone-light);
  padding: var(--space-sm) var(--space-md);
  padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(250, 247, 242, 0.95);
}

.nav-list {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: var(--container-max);
  margin: 0 auto;
  list-style: none;
  height: 100%;
}

.nav-item {
  flex: 1;
}

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  color: var(--color-stone);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-link svg {
  width: 24px;
  height: 24px;
  transition: transform var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-forest);
}

.nav-link.active svg {
  transform: scale(1.1);
}

.nav-link:active {
  transform: scale(0.95);
}

/* ========================================
   CARDS & CONTAINERS
   ======================================== */
.card {
  background: white;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(139, 129, 120, 0.1);
}

.card-elevated {
  box-shadow: var(--shadow-md);
}

.card + .card {
  margin-top: var(--space-md);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--color-charcoal);
}

/* ========================================
   FORMS
   ======================================== */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-group:last-of-type {
  margin-bottom: var(--space-xl);
}

label,
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-charcoal);
  margin-bottom: var(--space-xs);
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--color-stone);
  font-weight: 400;
  margin-left: var(--space-xs);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="date"],
input[type="tel"],
input[type="url"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: var(--space-md);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-charcoal);
  background: white;
  border: 2px solid var(--color-stone-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-forest);
  box-shadow: 0 0 0 3px rgba(26, 77, 62, 0.12);
}

/* Fields with errors (see config/initializers/field_error_proc.rb) */
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"],
.input-affix:has([aria-invalid="true"]) {
  border-color: var(--color-error);
  background-color: var(--color-error-bg);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-stone);
}

/* Input with an inline prefix/suffix ("$ 10.00", "3 month(s)") — see FormFieldsHelper */
.input-affix {
  display: flex;
  align-items: center;
  background: white;
  border: 2px solid var(--color-stone-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.input-affix:focus-within {
  border-color: var(--color-forest);
  box-shadow: 0 0 0 3px rgba(26, 77, 62, 0.12);
}

.input-affix input,
.input-affix input:focus {
  flex: 1;
  min-width: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.input-affix-prefix,
.input-affix-suffix {
  flex: none;
  color: var(--color-stone);
  font-size: 1rem;
  white-space: nowrap;
  pointer-events: none;
}

.input-affix-prefix {
  padding-left: var(--space-md);
  margin-right: calc(var(--space-md) * -0.6);
}

.input-affix-suffix {
  padding-right: var(--space-md);
}

/* Grows with its content where supported (one instruction step per line) */
.textarea-autosize {
  field-sizing: content;
  min-height: 7.5em;
  max-height: 24em;
}

/* Photo upload: styled drop zone over a hidden native file input, plus thumbnails */
.photo-dropzone,
.field label.photo-dropzone {
  position: relative;
  display: flex;
  margin: 0;
  font-weight: 400;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-lg);
  text-align: center;
  background: var(--color-cream);
  border: 2px dashed var(--color-stone-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.photo-dropzone:hover,
.photo-dropzone.is-dragging,
.photo-dropzone:focus-within {
  border-color: var(--color-forest);
  background: var(--color-cream-warm);
}

.photo-dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.photo-dropzone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: white;
  color: var(--color-forest);
}

.photo-dropzone-title {
  font-weight: 600;
  color: var(--color-forest);
}

.photo-dropzone-hint {
  font-size: 0.8125rem;
  color: var(--color-stone);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--space-sm);
  margin: 0 0 var(--space-sm);
  padding: 0;
  list-style: none;
}

.photo-dropzone + .photo-grid {
  margin: var(--space-sm) 0 0;
}

.photo-grid-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-cream-warm);
}

.photo-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-grid-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(45, 41, 38, 0.72);
  color: white;
  cursor: pointer;
}

/* Password input with show/hide toggle */
.password-field {
  position: relative;
}

.password-field input {
  padding-right: calc(var(--space-md) + 40px);
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: var(--space-xs);
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-stone);
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle[aria-pressed="true"] {
  color: var(--color-forest);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--color-forest);
  outline-offset: -4px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238b8178' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  background-size: 18px;
  padding-right: calc(var(--space-md) * 2 + 18px);
}

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

/* Checkbox & Radio */
.checkbox-group,
.radio-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

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

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-stone-light);
}

.toggle-wrapper:last-child {
  border-bottom: none;
}

/* A field that belongs to the toggle above it (e.g. Email style under Email notifications) */
.toggle-wrapper + .form-group {
  margin-top: var(--space-lg);
}

.toggle-wrapper:has(+ .form-group[hidden]) {
  border-bottom: none;
}

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

.toggle-title {
  font-weight: 600;
  color: var(--color-charcoal);
}

.toggle-description {
  font-size: 0.8125rem;
  color: var(--color-stone);
}

.toggle {
  position: relative;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-stone-light);
  border-radius: 32px;
  transition: var(--transition-base);
}

.toggle-track::before {
  position: absolute;
  content: '';
  height: 26px;
  width: 26px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-track {
  background-color: var(--color-forest);
}

.toggle input:checked + .toggle-track::before {
  transform: translateX(20px);
}

.toggle input:focus + .toggle-track {
  box-shadow: 0 0 0 3px rgba(26, 77, 62, 0.12);
}

/* A lone toggle in a form (e.g. a task's Active switch), carded like the form's fieldsets. */
.form-toggle-card {
  margin-top: var(--space-lg);
  padding-top: var(--space-sm);
  padding-bottom: var(--space-sm);
}

/* ========================================
   BUTTONS
   One system for every button and button-styled link:
     .btn + one variant: .btn-primary | .btn-secondary | .btn-tertiary | .btn-destructive
     optional size:      .btn-sm (default size needs no class)
     optional width:     .btn-block (full width, e.g. form submits)
   Every variant has the same 1px border, so buttons of one size line up.
   Use at most one .btn-primary per view.
   ======================================== */

/* Unclassed buttons (icon buttons, menu rows) start from a neutral reset. */
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  box-shadow: none;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast), box-shadow var(--transition-fast);
}

.btn:focus-visible {
  outline: 2px solid var(--color-forest);
  outline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-forest-light) 100%);
  color: white;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:hover {
  color: white;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-secondary {
  background: white;
  color: var(--color-forest);
  border-color: var(--color-forest);
}

.btn-secondary:hover {
  background: rgba(26, 77, 62, 0.06);
  color: var(--color-forest-dark);
}

.btn-tertiary {
  background: transparent;
  color: var(--color-forest);
}

.btn-tertiary:hover {
  background: rgba(26, 77, 62, 0.08);
  color: var(--color-forest-dark);
}

.btn-destructive {
  background: white;
  color: var(--color-error);
  border-color: rgba(196, 69, 54, 0.5);
}

.btn-destructive:hover {
  background: var(--color-error-bg);
  color: #a33a2d;
  border-color: var(--color-error);
}

.btn-sm {
  min-height: 36px;
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
}

/* Square icon-only button; pair with an aria-label. */
.btn.btn-icon {
  width: 48px;
  padding: 0;
}

.btn.btn-icon.btn-sm {
  width: 36px;
}

.btn-block {
  width: 100%;
}

/* A row of buttons; wraps on narrow screens. button_to's <form> is the flex item. */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.btn-row form {
  margin: 0;
}

/* ========================================
   CONFIRM DIALOG (data-turbo-confirm; app/javascript/confirm_dialog.js)
   ======================================== */
.confirm-dialog {
  width: min(calc(100% - 2 * var(--space-md)), 420px);
  margin: auto;
  padding: 0;
  border: none;
  border-radius: var(--radius-lg);
  background: white;
  color: var(--color-charcoal);
  box-shadow: var(--shadow-lg);
}

.confirm-dialog::backdrop {
  background: rgba(45, 41, 38, 0.45);
}

.confirm-dialog-panel {
  padding: var(--space-lg);
}

.confirm-dialog-title {
  font-size: 1.375rem;
  margin: 0 0 var(--space-sm);
}

.confirm-dialog-detail {
  color: var(--color-charcoal-light);
  font-size: 0.9375rem;
  margin: 0;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* ========================================
   ALERTS & MESSAGES
   ======================================== */
.notice,
.alert,
.flash-message {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: slideDown 0.3s ease;
}

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

.notice,
.flash-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(74, 124, 78, 0.2);
}

.alert,
.flash-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid rgba(196, 69, 54, 0.2);
}

.flash-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid rgba(212, 160, 58, 0.2);
}

/* Toast container: flashes (server-rendered and Turbo Stream) float below the header */
.flash-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-md));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 2 * var(--space-md)), var(--container-max));
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.flash-container-auth {
  top: var(--space-md);
}

.flash-container .flash-message {
  margin-bottom: 0;
  padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

.flash-icon {
  flex-shrink: 0;
}

.flash-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.flash-dismiss {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.flash-dismiss:hover,
.flash-dismiss:focus-visible {
  opacity: 1;
  background: rgba(45, 41, 38, 0.06);
}

/* Undo in a toast (shared/_flash): a text button pushed to the end, before the dismiss. */
.flash-undo-form {
  flex-shrink: 0;
  margin: 0 0 0 auto;
}

.flash-undo {
  min-height: 32px;
  padding: 0 var(--space-sm);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.flash-undo:hover,
.flash-undo:focus-visible {
  background: rgba(45, 41, 38, 0.06);
}

.flash-message.flash-leaving {
  animation: flashLeave 0.2s ease forwards;
}

@keyframes flashLeave {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Below the desktop breakpoint, toasts sit just above the tab bar, clear of the back
   button and page title, and rise into place (newest nearest the tab bar). */
@media (max-width: 1023.98px) {
  .flash-container:not(.flash-container-auth) {
    top: auto;
    bottom: calc(var(--tab-bar-height) + var(--space-sm));
    flex-direction: column-reverse;
  }

  .flash-container:not(.flash-container-auth) .flash-message {
    animation-name: flashRise;
  }

  .flash-container:not(.flash-container-auth) .flash-message.flash-leaving {
    animation-name: flashSink;
  }

  /* Above a pinned action bar (a task's Mark complete), never over it. */
  body:has(.ti-complete-bar) .flash-container:not(.flash-container-auth) {
    bottom: calc(var(--tab-bar-height) + 72px + var(--space-sm));
  }

  /* A tap on the toast's text reaches what's under it (say, a Save button at the bottom of
     a form); only its own buttons take taps. */
  .flash-container .flash-message {
    pointer-events: none;
  }

  .flash-container .flash-message :is(button, a, form) {
    pointer-events: auto;
  }
}

@keyframes flashRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes flashSink {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* Keyboard users jump past the navigation; hidden until focused. */
.skip-link {
  position: fixed;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 200;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-forest);
  color: white;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transform: translateY(calc(-100% - var(--space-md)));
}

.skip-link:focus {
  transform: none;
}

/* The skip link's target; focusable only so the jump lands there. */
.app-main:focus {
  outline: none;
}

/* Error Explanation */
#error_explanation {
  background: var(--color-error-bg);
  border: 1px solid rgba(196, 69, 54, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

#error_explanation h2 {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-error);
  margin-bottom: var(--space-sm);
}

#error_explanation ul {
  list-style: none;
  margin: 0;
}

#error_explanation li {
  font-size: 0.875rem;
  color: var(--color-error);
  padding: var(--space-xs) 0;
}

#error_explanation li::before {
  content: '\2022';
  margin-right: var(--space-sm);
}

/* ========================================
   AUTH LINKS
   ======================================== */
.auth-links {
  text-align: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-stone-light);
}

.auth-link {
  display: block;
  padding: var(--space-sm) 0;
  color: var(--color-stone);
  font-size: 0.9375rem;
  transition: color var(--transition-fast);
}

.auth-link:hover {
  color: var(--color-forest);
}

/* ========================================
   DASHBOARD SPECIFIC
   ======================================== */
.dashboard-header {
  margin-bottom: var(--space-xl);
}

.greeting {
  font-size: 0.9375rem;
  color: var(--color-stone);
  margin-bottom: var(--space-xs);
}

/* Page titles are plain h1s (one size everywhere); this only styles the
   dashboard's side-column heading when it's an h2. */
.dashboard-title {
  font-family: var(--font-display);
  color: var(--color-charcoal);
}

h2.dashboard-title {
  font-size: 1.75rem;
}

/* ========================================
   DASHBOARD TASK SECTIONS (Overdue, This Week)
   ======================================== */
.dashboard-section + .dashboard-section {
  margin-top: var(--space-section);
}

.dashboard-all-clear {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin: 0 0 var(--space-lg);
  font-size: 0.875rem;
  color: var(--color-stone);
}

.dashboard-all-clear svg {
  flex-shrink: 0;
  color: var(--color-success);
}

.dashboard-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-forest);
}

.dashboard-section-overdue .dashboard-section-header {
  border-bottom-color: var(--color-error);
}

.dashboard-section-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.dashboard-section-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-forest-light) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-cream);
  flex-shrink: 0;
}

.dashboard-section-overdue .dashboard-section-icon {
  background: var(--color-error);
  color: white;
}

.dashboard-section-header .dashboard-section-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--color-charcoal);
  margin: 0;
}

.dashboard-section-count {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-stone);
}

.dashboard-view-all {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-forest);
  text-decoration: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.dashboard-view-all:hover {
  color: var(--color-forest-light);
  text-decoration: underline;
}

.dashboard-section .empty-state {
  background: white;
  border: 1px dashed var(--color-stone-light);
  border-radius: var(--radius-md);
}

/* ========================================
   TASK CARDS: one look for every task card (lists, dashboard, calendar day, an asset's
   tasks). Body markup: task_instances/_task_summary; the left stripe carries the status.
   ======================================== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.task-card {
  background: white;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(139, 129, 120, 0.1);
  border-left: 4px solid var(--color-sage);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.task-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.task-card.overdue {
  border-left-color: var(--color-error);
  background: linear-gradient(135deg, white 92%, var(--color-error-bg) 100%);
}

.task-card.due-today {
  border-left-color: var(--color-warning);
}

.task-card.skipped,
.task-card.missed,
.task-card.is-inactive {
  border-left-color: var(--color-stone-light);
}

.task-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.task-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-charcoal);
  margin: 0;
}

.task-title a {
  color: var(--color-charcoal);
  text-decoration: none;
}

.task-title a:hover {
  color: var(--color-forest);
}

.task-header .difficulty-badge {
  margin-top: 2px;
}

.task-header .overflow-menu {
  margin: -6px calc(-1 * var(--space-xs)) -6px 0;
}

.difficulty-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  white-space: nowrap;
  flex-shrink: 0;
}

.difficulty-badge.difficulty-easy {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.difficulty-badge.difficulty-medium {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.difficulty-badge.difficulty-hard {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.difficulty-badge.difficulty-inactive {
  background: var(--color-cream-warm);
  color: var(--color-stone);
}

/* "Main › Kitchen › Refrigerator" (asset_trail) */
.task-asset {
  font-size: 0.8125rem;
  color: var(--color-stone);
  margin: 0 0 var(--space-sm);
  overflow-wrap: anywhere;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--color-stone);
}

.task-meta .due-date strong {
  color: var(--color-charcoal);
}

.task-card.overdue .task-meta .due-date strong {
  color: var(--color-error);
}

/* "Due Oct 12 · 10 min · $20.00": a wrapping row of facts with dot separators. Each dot sits in
   the gap before its item, so an item that wraps to a new line leaves its dot in the clipped
   gutter left of the row instead of starting the line with "·". */
.meta-list {
  --meta-gap: var(--space-md);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--meta-gap);
  row-gap: 2px;
  overflow: hidden;
}

.meta-list > * {
  position: relative;
  white-space: nowrap;
}

.meta-list > * + *::before {
  content: '·';
  position: absolute;
  left: calc(var(--meta-gap) / -2);
  transform: translateX(-50%);
  color: var(--color-stone-light);
  font-weight: 700;
}

/* "Missed 3× · next due Oct 7": earlier occurrences rolled into this card. */
.task-missed {
  margin: var(--space-xs) 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-charcoal);
}

.task-missed-next {
  font-weight: 400;
  color: var(--color-stone);
}

/* "Reason: Landlord did it": why a closed task was skipped, or its done note, on one line. */
.task-closed-note {
  margin: var(--space-xs) 0 0;
  font-size: 0.8125rem;
  color: var(--color-stone);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Task list sections (tasks index and dashboard): a heading with an optional action. */
.task-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.task-section-header h2 {
  margin-bottom: 0;
}

.task-section + .task-section {
  margin-top: var(--space-section);
}

.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.task-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(139, 129, 120, 0.08);
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--color-charcoal);
  transition: all var(--transition-fast);
  border: 1px solid rgba(139, 129, 120, 0.1);
}

.quick-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--color-forest);
}

.quick-action:active {
  transform: translateY(0);
}

.quick-action-icon {
  width: 48px;
  height: 48px;
  background: var(--color-cream-warm);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-forest);
}

.quick-action-icon svg {
  width: 24px;
  height: 24px;
}

.quick-action-label {
  font-weight: 600;
  font-size: 0.875rem;
}

/* Menu List */
.menu-list {
  list-style: none;
}

.menu-item {
  border-bottom: 1px solid var(--color-stone-light);
}

.menu-item:last-child {
  border-bottom: none;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  color: var(--color-charcoal);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.menu-link:hover {
  color: var(--color-forest);
}

.menu-icon {
  width: 40px;
  height: 40px;
  background: var(--color-cream-warm);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-forest);
  flex-shrink: 0;
}

.menu-icon svg {
  width: 20px;
  height: 20px;
}

.menu-content {
  flex: 1;
}

.menu-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.menu-description {
  font-size: 0.8125rem;
  color: var(--color-stone);
}

.menu-arrow {
  color: var(--color-stone-light);
}

/* Sign out button styling */
.menu-item form {
  margin: 0;
}

.menu-item form button,
.menu-item form input[type="submit"] {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--color-error);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast);
  box-shadow: none;
  margin: 0;
}

.menu-item form button:hover,
.menu-item form input[type="submit"]:hover {
  opacity: 0.8;
  transform: none;
  box-shadow: none;
}

/* ========================================
   SETTINGS PAGES
   ======================================== */
.settings-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

/* Same size as every other page title (the h1 rule). */
.settings-title {
  font-family: var(--font-display);
  margin-bottom: 0;
}

/* Settings Sections */
.settings-section {
  margin-bottom: var(--space-section);
}

.settings-section-title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-stone);
  margin-bottom: var(--space-md);
}

/* Plan card: usage against the plan's limits */
.plan-usage {
  margin: 0 0 var(--space-md);
}

.plan-usage-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-stone-light);
}

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

.plan-usage-row dd {
  margin: 0;
  font-weight: 600;
}

.plan-options {
  display: grid;
  gap: var(--space-md);
}

.plan-option {
  padding: var(--space-md);
  border: 1px solid var(--color-stone-light);
  border-radius: var(--radius-md);
}

.plan-option.is-current {
  border-color: var(--color-forest);
}

.plan-option-name {
  margin: 0 0 var(--space-xs);
  font-size: 1rem;
}

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

.plan-option-price {
  margin: var(--space-sm) 0 0;
  font-weight: 600;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-muted { color: var(--color-stone); }
.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0; }
.mt-lg { margin-top: var(--space-lg); }
.mb-lg { margin-bottom: var(--space-lg); }

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.animate-fade-in {
  animation: fadeIn 0.4s ease;
}

.animate-slide-up {
  animation: slideUp 0.4s ease;
}

/* Staggered animations */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

/* ========================================
   RESPONSIVE - TABLET & DESKTOP
   ======================================== */
@media (min-width: 640px) {
  :root {
    --container-max: 560px;
  }

  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }

  .auth-logo {
    width: 80px;
    height: 80px;
  }

  .auth-logo svg {
    width: 44px;
    height: 44px;
  }
}

@media (min-width: 1024px) {
  :root {
    --container-max: 480px;
    --content-max: 760px;
    --content-max-wide: 1200px;
    --bottom-nav-height: 0px;
  }

  .bottom-nav {
    display: none;
  }

  .app-main {
    padding: var(--space-xl) var(--space-2xl) var(--space-2xl);
  }

  /* Persistent sidebar replaces the tab bar; the header keeps only the bell. */
  .app-shell-with-sidebar {
    padding-left: var(--sidebar-width);
  }

  .app-shell-with-sidebar .app-header {
    padding: var(--space-sm) var(--space-2xl);
  }

  .app-shell-with-sidebar .header-content {
    max-width: none;
  }

  .app-shell-with-sidebar .header-logo {
    display: none;
  }

  /* Toasts sit in the bottom corner, clear of the page header's actions (Add task, List or
     Calendar), and rise into place (newest at the bottom). */
  .flash-container:not(.flash-container-auth) {
    top: auto;
    left: auto;
    right: var(--space-lg);
    bottom: var(--space-lg);
    transform: none;
    width: min(calc(100% - var(--sidebar-width) - 2 * var(--space-lg)), 440px);
    flex-direction: column-reverse;
  }

  .flash-container:not(.flash-container-auth) .flash-message {
    animation-name: flashRise;
  }

  .flash-container:not(.flash-container-auth) .flash-message.flash-leaving {
    animation-name: flashSink;
  }
}

/* ========================================
   PAGE LAYOUTS & BACK NAVIGATION
   ======================================== */

/* Back navigation (shared/_page_nav, via NavigationHelper#page_nav):
   one back button below 1024px, breadcrumbs at 1024px and up. */
.page-nav {
  margin-bottom: var(--space-md);
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  max-width: 100%;
  margin-left: -6px;
  padding: 0 var(--space-sm) 0 2px;
  border-radius: var(--radius-sm);
  color: var(--color-forest);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition-fast);
}

.back-button:hover {
  background: var(--color-cream-warm);
  color: var(--color-forest);
}

.back-button svg {
  flex-shrink: 0;
}

.back-button-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumbs {
  display: none;
  font-size: 0.8125rem;
  color: var(--color-stone);
  line-height: 1.5;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.breadcrumbs li + li::before {
  content: "›";
  margin: 0 var(--space-sm);
  color: var(--color-stone-light);
}

.breadcrumbs a {
  color: var(--color-stone);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
  color: var(--color-forest);
}

.breadcrumbs .current {
  color: var(--color-charcoal);
  font-weight: 500;
}

/* List / Calendar switch shared by the task list and the calendar views
   (shared/_tasks_view_toggle); both live under the Tasks tab. */
.tasks-view-toggle {
  display: flex;
  width: 100%;
  max-width: 320px;
  margin-bottom: var(--space-lg);
  padding: 3px;
  background: var(--color-cream-warm);
  border-radius: var(--radius-md);
}

.tasks-view-option {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 40px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-stone);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.tasks-view-option:hover {
  color: var(--color-charcoal);
}

.tasks-view-option.active {
  background: white;
  color: var(--color-forest);
  box-shadow: var(--shadow-sm);
}

/* Compact: sits beside a heading (calendar header), icons only on narrow screens. */
.tasks-view-toggle-compact {
  flex-shrink: 0;
  width: auto;
  max-width: none;
  margin-bottom: 0;
}

.tasks-view-toggle-compact .tasks-view-option {
  flex: none;
  min-height: 30px;
  padding: 0 0.75rem;
}

@media (max-width: 479.98px) {
  .tasks-view-toggle-compact .tasks-view-option {
    width: 40px;
    padding: 0;
  }

  .tasks-view-toggle-compact .tasks-view-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
}

/* Two-pane layouts. Children stack in source order on small screens.
   .layout-split: a main column plus a narrower side column (.layout-side).
   .layout-stack: the same children, always stacked (e.g. when the side
   column would be nearly empty).
   .layout-master-detail: a list (.layout-list) plus a detail pane
   (.layout-detail, a turbo-frame shown only at 1200px and up).
   Both go side by side at 1200px (keep in sync with master_detail_controller's
   `media` value); between 1024px and 1200px pages use the single column. */
.layout-split,
.layout-stack,
.layout-master-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.layout-main,
.layout-side,
.layout-list,
.layout-detail {
  min-width: 0;
}

.layout-split > .layout-main,
.layout-split > .layout-side,
.layout-stack > .layout-main,
.layout-stack > .layout-side,
.layout-main > :first-child,
.layout-side > :first-child {
  margin-top: 0;
}

.layout-detail {
  display: none;
}

.layout-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 320px;
  padding: var(--space-xl);
  text-align: center;
  color: var(--color-stone);
  border: 2px dashed var(--color-cream-warm);
  border-radius: var(--radius-lg);
}

.layout-detail-empty svg {
  color: var(--color-stone-light);
}

@media (min-width: 1024px) {
  .page-nav .back-button {
    display: none;
  }

  .page-nav .breadcrumbs {
    display: block;
  }

  .page-nav:not(:has(.breadcrumbs)) {
    display: none;
  }
}

/* Two-pane layouts need more room than the sidebar leaves at 1024px. */
@media (min-width: 1200px) {
  .layout-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: var(--space-2xl);
    align-items: start;
  }

  /* Columns are placed explicitly so pages can keep a mobile-friendly
     source order (e.g. side content first) without affecting the desktop layout. */
  .layout-split > .layout-main {
    grid-column: 1;
    grid-row: 1;
  }

  .layout-split > .layout-side {
    grid-column: 2;
    grid-row: 1;
  }

  .layout-side-sticky {
    position: sticky;
    top: calc(var(--header-height) + var(--space-lg));
  }

  /* A page rendered inside the detail pane is too narrow for its own split. */
  .layout-detail .layout-split {
    display: flex;
  }

  .layout-detail .layout-side-sticky {
    position: static;
  }

  .layout-master-detail {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: var(--space-xl);
    align-items: start;
  }

  .layout-detail {
    display: block;
    position: sticky;
    top: calc(var(--header-height) + var(--space-lg));
    max-height: calc(100vh - var(--header-height) - 2 * var(--space-lg));
    max-height: calc(100dvh - var(--header-height) - 2 * var(--space-lg));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-xl);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
  }

  .layout-detail[busy] {
    opacity: 0.6;
    transition: opacity var(--transition-base);
  }
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   FIELD WRAPPER (for the .field class from Devise)
   ======================================== */
.field {
  margin-bottom: var(--space-lg);
}

.field:last-of-type {
  margin-bottom: var(--space-xl);
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-charcoal);
  margin-bottom: var(--space-xs);
}

.field label br {
  display: none;
}

.field:has(input[required], select[required], textarea[required]) > label::after {
  content: " *";
  color: var(--color-error, #dc2626);
}

.field em {
  font-size: 0.8125rem;
  color: var(--color-stone);
  font-style: normal;
}

.actions {
  margin-top: var(--space-lg);
}

/* ========================================
   CALENDAR
   ======================================== */
.calendar-container {
  max-width: 100%;
}

/* Shared header (calendar/_header): the title on its own row, the controls below it. */
.calendar-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

/* A page title with the List/Calendar switch at its right (tasks list and calendar). */
.calendar-title-row,
.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.page-title-row {
  margin-bottom: var(--space-md);
}

.page-title-row h1 {
  margin: 0;
  min-width: 0;
}

/* Buttons beside a page title (Add task, the list/calendar toggle); on phones the Add
   button keeps just its icon. */
.page-title-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: none;
}

@media (max-width: 480px) {
  .page-title-actions .btn-sm {
    width: 36px;
    padding: 0;
  }

  .page-title-action-label {
    display: none;
  }
}

/* Task list filters: side by side (sharing the row on phones), set apart from the list. */
.task-filters {
  margin-bottom: var(--space-xl);
}

.filter-form {
  display: flex;
  gap: var(--space-sm);
}

.filter-form select {
  flex: 1 1 0;
  min-width: 0;
}

@media (min-width: 768px) {
  .filter-form select {
    flex: none;
    width: auto;
    min-width: 220px;
  }
}

.calendar-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0;
  min-width: 0;
}

@media (min-width: 768px) {
  .calendar-title {
    font-size: 1.875rem;
  }
}

.calendar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Month · Week · Day segmented control; 36px tall to line up with .btn-sm. */
.view-switcher {
  display: flex;
  background: var(--color-cream-warm);
  border-radius: var(--radius-md);
  padding: 3px;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-stone);
  transition: background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
}

@media (max-width: 479.98px) {
  .calendar-controls {
    column-gap: var(--space-sm);
  }

  .view-btn {
    padding: 0 0.625rem;
  }
}

.view-btn:hover {
  color: var(--color-charcoal);
}

.view-btn.active {
  background: white;
  color: var(--color-forest);
  box-shadow: var(--shadow-sm);
}

/* Calendar Grid */
.calendar-grid {
  background: var(--color-cream);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--color-stone-light);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--color-cream-warm);
  border-bottom: 1px solid var(--color-stone-light);
}

.weekday {
  padding: var(--space-sm) 2px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-stone);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calendar-weeks {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(72px, auto);
}

@media (min-width: 768px) {
  .calendar-weeks {
    grid-auto-rows: minmax(104px, auto);
  }
}

.calendar-week {
  display: contents;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  min-width: 0;
  padding: 3px;
  border-right: 1px solid var(--color-stone-light);
  border-bottom: 1px solid var(--color-stone-light);
  position: relative;
  overflow: hidden;
  background: var(--color-cream);
}

@media (min-width: 768px) {
  .calendar-day {
    padding: var(--space-xs) var(--space-sm);
  }
}

.calendar-day:nth-child(7n) {
  border-right: none;
}

.calendar-week:last-child .calendar-day,
.calendar-weeks > .calendar-week:last-of-type .calendar-day {
  border-bottom: none;
}

.calendar-day.today {
  background: rgba(26, 77, 62, 0.05);
}

.calendar-day.other-month {
  background: var(--color-cream);
}

.calendar-day.weekend {
  background: var(--color-cream-warm);
}

/* The date links to its day view. */
.calendar-day .day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  border-radius: 13px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-charcoal);
  text-decoration: none;
}

.calendar-day .day-number:hover {
  background: rgba(26, 77, 62, 0.1);
  color: var(--color-forest);
}

.calendar-day.weekend .day-number {
  color: var(--color-charcoal-light);
}

.calendar-day.other-month .day-number {
  color: var(--color-stone);
}

.calendar-day.today .day-number {
  background: var(--color-forest);
  color: white;
}

/* Task count marker (month view): a dot and the count; "tasks" joins them from 768px. */
.task-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: background var(--transition-fast);
}

.task-count-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

.task-count-label {
  display: none;
}

@media (min-width: 768px) {
  .task-count-badge {
    padding: 2px 8px;
  }

  .task-count-label {
    display: inline;
  }
}

.task-count-badge.upcoming {
  background: rgba(26, 77, 62, 0.1);
  color: var(--color-forest);
}

.task-count-badge.upcoming:hover {
  background: rgba(26, 77, 62, 0.18);
}

.task-count-badge.due-today {
  background: var(--color-warning-bg);
  color: #8a6212;
  box-shadow: inset 0 0 0 1px rgba(212, 160, 58, 0.5);
}

.task-count-badge.has-overdue {
  background: var(--color-error-bg);
  color: var(--color-error);
  box-shadow: inset 0 0 0 1px rgba(196, 69, 54, 0.35);
}

/* A day where everything was done: muted, with a check instead of the dot. */
.task-count-badge.all-done {
  background: var(--color-cream-warm);
  color: var(--color-stone);
}

/* Month view on larger screens: the day's first few tasks by name instead of a count. */
.calendar-day-titles {
  display: none;
  align-self: stretch;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 1024px) {
  .calendar-day .task-count-badge {
    display: none;
  }

  .calendar-day-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
}

.calendar-day-title {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-left: 3px solid var(--color-forest);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(26, 77, 62, 0.08);
  color: var(--color-charcoal);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
}

.calendar-day-title:hover {
  background: rgba(26, 77, 62, 0.16);
  color: var(--color-charcoal);
}

.calendar-day-title.due-today {
  border-left-color: var(--color-warning);
  background: var(--color-warning-bg);
}

.calendar-day-title.overdue {
  border-left-color: var(--color-error);
  background: var(--color-error-bg);
}

.calendar-day-title.completed {
  border-left-color: var(--color-stone-light);
  background: transparent;
  color: var(--color-stone);
}

.calendar-day-title.completed svg {
  flex-shrink: 0;
  color: var(--color-success);
}

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

.calendar-day-more {
  padding: 0 6px;
  color: var(--color-stone);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.calendar-day-more:hover {
  color: var(--color-forest);
}

/* Overdue banner on today (calendar/_overdue_marker): solid so it outranks the
   per-day markers; links to the task list's Overdue group. */
.calendar-overdue-marker {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--color-error);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}

.calendar-overdue-marker:hover {
  background: #a33a2d;
  color: white;
}

.calendar-overdue-marker svg {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
}

@media (max-width: 767.98px) {
  .calendar-day .calendar-overdue-label {
    display: none;
  }
}

.week-day .calendar-overdue-marker {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  white-space: normal;
}

/* Day View */
.day-tasks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* A task card (see TASK CARDS) whose header toggles its steps, supplies and actions. */
.task-card.expandable-task-card {
  padding: 0;
  overflow: hidden;
}

.task-card.expandable-task-card:hover {
  transform: none;
}

.expandable-task-card.expanded {
  box-shadow: var(--shadow-md);
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-lg);
  cursor: pointer;
}

.task-card-header:focus-visible {
  outline: 2px solid var(--color-forest);
  outline-offset: -2px;
}

.task-card-info {
  flex: 1;
  min-width: 0;
}

.task-card-meta {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.75rem;
  color: var(--color-stone);
}

.meta-item svg {
  opacity: 0.7;
}

.task-card-toggle {
  padding: var(--space-xs);
  color: var(--color-stone);
  transition: transform var(--transition-fast);
}

.task-card-details {
  padding: 0 var(--space-lg) var(--space-lg);
  border-top: 1px solid var(--color-stone-light);
  background: var(--color-cream-warm);
}

@media (max-width: 480px) {
  .task-card,
  .task-card-header {
    padding: var(--space-md);
  }

  .task-card-details {
    padding: 0 var(--space-md) var(--space-md);
  }
}

.task-detail-section {
  padding-top: var(--space-md);
}

.task-detail-section:first-child {
  padding-top: var(--space-md);
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-stone);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-xs) 0;
}

.detail-text {
  font-size: 0.875rem;
  color: var(--color-charcoal);
  line-height: 1.6;
  margin: 0;
}

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

.supplies-list li {
  padding: var(--space-xs) 0;
  font-size: 0.875rem;
  color: var(--color-charcoal);
  border-bottom: 1px solid var(--color-stone-light);
}

.supplies-list li:last-child {
  border-bottom: none;
}

.task-card-actions {
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  margin-top: var(--space-md);
  border-top: 1px solid var(--color-stone-light);
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: var(--space-xs);
  background: white;
  border: 1px solid var(--color-stone-light);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 10;
  min-width: 160px;
}

.dropdown-menu form {
  display: block;
}

.dropdown-menu button,
.dropdown-menu input[type="submit"] {
  display: block;
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--color-charcoal);
}

.dropdown-menu button:hover,
.dropdown-menu input[type="submit"]:hover {
  background: var(--color-cream);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
}

.empty-state-icon {
  color: var(--color-stone-light);
  margin-bottom: var(--space-md);
}

/* Title first and prominent, explanation second and quieter (shared/_empty_state) */
.empty-state-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-charcoal);
  margin: 0 0 var(--space-xs) 0;
}

.empty-state-text {
  font-size: 0.875rem;
  color: var(--color-stone);
  max-width: 36ch;
  margin: 0 auto;
}

.empty-state-actions {
  margin-top: var(--space-lg);
}

/* Secondary small print, e.g. the technical reason an AI generation failed. */
.empty-state-detail {
  font-size: 0.75rem;
  color: var(--color-stone);
  max-width: 48ch;
  margin: var(--space-md) auto 0;
  overflow-wrap: anywhere;
}

.empty-state-compact {
  padding: var(--space-xl) var(--space-lg);
}

.empty-state-compact .empty-state-icon {
  margin-bottom: var(--space-sm);
}

/* Smaller, but the same display face as the full-size title. */
.empty-state-compact .empty-state-title {
  font-size: 1.0625rem;
}

.empty-state-compact .empty-state-text {
  font-size: 0.8125rem;
}

/* Week View: an agenda list (date beside its tasks) on phones, seven columns from 768px. */
.week-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.week-day {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-md);
  min-width: 0;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-cream);
  border: 1px solid var(--color-stone-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.week-day.today {
  border-color: var(--color-forest);
  box-shadow: 0 0 0 2px rgba(26, 77, 62, 0.1);
}

.week-day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  color: var(--color-charcoal);
  text-decoration: none;
}

.week-day-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-stone);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.week-day-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 600;
  transition: background var(--transition-fast);
}

.week-day-header:hover .week-day-number {
  background: rgba(26, 77, 62, 0.1);
  color: var(--color-forest);
}

.week-day.today .week-day-number {
  background: var(--color-forest);
  color: white;
}

.week-day-tasks {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
}

.week-day-empty {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--color-stone);
}

/* Empty days on phones collapse to a single line. */
.week-day.empty {
  align-items: center;
}

@media (min-width: 768px) {
  .week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--space-sm);
  }

  .week-day {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
    min-height: 200px;
    padding: var(--space-sm);
  }

  .week-day.empty {
    align-items: stretch;
  }

  .week-day-header {
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-stone-light);
  }

  .week-day-number {
    width: 36px;
    height: 36px;
    font-size: 1.125rem;
  }

  /* An empty column says enough on its own. */
  .week-day-empty {
    display: none;
  }
}

/* Month view on phones and tablets: the days with tasks, listed under the grid. */
.calendar-agenda {
  margin-top: var(--space-lg);
}

.calendar-agenda-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0 0 var(--space-md);
  color: var(--color-charcoal);
}

.calendar-agenda-overdue {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-error);
  text-decoration: none;
}

.calendar-agenda-day {
  display: grid;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.calendar-agenda-date {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-stone);
  text-decoration: none;
}

.calendar-agenda-tasks {
  display: grid;
  gap: var(--space-xs);
}

.calendar-agenda-empty {
  font-size: 0.875rem;
  color: var(--color-stone);
}

@media (min-width: 1024px) {
  .calendar-agenda {
    display: none;
  }
}

/* Task Card Mini (for week view) */
.task-card-mini {
  display: block;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: all var(--transition-fast);
}

.task-card-mini:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.task-card-mini.upcoming {
  background: rgba(26, 77, 62, 0.08);
  border-left: 3px solid var(--color-forest);
}

.task-card-mini.due-today {
  background: var(--color-warning-bg);
  border-left: 3px solid var(--color-warning);
}

.task-card-mini.overdue {
  background: var(--color-error-bg);
  border-left: 3px solid var(--color-error);
}

.task-card-mini.completed {
  background: transparent;
  border-left: 3px solid var(--color-stone-light);
}

.task-card-mini.completed .task-card-title {
  color: var(--color-stone);
}

.task-card-mini.completed .task-card-title svg {
  color: var(--color-success);
  vertical-align: -1px;
}

.task-card-mini .task-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-charcoal);
  margin-bottom: 2px;
}

.task-card-mini .task-card-asset {
  font-size: 0.75rem;
  color: var(--color-stone);
  margin: 0;
}

.task-card-time,
.task-card-status {
  font-size: 0.6875rem;
  color: var(--color-stone);
  margin-top: 4px;
}

.task-card-status {
  font-weight: 600;
  color: var(--color-error);
}

/* Integration Settings */
.feed-url-container {
  margin-bottom: var(--space-lg);
}

.url-input-group {
  display: flex;
  gap: var(--space-sm);
}

.feed-url-input {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-cream-warm);
  border: 1px solid var(--color-stone-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
}

.url-input-group .btn {
  flex-shrink: 0;
}

.url-input-group .btn.copied {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success);
}

.url-input-group .btn.copy-failed {
  background: var(--color-error-bg);
  color: var(--color-error);
  border-color: var(--color-error);
}

/* Calendar feed: the note under the Add to Apple/Google buttons */
.btn-row + .field-hint {
  margin-top: var(--space-sm);
}

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

.instructions-list li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-stone-light);
  font-size: 0.875rem;
  color: var(--color-charcoal);
}

.instructions-list li:last-child {
  border-bottom: none;
}

.instructions-list strong {
  color: var(--color-forest);
}

/* ========================================
   NOTIFICATIONS
   ======================================== */
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

.notification-bell {
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--color-cream-warm);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-charcoal);
  flex-shrink: 0;
  color: var(--color-charcoal);
  transition: all var(--transition-fast);
}

.notification-bell:hover {
  background: var(--color-stone-light);
}

.notification-bell svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.notification-bell.active {
  background: var(--color-forest);
  color: white;
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  background: var(--color-terracotta);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--color-cream);
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + var(--space-sm));
  right: 0;
  width: 320px;
  max-height: 480px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-stone-light);
  overflow: hidden;
  z-index: 200;
  animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-stone-light);
  background: var(--color-cream-warm);
}

.dropdown-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  color: var(--color-charcoal);
}

.notifications-list {
  max-height: 360px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-stone-light);
  transition: background var(--transition-fast);
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item.unread {
  background: rgba(26, 77, 62, 0.04);
}

.notification-item:hover {
  background: var(--color-cream-warm);
}

.notification-icon {
  width: 32px;
  height: 32px;
  background: var(--color-cream-warm);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-forest);
}

.notification-icon-overdue {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.notification-icon-due_today {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.notification-icon-digest {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.notification-link:hover .notification-title {
  color: var(--color-forest);
}

.notification-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-charcoal);
  margin: 0 0 2px 0;
  line-height: 1.4;
  transition: color var(--transition-fast);
}

.notification-body {
  font-size: 0.8125rem;
  color: var(--color-stone);
  margin: 0 0 4px 0;
  line-height: 1.4;
}

.notification-time {
  font-size: 0.75rem;
  color: var(--color-stone);
}

.notification-actions {
  flex-shrink: 0;
}

.mark-read-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--color-stone-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-stone);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.mark-read-btn:hover {
  background: var(--color-success-bg);
  border-color: var(--color-success);
  color: var(--color-success);
}

.dropdown-footer {
  display: block;
  padding: var(--space-md);
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-forest);
  text-decoration: none;
  border-top: 1px solid var(--color-stone-light);
  background: var(--color-cream-warm);
  transition: background var(--transition-fast);
}

.dropdown-footer:hover {
  background: var(--color-cream);
}

/* Notifications Page */
.notifications-page {
  margin: 0 auto;
}

.notifications-list-page .notification-item {
  padding: var(--space-lg);
}

.notifications-list-page .notification-icon {
  width: 40px;
  height: 40px;
}

.notifications-list-page .notification-title {
  font-size: 1rem;
}

.notifications-list-page .notification-body {
  font-size: 0.875rem;
}

.settings-header-actions {
  margin-left: auto;
}

.text-sm {
  font-size: 0.875rem;
}

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

/* Mobile adjustments for notification dropdown */
/* On narrow screens anchor the dropdown to the whole actions group (flush with
   the header's right padding) and span the header's content width. */
@media (max-width: 420px) {
  .header-actions {
    position: relative;
  }

  .header-actions .header-action-item {
    position: static;
  }

  .notification-dropdown {
    right: 0;
    width: calc(100vw - 2 * var(--space-lg));
  }
}

/* ========================================
   SIDEBAR (desktop navigation, >= 1024px)
   ======================================== */
.header-action-item {
  position: relative;
}

.app-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    z-index: 110;
    display: flex;
    flex-direction: column;
    background: white;
    border-right: 1px solid var(--color-cream-warm);
  }

  .sidebar-logo {
    height: var(--header-height);
    padding: 0 var(--space-lg);
    flex-shrink: 0;
  }
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) var(--space-md) var(--space-lg);
}

.sidebar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-heading {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-stone);
  margin: var(--space-lg) var(--space-sm) var(--space-sm);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-md);
  border-radius: var(--radius-sm);
  color: var(--color-charcoal-light);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-link svg {
  flex-shrink: 0;
  color: var(--color-stone);
  transition: color var(--transition-fast);
}

.sidebar-link:hover {
  background: var(--color-cream-warm);
  color: var(--color-charcoal);
}

.sidebar-link.active {
  background: rgba(26, 77, 62, 0.08);
  color: var(--color-forest);
  font-weight: 600;
}

.sidebar-link:hover svg,
.sidebar-link.active svg {
  color: var(--color-forest);
}

.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--color-cream-warm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sidebar-footer .user-info {
  padding: var(--space-sm);
}

.sidebar-footer .user-avatar {
  width: 36px;
  height: 36px;
  font-size: 0.9375rem;
}

.sidebar-signout {
  width: 100%;
  justify-content: flex-start;
}

.sidebar-footer form .sidebar-signout:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.sidebar-footer form .sidebar-signout:hover svg {
  color: var(--color-error);
}

/* User identity (sidebar footer, More page) */
.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
}

.user-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-forest-light) 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  color: var(--color-charcoal);
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.8125rem;
  color: var(--color-stone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   MORE PAGE (mobile "More" tab) & MENU LISTS
   ======================================== */
.more-user-card {
  margin-bottom: var(--space-xl);
}

.menu-section {
  margin-bottom: var(--space-xl);
}

.menu-section-title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-stone);
  margin-bottom: var(--space-sm);
}

.menu-list {
  list-style: none;
  padding: var(--space-xs) 0;
}

.menu-list li + li {
  border-top: 1px solid var(--color-cream-warm);
}

.menu-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-height: 56px;
  padding: var(--space-sm) var(--space-md);
  color: var(--color-charcoal);
  text-decoration: none;
  transition: background var(--transition-fast);
}

.menu-link:hover {
  background: var(--color-cream);
  color: var(--color-forest);
}

.menu-link-icon {
  width: 36px;
  height: 36px;
  background: var(--color-cream-warm);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-forest);
  flex-shrink: 0;
}

.menu-link-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.menu-link-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.menu-link-desc {
  font-size: 0.8125rem;
  color: var(--color-stone);
}

.menu-link-chevron {
  flex-shrink: 0;
  color: var(--color-stone-light);
}

/* Sign out: a secondary button with a quiet red label (it is not destructive). */
.btn.more-signout {
  color: var(--color-error);
  border-color: var(--color-stone-light);
}

.btn.more-signout:hover {
  background: var(--color-error-bg);
  border-color: var(--color-error);
}

/* ========================================
   PROPERTY CARDS
   ======================================== */
.property-grid {
  display: grid;
  /* minmax(0, …) lets long nowrap addresses ellipsize instead of widening the card */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}


.property-card {
  display: block;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.property-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-forest);
}

.property-card:active {
  transform: translateY(0);
}

.property-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.property-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--color-forest) 0%, var(--color-forest-light) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.property-info {
  flex: 1;
  min-width: 0;
}

.property-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--color-charcoal);
  margin: 0 0 var(--space-xs) 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.property-address {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.3em;
  font-size: 0.875rem;
  color: var(--color-stone);
  margin: 0;
}

.property-address-street {
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.property-address-locality {
  white-space: nowrap;
}

.property-stats {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-stone-light);
  margin-bottom: var(--space-sm);
}

/* Sits above the card's stretched link */
.property-add-details {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-left: auto;
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-forest);
  border-radius: var(--radius-sm);
}

.property-add-details:hover {
  background: var(--color-cream-warm);
}

/* Property page side column: the stats and Edit, without repeating the name. */
.property-summary .property-stats {
  padding-top: 0;
  border-top: none;
  margin-bottom: var(--space-md);
}

/* The property's assets fill the wide main column two (or more) abreast. */
@media (min-width: 1024px) {
  .property-page .layout-main .asset-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

.property-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-forest);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--color-stone);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 2px;
}

/* ========================================
   FORM ENHANCEMENTS
   ======================================== */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 480px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.field-hint {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-stone);
  margin-top: var(--space-xs);
}

.field-hint-warning {
  display: block;
  margin-top: var(--space-xs);
  color: var(--color-terracotta-dark);
  font-weight: 500;
}

/* A one-line suggestion above a form ("Your browser is on America/New_York — use it?") */
.inline-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  background: var(--color-warning-bg);
  border: 1px solid rgba(212, 160, 58, 0.35);
  border-radius: var(--radius-md);
}

.inline-prompt-text {
  margin: 0;
  flex: 1 1 260px;
  font-size: 0.9375rem;
  color: var(--color-charcoal);
}

.inline-prompt-actions {
  margin: 0;
}

/* ========================================
   FORM FIELDSETS & TAGS
   ======================================== */
.form-fieldset {
  border: 1px solid rgba(139, 129, 120, 0.15);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  padding-top: var(--space-md);
  margin-bottom: var(--space-lg);
  background: white;
}

.form-fieldset legend {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-stone);
  padding: 0 var(--space-sm);
}

/* A form section folded away until opened, e.g. an asset's make/model/warranty */
.form-disclosure {
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
}

.form-disclosure summary {
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-forest);
}

.form-disclosure[open] summary {
  margin-bottom: var(--space-md);
}

.form-disclosure-optional {
  font-weight: 400;
  color: var(--color-stone);
}

/* Task form supplies: name, quantity, cost and remove on one row; on phones the name
   takes its own line above the rest. */
.supplies-hint {
  margin: 0 0 var(--space-sm);
}

.supply-rows:not(:empty) {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.supply-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.5rem 7.5rem auto;
  gap: var(--space-sm);
  align-items: center;
}

@media (max-width: 600px) {
  .supply-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }

  .supply-row .supply-name {
    grid-column: 1 / -1;
  }

  .supply-row + .supply-row {
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(139, 129, 120, 0.12);
  }
}

.input-affix:has(input[readonly]) {
  background: var(--color-cream, #faf7f2);
}

/* Legacy fieldset (no .form-fieldset class) */
fieldset:not(.form-fieldset) {
  border: 1px solid rgba(139, 129, 120, 0.15);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  padding-top: var(--space-md);
  margin-bottom: var(--space-lg);
  background: white;
}

fieldset:not(.form-fieldset) legend {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-stone);
  padding: 0 var(--space-sm);
}

/* Tag picker (shared/_tag_picker): each option is a .tag-chip over a hidden
   checkbox, outlined when unselected and filled with a check when selected. */
.tag-picker-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.tag-picker .field-hint:last-child {
  margin-bottom: 0;
}

/* "New tag" field and button under the chips */
.tag-picker-new {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin-top: var(--space-sm);
}

.tag-picker-new .tag-picker-new-input {
  flex: 1;
  min-width: 0;
  max-width: 16rem;
}

.tag-picker-new .btn {
  flex-shrink: 0;
}

.tag-picker-error {
  margin: var(--space-xs) 0 0;
  font-size: 0.8125rem;
  color: var(--color-error);
}

.tag-option {
  display: inline-flex;
  cursor: pointer;
  margin-bottom: 0;
}

.tag-option-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tag-option-input:not(:checked) + .tag-chip {
  background: white;
  color: var(--color-charcoal-light);
  border-color: rgba(139, 129, 120, 0.35);
}

.tag-option-input:not(:checked) + .tag-chip .tag-chip-check {
  display: none;
}

/* The unselected chip keeps a dot of the tag's color. */
.tag-option-input:not(:checked) + .tag-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--tag-text);
  flex-shrink: 0;
}

.tag-option-input:checked + .tag-chip {
  border-color: var(--tag-text);
}

.tag-option:hover .tag-chip {
  border-color: var(--tag-text);
}

.tag-option-input:focus-visible + .tag-chip {
  outline: 2px solid var(--color-forest);
  outline-offset: 2px;
}

/* Form context text */
.form-context {
  font-size: 0.875rem;
  color: var(--color-stone);
  margin-bottom: var(--space-lg);
}

.form-context strong {
  color: var(--color-charcoal);
}

/* shared/_form_actions: full-width submit, then Cancel, after the form's cards. */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* shared/_danger_zone: the last card on an edit page. */
.danger-zone {
  margin-top: var(--space-section);
  border-color: rgba(196, 69, 54, 0.25);
}

.danger-zone-title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-error);
  margin: 0 0 var(--space-sm);
}

.danger-zone-text {
  font-size: 0.9375rem;
  color: var(--color-charcoal-light);
  margin-bottom: var(--space-md);
}

.danger-zone form {
  margin: 0;
}

/* ========================================
   TAGS PAGE
   ======================================== */
.tags-section {
  margin-bottom: var(--space-xl);
}

.tags-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.tags-section-title {
  font-size: 0.75rem;
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-stone);
  margin: 0;
}

.tags-section-header .tags-section-title {
  margin-bottom: 0;
}

/* Tag rows (user tags list) */
.tags-card-list {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 129, 120, 0.12);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid rgba(139, 129, 120, 0.08);
}

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

.tag-row-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.tag-row-hint {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 0.75rem;
  color: var(--color-charcoal-light);
}

.tag-row-hint form {
  margin: 0;
}

/* Sits under the hint text; the negative margin lines its label up with the text. */
.btn.tag-row-hint-action {
  min-height: 32px;
  margin-left: -0.875rem;
  font-size: 0.8125rem;
}

.tags-section-intro {
  font-size: 0.875rem;
  color: var(--color-charcoal-light);
  margin: 0;
}

.tag-row-count {
  font-size: 0.75rem;
  color: var(--color-stone);
}

.tag-row-count a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tag-row-count a:hover {
  color: var(--color-forest);
}

.tag-row-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.tag-action-link {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-stone);
  transition: all var(--transition-fast);
}

.tag-action-link:hover {
  background: var(--color-cream-warm);
  color: var(--color-forest);
}

.tag-row-actions form.button_to {
  margin: 0;
  line-height: 0;
}

.tag-action-delete {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-stone);
  transition: all var(--transition-fast);
}

.tag-action-delete:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
}

/* Color picker: round preset swatches plus a round "custom" swatch that wraps
   the native color input. The selected one gets a ring. */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: 4px;
}

.color-swatch-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.color-swatch-btn:focus-visible,
.color-swatch-custom:focus-within {
  outline: 2px solid var(--color-forest);
  outline-offset: 4px;
}

/* Not selected: a color wheel inviting a custom pick. Selected: the custom color. */
.color-swatch-custom {
  background: conic-gradient(#ef4444, #f59e0b, #10b981, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444);
}

.color-swatch-custom.is-selected {
  background: var(--swatch);
}

.color-swatch-custom-input {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  border: none !important;
  opacity: 0;
  cursor: pointer;
}

.color-swatch-btn:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-md);
}

.color-swatch-btn:active {
  transform: scale(0.95);
}

.color-swatch-btn[aria-pressed="true"],
.color-swatch-custom.is-selected {
  box-shadow: 0 0 0 2px white, 0 0 0 4px var(--color-charcoal);
}

/* Tag preview */
.tag-preview-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 129, 120, 0.12);
  margin-bottom: var(--space-lg);
}

.tag-preview-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-stone);
}

/* ========================================
   ASSET TILES
   ======================================== */
.asset-tiles {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.asset-tile {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  min-height: 72px;
  background: white;
  border: 1px solid rgba(139, 129, 120, 0.12);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--color-charcoal);
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast),
              border-color var(--transition-fast);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.asset-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-forest);
  color: var(--color-charcoal);
}

.asset-tile:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.asset-tile-icon {
  width: 44px;
  height: 44px;
  background: var(--color-cream-warm);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-forest);
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.asset-tile:hover .asset-tile-icon {
  background: var(--color-forest);
  color: white;
}

.asset-tile-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.asset-tile-name {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-charcoal);
  line-height: 1.3;
}

.asset-tile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* The one tag chip (TagsHelper#tag_chip). --tag-fill and --tag-text come from
   TagColor: a ~95% lightness fill with same-hue text at >= 4.5:1. */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.5;
  padding: 1px 8px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: var(--tag-fill, #f1f2f3);
  color: var(--tag-text, #5d636f);
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.tag-chip-md {
  font-size: 0.75rem;
  padding: 4px 12px;
}

.tag-chip-unselected {
  background: white;
  color: var(--color-charcoal-light);
  border-color: rgba(139, 129, 120, 0.35);
}

.tag-chip-check {
  flex-shrink: 0;
}

.tag-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.asset-tile-chevron {
  color: var(--color-stone-light);
  flex-shrink: 0;
  transition: transform var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
}

.asset-tile:hover .asset-tile-chevron {
  color: var(--color-forest);
  transform: translateX(2px);
}

/* ========================================
   ONBOARDING (dashboard without properties)
   ======================================== */
.onboarding-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-charcoal);
  margin-bottom: var(--space-xs);
}

.onboarding-intro {
  color: var(--color-stone);
  font-size: 0.9375rem;
  margin-bottom: var(--space-lg);
}

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

.onboarding-step {
  position: relative;
  display: flex;
  gap: var(--space-md);
  padding-bottom: var(--space-lg);
}

.onboarding-step:last-child {
  padding-bottom: 0;
}

/* Connector line between step numbers */
.onboarding-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 4px;
  width: 2px;
  background: var(--color-cream-warm);
}

.onboarding-step-number {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  background: var(--color-cream-warm);
  color: var(--color-stone);
}

.onboarding-step.is-current .onboarding-step-number {
  background: var(--color-forest);
  color: white;
}

.onboarding-step.is-done .onboarding-step-number {
  background: var(--color-success-bg, #e8f3ee);
  color: var(--color-success, #2d7a5a);
}

.onboarding-step.is-done .onboarding-step-title {
  color: var(--color-stone);
}

.onboarding-step-body {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.onboarding-step-title {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--color-charcoal);
}

.onboarding-step:not(.is-current) .onboarding-step-title {
  color: var(--color-charcoal-light);
}

.onboarding-step-text {
  font-size: 0.875rem;
  color: var(--color-stone);
  margin: 0;
}

.onboarding-step-action {
  margin-top: var(--space-md);
  width: auto;
}

/* ========================================
   ASSETS INDEX (tree grouped by property)
   ======================================== */
.asset-tree-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.asset-tree-section-header {
  margin-bottom: var(--space-md);
}

.asset-tree-property {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  text-decoration: none;
  color: var(--color-charcoal);
}

.asset-tree-property:hover .property-name {
  color: var(--color-forest);
}

.asset-tree-property .property-name {
  font-size: 1.25rem;
}

.asset-tree,
.asset-tree-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.asset-tree-children {
  margin-left: var(--space-md);
  padding-left: var(--space-sm);
  border-left: 2px solid var(--color-cream-warm);
}

.asset-tree-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.asset-tree-row:hover {
  background: var(--color-cream);
}

.asset-tree-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  min-height: 44px;
  text-decoration: none;
  color: var(--color-charcoal);
}

.asset-tree-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--color-cream-warm);
  color: var(--color-forest);
}

.asset-tree-body {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
}

.asset-tree-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.asset-tree-link:hover .asset-tree-name {
  color: var(--color-forest);
}

/* Trailing chevron: the whole row opens the asset (same affordance as the
   asset tiles on the asset page). */
.asset-tree-chevron {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--color-stone-light);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.asset-tree-link:hover .asset-tree-chevron {
  color: var(--color-forest);
  transform: translateX(2px);
}

/* Row currently shown in the desktop detail pane */
.asset-tree-row:has(.asset-tree-link.is-selected) {
  background: rgba(26, 77, 62, 0.08);
}

.asset-tree-link.is-selected .asset-tree-name,
.asset-tree-link.is-selected .asset-tree-chevron,
.asset-tree-property.is-selected .property-name {
  color: var(--color-forest);
}

.asset-tree-empty {
  font-size: 0.875rem;
  color: var(--color-stone);
  margin-bottom: var(--space-md);
}

/* Find an asset: the search box takes the room, the tag select what's left. */
.asset-filters {
  margin-bottom: var(--space-md);
}

.asset-filters input[type="search"] {
  flex: 1 1 0;
  min-width: 0;
}

.asset-filters select {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  max-width: 45%;
}

.asset-filters-summary {
  font-size: 0.875rem;
  color: var(--color-stone);
  margin-bottom: var(--space-md);
}

.asset-filters-summary a {
  margin-left: var(--space-sm);
  font-weight: 600;
}

/* While filtered, the assets a match sits in are shown for context, dimmed. */
.asset-tree-item.is-context > .asset-tree-row {
  opacity: 0.6;
}

.asset-tree-section-add {
  margin-top: var(--space-md);
  width: 100%;
}

/* ========================================
   ASSET DETAIL (non-root show page)
   ======================================== */
.asset-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.asset-detail-fields {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 129, 120, 0.12);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

/* The asset's (or property's) own notes, as written. */
.asset-notes {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 129, 120, 0.12);
  box-shadow: var(--shadow-sm);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-charcoal);
  overflow-wrap: anywhere;
}

.asset-notes p:last-child {
  margin-bottom: 0;
}

.asset-photos {
  margin-bottom: var(--space-lg);
}

.asset-photos a {
  display: block;
  height: 100%;
}

/* On the property page's side card: plain text between the stats and Edit. */
.property-summary-notes {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-bottom: var(--space-md);
  font-size: 0.875rem;
  color: var(--color-charcoal-light);
}

.property-summary .asset-photos {
  margin-bottom: var(--space-md);
}

/* Key/value rows: the label keeps one line; a long value (an email, a date with
   a time) wraps inside its side of the row instead of crowding the label or
   running past the card edge. */
.asset-detail-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid rgba(139, 129, 120, 0.08);
}

.asset-detail-field:last-child {
  border-bottom: none;
}

.asset-detail-label {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-stone);
  white-space: nowrap;
}

.asset-detail-value {
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-charcoal);
  text-align: right;
  overflow-wrap: anywhere;
}

/* Warranty already over, or ending within 90 days */
.warranty-expired {
  color: var(--color-error);
}

.warranty-ending {
  color: var(--color-terracotta-dark);
}

.asset-detail-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* Task Template Cards (inline on asset show) */
.task-templates-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

/* Card whose title link covers the whole card; interactive bits (menus) sit above it. */
.card-linked {
  position: relative;
}

.card-linked .card-link {
  color: inherit;
  text-decoration: none;
}

.card-linked .card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.card-linked .card-link:focus-visible {
  outline: none;
}

.card-linked:has(.card-link:focus-visible) {
  outline: 2px solid var(--color-forest);
  outline-offset: 2px;
}

.task-template-card.is-inactive {
  opacity: 0.7;
}

/* Resume on a paused task's card (Tasks, Paused), above the card's link. */
.task-template-card-resume {
  position: relative;
  z-index: 1;
  margin-top: var(--space-sm);
}

.task-template-card.is-inactive:has(.task-template-card-resume) {
  opacity: 1;
}

/* ========================================
   OVERFLOW MENU ("⋯" row actions; <details> + overflow-menu controller)
   ======================================== */
.overflow-menu {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.overflow-menu-trigger {
  list-style: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-stone);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

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

.overflow-menu-trigger:hover,
.overflow-menu[open] .overflow-menu-trigger {
  background: var(--color-cream-warm);
  color: var(--color-charcoal);
}

.overflow-menu-trigger:focus-visible {
  outline: 2px solid var(--color-forest);
  outline-offset: 2px;
}

.overflow-menu-list {
  position: absolute;
  top: calc(100% + var(--space-xs));
  right: 0;
  min-width: 168px;
  padding: var(--space-xs);
  background: white;
  border: 1px solid var(--color-cream-warm);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.overflow-menu-list form {
  margin: 0;
}

.overflow-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-charcoal);
  text-align: left;
  text-decoration: none;
}

.overflow-menu-item:hover {
  background: var(--color-cream);
  color: var(--color-charcoal);
}

.overflow-menu-item-destructive,
.overflow-menu-item-destructive:hover {
  color: var(--color-error);
}

/* ========================================
   TASK QUICK ACTIONS (task_instances/_done_button, _actions_menu)
   ======================================== */
.task-card-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.task-card-body {
  flex: 1;
  min-width: 0;
}

/* Above the card's covering title link (.card-link). */
.task-done-form {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin: 0;
}

/* A round check, like ticking off a list: big enough to hit with a thumb. */
.task-done-btn {
  width: 40px;
  height: 40px;
  margin: -6px 0 -6px -4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-stone-light);
  border-radius: var(--radius-full);
  background: white;
  color: var(--color-stone-light);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.task-done-btn:hover,
.task-done-btn:focus-visible {
  border-color: var(--color-success);
  background: var(--color-success-bg);
  color: var(--color-success);
}

.task-done-btn:focus-visible {
  outline: 2px solid var(--color-forest);
  outline-offset: 2px;
}

/* Fills in as soon as it's tapped, while the page refreshes. */
.task-done-btn:active,
.task-done-form[aria-busy="true"] .task-done-btn {
  border-color: var(--color-success);
  background: var(--color-success);
  color: white;
}

/* Day view: a completed task's filled check, in place of the Done button. */
.task-done-mark {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: var(--space-lg) 0 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-success-bg);
  color: var(--color-success);
}

@media (max-width: 480px) {
  .task-done-mark {
    margin: var(--space-md) 0 0 var(--space-md);
  }
}

.task-card.completed {
  border-left-color: var(--color-stone-light);
}

.task-actions-menu .overflow-menu-list {
  min-width: 220px;
  z-index: 3;
}

/* A form in a dialog (task page: Pick a date…, Skip task…). */
.confirm-dialog-panel .form-group {
  margin-top: var(--space-md);
}

/* "Or snooze until [date] [Snooze]" at the foot of the menu. */
.overflow-menu-date {
  margin: var(--space-xs) 0;
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--color-cream-warm);
  border-bottom: 1px solid var(--color-cream-warm);
}

.overflow-menu-date label {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-stone);
}

.overflow-menu-date-row {
  display: flex;
  gap: var(--space-xs);
}

.overflow-menu-date-row input[type="date"] {
  flex: 1;
  min-width: 0;
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.875rem;
}

/* An open menu's card sits above the cards after it (a hover lift or entry animation gives
   each its own stacking context), and the day view's card stops clipping it. */
.task-list > :has(.overflow-menu[open]),
.day-tasks-list > :has(.overflow-menu[open]) {
  position: relative;
  z-index: 2;
}

.task-card.expandable-task-card:has(.overflow-menu[open]) {
  overflow: visible;
}

/* Day view: Done and the menu flank the header, which keeps its padding as the tap area. */
.expandable-task-card > .task-card-row {
  gap: 0;
}

.expandable-task-card > .task-card-row > .task-done-form {
  margin: var(--space-lg) 0 0 var(--space-lg);
}

.expandable-task-card .task-card-header {
  flex: 1;
  min-width: 0;
}

.expandable-task-card > .task-card-row > .task-actions-menu {
  margin: calc(var(--space-lg) - 6px) var(--space-sm) 0 0;
}

.expandable-task-card > .task-card-row:has(.task-actions-menu) .task-card-header {
  padding-right: var(--space-xs);
}

@media (max-width: 480px) {
  .task-card-row {
    gap: var(--space-sm);
  }

  .expandable-task-card > .task-card-row > .task-done-form {
    margin: var(--space-md) 0 0 var(--space-md);
  }

  .expandable-task-card > .task-card-row > .task-actions-menu {
    margin-top: calc(var(--space-md) - 6px);
  }
}

.task-template-card-description {
  font-size: 0.875rem;
  color: var(--color-stone);
  margin: 0 0 var(--space-sm) 0;
}

/* ========================================
   TASK TEMPLATE SHOW PAGE
   ======================================== */

/* Header with title + badges */
.tt-show-header {
  margin-bottom: var(--space-md);
}

.tt-show-header h1 {
  margin-bottom: var(--space-sm);
}

.tt-show-badges {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* The difficulty pill sized like the status badge beside it. */
.tt-show-badges .difficulty-badge {
  font-size: 0.75rem;
  padding: 4px 12px;
  letter-spacing: 0.02em;
}

/* Status badge */
.tt-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.tt-status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
}

.tt-status-active {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.tt-status-active .tt-status-dot {
  background: var(--color-success);
  box-shadow: 0 0 0 2px rgba(74, 124, 78, 0.2);
}

.tt-status-inactive {
  background: var(--color-cream-warm);
  color: var(--color-stone);
}

.tt-status-inactive .tt-status-dot {
  background: var(--color-stone-light);
}

/* Tags row */
.tt-show-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

/* Detail fields card — reuses asset-detail-fields pattern */
.tt-show-fields {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 129, 120, 0.12);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

/* Content sections (description, instructions, supplies) */
.tt-show-section {
  margin-bottom: var(--space-lg);
}

.tt-show-section h3 {
  font-size: 0.75rem;
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-stone);
  margin-bottom: var(--space-sm);
}

.tt-show-section-body {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 129, 120, 0.12);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--color-charcoal);
}

.tt-show-section-body p:last-child {
  margin-bottom: 0;
}

/* Steps list (instructions as numbered steps) */
.tt-steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tt-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: white;
  border: 1px solid rgba(139, 129, 120, 0.12);
  border-bottom: none;
  position: relative;
}

.tt-step:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.tt-step:last-child {
  border-bottom: 1px solid rgba(139, 129, 120, 0.12);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.tt-step:only-child {
  border-radius: var(--radius-md);
  border-bottom: 1px solid rgba(139, 129, 120, 0.12);
}

.tt-step-number {
  width: 26px;
  height: 26px;
  min-width: 26px;
  background: var(--color-cream-warm);
  color: var(--color-forest);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.tt-step-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-charcoal);
}

/* Supplies card */
.tt-supplies-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 129, 120, 0.12);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.tt-supplies-card .supplies-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid rgba(139, 129, 120, 0.08);
}

.tt-supplies-card .supplies-list li:last-child {
  border-bottom: 1px solid rgba(139, 129, 120, 0.08);
}

.tt-supply-name {
  font-size: 0.9375rem;
  color: var(--color-charcoal);
}

.tt-supply-quantity {
  color: var(--color-stone);
}

.tt-supply-cost {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-forest);
}

.tt-supplies-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-cream-warm);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--color-charcoal);
}

/* Task instance cards */
.tt-instances-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.tt-show-occurrences + .tt-show-occurrences {
  margin-top: var(--space-section);
}

.tt-show-occurrences .empty-state {
  margin-bottom: var(--space-lg);
}

.tt-instance-card {
  display: block;
  color: inherit;
  text-decoration: none;
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 129, 120, 0.12);
  box-shadow: var(--shadow-sm);
  padding: var(--space-md) var(--space-lg);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.tt-instance-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* An inset stripe instead of a thicker border, so dates stay aligned with the other cards. */
.tt-instance-card.is-overdue {
  box-shadow: inset 4px 0 0 var(--color-error), var(--shadow-sm);
}

.tt-instance-card.is-overdue:hover {
  box-shadow: inset 4px 0 0 var(--color-error), var(--shadow-md);
}

.tt-instance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
}

.tt-instance-date {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-charcoal);
}

.tt-instance-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.tt-instance-pending,
.tt-instance-in_progress {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.tt-instance-completed {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.tt-instance-skipped,
.tt-instance-missed {
  background: var(--color-cream-warm);
  color: var(--color-stone);
}

.tt-instance-overdue {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.tt-instance-details {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* AI pick lists (suggested tasks and assets): each row is one big tap target with a
   roomy checkbox; a task's steps and supplies unfold below its row. */
.pick-list {
  display: flex;
  flex-direction: column;
  margin: var(--space-md) 0;
  border-top: 1px solid rgba(139, 129, 120, 0.12);
}

.pick-item {
  border-bottom: 1px solid rgba(139, 129, 120, 0.12);
}

.pick-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  min-height: 48px;
  padding: var(--space-md) 0;
  cursor: pointer;
  font-weight: 400;
  margin: 0;
}

.pick-row .pick-check {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--color-forest);
  cursor: pointer;
}

.pick-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
}

.pick-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
  line-height: 1.4;
}

.pick-body .suggestion-meta {
  margin-bottom: 0;
}

.pick-description {
  font-size: 0.875rem;
  color: var(--color-charcoal-light);
}

.pick-item > .suggestion-details {
  margin: calc(var(--space-sm) * -1) 0 0 calc(22px + var(--space-md));
  padding: 0 0 var(--space-md);
  border-top: none;
}

.suggestion-details {
  font-size: 0.875rem;
}

.suggestion-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-forest);
  padding: var(--space-xs) 0;
}

.suggestion-details ol,
.suggestion-details ul {
  margin: var(--space-sm) 0 0;
  padding-left: var(--space-lg);
}

.suggestion-details ul.suggestion-supplies {
  margin-top: var(--space-sm);
}

/* Suggested items: one line per item, under a heading per kind */
.pick-group-title {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-stone);
  margin: var(--space-lg) 0 0;
}

.pick-list-compact {
  margin-top: var(--space-xs);
}

.pick-list-compact .pick-row {
  align-items: center;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(139, 129, 120, 0.12);
}

.pick-list-compact .pick-row:last-child {
  border-bottom: none;
}

.pick-list-compact .pick-check {
  margin-top: 0;
}

.pick-body-inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
}

.pick-body-inline .suggestion-tags {
  margin-top: 0;
}

/* A property's AI card sits above its items */
.property-page .layout-main > [id^="ai_asset_suggestions"] > .card {
  margin-bottom: var(--space-lg);
}

/* "Suggested tasks to review" on Home and the property page */
.review-prompt {
  margin-bottom: var(--space-lg);
}

/* One card per item on the property's suggested-tasks page */
.property-task-suggestions > .card {
  margin-bottom: var(--space-md);
}

.suggestion-group-title {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}

.suggestion-group-title a {
  color: inherit;
  text-decoration: none;
}

.suggestion-group-place {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--color-stone);
}

/* Whole-home tasks follow the property's items */
.property-tasks {
  margin-top: var(--space-section);
}

.property-tasks > p {
  margin-bottom: var(--space-md);
}

/* After items are added: tasks for the ones without any, then "Suggest more items" */
.ai-more-items {
  font-size: 0.9375rem;
}

.ai-next-steps > .button_to + .ai-more-items {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(139, 129, 120, 0.12);
}

.ai-more-items p {
  margin-bottom: var(--space-sm);
}

.ai-not-added {
  margin-top: var(--space-md);
}

.ai-not-added summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-forest);
  padding: var(--space-xs) 0;
}

/* Asset tiles: how each item's tasks stand, and the note while AI suggests tasks */
.asset-tile-status {
  font-size: 0.8125rem;
  color: var(--color-stone);
}

.asset-tile-status.is-empty {
  color: var(--color-terracotta-dark);
}

.asset-tile-status.is-review {
  color: var(--color-forest);
  font-weight: 600;
}

.asset-tile-status.is-working {
  font-style: italic;
}

.asset-tiles-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: 0.9375rem;
  color: var(--color-charcoal-light);
}

.asset-tiles-progress > span:not(.spinner) {
  flex: 1;
  min-width: 0;
}

.asset-tiles-progress .poll-timeout {
  flex-basis: 100%;
}

.spinner.spinner-sm {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  border-width: 2px;
  flex: none;
}

/* Once an asset has tasks, the offer to suggest more is a quieter card after them */
.ai-suggestion-prompt-more {
  margin-top: var(--space-lg);
}

.ai-suggestion-prompt-more h3 {
  font-size: 1.0625rem;
}

/* AI results: one suggestion card per frame, each with its Add/Skip row */
.suggestion-card.card {
  padding: var(--space-lg);
}

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

.suggestion-title {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
}

.suggestion-header .difficulty-badge {
  margin-top: 3px;
}

.suggestion-description {
  font-size: 0.9375rem;
  color: var(--color-charcoal-light);
  margin: 0 0 var(--space-sm);
}

.suggestion-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  font-size: 0.8125rem;
  color: var(--color-charcoal-light);
  margin-bottom: var(--space-sm);
}

.suggestion-card details {
  font-size: 0.875rem;
  border-top: 1px solid rgba(139, 129, 120, 0.12);
  padding: var(--space-sm) 0;
}

.suggestion-card details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-forest);
}

.suggestion-card details ol,
.suggestion-card details ul {
  margin: var(--space-sm) 0 0;
  padding-left: var(--space-lg);
}

.suggestion-tags {
  margin-top: var(--space-sm);
}

.suggestion-actions {
  margin-top: var(--space-md);
}

/* Reviewed suggestions collapse to a status line: added (with a link to the task) or skipped (with undo) */
.suggestion-card.is-added .suggestion-header,
.suggestion-card.is-skipped .suggestion-header {
  margin-bottom: var(--space-xs);
}

.suggestion-card.is-skipped .suggestion-title {
  color: var(--color-stone);
}

.suggestion-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.suggestion-status-added {
  color: var(--color-success);
}

.suggestion-status-added a {
  margin-left: auto;
  font-weight: 600;
}

.suggestion-status-skipped {
  justify-content: space-between;
  color: var(--color-stone);
}

#suggestions > turbo-frame + turbo-frame {
  margin-top: var(--space-md);
}

.ai-info {
  margin-bottom: var(--space-lg);
}

/* Recent requests on the AI suggest page, below the Generate button */
.recent-requests {
  margin-top: var(--space-section);
}

/* A closing link or two after a page's content, set apart from it. */
.page-footer-actions {
  margin-top: var(--space-lg);
}

/* Action buttons row */
.tt-show-actions {
  margin-bottom: var(--space-lg);
}

/* The overflow menu (Deactivate, Delete) sits at the far end of the row. */
.tt-show-actions .tt-show-more {
  margin-left: auto;
}

.tt-show-more .overflow-menu-trigger {
  width: 48px;
  height: 48px;
  border: 1px solid var(--color-stone-light);
  border-radius: var(--radius-md);
}

.tt-show-more-scheduled {
  margin-top: var(--space-sm);
  font-size: 0.8125rem;
  color: var(--color-stone);
}

/* ========================================
   TASK INSTANCE SHOW PAGE
   ======================================== */
.ti-show {
  padding-bottom: var(--space-2xl);
}

/* Page header */
.ti-show-header {
  margin-bottom: var(--space-xl);
}

.ti-show-title {
  font-family: var(--font-display);
  color: var(--color-charcoal);
  margin-bottom: var(--space-sm);
  line-height: 1.2;
}

.ti-show-status-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Status badge */
.ti-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: capitalize;
}

.ti-status-badge.pending {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.ti-status-badge.in_progress {
  background: rgba(26, 77, 62, 0.08);
  color: var(--color-forest);
}

.ti-status-badge.completed {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.ti-status-badge.skipped,
.ti-status-badge.missed {
  background: var(--color-cream-warm);
  color: var(--color-stone);
}

.ti-missed-label {
  font-weight: 600;
  color: var(--color-charcoal);
}

.ti-missed-note {
  padding: var(--space-lg);
}

.ti-missed-note p {
  color: var(--color-stone);
  font-size: 0.9375rem;
}

.ti-status-badge.overdue {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.ti-due-label {
  font-size: 0.8125rem;
  color: var(--color-stone);
  font-weight: 500;
}

/* Detail fields card */
.ti-show-details {
  margin-bottom: var(--space-xl);
}

.ti-show-details .asset-detail-value a {
  color: var(--color-forest);
  font-weight: 600;
  text-decoration: none;
}

.ti-show-details .asset-detail-value a:hover {
  color: var(--color-forest-light);
  text-decoration: underline;
}

/* Sections (description, instructions, supplies, tags) */
.ti-show-section {
  margin-bottom: var(--space-section);
}

.ti-section-heading {
  font-size: 0.75rem;
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-stone);
  margin-bottom: var(--space-sm);
}

.ti-section-body {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 129, 120, 0.12);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--color-charcoal);
}

.ti-section-body p:last-child {
  margin-bottom: 0;
}

/* Instructions — slightly distinct background for visual weight */
.ti-instructions {
  border-left: 3px solid var(--color-forest);
}

/* Supplies list */
.ti-supplies-list {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid rgba(139, 129, 120, 0.12);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.ti-supply-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid rgba(139, 129, 120, 0.08);
}

.ti-supply-item:last-child {
  border-bottom: none;
}

.ti-supply-name {
  font-size: 0.9375rem;
  color: var(--color-charcoal);
}

.ti-supply-cost {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-copper);
}

/* Tags */
.ti-show-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* Completion details section */
.ti-completion-section .asset-detail-fields {
  border-left: 3px solid var(--color-success);
}

/* Complete form */
.ti-complete-form {
  border-top: 3px solid var(--color-success);
}

.ti-complete-form .form-actions {
  margin-top: var(--space-md);
}

.ti-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 500;
  cursor: pointer;
}

.ti-checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-forest);
}

/* Optional completion fields, collapsed by default */
.ti-complete-details summary {
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-forest);
  padding: var(--space-xs) 0;
}

.ti-complete-details[open] summary {
  margin-bottom: var(--space-md);
}

.ti-complete-optional {
  font-weight: 400;
  color: var(--color-stone);
}

.ti-complete-bar {
  margin-top: var(--space-md);
}

/* The bar's "⋯" (snooze, skip, time, cost & notes) is for phones; desktop shows those beside it. */
.ti-complete-bar .task-actions-menu {
  display: none;
}

/* Task page: what was spent and noted last time, and the way to the task's schedule. */
.ti-last-time .meta-list {
  margin: 0 0 var(--space-xs);
  font-size: 0.875rem;
  color: var(--color-charcoal-light);
}

.ti-last-time-notes {
  margin: 0;
  padding-left: var(--space-md);
  border-left: 3px solid var(--color-cream-warm);
  color: var(--color-charcoal-light);
  font-size: 0.9375rem;
}

.ti-last-time-notes p {
  margin: 0;
}

.ti-schedule-link {
  margin: var(--space-md) 0 var(--space-lg);
}

/* Up next on a task's page: Mark complete sits above the card's covering link. */
.tt-instance-complete {
  position: relative;
  z-index: 1;
  margin: var(--space-sm) 0 0;
}

/* Reopen, under a closed task's completion details. */
.ti-reopen {
  margin-top: var(--space-md);
}

.ti-reopen form {
  margin: 0 0 var(--space-xs);
}

/* Mobile/tablet: pin Mark Complete above the tab bar (desktop has the sticky side column). */
@media (max-width: 1023px) {
  .ti-show:has(.ti-complete-bar) {
    padding-bottom: calc(var(--space-2xl) + 72px);
  }

  .ti-complete-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--tab-bar-height);
    z-index: 90;
    margin: 0;
    padding: var(--space-sm) var(--space-md);
    background: rgba(250, 247, 242, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--color-cream-warm);
  }

  .ti-complete-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
  }

  .ti-complete-bar > .btn {
    flex: 1;
    max-width: var(--content-max);
    margin: 0;
    display: flex;
  }

  .ti-complete-bar .task-actions-menu {
    display: block;
  }

  .ti-complete-bar .task-actions-menu .overflow-menu-trigger {
    width: 44px;
    height: 44px;
    border: 1px solid var(--color-cream-warm);
    background: white;
  }

  /* Opens upward, out of the bar. */
  .ti-complete-bar .task-actions-menu .overflow-menu-list {
    top: auto;
    bottom: calc(100% + var(--space-sm));
  }
}

/* AI generating spinner */
.ai-generating {
  text-align: center;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 1rem;
  border: 3px solid var(--color-stone-light, #e0e0e0);
  border-top-color: var(--color-forest);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.poll-timeout {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--color-warning-bg);
  border: 1px solid rgba(212, 160, 58, 0.2);
  color: var(--color-charcoal);
  font-size: 0.9375rem;
}

.poll-timeout p {
  margin-bottom: var(--space-sm);
}

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


/* "Every [3] [months]" on the task form's schedule (task_templates/_schedule_fields) */
.schedule-every {
  display: flex;
  gap: var(--space-sm);
}

.schedule-every input {
  flex: 0 0 6rem;
}

.schedule-every select {
  flex: 1;
}

/* ========================================
   PLAN MY HOME (the starter plan interview)
   ======================================== */
.home-plan-steps {
  display: flex;
  gap: var(--space-sm);
  list-style: none;
  margin: 0 0 var(--space-lg);
  padding: 0;
}

.home-plan-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
  padding-top: var(--space-sm);
  border-top: 3px solid var(--color-cream-warm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-stone);
}

.home-plan-step.is-current,
.home-plan-step.is-done {
  border-top-color: var(--color-forest);
}

.home-plan-step.is-current {
  color: var(--color-charcoal);
}

.home-plan-step-number {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-cream-warm);
  font-size: 0.6875rem;
  font-weight: 700;
}

.home-plan-step.is-current .home-plan-step-number,
.home-plan-step.is-done .home-plan-step-number {
  background: var(--color-forest);
  color: white;
}

.home-plan-step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-plan-form > .card {
  margin-bottom: var(--space-lg);
}

.home-plan-card-title {
  font-size: 1.25rem;
  margin: 0 0 var(--space-xs);
}

.home-plan-card-text {
  font-size: 0.875rem;
  color: var(--color-charcoal-light);
  margin: 0 0 var(--space-md);
}

fieldset.home-plan-question {
  border: none;
  margin: 0 0 var(--space-lg);
  padding: 0;
}

fieldset.home-plan-question:last-child {
  margin-bottom: 0;
}

fieldset.home-plan-question legend {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--color-charcoal);
  margin-bottom: var(--space-sm);
  padding: 0;
}

/* Answers to pick from, as tappable cards two to a row. */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.choice {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 48px;
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--color-stone-light);
  border-radius: var(--radius-md);
  background: white;
  cursor: pointer;
  font-size: 0.9375rem;
  line-height: 1.3;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.choice input {
  flex: none;
  margin: 0;
}

.choice:has(input:checked) {
  border-color: var(--color-forest);
  background: var(--color-success-bg);
}

.choice:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(26, 77, 62, 0.2);
}

/* "Last done" under each task of the plan, lined up with the task's title. */
.home-plan-last-done {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: calc(var(--space-sm) * -1) 0 var(--space-md) calc(22px + var(--space-md));
}

.home-plan-last-done label {
  flex: none;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-charcoal-light);
}

.home-plan-last-done select {
  width: auto;
  min-width: 0;
  flex: 1;
  max-width: 16rem;
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
  border-width: 1px;
  border-radius: var(--radius-sm);
}

.home-plan-custom-items .home-plan-card-text {
  margin-bottom: 0;
}

.home-plan-history .pick-item > .suggestion-details {
  margin-top: 0;
}
