@font-face {
  font-family: Satoshi;
  src: url('../fonts/Satoshi-Variable.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
}
:root {
  font-family: Satoshi, Arial, sans-serif;
  color: #252525;
  background: #f5f5f5;
  --bg: #f5f5f5;
  --surface: #fff;
  --soft: #f0f0f0;
  --line: #e2e2e2;
  --text: #252525;
  --muted: #767676;
  --accent: #252525;
  --on: #fff;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #202020;
  --surface: #292929;
  --soft: #333;
  --line: #444;
  --text: #eee;
  --muted: #aaa;
  --accent: #eee;
  --on: #222;
  background: var(--bg);
  color: var(--text);
}
button,
input,
select,
textarea {
  font: inherit;
}
a {
  color: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #8b9faf;
  outline-offset: 3px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
  min-height: 43px;
}
.btn:hover {
  background: var(--soft);
}
.btn.primary {
  background: var(--accent);
  color: var(--on);
  border-color: var(--accent);
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.shell-header {
  min-height: 88px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 18px 32px;
  background: var(--surface);
}
.brand {
  border: 0;
  background: none;
  padding: 0;
  font-size: 17px;
}
.brand svg {
  width: 42px;
  height: 42px;
  padding: 10px;
  background: var(--accent);
  color: var(--on);
  border-radius: 11px;
}
.shell-header > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 1px solid var(--line);
  padding-left: 28px;
}
.shell-header small {
  color: var(--muted);
  font-size: 12px;
}
.theme {
  margin-left: auto;
}
.module-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100dvh - 88px);
}
.module-sidebar {
  padding: 30px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100dvh - 1px);
  display: flex;
  flex-direction: column;
}
.eyebrow {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.6px;
  font-weight: 700;
  color: var(--muted);
}
.module-sidebar > .eyebrow {
  padding: 0 12px;
  margin-bottom: 22px;
}
.module-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.nav-button {
  justify-content: flex-start;
  border: 0;
  background: none;
}
.nav-button[aria-current='page'] {
  background: var(--soft);
}
.sidebar-foot {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  padding: 12px;
  margin-top: auto;
}
.main {
  padding: 40px;
  min-width: 0;
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
}
.hub-layout .main {
  max-width: 1440px;
  padding-top: 65px;
}
h1 {
  font-size: 34px;
  letter-spacing: -1.2px;
  font-weight: 650;
  margin: 0 0 12px;
  line-height: 1.15;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.5px;
  margin: 0 0 22px;
}
h3 {
  font-size: 16px;
  margin: 0 0 10px;
}
p {
  line-height: 1.65;
}
.muted {
  color: var(--muted);
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.page-heading p {
  margin: 0;
  max-width: 70ch;
  font-size: 14px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 25px;
  margin-bottom: 24px;
  min-width: 0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat > span {
  font-size: 13px;
}
.stat strong {
  font-size: 29px;
  letter-spacing: -1px;
  /* Long values (e.g. an e-mail address) wrap instead of leaving the box (owner, 03.10). */
  overflow-wrap: anywhere;
}
.stat {
  min-width: 0;
}
.stat.is-long strong {
  font-size: 20px;
  letter-spacing: 0;
}
.stat small {
  font-size: 12px;
}
.module-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 40px 0;
}
.module-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.module-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px #0000000c;
}
.module-card > svg {
  width: 68px;
  height: 68px;
  padding: 17px;
  background: var(--soft);
  border-radius: 16px;
  margin: 25px 0;
}
.module-card h2 {
  font-size: 25px;
  margin-bottom: 12px;
}
.module-card p {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 22px;
}
.module-card .btn {
  margin-top: auto;
  align-self: start;
}
.module-card ul {
  padding-left: 18px;
  font-size: 14px;
  line-height: 2;
  color: var(--muted);
  margin: 0 0 28px;
}
.badge {
  display: inline-flex;
  border-radius: 30px;
  padding: 5px 9px;
  background: var(--soft);
  font-size: 11px;
  font-weight: 700;
  align-self: start;
  white-space: nowrap;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 24px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.toolbar input,
.toolbar select {
  max-width: 280px;
}
.toolbar .btn:last-child {
  margin-left: auto;
}
input,
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  min-height: 43px;
  max-width: 100%;
  min-width: 0;
}
textarea {
  min-height: 110px;
  resize: vertical;
}
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 18px;
}
.lane {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  padding: 14px;
  min-height: 300px;
}
.lane > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.lane h2 {
  font-size: 14px;
  margin: 0;
}
.lead-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 12px;
  color: inherit;
  gap: 10px;
}
.lead-card:hover {
  border-color: var(--muted);
}
.lead-card strong {
  font-size: 16px;
}
.lead-card small {
  color: var(--muted);
  font-size: 12px;
}
.lead-card .lead-bottom {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  font-size: 11px;
  color: var(--muted);
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
th,
td {
  text-align: left;
  padding: 17px 19px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--soft);
  white-space: nowrap;
}
td .muted {
  font-size: 12px;
  display: block;
  margin-top: 4px;
}
tr:last-child td {
  border-bottom: 0;
}
.text-link {
  padding: 0;
  background: none;
  border: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
  color: inherit;
  font: inherit;
  font-weight: 650;
}
.empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.row {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child {
  border: 0;
}
.row p {
  margin: 3px 0 0;
  font-size: 13px;
}
.row .btn {
  padding: 8px 11px;
  min-height: 36px;
}
.status-line {
  font-size: 12px;
  color: var(--muted);
  padding: 18px 0;
}
.demo-note {
  border-left: 3px solid var(--line);
  padding: 2px 0 2px 15px;
  font-size: 12px;
  color: var(--muted);
  margin: 24px 0;
}
.edit-dialog {
  width: min(800px, calc(100vw - 28px));
  max-height: 90dvh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 28px;
}
.edit-dialog::backdrop {
  background: #0007;
  backdrop-filter: blur(4px);
}
.edit-dialog > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 24px;
}
.edit-dialog h2 {
  margin: 0;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 19px 22px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}
