:root {
  --ink: #1c1c1c;
  --muted: #575757;
  --line: rgba(28, 28, 28, 0.1);
  --panel: #ffffff;
  --canvas: #f7f6f2;
  --surface: #fbfaf7;
  --olive: #6b7d5c;
  --stone: #d8d2c8;
  --stone-dark: #c9c0b3;
  --charcoal: #1c1c1c;
  --shadow: 0 22px 44px rgba(28, 28, 28, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
  letter-spacing: 0;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.is-hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(320px, 520px) 1fr;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 36px;
  padding: 48px clamp(24px, 5vw, 72px);
  background: var(--panel);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
}

.brand-lockup strong {
  display: block;
  color: var(--charcoal);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.brand-lockup small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-lockup-large strong {
  font-size: 22px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
  height: 46px;
  padding: 6px 14px;
  border: 1px solid rgba(107, 125, 92, 0.16);
  border-radius: 999px;
  background: #080808;
  box-shadow: 0 18px 32px rgba(12, 12, 12, 0.12);
}

.brand-lockup-large .logo-badge {
  min-width: 184px;
  height: 58px;
}

.logo-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: 30px;
  object-fit: contain;
}

.brand-lockup-large .logo-image {
  height: 39px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--olive);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-copy h1,
.login-aside h2 {
  margin: 0;
  max-width: 600px;
  font-size: clamp(32px, 6vw, 62px);
  line-height: 1.02;
  letter-spacing: 0;
}

.login-copy p,
.login-aside p {
  max-width: 560px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 18px;
  max-width: 420px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--charcoal);
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  outline: none;
}

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--olive);
  box-shadow: 0 0 0 4px rgba(107, 125, 92, 0.16);
}

.login-form input:focus {
  border-color: var(--olive);
  box-shadow: 0 0 0 4px rgba(107, 125, 92, 0.16);
}

.login-form button,
.primary-button,
.ghost-button,
.sidebar-footer button,
.danger-button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--olive);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--olive);
  color: #fff;
}

.login-aside {
  position: relative;
  display: flex;
  align-items: end;
  overflow: hidden;
  padding: 56px;
  background:
    linear-gradient(120deg, rgba(28, 28, 28, 0.74), rgba(107, 125, 92, 0.34)),
    url("https://www.compasshomeenergy.co.uk/project-photos/img-6219.jpg");
  background-position: center;
  background-size: cover;
  color: #fff;
}

.login-aside .eyebrow,
.login-aside p {
  color: #fff;
}

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

.sidebar {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-header {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
}

.nav-list {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.nav-list a {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  padding: 0 12px;
  color: #2a3642;
  font-weight: 700;
}

.nav-list a:hover,
.nav-list a.is-active {
  background: #eef1ea;
  color: var(--charcoal);
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--olive);
  font-size: 17px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.sidebar-footer p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.shell {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  min-height: 82px;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 248, 0.92);
  padding: 14px clamp(18px, 3vw, 34px);
  backdrop-filter: blur(16px);
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ghost-button {
  background: #fff;
  color: var(--charcoal);
  border: 1px solid var(--line);
}

.danger-button {
  background: #fff;
  color: #9a332b;
  border: 1px solid rgba(154, 51, 43, 0.24);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.profile-chip {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--charcoal);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--charcoal);
  cursor: pointer;
  font-size: 22px;
  font-weight: 800;
}

.mobile-only {
  display: none;
}

.content {
  padding: clamp(18px, 3vw, 34px);
}

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

.metric-card,
.panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10, 32, 48, 0.04);
}

.metric-card {
  padding: 18px;
}

.metric-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 30px;
}

