/*
 * Jitty CRM — workspace styles.
 *
 * Hand-written and small on purpose: the CRM is one app with one look, and it
 * keeps ActiveAdmin's stylesheet out of the agent-facing pages (the admin
 * layout loads that itself).
 */

:root {
  --ink: #17222e;
  --muted: #5b6b7b;
  --line: #e2e8ef;
  --line-strong: #cfd8e3;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --accent: #136b53;
  --accent-strong: #0e5442;
  --accent-soft: #e6f3ee;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --notice: #0b5cad;
  --notice-soft: #eef5fd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.muted {
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--panel);
  z-index: 10;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* --- shell ---------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.25rem 1rem;
  background: #0f1b26;
  color: #dbe4ec;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.5rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.brand-name {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}

.brand-name em {
  font-style: normal;
  font-weight: 400;
  color: #8fa3b5;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 7px;
  color: #c3cfda;
  font-size: 0.925rem;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}

.nav-divider {
  height: 1px;
  margin: 0.6rem 0.3rem;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-foot {
  margin-top: auto;
  padding: 0.75rem 0.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
}

.sidebar-agency {
  color: #fff;
  font-weight: 500;
}

.sidebar-user {
  color: #8fa3b5;
}

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar-agency {
  color: var(--muted);
  font-size: 0.85rem;
}

.main {
  width: 100%;
  max-width: 1040px;
  padding: 2rem;
}

/* --- page furniture ------------------------------------------------------- */

.page-head {
  margin-bottom: 1.5rem;
}

.page-head h1 {
  font-size: 1.5rem;
}

.page-lede {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.panel {
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.empty-state {
  padding: 3rem 2rem;
  text-align: center;
}

.empty-state-title {
  margin: 0 0 0.4rem;
  font-weight: 600;
}

.empty-state-body {
  max-width: 46ch;
  margin: 0 auto;
  color: var(--muted);
}

.details {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 0.6rem 1rem;
  margin: 0;
}

.details dt {
  color: var(--muted);
  font-size: 0.875rem;
}

.details dd {
  margin: 0;
}

/* --- forms and buttons ---------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.875rem;
  font-weight: 500;
}

input[type="email"],
input[type="text"],
input[type="search"],
input[type="tel"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
}

.button:hover {
  background: #f2f5f8;
  text-decoration: none;
}

.button-primary {
  width: 100%;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.button-primary:hover {
  background: var(--accent-strong);
}

.button-quiet {
  padding: 0.35rem 0.7rem;
  font-size: 0.825rem;
  color: var(--muted);
  background: transparent;
  border-color: var(--line-strong);
}

/* --- flash ---------------------------------------------------------------- */

.flash {
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.9rem;
}

.flash-notice {
  color: var(--notice);
  background: var(--notice-soft);
  border-color: #cfe2f7;
}

.flash-alert {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f4cdc9;
}

/* --- sign in -------------------------------------------------------------- */

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 2rem 1rem;
  background: radial-gradient(1200px 600px at 50% -10%, #e9f1ee 0%, var(--bg) 60%);
}

.auth {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  padding: 2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
}

.brand-auth {
  padding: 0;
  margin-bottom: 1.5rem;
}

.brand-auth .brand-mark {
  background: var(--accent);
}

.brand-auth .brand-name {
  color: var(--ink);
}

.brand-auth .brand-name em {
  color: var(--muted);
}

.auth-card h1 {
  margin-bottom: 0.35rem;
  font-size: 1.4rem;
}

.auth-lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.auth-card .flash {
  margin-bottom: 1rem;
}

.dev-link {
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: 8px;
}

.auth-foot {
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* --- enquiry inbox -------------------------------------------------------- */

.nav-count {
  min-width: 1.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

.nav-item.active .nav-count {
  background: rgba(255, 255, 255, 0.22);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.875rem;
}

.tab:hover {
  background: #eef2f6;
  color: var(--ink);
  text-decoration: none;
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.tab-count {
  font-size: 0.75rem;
  opacity: 0.7;
}

.enquiry-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.enquiry-list li + li {
  border-top: 1px solid var(--line);
}

.enquiry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 0.95rem 1.15rem;
  color: inherit;
}

.enquiry-row:hover {
  background: #f8fafc;
  text-decoration: none;
}

.enquiry-line {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.enquiry-name {
  font-weight: 600;
}

.enquiry-dot,
.enquiry-time {
  color: var(--muted);
  font-size: 0.8rem;
}

.enquiry-property {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.enquiry-snippet {
  margin: 0.35rem 0 0;
  color: #3d4b59;
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-new {
  color: #8a5a00;
  background: #fff7e6;
  border-color: #f2d9a6;
}

.badge-contacted {
  color: var(--notice);
  background: var(--notice-soft);
  border-color: #cfe2f7;
}

.badge-viewing_booked {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #bfe0d4;
}

.badge-closed {
  color: var(--muted);
  background: #f1f4f7;
  border-color: var(--line);
}

.back-link {
  margin: -0.5rem 0 0.75rem;
  font-size: 0.875rem;
}

.enquiry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.enquiry-contact {
  word-break: break-word;
}

.enquiry-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.25rem;
}

.message p {
  margin: 0 0 0.75rem;
  white-space: pre-line;
}

.enquiry-status-note {
  margin-top: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stack .button {
  width: 100%;
}

.thread {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.thread-item {
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.thread-meta {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.thread-body p {
  margin: 0 0 0.5rem;
  white-space: pre-line;
}

.thread-body p:last-child {
  margin-bottom: 0;
}

.reply-form {
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.form-hint {
  font-size: 0.8rem;
}

.pager {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.pager-count {
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- properties ----------------------------------------------------------- */

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

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.filters-field {
  display: flex;
  flex-direction: column;
}

.filters-grow {
  flex: 1 1 260px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table th {
  padding: 0.6rem 0.9rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #f8fafc;
}

.table-title {
  font-weight: 600;
}

.table-sub {
  margin-top: 0.15rem;
  font-size: 0.8rem;
}

.nowrap {
  white-space: nowrap;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.property-ref {
  font-size: 0.8rem;
}

.badge-live {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #bfe0d4;
}

.badge-draft {
  color: var(--muted);
  background: #f1f4f7;
  border-color: var(--line);
}

.lifecycle-appraisal,
.lifecycle-withdrawn {
  color: var(--muted);
  background: #f1f4f7;
  border-color: var(--line);
}

.lifecycle-instructed {
  color: var(--notice);
  background: var(--notice-soft);
  border-color: #cfe2f7;
}

.lifecycle-on_market {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #bfe0d4;
}

.lifecycle-under_offer,
.lifecycle-sstc {
  color: #8a5a00;
  background: #fff7e6;
  border-color: #f2d9a6;
}

.lifecycle-exchanged,
.lifecycle-completed {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.lifecycle-fallen_through {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f4cdc9;
}

.property-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.25rem;
}

.property-grid > aside .panel:first-child {
  margin-top: 0;
}

.details-wide {
  grid-template-columns: 150px minmax(0, 1fr);
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  padding: 0.2rem 0.6rem;
  background: #f1f4f7;
  border-radius: 999px;
  font-size: 0.8rem;
}

.missing-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.history {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

.history li + li {
  margin-top: 0.25rem;
}

.stack-button {
  width: 100%;
}

@media (max-width: 820px) {
  .property-grid {
    grid-template-columns: 1fr;
  }

  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--line);
  }

  .table td {
    padding: 0.15rem 0;
    border: 0;
  }

  .filters-grow {
    flex-basis: 100%;
  }
}



@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px;
  }

  .nav-divider,
  .sidebar-foot {
    display: none;
  }

  .topbar {
    padding: 0.6rem 1rem;
  }

  .main {
    padding: 1.25rem 1rem;
  }

  .details {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .details dd {
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 820px) {
  .enquiry-grid {
    grid-template-columns: 1fr;
  }

  .enquiry-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .form-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* --- property form -------------------------------------------------------- */

.page-head-row,
.property-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-lede {
  margin: -0.4rem 0 1rem;
  font-size: 0.875rem;
}

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

.form-grid .span-2 {
  grid-column: span 2;
}

.error-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

@media (max-width: 820px) {
  .page-head-row,
  .property-head {
    flex-direction: column;
  }

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

  .form-grid .span-2 {
    grid-column: auto;
  }
}

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-field input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.checkbox-field label {
  font-weight: 400;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.media-section {
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
}

.media-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.media-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.media-head h3 {
  margin: 0;
  font-size: 0.925rem;
}

.media-upload {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.media-file {
  max-width: 230px;
  font-size: 0.8rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.photo-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.media-remove {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.file-list .media-remove {
  width: auto;
  margin-top: 0;
}

/* --- contacts ------------------------------------------------------------- */

.chip {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  margin-right: 0.25rem;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 0.75rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.25rem;
}

.contact-grid > aside .panel:first-child,
.contact-grid > div > .panel:first-child {
  margin-top: 0;
}

.section-subhead {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.match-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.match-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.4rem 1rem;
}

.consent-field {
  margin-top: 1rem;
}

@media (max-width: 820px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.panel-head h2 {
  margin: 0;
}

/* --- valuations, viewings and diary --------------------------------------- */

.badge-status-requested {
  color: #8a5a00;
  background: #fff7e6;
  border-color: #f2d9a6;
}

.badge-status-scheduled,
.badge-status-confirmed {
  color: var(--notice);
  background: var(--notice-soft);
  border-color: #cfe2f7;
}

.badge-status-completed {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #bfe0d4;
}

.badge-status-cancelled {
  color: var(--muted);
  background: #f1f4f7;
  border-color: var(--line);
}

.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}

.day {
  min-height: 220px;
  padding: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.day-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 600;
}

.day-name {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event {
  padding: 0.45rem 0.5rem;
  background: #f8fafc;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

.event-valuation {
  border-left-color: #8a5a00;
}

.event-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.event-title {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.2rem;
  font-size: 0.72rem;
}

.event-status {
  margin-top: 0.25rem;
}

.day-empty {
  margin: 0.5rem 0;
  color: var(--line-strong);
  text-align: center;
}

.diary-hint {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.calendar-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}

@media (max-width: 900px) {
  .week {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --- site editor ---------------------------------------------------------- */

.badge-site-draft {
  color: var(--muted);
  background: #f1f4f7;
  border-color: var(--line);
}

.badge-site-preview {
  color: var(--notice);
  background: var(--notice-soft);
  border-color: #cfe2f7;
}

.badge-site-building {
  color: var(--notice);
  background: var(--notice-soft);
  border-color: #cfe2f7;
}

.build-progress {
  margin-bottom: 1rem;
}

.build-log {
  max-height: 14rem;
  overflow: auto;
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.badge-site-published {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #bfe0d4;
}

.badge-site-failed {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f4cdc9;
}

.commit {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}

/* --- site builder chat ---------------------------------------------------- */

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 30rem;
  overflow-y: auto;
  padding: 0.25rem 0.25rem 0.5rem;
  margin-bottom: 1rem;
}

.chat-message {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.chat-message-user {
  margin-left: 2rem;
  background: var(--accent-soft);
  border-color: #cfe7dd;
}

.chat-message-assistant {
  margin-right: 2rem;
}

.chat-message-status-failed {
  background: var(--danger-soft);
  border-color: #f4cdc9;
}

.chat-message-status-needs_owner {
  border-color: #cfe2f7;
}

.chat-message-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
}

.chat-author {
  font-weight: 600;
}

.chat-time {
  margin-left: auto;
}

.chat-status {
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 0.7rem;
}

.chat-status-queued,
.chat-status-running {
  color: var(--notice);
  background: var(--notice-soft);
}

.chat-status-done {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.chat-status-needs_owner {
  color: var(--notice);
  background: var(--notice-soft);
}

.chat-status-failed {
  color: var(--danger);
  background: var(--danger-soft);
}

.chat-body p {
  margin: 0.25rem 0;
}

.chat-body p:last-child {
  margin-bottom: 0;
}

.chat-thinking strong {
  font-weight: 600;
}

.chat-question {
  font-weight: 600;
}

.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.chat-options form {
  margin: 0;
}

.chat-preflight {
  margin-top: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  background: #fff;
  border: 1px solid #f4cdc9;
  font-size: 0.85rem;
}

.chat-preflight-title {
  margin: 0 0 0.25rem;
  font-weight: 600;
  color: var(--danger);
}

.chat-preflight ul {
  margin: 0;
  padding-left: 1.1rem;
}

.chat-message-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.55rem;
  font-size: 0.8rem;
}

.chat-log-tail {
  max-height: 6rem;
  margin: 0.45rem 0 0;
}

.chat-composer {
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.chat-composer textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
  resize: vertical;
}

.chat-composer textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.chat-composer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.55rem;
}

.chat-composer-actions .form-hint {
  margin: 0;
}