.field:has(textarea) {
  grid-column: 1/-1;
}
.field input,
.field select,
.field textarea {
  width: 100%;
}
.form-error {
  grid-column: 1/-1;
  margin: 0;
  color: #bb5656;
  font-size: 13px;
}
.form-grid > .primary {
  justify-self: start;
}
.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-size: 14px;
  margin: 20px 0;
}
.detail-meta small {
  display: block;
  color: var(--muted);
  margin-bottom: 5px;
}
.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 22px 0;
}
.activity {
  border-left: 2px solid var(--line);
  padding: 0 0 20px 17px;
  font-size: 14px;
}
.activity small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}
.progress {
  width: 100%;
  min-width: 100px;
  height: 7px;
  background: var(--soft);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--text);
}
.timeline-row {
  display: grid;
  grid-template-columns: 200px 1fr 70px;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.timeline-track {
  position: relative;
  height: 30px;
  background: var(--soft);
  border-radius: 7px;
}
.timeline-bar {
  position: absolute;
  height: 100%;
  border-radius: 7px;
  background: #788c83;
}
.timeline-row small {
  color: var(--muted);
  display: block;
  margin-top: 5px;
}
.budget-over {
  color: #b55454;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 24px);
  background: var(--accent);
  color: var(--on);
  padding: 14px 22px;
  border-radius: 10px;
  box-shadow: 0 6px 24px #0002;
  z-index: 1000;
  font-size: 14px;
}
.toast.error {
  background: #7e3434;
  color: white;
}
[hidden] {
  display: none !important;
}
.source-links {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}
.source-links a {
  margin-right: 16px;
}
@media (max-width: 1100px) {
  .main {
    padding: 28px;
  }
  .module-layout {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .module-cards {
    gap: 14px;
  }
  .module-card {
    padding: 22px;
  }
  .module-card h2 {
    font-size: 22px;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .shell-header {
    gap: 16px;
    padding: 18px 22px;
  }
  .shell-header > div {
    padding-left: 16px;
  }
  .brand {
    font-size: 0;
    gap: 0;
  }
  .timeline-row {
    grid-template-columns: 150px 1fr 50px;
  }
}
@media (max-width: 700px) {
  .module-layout {
    display: block;
  }
  .module-sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: auto;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .module-sidebar > .eyebrow,
  .sidebar-foot {
    display: none;
  }
  .module-sidebar nav {
    flex-direction: row;
    overflow: auto;
    scrollbar-width: thin;
  }
  .module-sidebar .btn {
    flex-shrink: 0;
  }
  .main,
  .hub-layout .main {
    padding: 25px 16px;
  }
  .shell-header {
    padding: 13px 16px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .shell-header > div {
    border: 0;
    padding: 0;
    flex: 1;
  }
  .shell-header strong {
    font-size: 14px;
  }
  .shell-header small {
    font-size: 11px;
  }
  .theme {
    font-size: 0;
    padding: 10px;
    gap: 0;
    min-width: 43px;
  }
  .theme span {
    display: none;
  }
  .module-cards {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 26px;
  }
  .module-card {
    padding: 26px;
  }
  .module-card > svg {
    margin: 20px 0;
  }
  .module-card ul {
    line-height: 1.8;
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 16px;
  }
  .stat strong {
    font-size: 24px;
  }
  h1 {
    font-size: 28px;
  }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 17px;
  }
  .panel {
    padding: 20px;
  }
  .toolbar {
    gap: 10px;
  }
  .toolbar input,
  .toolbar select {
    max-width: none;
    width: 100%;
  }
  .toolbar .btn:last-child {
    margin-left: 0;
  }
  .board {
    grid-template-columns: repeat(4, 270px);
  }
  .form-grid,
  .detail-meta {
    grid-template-columns: 1fr;
  }
  .field:has(textarea) {
    grid-column: auto;
  }
  .edit-dialog {
    padding: 20px;
  }
  .edit-dialog > header .btn {
    font-size: 0;
    gap: 0;
    padding: 9px;
  }
  .timeline-row {
    grid-template-columns: 1fr 54px;
    gap: 12px;
  }
  .timeline-track {
    grid-row: 2;
    grid-column: 1/-1;
  }
  .timeline-row > .btn {
    grid-row: 1;
    grid-column: 2;
  }
  .source-links a {
    display: block;
  }
  .table-wrap {
    max-width: 100%;
  }
  .hub-layout .demo-note {
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 700px) {
  .row {
    flex-wrap: wrap;
  }
  .row > div:first-child {
    flex-basis: 100%;
    min-width: 0;
  }
  .row > .btn {
    flex: 1;
  }
  .shell-header .theme {
    flex-shrink: 0;
  }
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.calendar-weekday {
  text-align: center;
  padding: 12px 0;
}
.calendar-day {
  min-height: 115px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  min-width: 0;
}
.calendar-day.today {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}
.calendar-event {
  display: block;
  width: 100%;
  white-space: normal;
  text-align: left;
  padding: 7px !important;
  min-height: 0 !important;
  font-size: 12px !important;
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.module-menu {
  position: relative;
  margin-left: auto;
}
.module-menu summary {
  cursor: pointer;
  white-space: nowrap;
}
.module-menu-links {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px;
  border-radius: 12px;
  min-width: 230px;
  box-shadow: 0 12px 30px #0003;
}
.module-menu-links a {
  display: flex;
  margin: 4px 0;
}
.shell-header .theme {
  margin-left: 0;
}
.calendar-empty {
  opacity: 0.3;
}
@media (max-width: 700px) {
  .calendar-grid {
    gap: 2px;
  }
  .calendar-day {
    padding: 3px;
    min-height: 80px;
  }
  .calendar-event {
    font-size: 10px !important;
    padding: 3px !important;
  }
  .shell-header {
    flex-wrap: wrap;
  }
  .calendar-weekday {
    font-size: 12px;
  }
}

.calendar-day {
  max-height: 220px;
  overflow: auto;
}
.calendar-grid {
  margin-top: 20px;
}
.calendar-day > strong {
  display: block;
  margin-bottom: 5px;
}

/* Shared identity: product + developer, followed by current module. */
.topbar .studio-identity,
.shell-header .studio-identity {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
  border: 0;
  padding: 0;
  flex-shrink: 0;
  width: auto;
}
.studio-identity .brand {
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0;
  border: 0;
  background: none;
  flex-shrink: 0;
}
.studio-identity .brand svg {
  width: 42px;
  height: 42px;
  padding: 10px;
  border-radius: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linejoin: round;
  box-sizing: border-box;
}
.studio-identity-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.studio-identity-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.3px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.studio-identity-copy small,
.studio-identity-copy #developerBadge {
  font-size: 12px;
  font-weight: 450;
  line-height: 1.35;
  letter-spacing: 0;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  display: block;
  text-align: left;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-identity #brandDeveloper {
  margin: 0;
  padding: 0;
  position: static;
}
.studio-module-name {
  border-left: 1px solid var(--line);
  padding-left: 18px;
  margin-left: 3px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  max-width: 155px;
}
@media (max-width: 700px) {
  .topbar .studio-identity,
  .shell-header .studio-identity {
    gap: 10px;
    flex-shrink: 1;
    max-width: 100%;
  }
  .studio-identity-title {
    font-size: 14px;
  }
  .studio-identity-copy small,
  .studio-identity-copy #developerBadge {
    font-size: 11px;
    max-width: 160px;
  }
  .studio-module-name {
    font-size: 12px;
    padding-left: 10px;
    margin-left: 0;
    max-width: 105px;
  }
  .studio-identity .brand svg {
    width: 36px;
    height: 36px;
    padding: 8px;
  }
}

/* Align module name with the product title, above the developer subtitle. */
.studio-identity .studio-module-name {
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  padding-top: 0;
  font-size: 16px;
  line-height: 1.3;
}
@media (max-width: 700px) {
  .studio-identity .studio-module-name {
    font-size: 14px;
    line-height: 1.3;
  }
}

.module-card {
  position: relative;
}
.module-card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.module-card:has(.module-card-link:hover) {
  border-color: var(--muted);
}
.module-card:has(.module-card-link:focus-visible) {
  outline: 3px solid #8b9faf;
  outline-offset: 3px;
}
.module-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.calendar-date.btn {
  min-height: 32px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  justify-content: flex-start;
}
.calendar-day {
  cursor: pointer;
}
.calendar-date:hover {
  background: var(--soft);
}
@media (max-width: 700px) {
  .module-cards {
    grid-template-columns: 1fr;
  }
}
.calendar-modes {
  display: flex;
  gap: 8px;
  margin: 0 0 20px;
  flex-wrap: wrap;
}
.calendar-agenda-scroll {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.calendar-agenda {
  display: grid;
  grid-template-columns: repeat(var(--days), minmax(150px, 1fr));
}
.calendar-agenda-day {
  min-width: 0;
  border-right: 1px solid var(--line);
}
.calendar-agenda-day:last-child {
  border: 0;
}
.calendar-agenda-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  border-radius: 0;
  background: var(--surface);
}
.calendar-all-day {
  min-height: 100px;
  padding: 8px;
  background: var(--soft);
}
.calendar-slot {
  min-height: 68px;
  padding: 6px;
  border-top: 1px solid var(--line);
}
.calendar-time.btn {
  font-size: 12px;
  min-height: 26px;
  padding: 2px 6px;
  border: 0;
  color: var(--muted);
}
.calendar-slot .calendar-event {
  white-space: normal;
  overflow-wrap: anywhere;
  width: 100%;
  text-align: left;
}
.field:has(input[type='checkbox']) {
  align-content: center;
}
.field input[type='checkbox'] {
  width: 20px;
  height: 20px;
}
.marketing-sources {
  margin-top: 24px;
}
.calendar-grid .calendar-day {
  height: 160px;
  min-height: 160px;
  max-height: 160px;
  overflow-y: auto;
  align-self: start;
  scrollbar-width: thin;
}
.calendar-grid .calendar-empty {
  height: 160px;
}
.calendar-day .calendar-date {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.calendar-slot,
.calendar-all-day {
  cursor: pointer;
}
.calendar-slot:hover {
  background: var(--soft);
}
.calendar-client {
  font-weight: 650;
}
.calendar-event.calendar-source-crm {
  border-left: 3px solid #7295b2;
  background: color-mix(in srgb, var(--surface) 91%, #7295b2);
}
.calendar-event.calendar-source-planner {
  border-left: 3px solid #ae9671;
  background: color-mix(in srgb, var(--surface) 91%, #ae9671);
}
.calendar-event.calendar-source-handover {
  border-left: 3px solid #6f9a7d;
  background: color-mix(in srgb, var(--surface) 91%, #6f9a7d);
}
.calendar-event.calendar-done {
  opacity: 0.5;
  text-decoration: line-through;
  filter: grayscale(1);
}
.calendar-modes select {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
}
.calendar-event-actions {
  margin-top: 6px;
  padding: 0 0 4px;
}
.calendar-event-actions .calendar-event {
  margin-top: 0;
}
.calendar-edit.btn {
  font-size: 11px;
  min-height: 26px;
  padding: 3px 8px;
  margin-top: 3px;
}
.calendar-event-actions:has(.calendar-edit:focus-visible) {
  outline: 1px solid var(--muted);
}
.crm-chart-row {
  margin: 18px 0;
}
.crm-chart-label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 7px;
}
.crm-chart-track {
  height: 9px;
  border-radius: 9px;
  background: var(--soft);
  overflow: hidden;
}
.crm-chart-bar {
  height: 100%;
  border-radius: 9px;
  background: #7896a9;
}
.crm-chart-row small {
  display: block;
  margin-top: 7px;
  line-height: 1.5;
}
.crm-pie {
  width: min(220px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  margin: 24px auto;
}
.crm-pie-key {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}
.crm-chart-label {
  align-items: center;
}
.crm-chart-label > span:nth-child(2) {
  flex: 1;
}
.crm-pie-wrap {
  position: relative;
  padding-bottom: 12px;
}
.crm-pie-tooltip {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: max-content;
  max-width: 100%;
  padding: 9px 13px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on);
  font-size: 13px;
  box-shadow: 0 4px 16px #0002;
  pointer-events: none;
  text-align: center;
  z-index: 2;
}
.crm-pie {
  cursor: crosshair;
}
.crm-pie:focus-visible {
  outline: 3px solid #8b9faf;
  outline-offset: 4px;
}
.planner-attachments {
  grid-column: 1/-1;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 16px;
  min-width: 0;
}
.planner-attachments .row {
  flex-wrap: wrap;
}
.planner-attachments .row > span {
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 120px;
}
.planner-attachment-image {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
}
/* Photos in a construction note: a row of thumbnails, tap to enlarge. */
.planner-note-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.planner-note-photos .btn {
  padding: 0;
  width: 88px;
  height: 88px;
  overflow: hidden;
  border-radius: 10px;
}
.planner-note-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.planner-context {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 24px;
}
.planner-context-name {
  font-weight: 700;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.planner-form-context {
  grid-column: 1/-1;
  font-weight: 650;
  margin: 0 0 12px;
}
.planner-context-name:empty {
  display: none;
}
@media (max-width: 700px) {
  .planner-context {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }
  .planner-context-name {
    font-size: 16px;
  }
}
.website-preview {
  width: calc(100vw - 32px);
  max-width: 1500px;
}
.website-preview > iframe {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--line);
  margin-top: 16px;
  background: white;
}
.website-preview > select {
  padding: 10px;
  max-width: 100%;
}
.website-upload {
  grid-column: 1/-1;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.website-upload h3 {
  width: 100%;
  margin: 0;
}
.website-upload img {
  max-width: 240px;
  max-height: 130px;
  object-fit: contain;
}
.website-upload input {
  max-width: 100%;
}
.website-builder {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.3fr);
  gap: 28px;
  align-items: start;
}
.website-builder > .form-grid {
  grid-template-columns: 1fr;
  min-width: 0;
}
.website-live {
  position: sticky;
  top: 20px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: var(--surface);
}
.website-live iframe {
  width: 100%;
  height: 75vh;
  border: 0;
  background: white;
  border-radius: 8px;
}
.website-live-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.website-live-bar select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
@media (max-width: 1100px) {
  .website-builder {
    grid-template-columns: 1fr;
  }
  .website-live {
    position: static;
  }
  .website-live iframe {
    height: 65vh;
  }
}

.website-premium {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 26px 30px;
  margin: 0 0 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.website-premium-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.website-premium h2 {
  font-size: 22px;
  line-height: 1.3;
  margin: 8px 0;
}
.website-premium p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.website-premium > .btn {
  flex-shrink: 0;
  text-decoration: none;
  text-align: center;
}
@media (max-width: 1000px) {
  .website-premium {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
  }
  .website-premium > .btn {
    max-width: 100%;
    white-space: normal;
  }
}

.budget-meter {
  margin: 18px 0 24px;
}
.budget-track {
  height: 10px;
  background: var(--soft);
  border-radius: 8px;
  overflow: hidden;
}
.budget-fill {
  height: 100%;
  background: #698c7e;
  border-radius: 8px;
}
.budget-fill.is-over {
  background: #b75d56;
}
.budget-over {
  color: #bf625b;
  font-weight: 650;
}
.website-live-bar {
  flex-wrap: wrap;
}
.website-live-bar select {
  flex: 1 1 180px;
}
.website-preview-viewport {
  background: var(--soft);
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 8px;
}
.website-preview-viewport iframe {
  display: block;
  width: 100%;
  height: 70vh;
  border: 0;
  background: white;
}
.website-preview-viewport.is-mobile iframe {
  width: 390px;
  max-width: 100%;
  flex: none;
}
.website-live-bar [aria-pressed='true'] {
  background: var(--accent);
  color: var(--on);
}

.module-layout.planner-portfolio {
  grid-template-columns: minmax(0, 1fr);
}
.planner-portfolio .main {
  max-width: 1560px;
}
.planner-main > .btn + .split {
  margin-top: 28px;
}
.planner-main .expense-register {
  margin-top: 28px;
}
.planner-main .timeline-row {
  grid-template-columns: minmax(180px, 1fr) 2fr auto;
}
.planner-document {
  display: block;
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 18px 0;
}
.edit-dialog > .btn {
  margin: 12px 8px 8px 0;
}
@media (max-width: 700px) {
  .planner-main .timeline-row {
    grid-template-columns: 1fr auto;
  }
  .planner-main .row {
    flex-wrap: wrap;
  }
}

.planner-main .table-wrap {
  max-height: 65vh;
  overflow: auto;
}
.planner-main thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--soft);
  box-shadow: 0 1px var(--line);
}
.planner-main tfoot td {
  font-weight: 700;
  background: var(--soft);
  border-top: 2px solid var(--line);
}
.expense-filters {
  align-items: end;
  margin-top: 20px;
}
.expense-filters .field {
  flex: 1 1 145px;
}
.expense-filters .field:first-child {
  flex: 2 1 230px;
}
.expense-filters input,
.expense-filters select {
  max-width: none;
}
.planner-click-card {
  cursor: pointer;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.planner-click-card:hover {
  border-color: var(--muted);
  box-shadow: 0 8px 24px #0000000a;
}
.planner-click-card:focus-visible {
  outline: 3px solid #8b9faf;
  outline-offset: 3px;
}
.planner-remove {
  display: flex;
  margin-top: 18px;
  color: #b55454;
}

.planner-click-card {
  display: flex;
  flex-direction: column;
}
.planner-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 18px;
}
.planner-card-actions .planner-remove {
  margin: 0;
  margin-left: auto;
}
.planner-card-actions .btn {
  white-space: normal;
  text-align: center;
}
@media (max-width: 420px) {
  .planner-card-actions {
    gap: 10px;
  }
  .planner-card-actions .btn {
    padding: 10px;
    font-size: 13px;
  }
}

.budget-detail-dialog .table-wrap {
  max-height: 45dvh;
  overflow: auto;
}
.budget-detail-dialog thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--soft);
  box-shadow: 0 1px var(--line);
}
.budget-detail-dialog tfoot td {
  font-weight: 650;
  background: var(--soft);
}
.budget-detail-dialog tfoot tr:first-child td {
  border-top: 2px solid var(--line);
}
.budget-detail-dialog tfoot tr:last-child td {
  font-weight: 750;
}
.budget-detail-dialog th:nth-child(3),
.budget-detail-dialog td:nth-child(3) {
  white-space: nowrap;
}

.budget-detail-dialog > .btn.primary {
  margin-top: 28px;
}
.stage-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.stage-time-dialog .stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stage-time-dialog .stat strong {
  font-size: 21px;
}
.stage-time-axis {
  height: 16px;
  position: relative;
  background: var(--soft);
  border-radius: 8px;
  margin: 28px 0 18px;
}
.stage-time-fill {
  height: 100%;
  background: #78958a;
  border-radius: 8px;
}
.stage-time-marker {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 3px;
  background: var(--text);
}
.stage-time-dialog > .btn {
  margin-top: 24px;
}
@media (max-width: 700px) {
  .planner-main .timeline-row .stage-actions {
    grid-column: 1/-1;
    grid-row: 3;
  }
  .stage-time-dialog .stats {
    grid-template-columns: 1fr 1fr;
  }
}

.stage-time-dates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}
.stage-time-dates > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.stage-time-dates small {
  color: var(--muted);
  font-size: 12px;
}
.stage-time-dates strong {
  font-size: 14px;
}
.stage-time-dates > div:nth-child(2) {
  text-align: center;
}
.stage-time-dates > div:last-child {
  text-align: right;
}
@media (max-width: 420px) {
  .stage-time-dates {
    gap: 6px;
  }
  .stage-time-dates strong {
    font-size: 12px;
  }
}

.stage-steps {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.stage-steps-list {
  list-style: none;
  margin: 24px 0 28px 10px;
  padding: 0 0 0 26px;
  border-left: 2px solid var(--line);
}
.stage-step {
  position: relative;
  padding: 0 0 24px 0;
}
.stage-step:last-child {
  padding-bottom: 0;
}
.stage-step::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--muted);
  background: var(--surface);
  border-radius: 50%;
}
.stage-step.is-done::before {
  background: #698c7e;
  border-color: #698c7e;
}
.stage-step label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  line-height: 1.6;
}
.stage-step input {
  width: 19px;
  height: 19px;
  min-height: 0;
  margin: 4px 0 0;
  flex: none;
  accent-color: #698c7e;
}
.stage-step span {
  overflow-wrap: anywhere;
  min-width: 0;
}
.stage-step.is-done span {
  color: var(--muted);
  text-decoration: line-through;
}
.stage-step-add {
  display: flex;
  align-items: end;
  gap: 14px;
}
.stage-step-add .field {
  flex: 1;
}
.stage-steps > .muted {
  font-size: 13px;
}
@media (max-width: 500px) {
  .stage-step-add {
    align-items: stretch;
    flex-direction: column;
  }
}

.edit-dialog > header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  padding: 10px 0 14px;
  box-shadow: 0 1px 0 var(--line);
}