.panel {
  margin-top: 18px;
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-header h2,
.empty-state h2 {
  margin: 0;
  font-size: 18px;
}

.stage-track {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  overflow-x: auto;
  padding-bottom: 6px;
}

.stage {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.stage h3 {
  margin: 0 0 12px;
  color: var(--charcoal);
  font-size: 14px;
}

.stage-placeholder {
  display: grid;
  min-height: 110px;
  place-items: center;
  border: 1px dashed #b8c4cc;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.empty-state {
  display: grid;
  min-height: min(560px, calc(100vh - 150px));
  place-items: center;
  padding: 42px 20px;
  text-align: center;
}

.empty-state-inner {
  max-width: 520px;
}

.empty-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 50%;
  background: #eef1ea;
  color: var(--olive);
  font-size: 24px;
  font-weight: 800;
}

.empty-state p {
  margin: 12px auto 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.customer-toolbar h2 {
  margin: 0;
  font-size: 24px;
}

.customers-layout {
  display: grid;
  align-items: start;
  gap: 18px;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
}

.customer-list-panel,
.customer-detail-panel,
.record-detail,
.customer-form,
.linked-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10, 32, 48, 0.04);
}

.customer-list-panel {
  position: sticky;
  top: 106px;
  overflow: hidden;
}

.customer-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.customer-search {
  display: grid;
  gap: 7px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.customer-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--charcoal);
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
}

.customer-list {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 196px);
  overflow: auto;
  padding: 10px;
}

.customer-list-item {
  display: flex;
  width: 100%;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 10px;
  color: var(--charcoal);
  cursor: pointer;
  text-align: left;
}

.customer-list-item:hover,
.customer-list-item.is-selected {
  border-color: rgba(107, 125, 92, 0.18);
  background: #eef1ea;
}

.customer-list-item strong,
.customer-list-item small {
  display: block;
}

.customer-list-item small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--surface);
  padding: 5px 8px;
  color: var(--olive);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.customer-reference {
  display: inline-flex;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--olive);
  font-size: 12px;
  font-weight: 800;
}

.customer-detail-panel {
  min-width: 0;
  padding: 0;
}

.record-detail,
.customer-form {
  padding: 22px;
}

.record-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.record-header h2 {
  margin: 0;
  font-size: 24px;
}

.record-header p:not(.eyebrow) {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.record-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

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

.detail-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.detail-grid dt {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

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

.install-history-panel {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.completed-install-record {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.completed-install-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.completed-install-header strong,
.completed-install-header small {
  display: block;
}

.completed-install-header small {
  margin-top: 5px;
  color: var(--muted);
}

.survey-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.survey-summary h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
}

.survey-summary p {
  margin: 0;
  color: var(--charcoal);
  line-height: 1.6;
}

.compact-photo-grid {
  padding: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.linked-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.linked-panel {
  min-width: 0;
  overflow: hidden;
  box-shadow: none;
}

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

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

.linked-panel-header span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #eef1ea;
  color: var(--olive);
  font-size: 12px;
  font-weight: 800;
}

.linked-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.linked-record {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.linked-record strong,
.linked-record small {
  display: block;
}

.linked-record p {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.5;
}

.linked-record small {
  color: var(--olive);
  font-weight: 800;
}

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

.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--charcoal);
  font-size: 13px;
  font-weight: 800;
}

.span-2 {
  grid-column: 1 / -1;
}

.muted-empty {
  border: 1px dashed rgba(28, 28, 28, 0.18);
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.compact-empty {
  min-height: 420px;
  border: 0;
  box-shadow: none;
}

.lead-form-panel {
  margin-bottom: 18px;
}

.pipeline-board {
  display: grid;
  align-items: start;
  gap: 14px;
  grid-template-columns: repeat(6, minmax(230px, 1fr));
  overflow-x: auto;
  padding-bottom: 8px;
}

.pipeline-column {
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 250, 247, 0.78);
}

.pipeline-column-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 92px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.pipeline-column-header h3 {
  margin: 0;
  font-size: 15px;
}

.pipeline-column-header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pipeline-column-header span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #eef1ea;
  color: var(--olive);
  font-size: 12px;
  font-weight: 800;
}

.pipeline-dropzone {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 500px;
  padding: 10px;
  transition: background-color 150ms ease;
}

.pipeline-dropzone.is-over {
  background: rgba(107, 125, 92, 0.12);
}

.pipeline-empty {
  display: grid;
  min-height: 96px;
  place-items: center;
  border: 1px dashed rgba(28, 28, 28, 0.18);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.lead-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(28, 28, 28, 0.05);
  cursor: grab;
}

.lead-card.is-dragging {
  opacity: 0.56;
}

.lead-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.lead-card-header strong,
.lead-card-header small {
  display: block;
}

.lead-card-header small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.lead-card-details {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.lead-card-details div {
  border-radius: 8px;
  background: var(--surface);
  padding: 9px;
}

.lead-card-details dt {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.lead-card-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.lead-card-footer {
  display: grid;
  gap: 10px;
}

.lead-card-footer label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.lead-card-footer select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 13px;
  text-transform: none;
}

.lead-card-footer button {
  width: 100%;
}

.jobs-layout {
  display: grid;
  align-items: start;
  gap: 18px;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

.jobs-status-panel {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 106px;
}

.job-status-group,
.job-detail-panel,
.workspace-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10, 32, 48, 0.04);
}

.job-status-group {
  overflow: hidden;
}

.job-status-header,
.workspace-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
}

