:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #18211f;
  --muted: #6a746f;
  --line: #dfddd5;
  --primary: #5b7c99;
  --secondary: #7faea3;
  --danger: #b42318;
  --good: #13795b;
  --warn: #b65c00;
  --shadow: 0 18px 50px rgba(24, 33, 31, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7f6f1 0%, var(--bg) 46%, #efede6 100%);
  color: var(--ink);
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.boot,
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.boot {
  align-content: center;
  gap: 16px;
}

.mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-card,
.empty-card,
.panel,
.task-row,
.client-row,
.modal-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(223, 221, 213, 0.9);
  box-shadow: 0 8px 28px rgba(24, 33, 31, 0.08);
  backdrop-filter: blur(14px);
}

.auth-card {
  width: min(100%, 460px);
  border-radius: 20px;
  padding: 28px;
}

.auth-card h1,
.auth-card h2,
.panel h2,
.empty-card h2 {
  margin: 0;
  line-height: 1.08;
}

.auth-card p,
.empty-card p,
.muted {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: #34413c;
  font-size: 0.88rem;
  font-weight: 650;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #34413c;
  font-size: 0.9rem;
  font-weight: 650;
}

.checkline input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

fieldset.field {
  border: 0;
  margin: 0;
  padding: 0;
}

fieldset.field legend {
  color: #34413c;
  font-size: 0.88rem;
  font-weight: 650;
  margin-bottom: 7px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fffefa;
  outline: none;
}

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

.rich-editor-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 7px;
  border-bottom: 1px solid rgba(223, 221, 213, 0.78);
  background: color-mix(in srgb, var(--bg), white 54%);
}

.rich-toolbar button,
.rich-toolbar select,
.rich-toolbar input[type="color"] {
  width: auto;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  border: 1px solid rgba(223, 221, 213, 0.92);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
}

.rich-toolbar button {
  display: inline-grid;
  place-items: center;
  font-weight: 800;
}

.rich-toolbar select {
  max-width: 116px;
  font-size: 0.84rem;
}

.rich-toolbar input[type="color"] {
  padding: 3px;
}

.rich-toolbar button:hover,
.rich-toolbar select:hover,
.rich-toolbar input[type="color"]:hover {
  border-color: color-mix(in srgb, var(--primary), white 10%);
}

.rich-editor {
  min-height: 132px;
  padding: 12px 13px;
  outline: none;
  line-height: 1.5;
}

.rich-editor:focus {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--primary), transparent 86%);
}

.rich-editor.is-empty::before,
.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: color-mix(in srgb, var(--muted), white 8%);
  pointer-events: none;
}

.rich-editor p,
.rich-editor ul,
.rich-editor ol,
.rich-preview p,
.rich-preview ul,
.rich-preview ol {
  margin: 0 0 0.62em;
}

.rich-editor p:last-child,
.rich-editor ul:last-child,
.rich-editor ol:last-child,
.rich-preview p:last-child,
.rich-preview ul:last-child,
.rich-preview ol:last-child {
  margin-bottom: 0;
}

.rich-editor ul,
.rich-editor ol,
.rich-preview ul,
.rich-preview ol {
  padding-left: 1.3rem;
}

.file-field input[type="file"] {
  min-height: auto;
  padding: 10px;
  font-size: 0.9rem;
}

.file-field small {
  font-size: 0.8rem;
}

.file-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.file-selection:empty {
  display: none;
}

.file-selection-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.file-selection-chip {
  max-width: 100%;
  border: 1px solid rgba(223, 221, 213, 0.92);
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--primary), white 92%);
  color: #303936;
  font-size: 0.8rem;
}

.file-selection-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-selection-chip small {
  flex: 0 0 auto;
  color: #6c7672;
  font-weight: 800;
}

.rich-preview {
  display: grid;
  gap: 5px;
  color: #303936;
  line-height: 1.45;
}

.rich-preview-content {
  overflow: hidden;
}

.rich-preview.can-expand:not(.expanded) .rich-preview-content {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.text-toggle {
  width: fit-content;
  padding: 0;
  color: color-mix(in srgb, var(--primary), black 8%);
  background: transparent;
  font-size: 0.86rem;
  font-weight: 800;
}

.text-toggle:hover {
  color: color-mix(in srgb, var(--primary), black 22%);
}

input:focus,
textarea:focus,
select:focus {
  border-color: color-mix(in srgb, var(--primary), white 10%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary), transparent 86%);
}

.btn {
  min-height: 42px;
  border-radius: 12px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: #eeeae1;
  font-weight: 750;
}

.btn.primary {
  color: white;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary), black 16%));
}