.delete-icon {
  width: 40px;
  min-width: 40px;
  padding: 9px;
  color: #b55454;
  justify-self: end;
}
.delete-icon svg {
  width: 20px;
  height: 20px;
}
.stage-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.stage-step label {
  flex: 1;
}
.stage-step .delete-icon {
  margin: 0;
  flex: none;
}

.planner-list-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.planner-main .stage-actions {
  align-items: center;
}
.planner-main .stage-actions .delete-icon {
  margin-left: 4px;
  flex: none;
}
.planner-main .detail-actions .delete-icon {
  align-self: center;
}
/* Keep expense row actions together, including narrow viewports. */
.expense-register .planner-list-actions {
  flex-wrap: nowrap;
  width: max-content;
  min-width: max-content;
  gap: 10px;
}
.expense-register .planner-list-actions > .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.planner-dialog-actions {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 18px;
  margin-top: 28px;
  width: 100%;
}
.planner-dialog-actions > .delete-icon {
  margin: 0 0 0 auto;
  flex: none;
}
.budget-detail-dialog .planner-list-actions {
  flex-wrap: nowrap;
  width: max-content;
}
.budget-detail-dialog .planner-dialog-actions {
  width: 100%;
}
.planner-dialog-actions > .btn.primary {
  white-space: normal;
}