.job-status-header h3,
.workspace-panel-header h3 {
  margin: 0;
  font-size: 14px;
}

.job-status-header span,
.workspace-panel-header span {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: #eef1ea;
  color: var(--olive);
  font-size: 12px;
  font-weight: 800;
}

.job-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.job-list-item {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 11px;
  color: var(--charcoal);
  cursor: pointer;
  text-align: left;
}

.job-list-item:hover,
.job-list-item.is-selected {
  border-color: rgba(107, 125, 92, 0.18);
  background: #eef1ea;
}

.job-list-item strong,
.job-list-item small,
.job-list-item span {
  display: block;
}

.job-list-item small,
.job-list-item span,
.job-list-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.job-list-empty {
  border: 1px dashed rgba(28, 28, 28, 0.18);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.job-detail-panel {
  min-width: 0;
}

.job-detail {
  border: 0;
  box-shadow: none;
}

.status-control {
  display: grid;
  min-width: 220px;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.job-workspace {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.workspace-panel {
  overflow: hidden;
  box-shadow: none;
}

.checklist,
.note-list,
.photo-grid {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.checklist-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  cursor: pointer;
  line-height: 1.45;
}

.checklist-item input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--olive);
}

.checklist-item input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

.inline-add-form,
.stacked-add-form,
.photo-add-form {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 12px;
}

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

.job-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.job-note p {
  margin: 0 0 8px;
  color: var(--charcoal);
  line-height: 1.55;
}

.job-note small {
  color: var(--olive);
  font-weight: 800;
}

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

.job-photo {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.job-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--stone);
}

.job-photo figcaption {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

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

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

.tracking-layout {
  display: grid;
  align-items: start;
  gap: 18px;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

.tracking-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10, 32, 48, 0.04);
}

.source-list,
.website-event-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.source-row,
.website-event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.source-row strong,
.source-row small,
.website-event h3,
.website-event p,
.website-event small {
  display: block;
}

.source-row small,
.website-event p,
.website-event small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-row b {
  display: grid;
  min-width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #eef1ea;
  color: var(--olive);
}

.website-event h3 {
  margin: 10px 0 6px;
  font-size: 16px;
}

.website-event button {
  flex: 0 0 auto;
}

.calendar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.calendar-summary-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.calendar-layout {
  display: grid;
  align-items: start;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
}

.calendar-grid-panel,
.calendar-agenda-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10, 32, 48, 0.04);
}

.calendar-weekdays,
.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.calendar-weekdays span {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 132px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px;
  background: #fff;
}

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

.calendar-day.is-empty {
  background: #faf9f6;
}

.calendar-day.has-events {
  background: #fbfcf8;
}