.btn.danger {
  color: white;
  background: var(--danger);
}

.btn.subtle {
  background: transparent;
  color: var(--muted);
}

.btn.full {
  width: 100%;
}

.btn.small {
  min-height: 32px;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 0.84rem;
}

.btn.tiny {
  min-height: 28px;
  border-radius: 9px;
  padding: 0 9px;
  font-size: 0.76rem;
}

.btn.subtle-danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger), white 90%);
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.mobile-header,
.menu-backdrop {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand.compact .mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  box-shadow: none;
}

.mobile-brand-stack {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.workspace-switcher {
  display: grid;
  gap: 5px;
}

.workspace-switcher span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.workspace-switcher select {
  min-height: 36px;
  border-radius: 11px;
  padding: 0 10px;
  background: rgba(255, 254, 250, 0.88);
  font-size: 0.86rem;
  font-weight: 750;
}

.workspace-switcher.mobile {
  display: none;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(238, 234, 225, 0.95);
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 800;
}

.menu-toggle {
  gap: 4px;
}

.menu-toggle span {
  width: 19px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.sidebar-close {
  display: none;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  min-height: 42px;
  border-radius: 12px;
  text-align: left;
  padding: 0 12px;
  color: #34413c;
  background: transparent;
  font-weight: 700;
}

.nav button.active {
  color: white;
  background: var(--primary);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.content {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
  position: relative;
  min-height: 210px;
  padding: 24px;
  border-radius: 22px;
  overflow: hidden;
  color: white;
  background:
    linear-gradient(90deg, rgba(24, 33, 31, 0.78), rgba(24, 33, 31, 0.28)),
    var(--hero-image),
    linear-gradient(135deg, var(--primary), var(--secondary));
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: clamp(2rem, 4vw, 4.8rem);
  line-height: 0.96;
}

.topbar p {
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.grid.metrics.client-profile-metrics {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  align-items: start;
}

.task-compose-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.18fr);
  gap: 16px;
  align-items: start;
}

.tasks-toolbar {
  align-items: center;
}

.dashboard-task-grid {
  margin-top: 28px;
}

.open-questions-panel {
  margin-top: 20px;
}

.compact-toolbar {
  align-items: flex-start;
  margin-bottom: 10px;
}

.compact-toolbar p {
  margin: 4px 0 0;
}

.open-question-list {
  display: grid;
  gap: 10px;
}

.open-question-row {
  border: 1px solid rgba(223, 221, 213, 0.92);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(170px, 0.72fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  background: #fffefa;
}

.open-question-row strong {
  display: block;
  margin-bottom: 4px;
  line-height: 1.24;
}

.open-question-row small {
  display: block;
}

.open-question-preview {
  display: grid;
  gap: 8px;
}

.question-preview.can-expand:not(.expanded) .rich-preview-content {
  -webkit-line-clamp: 2;
}

.task-create-standalone {
  margin-bottom: 18px;
  display: flex;
  justify-content: flex-start;
}

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

.new-task-btn {
  min-height: 50px;
  border-radius: 15px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--primary), transparent 76%);
}

.panel,
.empty-card {
  border-radius: 18px;
  padding: 18px;
}

.metric {
  min-height: 96px;
  display: grid;
  align-content: space-between;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.96), rgba(255, 254, 250, 0.82)),
    color-mix(in srgb, var(--primary), white 92%);
}

.metric span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.metric strong {
  font-size: 1.85rem;
  letter-spacing: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar h2 {
  margin: 0;
}

.dashboard-grid {
  margin-top: 16px;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 14px;
  background: #eeeae1;
}

.segmented button {
  min-height: 34px;
  border-radius: 10px;
  padding: 0 11px;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
}

.segmented button.active {
  color: var(--ink);
  background: white;
}

.task-list,
.client-list {
  display: grid;
  gap: 9px;
}

.group-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.group-card {
  border: 1px solid rgba(223, 221, 213, 0.92);
  border-radius: 16px;
  padding: 14px;
  background: #fffefa;
  display: grid;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(24, 33, 31, 0.045);
}

.group-card h3 {
  margin: 0 0 4px;
}

.compact-group-card {
  cursor: default;
}

.compact-group-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.compact-group-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.compact-toolbar {
  gap: 10px;
}

.group-member-chips {
  min-height: 34px;
}

.group-task-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}

.group-selection-chips {
  grid-column: 1 / -1;
}

.group-batch-list {
  display: grid;
  gap: 9px;
  border-top: 1px solid rgba(223, 221, 213, 0.72);
  padding-top: 12px;
}