.crm-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  width: max-content;
}
.crm-lead-wrap {
  position: relative;
}
.crm-lead-wrap > .lead-card {
  padding-right: 56px;
}
.crm-lead-wrap > .delete-icon {
  position: absolute;
  right: 9px;
  top: 9px;
}
.calendar-event-with-delete {
  display: flex;
  gap: 4px;
  align-items: start;
  min-width: 0;
  margin-top: 6px;
}
.calendar-event-with-delete > .calendar-event {
  flex: 1;
  min-width: 0;
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.calendar-event-with-delete > .delete-icon {
  flex: none;
  width: 28px;
  min-width: 28px;
  min-height: 30px;
  padding: 5px;
  margin: 0;
}
.calendar-event-with-delete > .delete-icon svg {
  width: 16px;
  height: 16px;
}

/* Stable task columns and room for real contact names, shared by dashboard/tasks. */
.crm-overview-split {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
}
.crm-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px max-content;
  gap: 16px;
  align-items: center;
}
.crm-task-row > div:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.crm-task-row > div:first-child p {
  margin: 5px 0 0;
}
.crm-task-row > .btn {
  width: 126px;
}
.crm-contact-identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.crm-contact-identity .text-link {
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.crm-contact-identity small {
  display: block;
  line-height: 1.45;
}
.crm-recent-contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px max-content;
  gap: 14px;
}
.crm-recent-contact > .badge {
  justify-self: center;
  white-space: normal;
  text-align: center;
}
@media (max-width: 1350px) {
  .crm-overview-split {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .crm-task-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
  }
  .crm-task-row > div:first-child {
    grid-column: 1/-1;
  }
  .crm-task-row > .crm-row-actions {
    justify-self: end;
  }
  .crm-recent-contact {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .crm-recent-contact > .crm-contact-identity {
    grid-column: 1/-1;
  }
  .crm-recent-contact > .badge {
    justify-self: start;
  }
  .crm-recent-contact > .crm-row-actions {
    justify-self: end;
  }
}
/* Contact names are text links, not padded action buttons. */
.crm-contact-identity > .btn.text-link {
  padding: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  justify-content: flex-start;
  align-items: flex-start;
  line-height: 1.4;
  margin: 0;
  text-align: left;
}
.crm-contact-identity > small {
  margin: 0;
  padding: 0;
}
.crm-recent-contact {
  align-items: center;
}
.crm-recent-contact > .badge,
.crm-recent-contact > .crm-row-actions {
  align-self: center;
  margin-top: 0;
  margin-bottom: 0;
}
.crm-portal-panel > h3 {
  margin: 28px 0 12px;
}
.crm-portal-panel > .table-wrap + h3 {
  margin-top: 32px;
}
.crm-portal-panel > .detail-actions {
  gap: 12px;
  margin-bottom: 24px;
}
/* Upcoming stages: consistent columns regardless of title length. */
.planner-main .planner-upcoming-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 60px 100px max-content;
  gap: 16px;
  align-items: center;
}
.planner-upcoming-row > div:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.planner-upcoming-row > div:first-child p {
  margin: 5px 0 0;
}
.planner-upcoming-row > .badge {
  justify-self: center;
  align-self: center;
  margin: 0;
}
.planner-upcoming-row > .btn {
  width: 100%;
  align-self: center;
}
.planner-upcoming-row > .planner-list-actions {
  align-self: center;
  flex-wrap: nowrap;
}
@media (max-width: 750px) {
  .planner-main .planner-upcoming-row {
    grid-template-columns: 60px minmax(0, 1fr) max-content;
    gap: 12px;
  }
  .planner-upcoming-row > div:first-child {
    grid-column: 1/-1;
  }
  .planner-upcoming-row > .badge {
    justify-self: start;
  }
  .planner-upcoming-row > .btn {
    width: auto;
    justify-self: end;
  }
}