.calendar-date {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: var(--charcoal);
  font-size: 12px;
  font-weight: 800;
}

.calendar-day-events,
.calendar-agenda-list {
  display: grid;
  gap: 8px;
}

.calendar-day-events {
  margin-top: 8px;
}

.calendar-day-events small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.calendar-event-pill {
  width: 100%;
  border: 1px solid rgba(107, 125, 92, 0.22);
  border-radius: 7px;
  background: #eef1ea;
  padding: 7px 8px;
  color: var(--olive);
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.calendar-event-pill.commissioning {
  border-color: rgba(23, 98, 116, 0.22);
  background: #e8f2f4;
  color: #176274;
}

.calendar-event-pill.google-busy,
.calendar-agenda-item.google-busy {
  border-color: rgba(142, 52, 52, 0.24);
  background: #fff0ee;
  color: #8e3434;
}

.calendar-event-pill.has-conflict,
.calendar-agenda-item.has-conflict {
  border-color: rgba(173, 89, 31, 0.36);
  background: #fff6e8;
}

.conflict-text {
  color: #ad591f !important;
  font-weight: 800;
}

.calendar-agenda-list {
  max-height: 680px;
  overflow: auto;
  padding: 12px;
}

.calendar-agenda-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  color: var(--charcoal);
  text-align: left;
  cursor: pointer;
}

.calendar-agenda-item:hover {
  border-color: rgba(107, 125, 92, 0.25);
  background: #eef1ea;
}

.calendar-agenda-item strong,
.calendar-agenda-item small,
.calendar-agenda-item b {
  display: block;
}

.calendar-agenda-item small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-agenda-item > span:last-child {
  flex: 0 0 auto;
  text-align: right;
}

.settings-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr);
}

.settings-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(10, 32, 48, 0.04);
}

.settings-panel-body {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-actions button {
  width: auto;
}

.settings-note {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 4;
  background: rgba(16, 25, 35, 0.44);
}

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

  .login-aside {
    min-height: 360px;
  }

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

  .customers-layout,
  .linked-grid,
  .jobs-layout,
  .job-workspace,
  .tracking-layout,
  .calendar-layout {
    grid-template-columns: 1fr;
  }

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

  .jobs-status-panel {
    position: static;
  }

  .pipeline-board {
    grid-template-columns: repeat(6, minmax(240px, 280px));
  }

  .customer-list-panel {
    position: static;
  }

  .customer-list {
    max-height: 320px;
  }

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

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

@media (max-width: 760px) {
  .mobile-only {
    display: grid;
  }

  .app-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 5;
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

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

  .topbar {
    align-items: center;
  }

  .topbar-actions .ghost-button {
    display: none;
  }

  .customer-toolbar,
  .calendar-actions,
  .settings-actions,
  .record-header,
  .record-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .record-actions {
    width: 100%;
  }

  .record-actions button,
  .customer-toolbar button,
  .settings-actions button {
    width: 100%;
  }

  .website-event,
  .source-row {
    align-items: stretch;
    flex-direction: column;
  }

  .website-event button {
    width: 100%;
  }

  .calendar-weekdays {
    display: none;
  }

  .calendar-month-grid {
    grid-template-columns: 1fr;
  }

  .calendar-day,
  .calendar-day:nth-child(7n) {
    min-height: auto;
    border-right: 0;
  }

  .calendar-day.is-empty {
    display: none;
  }

  .calendar-agenda-item {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-agenda-item > span:last-child {
    text-align: left;
  }

  .photo-add-form,
  .inline-add-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .login-panel,
  .login-aside {
    padding: 28px 20px;
  }

  .login-copy h1,
  .login-aside h2 {
    font-size: 34px;
  }

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

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .detail-grid,
  .form-grid,
  .tracking-grid,
  .calendar-summary-grid,
  .compact-photo-grid {
    grid-template-columns: 1fr;
  }

  .record-detail,
  .customer-form {
    padding: 16px;
  }

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