.compact-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.group-batch-row {
  width: 100%;
  border: 1px solid rgba(223, 221, 213, 0.86);
  border-radius: 14px;
  padding: 10px 11px;
  background: #fffefa;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(120px, 0.8fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.group-batch-row strong,
.group-batch-row small,
.group-batch-progress span,
.group-batch-mini {
  display: block;
}

.group-batch-row small,
.group-batch-mini {
  color: var(--muted);
  font-size: 0.78rem;
}

.group-batch-progress {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 800;
}

.group-batch-progress i {
  display: block;
  height: 7px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--primary) var(--progress), rgba(223, 221, 213, 0.72) 0);
}

.batch-modal-card {
  width: min(100%, 860px);
  padding: 0;
  overflow: hidden;
}

.batch-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 20px 0;
}

.batch-summary article {
  border: 1px solid rgba(223, 221, 213, 0.78);
  border-radius: 14px;
  padding: 10px;
  background: #fffefa;
}

.batch-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.batch-summary strong {
  display: block;
  margin-top: 3px;
  font-size: 1.25rem;
}

.batch-modal-body {
  display: grid;
  gap: 14px;
  max-height: min(62vh, 620px);
  overflow: auto;
  padding: 16px 20px 20px;
}

.batch-person-section {
  display: grid;
  gap: 8px;
}

.batch-person-section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  font-size: 1rem;
}

.batch-person-section h3 span {
  color: var(--muted);
  font-size: 0.86rem;
}

.batch-person-list {
  display: grid;
  gap: 8px;
}

.batch-person-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(223, 221, 213, 0.86);
  border-radius: 14px;
  padding: 11px 12px;
  background: #fffefa;
}

.batch-person-row.done {
  border-color: color-mix(in srgb, var(--good), white 62%);
}

.batch-person-row.overdue {
  border-color: color-mix(in srgb, var(--warn), white 50%);
}

.batch-person-row small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.batch-person-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.compact-help {
  margin: 0;
  font-size: 0.86rem;
}

.task-row,
.client-row {
  border: 1px solid rgba(223, 221, 213, 0.92);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: #fffefa;
  box-shadow: 0 4px 16px rgba(24, 33, 31, 0.045);
}

.readable-row {
  cursor: zoom-in;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.readable-row:hover,
.readable-row:focus-visible {
  border-color: color-mix(in srgb, var(--primary), white 22%);
  box-shadow: 0 8px 22px rgba(24, 33, 31, 0.075);
  outline: none;
}

.readable-row:active {
  transform: scale(0.995);
}

.task-row header,
.client-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.task-row h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.22;
}

.task-description,
.reflection-text,
.note-text {
  margin: 0;
  color: #303936;
  line-height: 1.45;
}

.task-meta {
  margin-top: 2px;
}

.task-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.task-row-actions .btn {
  min-height: 42px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.attachment-chip {
  max-width: 100%;
  min-height: 32px;
  border: 1px solid rgba(223, 221, 213, 0.96);
  border-radius: 999px;
  padding: 4px 9px 4px 5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #303936;
  background: color-mix(in srgb, var(--secondary), white 90%);
  font-size: 0.78rem;
  font-weight: 800;
}

.attachment-chip span {
  min-width: 32px;
  min-height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: white;
  background: color-mix(in srgb, var(--primary), black 4%);
  font-size: 0.67rem;
}

.attachment-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip:hover {
  border-color: color-mix(in srgb, var(--primary), white 16%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary), transparent 88%);
}

.reflection-row {
  position: relative;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 8px;
  border-bottom: 1px solid rgba(223, 221, 213, 0.78);
}

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

.reflection-row:first-child {
  padding-top: 0;
}

.reflection-dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary), transparent 88%);
}

.reflection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.reflection-head strong {
  line-height: 1.25;
}

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

.invite-actions .btn {
  min-height: 36px;
  padding: 0 11px;
  font-size: 0.9rem;
}

.invite-flow {
  max-width: 860px;
}

.client-management-grid {
  align-items: start;
}

.client-directory-panel {
  padding: 16px;
}

.client-directory-head {
  margin-bottom: 10px;
}

.client-directory-head p {
  margin: 3px 0 0;
  font-size: 0.9rem;
}

.client-directory-search {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.client-directory-search span {
  color: #34413c;
  font-size: 0.78rem;
  font-weight: 800;
}

.client-directory-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0 13px;
  background: #fffefa;
  color: var(--ink);
}

.compact-directory {
  gap: 7px;
}

.compact-client-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
  padding: 11px 12px;
}

.client-identity {
  min-width: 0;
}