/* Global account settings: consistent gaps, independent of other modules. */
.account-settings-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 24px;
}
.account-settings-panel > h2,
.account-settings-panel > h3,
.account-settings-panel > p {
  margin: 0;
}
.account-settings-panel > p {
  max-width: 90ch;
}
.account-settings-panel > .btn {
  align-self: flex-start;
}
.account-settings-panel > .table-wrap {
  margin: 0;
}
.account-settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  max-width: 760px;
  width: 100%;
}
.account-settings-form > .btn {
  justify-self: start;
  margin-top: 6px;
}
.account-settings-form > .form-error {
  margin: 0;
}
.account-settings-form > .form-error:empty {
  display: none;
}
.account-user-dialog .form-grid > p {
  grid-column: 1/-1;
  margin: 4px 0 8px;
  line-height: 1.65;
}
.account-user-dialog .form-grid > [type='submit'] {
  margin-top: 6px;
}
@media (max-width: 700px) {
  .account-settings-panel {
    gap: 20px;
  }
  .account-settings-form {
    gap: 20px;
  }
}

.crm-scope-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px 28px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 28px;
}
.crm-scope-toolbar label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  min-width: min(100%, 280px);
}
.crm-scope-toolbar select {
  padding: 10px 14px;
  max-width: 100%;
}
.crm-scope-toolbar > .muted {
  font-size: 13px;
}
.crm-scope-toolbar + .field {
  margin-bottom: 20px;
}

