/* ========== Theme Tokens ========== */
:root {
  color-scheme: light;
  --color-base: #f3f4f6;
  --color-surface: #ffffff;
  --color-surface-muted: #f9fafb;
  --color-border: #d1d5db;
  --color-text: #111827;
  --color-text-muted: #4b5563;
  --color-accent: #1f6f43;
  --color-accent-strong: #155b33;
  --color-accent-contrast: #f7fdf9;
  --color-accent-rgb: 31, 111, 67;
  --color-shadow: rgba(15, 23, 42, 0.15);
  --color-warning: #d97706;
  --color-warning-contrast: #ffffff;
}

[data-theme="dark"] {
  color-scheme: dark;
  --color-base: #111827;
  --color-surface: #1f2933;
  --color-surface-muted: #25323f;
  --color-border: #374151;
  --color-text: #f9fafb;
  --color-text-muted: #d1d5db;
  --color-accent: #1f6f43;
  --color-accent-strong: #2f8a58;
  --color-accent-contrast: #f7fdf9;
  --color-accent-rgb: 31, 111, 67;
  --color-shadow: rgba(0, 0, 0, 0.45);
  --color-warning: #f59e0b;
  --color-warning-contrast: #1f2933;
}

/* ========== Global ========== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-base);
  color: var(--color-text);
  line-height: 1.5;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body[data-guest-mode="true"] .requires-auth {
  display: none !important;
}

.guest-indicator {
  margin-left: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--color-warning);
  color: var(--color-warning-contrast);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.guest-banner {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.12);
  color: var(--color-warning);
  font-weight: 600;
}

[data-theme="dark"] .guest-banner {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.2);
}

body[data-guest-mode="true"] .page-header::after {
  content: "Guest demo mode – editing disabled.";
  flex-basis: 100%;
  font-size: 0.9rem;
  color: var(--color-warning);
  font-weight: 600;
  margin-top: 0.35rem;
}

html,
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

a:hover,
a:focus-visible {
  color: var(--color-accent-strong);
  text-decoration: underline;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

form.inline-form {
  display: inline-flex;
  margin: 0;
  align-items: center;
  gap: 0.35rem;
}

form.inline-form > * {
  flex-shrink: 0;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 12px 24px rgba(var(--color-accent-rgb), 0.08);
  margin-bottom: 1.5rem;
}

.auth-card {
  max-width: 420px;
  margin: 4rem auto 0;
  padding: 2.25rem;
}

.auth-landing {
  display: grid;
  gap: 2rem;
  align-items: flex-start;
  max-width: 1100px;
  margin: 3rem auto 0;
  padding: 0 1.5rem 3rem;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
}

.auth-landing .auth-card {
  margin: 0;
  width: 100%;
}

.auth-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-info-card h2 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

.auth-info-card p {
  margin: 0 0 1rem 0;
  color: var(--color-text-muted);
}

.auth-info-card ul {
  margin: 0;
  padding-left: 1.25rem;
  list-style: disc;
  display: grid;
  gap: 0.5rem;
}

.auth-info-card ul li {
  line-height: 1.4;
}

.auth-contact-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.auth-contact-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.75rem;
  align-items: baseline;
}

.auth-contact-item dt {
  font-weight: 600;
  color: var(--color-text-muted);
}

.auth-contact-item dd {
  margin: 0;
}

.auth-contact-item a {
  color: var(--color-primary);
  font-weight: 600;
}

@media (max-width: 900px) {
  .auth-landing {
    grid-template-columns: 1fr;
    margin-top: 2rem;
  }

  .auth-landing .auth-card {
    max-width: none;
  }

  .auth-contact-item {
    grid-template-columns: 1fr;
  }
}

.auth-card h1 {
  margin-bottom: 0.35rem;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.auth-card label {
  font-weight: 600;
  font-size: 0.85rem;
}

.auth-card input[type="email"],
.auth-card input[type="password"] {
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  background: var(--color-surface);
  color: inherit;
}

.auth-card button[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
}

.auth-card .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.auth-card .muted {
  text-align: center;
}

.auth-divider {
  position: relative;
  margin: 2rem 0 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--color-border);
}

.auth-divider::before {
  left: 0;
}

.auth-divider::after {
  right: 0;
}

.auth-divider span {
  background: var(--color-surface);
  padding: 0 0.75rem;
}

.auth-guest {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
}

.auth-guest .muted {
  margin: 0;
}

.btn.full-width {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.card h2,
.card h3,
.card h4 {
  margin-top: 0;
}

.card-grid {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.profile-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

.status-pill.active {
  background: rgba(var(--color-accent-rgb), 0.15);
  color: var(--color-accent);
}

.status-pill.inactive {
  background: rgba(217, 119, 6, 0.15);
  color: var(--color-warning);
}

.status-pill.neutral {
  background: var(--pill-color, var(--color-surface-muted));
  color: var(--color-text);
}

.profile-details {
  margin: 0;
  display: grid;
  gap: 0.75rem 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.profile-details__item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.profile-details__item dt {
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.profile-details__item dd {
  margin: 0;
  font-size: 0.95rem;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.card-heading h2 {
  margin: 0;
}

.profile-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.profile-list li {
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--color-surface-muted);
}

.profile-list .item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 600;
  margin: 0 0 0.3rem;
}

.profile-list .item-subtitle {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0.1rem 0;
}

.profile-list .item-notes {
  margin: 0.5rem 0 0;
}

.dog-profile-overview {
  margin-bottom: 2rem;
}

.dog-profile-summary {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 720px) {
  .dog-profile-summary {
    grid-template-columns: minmax(0, 220px) 1fr;
  }
}

.dog-profile-photo {
  width: 100%;
  max-width: 220px;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  object-fit: cover;
  aspect-ratio: 1;
}

.dog-photo-placeholder {
  width: 100%;
  max-width: 220px;
  border-radius: 0.75rem;
  border: 1px dashed var(--color-border);
  background: var(--color-surface-muted);
  display: grid;
  place-items: center;
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.card form {
  background: none;
  border: none;
  padding: 0;
}

.metrics {
  margin: 0;
}

.chart-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.chart {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 24px rgba(var(--color-accent-rgb), 0.06);
}

.chart figcaption {
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.chart canvas {
  flex: 1 1 auto;
  min-height: 240px;
}

/* ========== Top navbar / toolbar ========== */