.client-identity strong,
.client-identity p {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-identity p {
  margin: 2px 0 0;
  font-size: 0.88rem;
}

.client-row-meta,
.client-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.mini-stat {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  background: #eeeae1;
  color: #4b5551;
  font-size: 0.74rem;
  font-weight: 800;
}

.mini-stat.done {
  background: color-mix(in srgb, var(--good), white 84%);
  color: color-mix(in srgb, var(--good), black 28%);
}

.mini-stat.overdue {
  background: color-mix(in srgb, var(--warn), white 84%);
  color: color-mix(in srgb, var(--warn), black 28%);
}

.chip.clickable {
  border: 1px solid color-mix(in srgb, var(--primary), white 72%);
  color: color-mix(in srgb, var(--primary), black 18%);
  background: color-mix(in srgb, var(--primary), white 90%);
}

button.chip.clickable {
  min-height: 0;
  width: auto;
  cursor: pointer;
}

button.chip.clickable:hover {
  border-color: color-mix(in srgb, var(--primary), white 28%);
  background: color-mix(in srgb, var(--primary), white 84%);
}

.invite-delivery {
  display: grid;
  gap: 16px;
}

.delivery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.delivery-card,
.open-invite-row {
  border: 1px solid var(--line);
  background: #fffefa;
  color: var(--ink);
  text-align: left;
}

.delivery-card {
  min-height: 104px;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.delivery-card.preferred {
  border-color: color-mix(in srgb, var(--primary), white 18%);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--primary), white 86%),
    color-mix(in srgb, var(--secondary), white 88%)
  );
}

.delivery-card strong {
  font-size: 1.05rem;
}

.delivery-card span {
  color: var(--muted);
  line-height: 1.35;
}

.delivery-card:hover,
.open-invite-row:hover,
.open-invite-row.active {
  border-color: color-mix(in srgb, var(--primary), white 24%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary), transparent 88%);
}

.open-invite-list {
  display: grid;
  gap: 8px;
}

.open-invites-panel.compact {
  padding: 10px;
  box-shadow: 0 2px 10px rgba(24, 33, 31, 0.04);
  opacity: 0.92;
}

.open-invites-panel.compact .toolbar {
  margin-bottom: 6px;
}

.open-invites-panel.compact h2 {
  font-size: 0.9rem;
}

.open-invites-panel.compact .open-invite-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
}

.open-invite-row {
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.open-invites-panel.compact .open-invite-row {
  min-height: 30px;
  border-radius: 9px;
  padding: 0 8px;
  font-size: 0.76rem;
}

.open-invite-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 760;
}

.open-invite-row code {
  border-radius: 999px;
  padding: 6px 9px;
  background: #eeeae1;
  font-weight: 800;
}

.open-invites-panel.compact .open-invite-row code {
  padding: 3px 6px;
  font-size: 0.7rem;
}

.template-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: #fffefa;
}

.template-row strong {
  display: block;
  margin-bottom: 3px;
}

.template-description {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.reminder-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  background: #fffefa;
}

.reminder-row p {
  margin: 3px 0 0;
}

.template-row.editing {
  grid-template-columns: 1fr;
}

.template-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.template-actions .icon-btn {
  width: auto;
  height: 32px;
  display: inline-flex;
}

.icon-btn {
  min-height: 32px;
  border-radius: 9px;
  padding: 0 10px;
  background: #eeeae1;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.icon-btn.danger {
  color: white;
  background: var(--danger);
}

.menu-toggle {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 14px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  background: rgba(238, 234, 225, 0.95);
}

.menu-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition:
    transform 0.16s ease,
    opacity 0.16s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  color: #34413c;
  background: #eeeae1;
  font-size: 0.8rem;
  font-weight: 760;
}

.chip.done {
  color: white;
  background: var(--good);
}

.chip.overdue {
  color: white;
  background: var(--warn);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.task-composer {
  gap: 14px;
}

.task-composer-modal {
  width: min(100%, 880px);
  padding: 18px;
}

.task-composer-head,
.task-create-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-composer-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.task-composer-head h2 {
  margin: 2px 0 0;
}

.section-kicker {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recipient-count-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 11px;
  background: color-mix(in srgb, var(--primary), white 84%);
  color: color-mix(in srgb, var(--primary), black 34%);
  font-size: 0.82rem;
  font-weight: 850;
}

.task-compose-section {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(223, 221, 213, 0.78);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 254, 250, 0.58);
}

.task-section-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.task-section-title > span {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--primary), white 82%);
  color: color-mix(in srgb, var(--primary), black 34%);
  font-weight: 900;
}

.task-section-title h3 {
  margin: 0;
  font-size: 1rem;
}

.task-section-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.compact-field {
  max-width: 100%;
}