.website-builder {
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.85fr);
}
.website-editor-section {
  grid-column: 1/-1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.website-editor-section > summary {
  padding: 18px 20px;
  cursor: pointer;
  font-weight: 650;
  list-style: revert;
}
.website-editor-fields {
  display: grid;
  gap: 20px;
  padding: 4px 20px 22px;
}
.website-editor-fields .website-upload {
  margin: 0;
}
.website-editor-fields .website-upload img {
  max-height: 150px;
  object-fit: contain;
}
.website-editor-fields .website-upload h3 {
  margin-bottom: 14px;
}
.website-live-bar {
  flex-wrap: wrap;
  gap: 8px;
}
.website-live-bar > select {
  flex: 1 1 100%;
}
.module-sidebar .website-preview-nav {
  margin-top: 20px;
  background: var(--accent);
  color: var(--on);
  border: 1px solid var(--accent);
  justify-content: center;
}
.module-sidebar .website-preview-nav:hover {
  opacity: 0.85;
  background: var(--accent);
}
@media (max-width: 1100px) {
  .website-builder {
    grid-template-columns: 1fr;
  }
  .website-builder > .website-live {
    order: 2;
  }
  .website-builder > .form-grid {
    order: 1;
  }
}
@media (max-width: 700px) {
  .module-sidebar .website-preview-nav {
    margin-top: 0;
    margin-left: 12px;
  }
}

@media (min-width: 1101px) {
  .website-builder {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 22px;
  }
}

.website-domain-row {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.website-publish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.website-domain-row h3 {
  margin: 0 0 14px;
}

.website-sticky-heading {
  position: sticky;
  top: var(--website-nav-offset, 0px);
  z-index: 9;
  background: var(--bg);
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.website-main .website-premium {
  margin: 32px 0 0;
}
@media (min-width: 1101px) {
  .website-main .website-live {
    top: calc(var(--website-heading-height, 120px) + 16px);
  }
  .website-main .website-live iframe {
    height: calc(100dvh - var(--website-heading-height, 120px) - 160px);
    min-height: 240px;
  }
}
@media (max-width: 700px) {
  .website-sticky-heading {
    gap: 10px;
    padding: 12px 0;
  }
  .website-sticky-heading h1 {
    font-size: 23px;
    margin-bottom: 0;
  }
  .website-sticky-heading .muted {
    display: none;
  }
  .website-sticky-heading {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  .website-sticky-heading > .btn {
    font-size: 13px;
  }
}

/* Kopia zapasowa (hub) */
.backup-status p {
  margin: 6px 0;
  padding-left: 22px;
  position: relative;
}
.backup-status p::before {
  position: absolute;
  left: 0;
  font-weight: 700;
}
.backup-ok::before {
  content: '✓';
  color: #2f6b4f;
}
.backup-warn::before {
  content: '!';
  color: #a4471b;
}
.backup-info::before {
  content: 'i';
  color: currentColor;
}
.backup-action {
  padding-left: 0 !important;
}

/* Plany i moduły zablokowane (symulacja) */
.locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}
.locked-badge svg,
.badge svg,
.module-menu-links a.is-locked svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  flex: none;
}
.badge svg {
  margin-right: 5px;
  vertical-align: -2px;
}
.module-card.is-locked {
  background: repeating-linear-gradient(135deg, var(--surface) 0 14px, var(--soft) 14px 15px);
}
.module-card.is-locked h2,
.module-card.is-locked > p,
.module-card.is-locked ul {
  color: var(--muted);
}
.module-menu-links a.is-locked {
  color: var(--muted);
}
.locked-module {
  max-width: 720px;
}
.locked-module h1 {
  margin: 16px 0 8px;
}
.analytics-preview {
  position: relative;
  margin-top: 24px;
}
.analytics-preview.is-locked .analytics-preview-content {
  filter: blur(5px);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
.analytics-lock {
  position: absolute;
  inset: 40px 0 auto;
  margin: 0 auto;
  max-width: 460px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 18px 48px #0002;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 12px;
}
.analytics-lock h2,
.analytics-lock p {
  margin: 0;
}
.analytics-calc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.plan-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}
/* Long plan names wrap inside the button instead of widening the page (phones). */
.plan-choice .btn {
  max-width: 100%;
  white-space: normal;
  text-align: left;
}
@media (max-width: 760px) {
  /* No button may widen the page on a phone (e.g. „Zarządzaj płatnościami — w przygotowaniu”). */
  .btn {
    max-width: 100%;
    white-space: normal;
  }
  .plan-choice {
    display: grid;
  }
  .plan-choice .btn {
    justify-content: flex-start;
  }
}
/* A button row directly above a table or its "Przesuń w bok" hint keeps a gap. */
.row-actions + .table-wrap,
.row-actions + .scroll-hint,
.row-actions + [data-scroll-hint],
.handover-toolbar + .panel {
  margin-top: 14px;
}
main > .row-actions:not(:last-child) {
  margin-bottom: 16px;
}
/* Two tables, or a table and a heading, one after another in a panel keep a gap. */
.table-wrap + .table-wrap,
.table-wrap + .scroll-hint,
.table-wrap + h3,
.table-wrap + p {
  margin-top: 22px;
}

/* Analytics signals: one row per signal — status on the left, area and explanation on the right. */
.analytics-signals {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.analytics-signals li {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: start;
  gap: 4px 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--surface);
  line-height: 1.45;
}
.analytics-signals li > .badge {
  grid-row: span 2;
  justify-self: start;
}
.analytics-signals li > strong,
.analytics-signals li > span {
  grid-column: 2;
}
.analytics-signals li > strong {
  font-size: 15px;
}
.analytics-signals li > span {
  color: var(--muted);
  font-size: 14px;
}
.analytics-signals li.is-ok {
  border-left-color: #6f9a7d;
}
.analytics-signals li.is-uwaga {
  border-left-color: #c9a227;
}
.analytics-signals li.is-ryzyko {
  border-left-color: #c0564a;
}
.analytics-signals li.is-info {
  border-left-color: var(--muted);
}
.analytics-level.analytics-ryzyko {
  background: #f6dcd8;
  color: #8a2f25;
}
.analytics-level.analytics-uwaga {
  background: #f6ecc8;
  color: #6b5410;
}
.analytics-level.analytics-ok {
  background: #dcebe1;
  color: #2d5b3c;
}
@media (max-width: 760px) {
  .analytics-signals li {
    grid-template-columns: minmax(0, 1fr);
  }
  .analytics-signals li > .badge {
    grid-row: auto;
  }
  .analytics-signals li > strong,
  .analytics-signals li > span {
    grid-column: 1;
  }
}
@media (max-width: 700px) {
  .analytics-lock {
    inset: 16px 12px auto;
    padding: 20px;
  }
}

/* Start screen: figures that call for action, each opens the matching place. */
.hub-stats {
  margin: 28px 0 8px;
}
.stat-link {
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.stat-link:hover,
.stat-link:focus-visible {
  border-color: var(--text);
  box-shadow: 0 4px 16px #0000000f;
}
/* Start screen modules: four per row on a wide screen (rule at the end), three on a smaller computer, two on a tablet, one on a phone. */
.hub-modules {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.hub-modules .module-card {
  padding: 24px;
}
.hub-modules .module-card h2 {
  font-size: 21px;
}
@media (max-width: 1100px) {
  .hub-modules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .hub-modules {
    grid-template-columns: 1fr;
  }
}
.analytics-features {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1100px) {
  .analytics-features {
    grid-template-columns: 1fr;
  }
}

/* Planner portfolio cards: each figure line with its icon. */
.planner-fact {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 !important;
}
.planner-fact + .planner-fact {
  margin-top: 8px !important;
}
.planner-fact svg {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 10px;
  background: var(--soft);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  box-sizing: border-box;
}
/* Settings → Dane przykładowe: permanent removal is visibly different from hiding. */
.demo-data .btn.danger {
  color: #b42318;
  border-color: #f0c4bf;
}
html[data-theme='dark'] .demo-data .btn.danger {
  color: #ff9b8f;
  border-color: #6b2b25;
}
/* Start screen: hint to hide the example data after the first own investment. */
.demo-hint {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.demo-hint p {
  margin: 0;
}
/* Settings → Dane przykładowe: buttons side by side with a gap, wrapping on phones. */
.demo-data .publish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
/* DFG module: gaps with legal references, report states, the package for the DFG portal. */
.dfg-gaps {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}
.dfg-ok {
  margin: 8px 0 0;
}
.dfg-events {
  list-style: none;
  margin: 10px 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.dfg-events li {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.badge.dfg-state-overdue {
  background: #fde8e6;
  color: #b42318;
}
.badge.dfg-state-todo {
  background: #fff4dd;
  color: #8a5a00;
}
.badge.dfg-state-sent {
  background: #e8f0fe;
  color: #1d4ed8;
}
.badge.dfg-state-accepted {
  background: #e6f6ec;
  color: #1e7a3c;
}
.dfg-package {
  padding: 0 24px 24px;
}
.dfg-package dl {
  display: grid;
  grid-template-columns: minmax(160px, 40%) 1fr;
  gap: 6px 14px;
  margin: 12px 0 16px;
  font-size: 14px;
}
.dfg-package dt {
  color: var(--muted, #6b6b6b);
}
.dfg-package dd {
  margin: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 760px) {
  .dfg-package dl {
    grid-template-columns: 1fr;
  }
  .dfg-package dd {
    margin-bottom: 8px;
  }
}

/* Odbiory (handover): toolbar with a filter, two-line cells, defect states. */
.handover-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin: 0 0 16px;
}
.handover-toolbar .field {
  min-width: 220px;
  max-width: 360px;
  margin: 0;
}
.handover-cell {
  display: grid;
  gap: 2px;
}
.handover-cell small {
  font-size: 12px;
}
.handover-state.handover-deemed,
.handover-state.handover-overdue-fix {
  background: #f6dcd8;
  color: #8a2f25;
}
.handover-state.handover-fixed {
  background: #dcebe1;
  color: #2d5b3c;
}
.handover-protocol dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
}
.handover-protocol dt {
  color: var(--muted);
}
@media print {
  body > :not(dialog.printable) {
    display: none !important;
  }
  dialog.printable {
    position: static;
    border: 0;
    box-shadow: none;
    max-width: none;
    width: auto;
  }
  dialog.printable header button,
  dialog.printable .handover-protocol > button {
    display: none;
  }
}

/* Odbiory: defect photos and rows of the phone view. */
.handover-photos h3 {
  margin: 8px 0;
  font-size: 15px;
}
.handover-photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.handover-photo {
  position: relative;
  margin: 0;
}
.handover-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.handover-photo .btn {
  position: absolute;
  top: 4px;
  right: 4px;
  min-height: 0;
  padding: 4px;
}
.simple-row .simple-row-text {
  display: grid;
  gap: 3px;
  font-size: inherit;
  color: inherit;
}

/* Dates with a colour (Odbiory, Analityka; owner's rule 02.10): red after the date, orange 0–3 days,
   light orange 4–7 days, green later. */
.due-badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
  background: var(--soft);
  color: var(--muted);
}
.due-badge.due-overdue {
  background: #fbe3e1;
  color: #a12a22;
}
.due-badge.due-soon {
  background: #fbcd9c;
  color: #7a3500;
}
.due-badge.due-week {
  background: #fdf0d4;
  color: #8a6012;
}
.due-badge.due-later {
  background: #e3f1e4;
  color: #2f6b36;
}
html[data-theme='dark'] .due-badge.due-overdue {
  background: #5a2320;
  color: #ffd4d0;
}
html[data-theme='dark'] .due-badge.due-soon {
  background: #5a3512;
  color: #ffdcb8;
}
html[data-theme='dark'] .due-badge.due-week {
  background: #4a3d1c;
  color: #f6e2b5;
}
html[data-theme='dark'] .due-badge.due-later {
  background: #24412a;
  color: #cdeccf;
}
.due-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 12px;
}
/* Main buttons on top of every Odbiory section. */
.handover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
}
/* Rows that open their item on click. */
tr.is-clickable {
  cursor: pointer;
}
tr.is-clickable:hover td,
tr.is-clickable:focus-visible td {
  background: var(--soft);
}
tr.is-clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
/* Documents and photos inside a form (modules/attachments.js). */
.studio-attachment-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}
.studio-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.studio-attachment-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex: none;
}
.studio-attachment-pdf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--soft);
  font-size: 11px;
  font-weight: 700;
  flex: none;
}
.studio-attachment-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
/* Buttons in a row (table actions, bars above lists) never touch each other. */
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
/* In a table row the buttons stay in one line; the other columns give way (owner, 03.10:
   "Uznaj, Odmów, Usunięta, Edytuj" wrapped into a second row in Odbiory). Phones: mobile.css. */
