:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f9fafc;
  --line: #e5eaf1;
  --line-strong: #d8e0eb;
  --text: #172033;
  --muted: #667085;
  --muted-2: #8a94a6;
  --accent: #2f6fed;
  --accent-soft: #eaf1ff;
  --green: #21a67a;
  --green-soft: #e8f8f2;
  --amber: #c98516;
  --amber-soft: #fff5df;
  --red: #d64a4a;
  --red-soft: #fff0f0;
  --blue-soft: #edf6ff;
  --shadow: 0 18px 55px rgba(27, 39, 65, 0.08);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar: 220px;
  --topbar: 72px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  min-width: 0;
  max-width: 100%;
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(520px, 1.15fr);
  background:
    linear-gradient(135deg, rgba(47, 111, 237, 0.08), rgba(33, 166, 122, 0.07)),
    #ffffff;
}

.login-brand {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand-mark,
.sidebar-brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: inline-grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, #2f6fed, #21a67a);
  font-weight: 800;
}

.login-brand h1 {
  max-width: 540px;
  margin: 28px 0 16px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.login-brand p {
  max-width: 530px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.login-hints {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.login-hints code {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
}

.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.login-card h2,
.modal-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
}

.login-card p,
.modal-card p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

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

.field label {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea,
.search-box input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-box input:focus {
  border-color: rgba(47, 111, 237, 0.55);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .wide,
.field.wide {
  grid-column: 1 / -1;
}

.error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #9a2f2f;
  background: var(--red-soft);
  border: 1px solid #ffd7d7;
  font-size: 14px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  max-width: 100%;
  background: #ffffff;
}

.sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: start;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}

.sidebar-brand strong {
  display: block;
  font-size: 17px;
}

.sidebar-brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

.nav button {
  min-height: 42px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 0 12px;
  color: #465267;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
}

.nav button strong {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
}

.nav button svg,
.icon-btn svg,
.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.nav button:hover {
  background: var(--surface-soft);
}

.nav button.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.sidebar-footer {
  margin-top: 28px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

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

.mini-value {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 750;
}

.workspace {
  min-width: 0;
  max-width: 100%;
  padding: 0;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(280px, 420px) minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  min-height: var(--topbar);
  padding: 0 24px 0 20px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.mobile-top-logo,
.mobile-bottom-nav,
.mobile-scrim {
  display: none;
}

.search-box {
  position: relative;
}

.search-box svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 18px;
  height: 18px;
  color: var(--muted-2);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box input {
  padding-left: 42px;
  background: var(--surface);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.avatar {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: white;
  background: var(--avatar, #2f6fed);
  font-size: 12px;
  font-weight: 800;
}

.avatar.large {
  width: 48px;
  height: 48px;
  font-size: 14px;
}

.avatar.small {
  width: 26px;
  height: 26px;
  font-size: 11px;
}

.avatar img,
.client-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.profile-button {
  display: inline-flex;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.topbar-menu {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #344054;
  font-size: 20px;
}

.split-btn {
  justify-self: end;
  min-width: 190px;
}

.split-btn span {
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.top-icon {
  width: 34px;
  height: 34px;
  border-color: transparent;
  color: #667085;
}

.topbar-profile .user-copy {
  min-width: 116px;
}

.topbar-popover-wrap {
  position: relative;
}

.top-icon {
  position: relative;
}

.top-icon svg,
.nav-utility svg,
.hero-fact svg {
  width: 18px;
  height: 18px;
}

.notify-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
}

.top-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  width: min(340px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 14px;
}

.help-popover p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.popover-head button,
.row-actions button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

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

.notification-permission {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #344054;
  font-size: 13px;
  line-height: 1.35;
}

.notification-permission.enabled {
  border-color: rgba(33, 166, 122, 0.28);
  background: var(--green-soft);
  color: #167357;
  font-weight: 750;
}

.notification-permission.warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: var(--amber-soft);
  color: #7a4c10;
}

.notification-permission button {
  justify-self: start;
  min-height: 32px;
  border: 1px solid rgba(47, 111, 237, 0.28);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #ffffff;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.notification-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.notification-item.unread {
  border-color: rgba(47, 111, 237, 0.3);
  background: var(--accent-soft);
}

.notification-item strong,
.notification-item p,
.notification-item span {
  display: block;
}

.notification-item p {
  margin: 5px 0;
  color: #344054;
  font-size: 13px;
  line-height: 1.35;
}

.notification-item span {
  color: var(--muted);
  font-size: 11px;
}

.sidebar-lower {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 16px;
  display: grid;
  gap: 8px;
}

.nav-utility,
.sidebar-user {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #465267;
  padding: 0 8px;
  text-align: left;
}

.nav-utility strong {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}

.sidebar-user {
  margin-top: 22px;
  grid-template-columns: auto minmax(0, 1fr);
}

.sidebar-user span {
  display: grid;
  min-width: 0;
}

.sidebar-user strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user em {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-avatar {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #344054;
  background: var(--accent-soft);
  font-size: 17px;
  font-weight: 800;
}

.client-avatar.large {
  width: 52px;
  height: 52px;
  font-size: 20px;
}

.client-avatar.tiny {
  width: 20px;
  height: 20px;
  font-size: 11px;
}

.user-copy {
  display: grid;
}

.user-copy strong {
  font-size: 14px;
}

.user-copy span {
  color: var(--muted);
  font-size: 12px;
}

.btn,
.ghost-btn,
.icon-btn,
.tab-btn,
.chip-btn {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  text-decoration: none;
}

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

.btn.success {
  border-color: var(--green);
  color: #ffffff;
  background: var(--green);
}

.btn:hover,
.ghost-btn:hover,
.icon-btn:hover,
.tab-btn:hover,
.chip-btn:hover {
  transform: translateY(-1px);
}

.btn.primary:hover {
  background: #245ed1;
}

.ghost-btn {
  min-height: 36px;
  padding: 0 12px;
  color: #465267;
}

.ghost-btn.compact {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.view-head h2 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.1;
}

.view-head p {
  margin: 0;
  color: var(--muted);
}

.view-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.44fr);
  gap: 16px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}

.panel-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-header h3 {
  margin: 0;
  font-size: 16px;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-header select,
.quick-form input,
.quick-form textarea {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #344054;
  padding: 8px 10px;
  outline: none;
}

.quick-form textarea {
  min-height: 78px;
  resize: vertical;
}

.client-table-wrap {
  overflow: auto;
}

.client-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.client-table th {
  padding: 11px 14px;
  color: var(--muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  text-align: left;
  font-weight: 800;
  text-transform: uppercase;
}

.client-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 14px;
}

.client-table tr {
  transition: background 0.14s ease;
}

.client-table tbody tr:hover,
.client-table tbody tr.selected {
  background: #f8fbff;
}

.client-name {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  text-align: left;
  padding: 0;
}

.client-cell,
.client-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.client-cell > div,
.client-heading > div {
  min-width: 0;
}

.subtext {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.status,
.priority {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.lead,
.status.new {
  color: #2460c8;
  background: var(--blue-soft);
}

.status.active,
.status.progress {
  color: #167357;
  background: var(--green-soft);
}

.status.pause,
.status.review,
.priority.high {
  color: #9d6614;
  background: var(--amber-soft);
}

.status.done,
.status.repeat,
.priority.low {
  color: #475467;
  background: #eef1f6;
}

.status.overdue,
.priority.urgent {
  color: #b33333;
  background: var(--red-soft);
}

.priority.normal {
  color: #2460c8;
  background: var(--accent-soft);
}

.progress-line {
  width: 100%;
  min-width: 84px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f7;
}

.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6fed, #21a67a);
}

.detail-panel {
  position: sticky;
  top: 24px;
}

.detail-body {
  padding: 16px;
}

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

.detail-title h3 {
  margin: 0 0 5px;
  font-size: 22px;
}

.contact-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.info-tile {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.info-tile span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.info-tile strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.tab-btn {
  min-height: 32px;
  flex: 1;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.tab-btn.active {
  color: var(--text);
  background: #ffffff;
  border-color: var(--line);
}

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

.mini-section {
  display: grid;
  gap: 10px;
}

.mini-section h4 {
  margin: 0;
  font-size: 14px;
}

.link-list,
.note-list,
.task-list,
.team-list {
  display: grid;
  gap: 8px;
}

.link-item,
.note-item,
.task-row,
.team-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.link-item a {
  overflow-wrap: anywhere;
  color: var(--accent);
  font-weight: 750;
  text-decoration: none;
}

.note-item p,
.task-row p {
  margin: 0;
  color: #344054;
  line-height: 1.45;
}

.note-meta,
.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.quick-form {
  display: grid;
  gap: 8px;
}

.quick-form .inline-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  overflow: auto;
}

.task-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.task-client-rail {
  overflow: hidden;
}

.task-client-list {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.task-client-button {
  min-height: 44px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #344054;
  padding: 8px;
  text-align: left;
  font-weight: 750;
}

.task-client-button span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-client-button strong {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
}

.task-client-button:hover,
.task-client-button.active {
  border-color: rgba(47, 111, 237, 0.2);
  background: var(--accent-soft);
  color: var(--accent);
}

.task-main-panel {
  overflow: hidden;
}

.task-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

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

.task-main-title h3 {
  margin: 0 0 4px;
  font-size: 22px;
}

.task-main-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.task-main-panel .filters {
  padding: 12px 16px 0;
}

.concept-board {
  padding: 0 16px 16px;
}

.task-column {
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.task-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.task-column-head h3 {
  margin: 0;
  font-size: 14px;
}

.count-pill {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 800;
}

.task-cards {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.task-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.task-card,
.task-row,
.reference-task-card {
  position: relative;
  overflow: hidden;
}

.task-card::before,
.task-row::before,
.reference-task-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--line-strong);
}

.task-card.status-new,
.task-row.status-new,
.reference-task-card.status-new {
  border-color: rgba(47, 111, 237, 0.18);
  background: linear-gradient(90deg, rgba(47, 111, 237, 0.08), #ffffff 42%);
}

.task-card.status-new::before,
.task-row.status-new::before,
.reference-task-card.status-new::before {
  background: var(--accent);
}

.task-card.status-progress,
.task-row.status-progress,
.reference-task-card.status-progress {
  border-color: rgba(245, 158, 11, 0.24);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), #ffffff 44%);
}

.task-card.status-progress::before,
.task-row.status-progress::before,
.reference-task-card.status-progress::before {
  background: #f59e0b;
}

.task-card.status-review,
.task-row.status-review,
.reference-task-card.status-review {
  border-color: rgba(139, 92, 246, 0.22);
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.1), #ffffff 44%);
}

.task-card.status-review::before,
.task-row.status-review::before,
.reference-task-card.status-review::before {
  background: #8b5cf6;
}

.task-card.status-done,
.task-row.status-done,
.reference-task-card.status-done {
  border-color: rgba(33, 166, 122, 0.22);
  background: linear-gradient(90deg, rgba(33, 166, 122, 0.11), #ffffff 44%);
}

.task-card.status-done::before,
.task-row.status-done::before,
.reference-task-card.status-done::before {
  background: var(--green);
}

.task-card[draggable="true"],
.reference-task-card[draggable="true"] {
  cursor: grab;
}

.task-card.dragging,
.reference-task-card.dragging {
  opacity: 0.55;
}

.task-column.drag-over,
.reference-column.drag-over {
  border-color: rgba(47, 111, 237, 0.55);
  background: var(--accent-soft);
}

.task-card-head,
.task-row-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.task-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.35;
}

.task-card-head h4 {
  margin-bottom: 0;
}

.task-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.task-controls {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.subtask-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.subtask-editor {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

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

.subtask-row,
.subtask-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.subtask-row {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.subtask-row strong,
.subtask-row span {
  display: block;
}

.subtask-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.subtask-create {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.7fr) 150px 110px;
  margin-top: 10px;
}

.muted-box,
.compact-empty {
  color: var(--muted);
  font-size: 13px;
}

.icon-mini {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 900;
}

.task-client-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.task-controls select {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 6px 9px;
  color: #344054;
  font-size: 13px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.chip-btn {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
}

.chip-btn.active {
  color: var(--accent);
  border-color: rgba(47, 111, 237, 0.34);
  background: var(--accent-soft);
}

.client-team-picker {
  gap: 10px;
}

.client-team-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.client-team-options label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: #344054;
  font-size: 13px;
  font-weight: 750;
}

.client-team-options input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.client-team-options label:has(input:checked) {
  border-color: rgba(47, 111, 237, 0.36);
  background: var(--accent-soft);
  color: var(--accent);
}

.client-team-options span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.team-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.team-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.team-card h3 {
  margin: 0;
  font-size: 16px;
}

.team-card span {
  color: var(--muted);
  font-size: 13px;
}

.team-edit {
  width: 100%;
  margin-top: 12px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.metric-row strong {
  color: var(--text);
}

.knowledge-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.knowledge-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.knowledge-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.knowledge-list-head span {
  min-width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.knowledge-item {
  width: 100%;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 12px;
  color: var(--text);
  text-align: left;
}

.knowledge-item.active {
  border-color: rgba(47, 111, 237, 0.34);
  background: var(--accent-soft);
}

.knowledge-item.system-item {
  border-color: rgba(33, 166, 122, 0.28);
}

.knowledge-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-item span {
  color: var(--muted);
  font-size: 12px;
}

.knowledge-editor {
  min-width: 0;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.knowledge-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.knowledge-editor-head span,
.knowledge-actions span {
  color: var(--muted);
  font-size: 13px;
}

.knowledge-editor-head h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.knowledge-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.editor-toolbar button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #344054;
  padding: 0 10px;
  font-weight: 800;
}

.editor-toolbar svg {
  width: 16px;
  height: 16px;
}

.knowledge-content-editor {
  min-height: 420px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  line-height: 1.65;
  outline: none;
}

.knowledge-content-editor:focus {
  border-color: rgba(47, 111, 237, 0.55);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.knowledge-content-editor p {
  margin: 0 0 12px;
}

.knowledge-content-editor img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.knowledge-content-editor figure {
  margin: 16px 0;
}

.knowledge-content-editor figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

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

.direct-targets-page {
  align-content: start;
}

.direct-target-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
}

.direct-target-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.direct-target-summary span {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.direct-target-sections {
  display: grid;
  gap: 16px;
}

.direct-target-section h4 {
  margin: 0 0 10px;
  font-size: 16px;
}

.direct-target-groups {
  display: grid;
  gap: 10px;
}

.direct-target-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  overflow: hidden;
}

.direct-target-group summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-soft);
  cursor: pointer;
  font-weight: 800;
}

.direct-target-group summary span {
  min-width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.direct-target-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.direct-target-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #344054;
  font-size: 13px;
  line-height: 1.35;
}

.direct-target-item span {
  overflow-wrap: anywhere;
}

.direct-target-item b {
  color: var(--muted-2);
  font-weight: 700;
}

.knowledge-empty {
  display: grid;
  place-items: start;
  gap: 10px;
  padding: 24px;
}

.knowledge-empty h3,
.knowledge-empty p {
  margin: 0;
}

.ghost-btn.danger {
  color: #b33333;
  border-color: #ffd7d7;
  background: var(--red-soft);
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.report-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.report-card h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

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

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f7;
}

.bar-track span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.34);
}

.modal-card {
  width: min(720px, 100%);
  max-height: min(86vh, 780px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

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

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

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

.task-drawer-modal {
  place-items: stretch end;
  padding: 0;
  background: rgba(15, 23, 42, 0.24);
}

.task-drawer-card {
  width: min(560px, 100%);
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  border-radius: 22px 0 0 22px;
  box-shadow: -22px 0 70px rgba(15, 23, 42, 0.18);
  padding: 0;
  overflow: hidden;
}

.task-drawer-card .modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  margin: 0;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.modal-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.task-drawer-card .modal-head h2 {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-drawer-card .form-grid {
  flex: 1;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 18px 22px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.task-drawer-card .field {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.task-drawer-card .field > span {
  color: var(--muted);
  font-size: 13px;
}

.task-drawer-card .field input,
.task-drawer-card .field select,
.task-drawer-card .field textarea {
  min-height: 38px;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  font-size: 17px;
}

.task-drawer-card .field input:focus,
.task-drawer-card .field select:focus,
.task-drawer-card .field textarea:focus {
  box-shadow: none;
}

.task-drawer-card .field textarea {
  min-height: 118px;
  line-height: 1.45;
}

.task-drawer-card .modal-actions {
  margin: 0;
  padding: 16px 22px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.recurrence-panel {
  gap: 14px;
}

.recurrence-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.recurrence-icon {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
}

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

.recurrence-head strong {
  display: block;
  font-size: 16px;
}

.recurrence-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.recurrence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.recurrence-grid .field {
  padding: 11px 12px;
  background: var(--surface-soft);
  box-shadow: none;
}

.weekday-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-picker label {
  min-width: 0;
}

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

.weekday-picker span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.weekday-picker input:checked + span {
  border-color: rgba(47, 111, 237, 0.4);
  color: var(--accent);
  background: var(--accent-soft);
}

.avatar-field > span {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.avatar-picker {
  display: grid;
  grid-template-columns: auto minmax(110px, 0.4fr) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.avatar-picker label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.avatar-picker input[type="file"] {
  min-height: 38px;
  padding: 7px 10px;
}

.inline-check {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.inline-check input {
  width: auto;
  min-height: auto;
}

.reference-view {
  height: calc(100vh - var(--topbar));
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  overflow: hidden;
  background: #ffffff;
}

.client-directory {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.directory-head {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.directory-head h2 {
  margin: 0;
  font-size: 24px;
}

.icon-btn.flat {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.directory-search {
  position: relative;
  display: block;
  margin: 0 20px 18px;
}

.directory-search svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--muted-2);
  transform: translateY(-50%);
}

.directory-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px 9px 38px;
  outline: none;
}

.directory-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.directory-list {
  overflow: auto;
}

.directory-client {
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 0 20px;
  text-align: left;
}

.directory-client:hover,
.directory-client.selected {
  background: #f7fbff;
  box-shadow: inset 2px 0 0 var(--accent);
}

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

.directory-client-main > span:last-child {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.directory-footer > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-dot {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #344054;
  font-weight: 750;
}

.page-dot.active {
  color: #ffffff;
  background: var(--accent);
}

.client-profile-view {
  min-width: 0;
  overflow: auto;
  background: #ffffff;
}

.client-hero {
  padding: 24px 24px 18px;
}

.client-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.client-title-row h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.client-hero-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(220px, 0.8fr) minmax(220px, 0.55fr);
  gap: 28px;
  align-items: start;
}

.client-facts {
  display: grid;
  gap: 16px;
}

.hero-fact {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.hero-fact > span {
  color: var(--muted);
  font-size: 18px;
}

.hero-fact strong {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.hero-fact em {
  display: block;
  overflow-wrap: anywhere;
  color: #344054;
  font-style: normal;
  font-size: 14px;
}

.client-owner-box {
  display: grid;
  gap: 12px;
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.client-owner-box > span {
  color: var(--muted);
  font-size: 12px;
}

.team-bubbles {
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-more {
  min-width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reference-tabs {
  display: flex;
  gap: 28px;
  min-height: 48px;
  padding: 0 24px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  overflow: auto;
}

.reference-tabs .tab-btn {
  flex: 0 0 auto;
  min-height: 48px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #344054;
  padding: 0;
  font-size: 14px;
  font-weight: 650;
}

.reference-tabs .tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

.reference-content-grid {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
  padding: 22px 24px 26px 14px;
}

.reference-side-stack {
  display: grid;
  gap: 20px;
  align-content: start;
}

.reference-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.reference-card-head,
.reference-task-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
}

.reference-card-head h3,
.reference-task-head h3 {
  margin: 0;
  font-size: 18px;
}

.mini-add {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
}

.reference-list {
  display: grid;
  gap: 2px;
  padding: 0 12px 12px;
}

.reference-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
}

.reference-link-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.doc-icon {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.reference-link-main strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-link-main em {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-link-main b {
  color: var(--accent);
  font-size: 14px;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.row-actions button {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
}

.row-actions button:hover {
  background: var(--surface-soft);
  color: var(--accent);
}

.reference-note {
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.reference-note:first-child {
  border-top: 0;
}

.reference-note p {
  margin: 0 0 8px;
  color: #344054;
  font-size: 12px;
  line-height: 1.45;
}

.reference-note span {
  color: var(--muted);
  font-size: 11px;
}

.note-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reference-form {
  padding: 0 12px 12px;
}

.reference-tasks {
  min-width: 0;
  border: 0;
}

.reference-tasks.wide,
.full-reference-card {
  margin: 22px 24px;
}

.reference-task-head {
  padding: 0 0 14px;
}

.reference-task-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reference-kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
  min-width: 0;
}

.reference-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.reference-column-head {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
}

.reference-column-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
}

.reference-column-head span {
  color: var(--muted);
  font-size: 13px;
}

.reference-column-body {
  display: grid;
  gap: 8px;
  padding: 0 8px 10px;
}

.reference-task-card {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.task-card-click {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.task-card-click strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.task-card-click span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.task-card-click small {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 11px;
  line-height: 1.35;
}

.reference-task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.reference-task-meta em {
  color: #344054;
  font-size: 12px;
  font-style: normal;
}

.dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #f59e0b;
}

.dot.done {
  background: #16a34a;
}

.dot.danger {
  background: #c23b3b;
}

.add-task-inline {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 4px;
  text-align: left;
  font-size: 13px;
}

.doc-list {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.doc-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.doc-row:first-child {
  border-top: 0;
}

.doc-row strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

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

.history-list {
  display: grid;
  gap: 0;
  padding: 0 16px 16px;
}

.history-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: #344054;
  font-size: 13px;
}

.history-row:first-child {
  border-top: 0;
}

.history-row em {
  color: var(--muted);
  font-style: normal;
}

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

@media (max-width: 1180px) {
  .main-grid,
  .reports-grid,
  .knowledge-layout,
  .task-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

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

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

@media (max-width: 860px) {
  .login-page,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: auto;
    gap: 36px;
    padding: 32px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .login-panel {
    min-height: auto;
  }

  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .nav button {
    justify-content: center;
  }

  .nav button span {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .user-menu {
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .view-head,
  .detail-title {
    display: grid;
  }

  .view-actions {
    justify-content: stretch;
  }

  .view-actions .btn,
  .modal-actions .btn,
  .modal-actions .ghost-btn {
    width: 100%;
  }

  .form-grid,
  .stats-grid,
  .team-grid,
  .contact-list,
  .quick-form .inline-fields,
  .task-client-list,
  .client-team-options,
  .avatar-picker {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    display: grid;
  }
}

@media (max-width: 900px) {
  :root {
    --topbar: 62px;
  }

  body {
    overflow-x: hidden;
    padding-bottom: 76px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    width: min(310px, 84vw);
    min-height: 100vh;
    padding: 18px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: var(--shadow);
    transform: translateX(-104%);
    transition: transform 0.18s ease;
  }

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

  .mobile-scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    border: 0;
    background: rgba(15, 23, 42, 0.28);
  }

  .sidebar-brand {
    padding: 0 4px 18px;
  }

  .sidebar-brand > div:last-child {
    display: none;
  }

  .nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    overflow: visible;
  }

  .nav button {
    min-height: 48px;
    justify-content: flex-start;
    padding: 0 12px;
  }

  .nav button span {
    display: inline;
  }

  .sidebar-lower {
    position: static;
    margin-top: 18px;
  }

  .sidebar-lower .nav-utility[data-popover] {
    display: none;
  }

  .sidebar-user span,
  .nav-utility span:nth-child(2) {
    display: block;
  }

  .workspace {
    padding: 0;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto auto auto;
    gap: 8px;
    min-height: var(--topbar);
    padding: 8px 12px;
  }

  .mobile-top-logo {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #2f6fed, #21a67a);
    color: #ffffff;
    font-weight: 900;
  }

  .topbar .search-box {
    display: none;
  }

  .split-btn {
    min-width: 44px;
    width: 44px;
    padding: 0;
    overflow: hidden;
    justify-content: center;
    font-size: 0;
  }

  .split-btn svg {
    margin: 0;
  }

  .split-btn span {
    display: none;
  }

  .topbar-profile .user-copy {
    display: none;
  }

  .topbar-profile .icon-btn {
    display: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    min-height: 70px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
  }

  .mobile-bottom-nav button {
    position: relative;
    min-width: 0;
    display: grid;
    place-items: center;
    gap: 3px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    padding: 5px 2px;
    font-size: 10px;
    font-weight: 750;
  }

  .mobile-bottom-nav button.active {
    color: var(--accent);
    background: var(--accent-soft);
  }

  .mobile-bottom-nav svg {
    width: 21px;
    height: 21px;
  }

  .mobile-bottom-nav strong {
    position: absolute;
    top: 3px;
    right: 14%;
    min-width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 10px;
  }

  .reference-view {
    height: auto;
    min-height: calc(100vh - var(--topbar));
    display: block;
    overflow: visible;
  }

  .client-directory {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .directory-list {
    max-height: 260px;
  }

  .client-profile-view {
    overflow: visible;
  }

  .client-hero {
    padding: 18px 14px 12px;
  }

  .client-title-row {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 16px;
  }

  .client-title-row h1 {
    width: 100%;
    font-size: 23px;
  }

  .client-hero-grid,
  .reference-content-grid,
  .knowledge-meta,
  .direct-target-controls,
  .task-layout,
  .reports-grid,
  .team-grid,
  .finance-grid {
    grid-template-columns: 1fr;
  }

  .client-hero-grid {
    gap: 14px;
  }

  .client-owner-box {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }

  .reference-tabs {
    gap: 18px;
    padding: 0 14px;
  }

  .reference-content-grid,
  .reference-tasks.wide,
  .full-reference-card {
    margin: 0;
    padding: 14px;
  }

  .reference-kanban,
  .task-board {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
  }

  .reference-column,
  .task-column {
    min-width: min(82vw, 340px);
    scroll-snap-align: start;
  }

  .task-main-head {
    display: grid;
    padding: 14px;
  }

  .task-main-head .btn {
    width: 100%;
  }

  .task-client-list {
    display: flex;
    overflow-x: auto;
    grid-template-columns: none;
  }

  .task-client-button {
    min-width: 220px;
  }
}

@media (max-width: 560px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-brand {
    padding: 28px 18px;
  }

  .login-brand h1 {
    font-size: 38px;
  }

  .login-panel {
    min-height: auto;
    padding: 18px;
  }

  .topbar {
    grid-template-columns: auto auto minmax(0, 1fr) auto auto auto auto;
  }

  .topbar-profile {
    display: flex;
  }

  .search-box input {
    min-height: 38px;
    font-size: 14px;
  }

  .top-popover {
    position: fixed;
    top: 70px;
    left: 10px;
    right: 10px;
    width: auto;
  }

  .directory-head,
  .directory-footer {
    padding-inline: 14px;
  }

  .directory-search {
    margin-inline: 14px;
  }

  .directory-client {
    padding-inline: 14px;
  }

  .reference-task-head {
    display: grid;
    align-items: stretch;
  }

  .reference-task-head > div,
  .reference-task-head .btn {
    width: 100%;
  }

  .knowledge-editor {
    padding: 14px;
  }

  .knowledge-editor-head,
  .knowledge-actions {
    display: grid;
    align-items: stretch;
  }

  .knowledge-content-editor {
    min-height: 300px;
    padding: 14px;
  }

  .form-grid,
  .quick-form .inline-fields,
  .avatar-picker,
  .direct-target-items,
  .subtask-row,
  .subtask-create,
  .doc-row,
  .history-row {
    grid-template-columns: 1fr;
  }

  .modal {
    align-items: stretch;
    justify-items: stretch;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    overflow: auto;
    padding: 16px;
    border-radius: 0;
  }

  .task-modal-card {
    height: 100vh;
    max-height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
  }

  .task-modal-card .modal-head {
    z-index: 2;
    margin: 0;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    align-items: center;
  }

  .task-modal-card .modal-head h2 {
    margin: 0;
    font-size: 20px;
  }

  .task-modal-card .modal-head p {
    display: none;
  }

  .task-modal-card .error {
    margin: 10px 16px 0;
  }

  .task-modal-card .form-grid {
    flex: 1;
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 12px;
    overflow-y: auto;
    padding: 12px 16px 18px;
    -webkit-overflow-scrolling: touch;
  }

  .task-modal-card .field {
    gap: 5px;
  }

  .task-modal-card .field > span,
  .task-modal-card .field label {
    font-size: 13px;
  }

  .task-modal-card .field input,
  .task-modal-card .field select {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 15px;
  }

  .task-modal-card .field textarea {
    min-height: 86px;
    max-height: 120px;
    padding: 9px 10px;
    font-size: 15px;
  }

  .recurrence-grid {
    grid-template-columns: 1fr;
  }

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

  .task-modal-card .modal-actions {
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: #ffffff;
  }

  .task-modal-card .modal-actions .btn,
  .task-modal-card .modal-actions .ghost-btn {
    width: 100%;
    min-height: 44px;
  }

  .task-modal-card .modal-actions .btn {
    order: 1;
  }

  .task-modal-card .modal-actions .ghost-btn {
    order: 2;
  }
}