.task-create-footer {
  position: sticky;
  bottom: 0;
  z-index: 4;
  border: 1px solid rgba(223, 221, 213, 0.9);
  border-radius: 16px;
  padding: 11px;
  background: rgba(255, 254, 250, 0.94);
  box-shadow: 0 -8px 22px rgba(24, 33, 31, 0.06);
  backdrop-filter: blur(12px);
}

.task-create-footer div {
  display: grid;
  gap: 2px;
}

.task-create-footer span {
  color: var(--muted);
  font-size: 0.78rem;
}

.task-create-footer .task-create-success {
  color: var(--good);
  font-weight: 850;
}

.client-picker {
  display: grid;
  gap: 8px;
}

.client-picker legend {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.selected-client-chips {
  min-height: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.selected-client-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 5px 0 9px;
  background: color-mix(in srgb, var(--primary), white 86%);
  color: color-mix(in srgb, var(--primary), black 36%);
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1;
}

.selected-client-chip button {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: white;
  color: inherit;
  font-weight: 900;
  font-size: 0.78rem;
  line-height: 1;
}

.client-picker-hint {
  color: var(--muted);
  font-size: 0.88rem;
}

.client-search-box {
  position: relative;
}

.client-search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 248px;
  overflow: auto;
  display: none;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefa;
  box-shadow: 0 18px 40px rgba(26, 31, 28, 0.16);
}

.client-search-results.is-open {
  display: grid;
}

.client-result {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 7px 9px;
  display: grid;
  gap: 2px;
  text-align: left;
  background: transparent;
  color: var(--ink);
}

.client-result small {
  color: var(--muted);
}

.client-result:hover {
  background: color-mix(in srgb, var(--primary), white 94%);
}

.client-empty {
  margin: 4px 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.notice {
  border-radius: 14px;
  padding: 12px;
  background: color-mix(in srgb, var(--primary), white 88%);
  color: color-mix(in srgb, var(--primary), black 35%);
}

.limit-meter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--primary), white 78%);
  border-radius: 14px;
  padding: 11px 12px;
  background: color-mix(in srgb, var(--primary), white 92%);
}

.limit-meter div {
  display: grid;
  gap: 2px;
}

.limit-meter strong {
  font-size: 0.9rem;
}

.limit-meter span,
.limit-meter small {
  color: var(--muted);
  font-size: 0.84rem;
}

.limit-meter.is-full {
  border-color: color-mix(in srgb, var(--warn), white 56%);
  background: color-mix(in srgb, var(--warn), white 88%);
}

.error {
  color: var(--danger);
}

.form-submit-error {
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--danger), white 62%);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger), white 91%);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.36;
}

.form-submit-error[hidden] {
  display: none;
}

.submit-status {
  margin: 0;
  border-radius: 12px;
  padding: 9px 11px;
  color: color-mix(in srgb, var(--primary), black 30%);
  background: color-mix(in srgb, var(--primary), white 91%);
  font-size: 0.9rem;
  font-weight: 800;
}

.submit-status[hidden] {
  display: none;
}

.spinner {
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.44);
  border-top-color: white;
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
}

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

.success {
  color: var(--good);
}

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 33, 31, 0.38);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-card {
  width: min(100%, 560px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: 20px;
  padding: 20px;
}

.modal-card.invite-delivery {
  width: min(100%, 860px);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 140;
  max-width: calc(100vw - 24px);
  border-radius: 12px;
  padding: 12px 18px;
  color: white;
  background: #09956b;
  box-shadow: 0 12px 32px rgba(9, 149, 107, 0.28);
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
  animation: toast-slide 3s ease both;
}

@keyframes toast-slide {
  0% {
    opacity: 0;
    transform: translate(-50%, 18px);
  }

  12%,
  88% {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, 18px);
  }
}

.reader-modal {
  width: min(100%, 720px);
  padding: 0;
  overflow: hidden;
  touch-action: auto;
}

.removal-modal {
  width: min(100%, 680px);
}

.brand-color-field {
  min-width: 0;
}