td .row-actions {
  flex-wrap: nowrap;
}
td .row-actions .btn {
  white-space: nowrap;
}
/* Start screen on a wide screen: four module tiles in a row, in line with the four figures above
   (owner, 02.10). Narrower screens keep three, phones keep their own layout. */
@media (min-width: 1200px) {
  .module-cards.hub-modules {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
/* Start screen: the "Na dziś" list keeps a gap under the figures. */
.hub-stats + #na-dzis {
  margin-top: 20px;
}
/* Buyer zone (Odbiory → Strefa nabywcy): the buyer's own screen, shown as a separate card. */
.buyer-zone {
  max-width: 920px;
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}
.buyer-zone-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 24px 28px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
.buyer-zone-head h1,
.buyer-zone-head h2 {
  margin: 4px 0;
  font-size: clamp(22px, 4vw, 30px);
}
.buyer-zone-unit {
  font-weight: 650;
}
.buyer-zone-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 28px 0;
}
.buyer-zone-body {
  padding: 20px 28px 28px;
}
.buyer-zone-body h3 {
  margin: 18px 0 10px;
}
.buyer-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.buyer-card .btn {
  justify-self: start;
  margin-top: 8px;
}
.buyer-progress {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}
.buyer-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}
.buyer-progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.buyer-thread {
  display: grid;
  align-content: start;
  gap: 10px;
  margin: 0 0 18px;
  /* A long conversation scrolls inside its box; the newest message is shown first. */
  max-height: min(55vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 6px 4px 0;
}
.buyer-message {
  display: grid;
  gap: 4px;
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--soft);
  overflow-wrap: anywhere;
}
.buyer-message.is-mine {
  justify-self: end;
  background: var(--accent);
  color: var(--on);
}
.buyer-message.is-mine .muted {
  color: inherit;
  opacity: 0.75;
}
/* Phones: no scrolling box inside the card — the finger scrolls the whole card or page. */
@media (max-width: 760px), (pointer: coarse) {
  .buyer-thread {
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
  }
}
@media (max-width: 700px) {
  .buyer-zone-head,
  .buyer-zone-nav,
  .buyer-zone-body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .buyer-message {
    max-width: 92%;
  }
}
/* A longer note in the colour of a date (buyer waits for an answer): wraps on phones. */
.due-badge.buyer-owed {
  white-space: normal;
  border-radius: 12px;
  max-width: 100%;
}
.buyer-pickers .field {
  min-width: 180px;
}
.buyer-pickers {
  margin-top: 14px;
}
/* The buyer's card in the developer's panel: one window with everything about the buyer. */
.edit-dialog.buyer-card-dialog {
  width: min(1000px, calc(100vw - 28px));
}
.buyer-card-info {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.buyer-card-info p {
  margin: 0;
}
.buyer-card-info .due-badge {
  justify-self: start;
  white-space: normal;
}
.buyer-card-section {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.buyer-card-section h3 {
  margin: 0 0 14px;
}
/* The e-mail with the link and the code (shown once). */
.buyer-invite {
  display: grid;
  gap: 8px;
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}
.buyer-invite p {
  margin: 0;
}
.buyer-invite-link {
  overflow-wrap: anywhere;
  font-size: 13px;
}
.buyer-code {
  font-size: 30px;
  letter-spacing: 0.25em;
  font-variant-numeric: tabular-nums;
}
/* The buyer's own page (nabywca.html): no panel, only the buyer's zone. */
.buyer-page {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  box-sizing: border-box;
}
/* One width on every tab: the card fills the page column whatever the content. */
.buyer-page .buyer-zone {
  width: 100%;
  max-width: none;
  margin: 0;
  min-width: 0;
}
.buyer-page .buyer-zone-body {
  min-width: 0;
}
.buyer-zone-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.buyer-install-steps {
  display: grid;
  gap: 8px;
  padding-left: 20px;
}
/* "Zdjęcia z budowy": photos the developer shared from the planner. */
.buyer-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
  gap: 12px;
}
.buyer-gallery-item {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--soft);
}
.buyer-gallery-item button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.buyer-gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.buyer-gallery-item figcaption {
  padding: 8px 10px;
  font-size: 12px;
}
.buyer-gallery-big {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  margin: 0 auto;
}
.buyer-card-tabs {
  padding: 0;
  margin: 22px 0 0;
}
.buyer-card-tabs + .buyer-card-section {
  margin-top: 16px;
}
/* Planner note: share the photos with buyers. */
.field.buyer-share {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.field.buyer-share input {
  width: auto;
}
.due-badge.buyer-shared {
  justify-self: start;
  margin: 6px 0;
}
.buyer-login {
  max-width: 440px;
  margin: 8vh auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.buyer-login h1 {
  margin: 6px 0 12px;
}
.buyer-login .form-grid {
  grid-template-columns: 1fr;
}
/* "Gdzie jest mój lokal": the Makieta views down to the unit, the way marked. */
.buyer-structure {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px;
}
.buyer-structure-step {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--soft);
}
.buyer-structure-step svg,
.buyer-structure-step img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: contain;
}
.buyer-structure-step figcaption {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
}
.buyer-structure-mark {
  fill: #f2a33a;
  fill-opacity: 0.5;
  stroke: #fff;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.buyer-list td:nth-child(2) {
  white-space: nowrap;
  font-weight: 650;
}
.simple-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin: 0 0 14px;
}
.simple-pick .field {
  min-width: 0;
}
.simple-pick .field:first-child {
  grid-column: 1 / -1;
}
.simple-pick input,
.simple-pick select {
  width: 100%;
}