.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toolbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.topbar__controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
}

.topbar__collapsible {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  width: 100%;
}

.topbar__collapsible.is-open {
  display: flex;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: 0 12px 24px rgba(var(--color-accent-rgb), 0.08);
}

@media (min-width: 901px) {
  .topbar {
    align-items: stretch;
  }
}

.nav-links {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
}

.nav-links a {
  color: var(--color-text);
  font-weight: 500;
  padding: 0.6rem 0.75rem;
  border-bottom: none;
  border-radius: 0.5rem;
  background: var(--color-surface-muted);
}

.nav-links a.active {
  color: var(--color-accent);
  background: rgba(var(--color-accent-rgb), 0.14);
  border-color: transparent;
}


.nav-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.nav-actions .link {
  color: var(--color-text-muted);
  font-weight: 500;
}

.nav-actions .link:hover,
.nav-actions .link:focus-visible {
  color: var(--color-accent);
  text-decoration: underline;
}

.user-pill {
  background: var(--color-surface-muted);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.45rem 0.75rem;
  border-radius: 0.5rem;
  font-weight: 600;
}

.nav-inbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: var(--color-surface);
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.nav-inbox:hover,
.nav-inbox:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-surface-muted);
  box-shadow: 0 6px 12px rgba(var(--color-accent-rgb), 0.12);
  outline: none;
}

.nav-inbox.is-active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: rgba(var(--color-accent-rgb), 0.12);
}

.nav-inbox__icon svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.nav-inbox__badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.2;
  min-width: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(var(--color-accent-rgb), 0.3);
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: var(--color-surface-muted);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.nav-toggle__icon {
  position: relative;
  width: 20px;
  height: 2px;
  background: currentColor;
  display: inline-block;
}