.brand-color-trigger {
  display: grid;
  grid-template-columns: 36px minmax(76px, auto) 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 7px 12px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.brand-color-trigger:hover {
  border-color: color-mix(in srgb, var(--primary), white 28%);
}

.brand-color-trigger > span:last-child {
  justify-self: end;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.brand-color-swatch {
  width: 36px;
  height: 36px;
  border: 2px solid white;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(32, 43, 40, 0.15);
}

.color-picker-modal {
  width: min(100%, 520px);
}

.color-picker-preview {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-height: 124px;
  border-radius: 16px;
  padding: 18px;
  color: white;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.color-picker-preview span {
  font-weight: 900;
}

.color-picker-controls {
  display: grid;
  gap: 16px;
}

.color-picker-controls label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.color-picker-controls input[type="range"] {
  appearance: none;
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: 999px;
  outline: none;
}

.color-picker-controls input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 28px;
  height: 28px;
  border: 3px solid white;
  border-radius: 50%;
  background: #27332f;
  box-shadow: 0 2px 8px rgba(24, 33, 31, 0.28);
  cursor: pointer;
}

.color-picker-controls input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid white;
  border-radius: 50%;
  background: #27332f;
  box-shadow: 0 2px 8px rgba(24, 33, 31, 0.28);
  cursor: pointer;
}

[data-color-picker-hue] {
  background: linear-gradient(90deg, #d86b6b, #d8ca6b, #73bf80, #6bc7d8, #7785d2, #b879cf, #d86b6b);
}

.removal-options {
  display: grid;
  gap: 12px;
}

.removal-option {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 1px solid rgba(223, 221, 213, 0.92);
  border-radius: 18px;
  padding: 16px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.removal-option:hover {
  border-color: color-mix(in srgb, var(--primary), white 30%);
  box-shadow: 0 14px 32px rgba(34, 44, 41, 0.1);
}

.removal-option strong {
  font-size: 1rem;
}

.removal-option span {
  color: var(--muted);
  line-height: 1.45;
}

.removal-option.danger {
  border-color: rgba(197, 51, 45, 0.22);
  background: rgba(255, 247, 245, 0.88);
}

.access-list {
  display: grid;
  gap: 10px;
}

.access-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(223, 221, 213, 0.8);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.club-summary-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.seat-meter {
  display: grid;
  min-width: 170px;
  gap: 2px;
  border-left: 4px solid var(--primary);
  padding: 8px 0 8px 16px;
}

.seat-meter strong {
  font-size: 1.8rem;
  line-height: 1;
}

.seat-meter span {
  font-weight: 800;
}

.seat-meter small,
.compact-invite-list small {
  color: var(--muted);
}

.seat-meter.is-full {
  border-left-color: var(--danger);
}

.club-license-list,
.club-trainer-list,
.club-transfer-list,
.compact-invite-list {
  display: grid;
  gap: 10px;
}

.club-license-row,
.club-trainer-row,
.club-transfer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(223, 221, 213, 0.82);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
}

.club-transfer-row .field {
  min-width: min(260px, 100%);
  margin-left: auto;
}

.compact-invite-list {
  border-top: 1px solid rgba(223, 221, 213, 0.72);
  padding-top: 12px;
}

.club-invite-notice {
  display: grid;
  gap: 3px;
}

@media (max-width: 720px) {
  .brand-color-trigger {
    grid-template-columns: 36px 1fr auto;
  }

  .club-summary-panel,
  .club-license-row,
  .club-trainer-row,
  .club-transfer-row {
    align-items: stretch;
    flex-direction: column;
  }

  .seat-meter {
    min-width: 0;
  }

  .club-license-row .chips,
  .club-trainer-row .btn,
  .club-transfer-row .field,
  .club-transfer-row .btn {
    width: 100%;
    margin-left: 0;
  }
}

.reader-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 20px 20px 12px;
  border-bottom: 1px solid rgba(223, 221, 213, 0.76);
}

.reader-head h2 {
  margin: 4px 0 0;
  line-height: 1.14;
}

.reader-eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.reader-meta {
  padding: 12px 20px 0;
}

.reader-body {
  max-height: min(62vh, 620px);
  overflow: auto;
  padding: 16px 20px 22px;
  color: #26302d;
  font-size: 1.02rem;
  line-height: 1.58;
  user-select: text;
  touch-action: auto;
}

.reader-body p,
.reader-body ul,
.reader-body ol {
  margin: 0 0 0.82em;
}

.reader-body p:last-child,
.reader-body ul:last-child,
.reader-body ol:last-child {
  margin-bottom: 0;
}

.reader-body ul,
.reader-body ol {
  padding-left: 1.4rem;
}

.reader-body a {
  color: color-mix(in srgb, var(--primary), black 12%);
  font-weight: 750;
}

.reader-sections {
  display: grid;
  gap: 14px;
}

.reader-section {
  border: 1px solid rgba(223, 221, 213, 0.82);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: rgba(255, 254, 250, 0.72);
}

.reader-section header {
  display: grid;
  gap: 8px;
}

.reader-section h3 {
  margin: 0;
  font-size: 1.05rem;
}

.reader-section-body {
  color: #26302d;
}

.reader-response {
  border-top: 1px solid rgba(223, 221, 213, 0.72);
  padding-top: 10px;
  display: grid;
  gap: 6px;
  color: #26302d;
}

.reader-response strong {
  font-size: 0.9rem;
}

.reader-answer-form {
  border-top: 1px solid rgba(223, 221, 213, 0.72);
  padding-top: 10px;
  display: grid;
  gap: 10px;
}

.reader-answer-form .rich-editor {
  min-height: 96px;
}

.reader-actions {
  border-top: 1px solid rgba(223, 221, 213, 0.76);
  padding-top: 12px;
}

.group-modal-card {
  width: min(100%, 760px);
  padding: 0;
  overflow: hidden;
}

.group-modal-body {
  display: grid;
  gap: 14px;
  padding: 16px 20px 4px;
}

.group-select-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.group-member-list {
  display: grid;
  gap: 8px;
  max-height: min(48vh, 430px);
  overflow: auto;
  padding-right: 4px;
}

.group-member-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid rgba(223, 221, 213, 0.86);
  border-radius: 14px;
  background: #fffefa;
  cursor: pointer;
}

.group-member-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.group-member-row span {
  display: grid;
  gap: 2px;
}

.group-member-row small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
    padding-top: 98px;
  }

  .mobile-header {
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    right: 0;
    min-height: 74px;
    height: auto;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(223, 221, 213, 0.78);
    background: rgba(246, 244, 239, 0.86);
    backdrop-filter: blur(18px);
  }

  .workspace-switcher.sidebar {
    margin-top: -8px;
  }

  .workspace-switcher.mobile {
    display: grid;
  }

  .workspace-switcher.mobile span {
    display: none;
  }

  .workspace-switcher.mobile select {
    min-height: 28px;
    max-width: min(62vw, 260px);
    padding: 0 8px;
    border-radius: 9px;
    font-size: 0.74rem;
  }

  .sidebar {
    position: fixed;
    z-index: 60;
    inset: 0 auto 0 0;
    width: min(86vw, 340px);
    height: 100vh;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 18px 0 42px rgba(24, 33, 31, 0.18);
    overflow-y: auto;
  }

  .menu-open .sidebar {
    transform: translateX(0);
  }

  .menu-backdrop {
    position: fixed;
    z-index: 50;
    inset: 0;
    width: 100%;
    min-height: 100%;
    border-radius: 0;
    background: rgba(24, 33, 31, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .menu-open .menu-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-close {
    display: inline-grid;
  }

  .nav {
    gap: 10px;
  }

  .nav button {
    min-height: 48px;
    border-radius: 14px;
    font-size: 1rem;
  }

  .content {
    padding: 18px;
  }

  .grid.metrics,
  .grid.two,
  .task-compose-layout {
    grid-template-columns: 1fr;
  }

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

  .grid.metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .group-task-picker {
    grid-template-columns: 1fr;
  }

  .compact-group-main {
    align-items: flex-start;
    flex-direction: column;
  }

  .compact-group-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .group-batch-row,
  .batch-person-row {
    grid-template-columns: 1fr;
  }

  .batch-person-meta {
    justify-content: flex-start;
  }

  .batch-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding-inline: 12px;
  }

  .batch-summary article {
    padding: 8px 7px;
  }

  .batch-summary strong {
    font-size: 1rem;
  }

  .task-composer-head,
  .task-create-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .recipient-count-pill {
    width: fit-content;
  }

  .task-create-footer .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 10px;
  }

  .topbar {
    min-height: 128px;
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 12px;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 1.9rem;
  }

  .topbar p {
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .topbar .btn {
    align-self: flex-start;
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.88rem;
  }

  .panel,
  .empty-card,
  .task-row,
  .client-row,
  .modal-card {
    border-radius: 16px;
  }

  .panel,
  .empty-card {
    padding: 14px;
  }

  .modal {
    align-items: center;
    padding: 14px 10px;
  }

  .modal-card {
    max-height: calc(100dvh - 20px);
    padding: 14px;
  }

  .reader-modal {
    padding: 0;
  }

  .reader-head {
    padding: 15px 15px 10px;
  }

  .reader-head h2 {
    font-size: 1.22rem;
  }

  .reader-meta {
    padding: 10px 15px 0;
  }

  .reader-body {
    max-height: calc(100dvh - 168px);
    padding: 14px 15px 18px;
    font-size: 0.98rem;
    line-height: 1.55;
  }

  .modal-card.invite-delivery {
    gap: 10px;
  }

  .invite-delivery .toolbar {
    flex-direction: row;
    align-items: flex-start;
  }

  .invite-delivery .toolbar h2 {
    font-size: 1.05rem;
    line-height: 1.18;
  }

  .invite-delivery .toolbar p {
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .invite-delivery .toolbar .btn {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .delivery-grid {
    gap: 8px;
  }

  .delivery-card {
    min-height: 72px;
    border-radius: 13px;
    padding: 10px;
    gap: 3px;
  }

  .delivery-card strong {
    font-size: 0.92rem;
  }

  .delivery-card span {
    font-size: 0.72rem;
    line-height: 1.25;
  }

  .dashboard-grid {
    margin-top: 10px;
    gap: 10px;
  }

  .open-questions-panel {
    margin-top: 14px;
    padding: 12px;
  }

  .open-question-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 11px;
  }

  .grid.metrics {
    gap: 7px;
  }

  .metric {
    min-height: 58px;
    padding: 8px 6px;
    border-radius: 14px;
    align-content: center;
    justify-items: center;
    gap: 2px;
    text-align: center;
  }

  .metric span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(0.58rem, 2.35vw, 0.72rem);
  }

  .metric strong {
    font-size: clamp(1rem, 4.6vw, 1.28rem);
    line-height: 1;
  }

  .toolbar {
    gap: 9px;
    margin-bottom: 10px;
  }

  .toolbar h2 {
    font-size: 1.18rem;
  }

  .task-panel {
    padding: 12px;
  }

  .toolbar,
  .client-row {
    align-items: stretch;
    flex-direction: column;
  }

  .task-toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .task-create-standalone {
    margin-bottom: 18px;
  }

  .task-create-standalone > .btn {
    width: 100%;
  }

  .task-row,
  .client-row,
  .reminder-row {
    padding: 12px;
    gap: 8px;
  }

  .client-directory-panel {
    padding: 11px;
  }

  .client-directory-head {
    margin-bottom: 8px;
  }

  .client-directory-search {
    margin-bottom: 8px;
  }

  .client-directory-search input {
    min-height: 40px;
    border-radius: 12px;
    font-size: 0.92rem;
  }

  .compact-directory {
    gap: 6px;
  }

  .compact-client-row {
    padding: 9px 10px;
    border-radius: 13px;
    gap: 7px;
  }

  .client-identity strong {
    font-size: 0.95rem;
  }

  .client-identity p {
    font-size: 0.78rem;
  }

  .client-row-meta {
    gap: 4px;
  }

  .client-row-actions {
    justify-content: flex-start;
    gap: 6px;
  }

  .mini-stat {
    min-height: 20px;
    padding: 0 7px;
    font-size: 0.66rem;
  }

  .btn.small {
    min-height: 30px;
    padding: 0 9px;
    font-size: 0.78rem;
  }

  .open-invites-panel.compact {
    padding: 8px;
  }

  .open-invites-panel.compact .open-invite-list {
    grid-template-columns: 1fr;
  }

  .open-invites-panel.compact .open-invite-row {
    min-height: 28px;
  }

  .task-row header {
    align-items: flex-start;
  }

  .task-row h3 {
    font-size: 0.98rem;
  }

  .task-description,
  .reflection-text,
  .note-text,
  .template-description {
    font-size: 0.92rem;
    line-height: 1.38;
  }

  .task-list,
  .client-list {
    gap: 8px;
  }

  .reminder-row {
    grid-template-columns: 1fr;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    border-radius: 13px;
    scrollbar-width: none;
  }

  .segmented::-webkit-scrollbar {
    display: none;
  }

  .segmented button {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.88rem;
  }

  .chip {
    min-height: 23px;
    padding: 0 8px;
    font-size: 0.74rem;
  }

  .reflection-row {
    grid-template-columns: 13px minmax(0, 1fr);
    gap: 8px;
    padding: 10px 0;
  }

  .reflection-head {
    align-items: flex-start;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 46px;
    border-radius: 13px;
    padding: 0 13px;
  }

  .field textarea {
    padding-top: 12px;
  }

  .rich-toolbar {
    gap: 3px;
    padding: 6px;
  }

  .rich-toolbar button,
  .rich-toolbar select,
  .rich-toolbar input[type="color"] {
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    border-radius: 8px;
    padding: 0 7px;
    font-size: 0.8rem;
  }

  .rich-toolbar select {
    max-width: 92px;
  }

  .rich-editor {
    min-height: 112px;
    padding: 11px 12px;
  }

  .rich-preview.can-expand:not(.expanded) .rich-preview-content {
    -webkit-line-clamp: 2;
  }

  .attachment-chip {
    width: 100%;
    border-radius: 12px;
  }

  .task-row-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .task-row-actions .btn {
    width: 100%;
  }

  .form-grid {
    gap: 10px;
  }
}