.nav-toggle__icon::before,
.nav-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
  transition: transform 0.2s ease;
}

.nav-toggle__icon::before {
  transform: translateY(-6px);
}

.nav-toggle__icon::after {
  transform: translateY(6px);
}

body.nav-open .nav-toggle__icon {
  background: transparent;
}

body.nav-open .nav-toggle__icon::before {
  transform: rotate(45deg);
}

body.nav-open .nav-toggle__icon::after {
  transform: rotate(-45deg);
}

.btn,
button,
input[type="submit"] {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border: none;
  border-radius: 0.375rem;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn.secondary,
button.secondary {
  background: var(--color-text-muted);
  color: var(--color-surface);
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--color-accent-strong);
}

.btn.secondary:hover,
button.secondary:hover {
  background: var(--color-text);
  color: var(--color-surface);
}

.btn:focus-visible,
button:focus-visible,
input[type="submit"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.35);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.75rem;
}

.page-subtitle {
  margin: 0.15rem 0 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.muted {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.settings-section {
  margin-bottom: 2rem;
}

.settings-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 12px 24px rgba(var(--color-accent-rgb), 0.08);
}

.settings-card .section-heading,
.settings-card h2,
.settings-card h3 {
  margin-top: 0;
}

.settings-card > * + * {
  margin-top: 1rem;
}

.theme-preference {
  margin-top: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.theme-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-preview__panel {
  display: inline-flex;
  gap: 0.5rem;
}

.theme-preview__swatch {
  width: 56px;
  height: 40px;
  border-radius: 0.6rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 12px 20px rgba(var(--color-accent-rgb), 0.08);
}

.theme-preview__swatch--light {
  background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
}

.theme-preview__swatch--dark {
  background: linear-gradient(135deg, #1f2933 0%, #0f172a 100%);
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

input[type="checkbox"] {
  accent-color: var(--color-accent);
}

.fieldset-help {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.form-help {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar-title {
  font-weight: 600;
  color: var(--color-text);
}

.toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ========== Flash messages ========== */
.flash-messages {
  margin-bottom: 1rem;
}

.flash-messages li {
  background: rgba(var(--color-accent-rgb), 0.12);
  border: 1px solid rgba(var(--color-accent-rgb), 0.45);
  color: var(--color-accent);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
}

/* ========== Tables ========== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: 0.5rem;
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll table {
  min-width: 600px;
  margin: 0;
}

th,
td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
  color: var(--color-text);
}

th {
  background: var(--color-surface-muted);
  font-weight: 600;
}

tr:nth-child(even) td {
  background: var(--color-surface-muted);
}

.table-schedule td:first-child {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table-schedule td:last-child {
  white-space: nowrap;
}

/* ========== Forms ========== */
form {
  background: var(--color-surface);
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border);
  max-width: 650px;
}

form.filter-form,
form.bulk-action-form {
  max-width: none;
}

form.bulk-action-form {
  background: none;
  border: none;
  padding: 0;
}

.walks-filters {
  margin-bottom: 1.5rem;
}

.filter-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.filter-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.bulk-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.bulk-select {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.walk-history-table {
  width: 100%;
}

.walk-history-table .nowrap {
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  text-transform: capitalize;
}

.status-badge.status-completed {
  background: rgba(var(--color-accent-rgb), 0.12);
  color: var(--color-accent-strong);
  border-color: rgba(var(--color-accent-rgb), 0.45);
}

.status-badge.status-cancelled,
.status-badge.status-no-show {
  background: rgba(217, 48, 37, 0.12);
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.35);
}

.status-badge.status-scheduled {
  background: rgba(30, 64, 175, 0.12);
  color: #1d4ed8;
  border-color: rgba(29, 78, 216, 0.35);
}

.logs-cell {
  max-width: 240px;
}

.log-snippet {
  margin-bottom: 0.5rem;
}

.log-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.log-text {
  font-size: 0.85rem;
}

.log-link {
  font-size: 0.8rem;
  display: inline-block;
  margin-top: 0.25rem;
}

.actions-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 120px;
}

.link-button {
  background: none;
  color: var(--color-accent);
  border: none;
  padding: 0;
  font-size: 0.8rem;
  cursor: pointer;
}

.link-button:hover,
.link-button:focus-visible {
  text-decoration: underline;
  background: none;
  box-shadow: none;
}

.link-button.danger {
  color: #b91c1c;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.pagination .disabled {
  color: var(--color-text-muted);
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  color: var(--color-text);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.875rem;
  background: var(--color-surface);
  color: var(--color-text);
  margin-bottom: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus-visible,
input[type="number"]:focus-visible,
input[type="date"]:focus-visible,
input[type="time"]:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--color-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.25);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

fieldset {
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  padding: 0.75rem 0.75rem 0.25rem;
  margin-bottom: 0.75rem;
}

legend {
  font-weight: 600;
  padding: 0 0.25rem;
}

.inline-field {
  display: flex;
  gap: 0.75rem;
}

/* ========== Schedule (week view) ========== */

.week-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  --time-grid-line: rgba(17, 24, 39, 0.08);
  --time-grid-line-strong: rgba(17, 24, 39, 0.18);
  --time-grid-fill: rgba(17, 24, 39, 0.025);
  --time-grid-fill-strong: rgba(17, 24, 39, 0.05);
}

[data-theme="dark"] .week-wrapper {
  --time-grid-line: rgba(249, 250, 251, 0.14);
  --time-grid-line-strong: rgba(249, 250, 251, 0.28);
  --time-grid-fill: rgba(249, 250, 251, 0.045);
  --time-grid-fill-strong: rgba(249, 250, 251, 0.08);
}

.week-grid {
  --time-gutter-width: 82px;
  --day-header-height: 3.25rem;
  display: grid;
  grid-template-columns: var(--time-gutter-width) repeat(7, minmax(110px, 1fr));
  position: relative;
}

@media (max-width: 768px) {
  .week-wrapper {
    -webkit-overflow-scrolling: touch;
  }

  .week-grid {
    grid-template-columns: var(--time-gutter-width) repeat(7, minmax(140px, 1fr));
  }
}

.time-gutter {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
}

.time-header {
  gap: 0.15rem;
  min-height: var(--day-header-height);
  display: flex;
  align-items: center;
  justify-content: center;
}

.time-header__label {
  display: block;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.time-header__range {
  display: block;
  font-size: 0.65rem;
  color: var(--color-text-muted);
}

.time-body {
  position: relative;
  flex: 0 0 var(--calendar-height);
  height: var(--calendar-height);
  min-height: var(--calendar-height);
  isolation: isolate;
}

.time-marker {
  position: absolute;
  left: 0.75rem;
  font-size: 0.65rem;
  color: var(--color-text-muted);
  line-height: 1;
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: none;
  background: var(--color-surface);
  padding-right: 0.25rem;
}

.time-marker:first-child {
  transform: translateY(0);
}

.time-marker:last-child {
  transform: translateY(-100%);
}

.day-col {
  position: relative;
  border-left: 1px solid var(--color-surface-muted);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.day-header {
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 5;
  padding: 0.4rem 0.5rem;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text);
  min-height: var(--day-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.day-header__content {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.day-header__name {
  font-size: 0.85rem;
}

.day-header .day-date {
  display: block;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-top: 0.1rem;
}

.day-header__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  background: transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.day-header__action:hover,
.day-header__action:focus {
  color: var(--color-primary);
  border-color: var(--color-border-strong);
  background: var(--color-surface-muted);
  outline: none;
}

.day-header__action:focus-visible {
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.day-header__action--active {
  color: var(--color-primary);
  border-color: var(--color-border);
  background: var(--color-surface-muted);
}

.day-header__icon {
  width: 1rem;
  height: 1rem;
  display: block;
}

.day-override-notice {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  margin: 0.25rem 0.5rem 0.25rem;
  display: inline-block;
}


.day-body {
  position: relative;
  height: var(--calendar-height);
  min-height: var(--calendar-height);
  flex: 0 0 var(--calendar-height);
  isolation: isolate;
}

.time-slots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.time-slot {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--time-grid-line);
  background: var(--time-grid-fill);
}

.time-slot--hour {
  border-top-color: var(--time-grid-line-strong);
  background: var(--time-grid-fill-strong);
}

.walk-window {
  position: absolute;
  left: 4%;
  right: 4%;
  background: rgba(var(--color-accent-rgb), 0.12);
  border-left: 1px dashed rgba(var(--color-accent-rgb), 0.45);
  border-right: 1px dashed rgba(var(--color-accent-rgb), 0.45);
  border-radius: 0.4rem;
  pointer-events: none;
  z-index: 1;
}

.working-hours-block {
  position: absolute;
  left: 6%;
  right: 6%;
  border-radius: 0.45rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.7rem;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  pointer-events: none;
  z-index: 0;
  box-shadow: inset 0 0 0 1px rgba(107, 114, 128, 0.2);
}

.working-hours-block--default {
  background: rgba(107, 114, 128, 0.08);
  border: 1px solid rgba(107, 114, 128, 0.4);
  color: var(--color-text);
}

.working-hours-block--override {
  background: rgba(75, 85, 99, 0.14);
  border: 1px solid rgba(75, 85, 99, 0.5);
  color: var(--color-text);
}

.working-hours-block--fallback {
  border-style: dashed;
  opacity: 0.95;
}

.working-hours-block .label {
  font-weight: 600;
}

.working-hours-block .time {
  font-size: 0.68rem;
  opacity: 0.9;
}

[data-theme="dark"] .working-hours-block--default {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.45);
  color: var(--color-text);
}

[data-theme="dark"] .working-hours-block--override {
  background: rgba(148, 163, 184, 0.22);
  border-color: rgba(148, 163, 184, 0.55);
  color: var(--color-text);
}

[data-theme="dark"] .working-hours-block--fallback {
  opacity: 0.85;
}

.off-hours-block {
  position: absolute;
  left: 4%;
  right: 4%;
  background: rgba(75, 85, 99, 0.12);
  border: 1px dashed rgba(75, 85, 99, 0.28);
  border-radius: 0.35rem;
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .off-hours-block {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.3);
}



.walk-block {
  position: absolute;
  left: 8%;
  right: 8%;
  border-radius: 0.4rem;
  background: var(--client-color-light, var(--color-accent));
  color: var(--color-accent-contrast);
  padding: 0.45rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.2;
  box-shadow: 0 2px 4px var(--color-shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.15rem;
  text-decoration: none;
  z-index: 2;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.walk-block:hover,
.walk-block:focus-visible {
  text-decoration: none;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.25);
  transform: translateY(-1px);
}

.walk-block:focus-visible {
  outline: 2px solid rgba(var(--color-accent-rgb), 0.7);
  outline-offset: 2px;
}

[data-theme="dark"] .walk-block {
  background: var(--client-color-dark, var(--color-accent));
}

.walk-block .dog-name {
  font-weight: 700;
  line-height: 1.2;
}

.walk-block .client-name {
  font-weight: 500;
  opacity: 0.85;
}

.unavailability-block {
  position: absolute;
  left: 10%;
  right: 10%;
  border-radius: 0.4rem;
  background: rgba(185, 28, 28, 0.12);
  border: 1px dashed rgba(185, 28, 28, 0.45);
  color: #7f1d1d;
  padding: 0.4rem 0.45rem;
  font-size: 0.7rem;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
  z-index: 2;
}

.unavailability-block .label {
  font-weight: 600;
}

.unavailability-block .time {
  font-size: 0.68rem;
  opacity: 0.85;
}

.unavailability-block .walker {
  font-size: 0.65rem;
  opacity: 0.85;
}

.unavailability-block:hover,
.unavailability-block:focus-visible {
  text-decoration: none;
  border-color: rgba(185, 28, 28, 0.7);
  box-shadow: 0 4px 10px rgba(185, 28, 28, 0.15);
}

[data-theme="dark"] .unavailability-block {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

[data-theme="dark"] .unavailability-block:hover,
[data-theme="dark"] .unavailability-block:focus-visible {
  border-color: rgba(248, 113, 113, 0.7);
  box-shadow: 0 4px 10px rgba(248, 113, 113, 0.3);
}

/* unpaid example */
.walk-block.unpaid {
  background: var(--color-warning);
  color: var(--color-warning-contrast);
}

.walk-tooltip {
  position: absolute;
  max-width: 260px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 0.6rem;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.22);
  padding: 0.75rem 0.85rem;
  font-size: 0.75rem;
  line-height: 1.35;
  z-index: 2000;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.walk-tooltip[data-visible="true"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.walk-tooltip:focus-visible {
  outline: 2px solid rgba(var(--color-accent-rgb), 0.7);
  outline-offset: 2px;
}

.walk-tooltip .tooltip-section + .tooltip-section {
  margin-top: 0.55rem;
}

.walk-tooltip .tooltip-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.15rem;
}

.walk-tooltip .tooltip-value {
  white-space: pre-wrap;
  word-break: break-word;
}

.client-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.client-color-option {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.client-color-option:hover,
.client-color-option:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(var(--color-accent-rgb), 0.2);
}

.client-color-option input[type="radio"] {
  accent-color: var(--color-accent);
  align-self: flex-start;
}

.client-color-swatches {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.client-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 0.4rem;
  border: 1px solid var(--color-border);
}

.client-color-option .label-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
}

.client-color-option .label-subtext {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.walk-log-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.walk-log-photos img {
  display: block;
  max-width: 180px;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

.portal-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portal-week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.portal-week-range {
  font-weight: 600;
}

.portal-client-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.portal-client-chip {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  min-width: 220px;
  box-shadow: 0 6px 14px rgba(var(--color-accent-rgb), 0.06);
}

.portal-client-name {
  font-weight: 600;
}

.portal-client-walker {
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

.portal-section-heading {
  margin-top: 0;
}

.portal-day {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}

.portal-day:last-of-type {
  border-bottom: none;
}

.portal-day h3 {
  margin: 0 0 0.5rem;
}

.portal-day-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.portal-day-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
}

.portal-day-time {
  font-weight: 600;
  min-width: 90px;
}

.portal-day-details {
  display: grid;
  gap: 0.25rem;
}

.portal-day-details > div {
  font-size: 0.9rem;
}

/* ========== Responsive adjustments ========== */
@media (max-width: 900px) {
  .nav-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-actions .btn,
  .nav-actions .link {
    width: 100%;
    justify-content: center;
  }

  .nav-actions .link {
    display: inline-flex;
    padding: 0.45rem 0.5rem;
  }

  .nav-actions .user-pill {
    width: 100%;
  }
}

@media (max-width: 768px) {
  main {
    padding: 1.25rem 0.85rem 2.5rem;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-field {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-landing {
    grid-template-columns: 1fr;
    margin-top: 2.5rem;
  }

  .auth-contact-item {
    grid-template-columns: 1fr;
  }

  .theme-preference {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-details {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .portal-week-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-client-list {
    flex-direction: column;
  }

  .portal-client-chip {
    min-width: 0;
    width: 100%;
  }

  .actions-cell {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .logs-cell {
    max-width: none;
  }

  .table-scroll {
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
  }
}

@media (max-width: 600px) {
  .card {
    padding: 1.25rem;
  }

  .auth-card {
    margin-top: 2.5rem;
    padding: 1.5rem;
  }

  .portal-day {
    padding: 0.75rem 0;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

.portal-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.portal-request-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.portal-request-item {
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--color-surface-muted);
}

.portal-request-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.portal-request-body > div {
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.portal-request-body > div:last-child {
  margin-bottom: 0;
}

.definition-list {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0.5rem 1rem;
}

.definition-list > div {
  display: contents;
}

.definition-list dt {
  font-weight: 600;
}

.definition-list dd {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
