.login {
  max-width: 460px;
  margin: 10vh auto;
  background: white;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.login h1 {
  font-size: 25px;
  margin-bottom: 12px;
}
.login label,
form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 12px;
}
input,
textarea,
select {
  padding: 11px;
  border: 1px solid #dce1d9;
  border-radius: 6px;
  background: #fff;
  min-width: 0;
}
form .primary {
  min-height: 44px;
}
.crm-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 24px;
  margin: 18px 0;
}
.crm-table {
  width: 100%;
  border-collapse: collapse;
}
.crm-table th,
.crm-table td {
  padding: 15px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.crm-table th {
  color: var(--muted);
  font-weight: 500;
}
.crm-table small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
.crm-table tr:hover {
  background: #fafbf8;
}
.crm-table button {
  text-align: left;
}
.crm-empty {
  padding: 50px 20px;
  color: var(--muted);
  text-align: center;
}
.crm-error {
  color: #9f3029;
  background: #fff0ee;
  padding: 12px;
  border-radius: 6px;
  margin: 12px 0;
  white-space: pre-wrap;
}
.crm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.crm-note {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  white-space: pre-wrap;
}
.crm-note small {
  display: block;
  color: var(--muted);
}
.crm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.crm-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.crm-line {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 80px 100px 40px;
  gap: 8px;
  margin: 10px 0;
}
.crm-line input {
  width: 100%;
}
dialog {
  max-width: 700px;
  width: calc(100vw - 32px);
  max-height: 90dvh;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: auto;
}
dialog::backdrop {
  background: #17262066;
}
body:has(dialog[open]) {
  overflow: hidden;
}
.credential {
  overflow-wrap: anywhere;
  user-select: all;
  padding: 15px;
  background: #eef1e8;
}
.mobile-nav {
  display: none;
}
.crm-toolbar input {
  flex: 1;
}
.meta {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
}
.state-loading {
  opacity: 0.65;
  pointer-events: none;
}
@media (max-width: 800px) {
  .sidebar {
    display: none;
  }
  .shell {
    margin: 0;
  }
  .topbar {
    padding: 15px;
    height: auto;
    gap: 12px;
  }
  main {
    padding: 18px;
  }
  .mobile-nav {
    display: flex;
    gap: 5px;
    overflow: auto;
  }
  .mobile-nav button {
    padding: 10px;
  }
  .crm-grid {
    grid-template-columns: 1fr;
  }
  .crm-table .optional {
    display: none;
  }
  .crm-panel {
    padding: 14px;
  }
  .crm-table td,
  .crm-table th {
    padding: 12px 6px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .page-heading h1 {
    font-size: 25px;
  }
  .crm-line {
    grid-template-columns: minmax(80px, 1fr) 48px 80px 24px;
  }
  .login {
    margin: 30px 16px;
  }
  .crm-header {
    align-items: flex-start;
  }
  .crm-table {
    table-layout: fixed;
  }
  .crm-table td {
    overflow-wrap: anywhere;
  }
}
.crm-table {
  white-space: normal;
}
.crm-table button {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}
.crm-table td strong,
.crm-table td small {
  overflow-wrap: anywhere;
}
.crm-table td:first-child button {
  display: block;
  width: 100%;
}
.crm-table td:first-child button strong,
.crm-table td:first-child button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 800px) {
  #request-list th:first-child {
    width: 50%;
  }
  #request-list th:last-child {
    width: 20%;
  }
  .crm-table button {
    padding-left: 0;
    padding-right: 0;
  }
}
.photo-grid,
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 18px 0 30px;
}
.photo-grid figure {
  margin: 0;
  border: 1px solid #dfe5d9;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.photo-grid img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.photo-grid figcaption {
  padding: 12px;
  font-size: 13px;
}
.photo-grid figcaption small {
  display: block;
  margin-top: 5px;
  color: #6b7864;
}
.photo-grid button {
  margin: 0 10px 12px;
  font-size: 11px;
}
.template-grid h3 {
  margin: 15px 0 6px;
}
.template-grid .secondary {
  margin-top: 14px;
}
.mail-preview {
  font: 14px/1.7 inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f2f5ed;
  border-radius: 8px;
  padding: 22px;
}
.customer-story {
  max-width: 950px;
  padding: 50px 24px;
}
.customer-story h1 {
  margin: 15px 0 28px;
}
.customer-story h2 {
  margin-top: 32px;
}
#share-output input {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
}
.crm-toolbar {
  flex-wrap: wrap;
}
.customer-story .photo-grid img {
  height: auto;
  object-fit: contain;
}
/* Sales workflow follows the existing cream, green and orange palette. */
.sales-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 16px;
  align-items: start;
}
.board-column {
  background: #edf0e7;
  padding: 16px;
  border-radius: 14px;
  min-width: 0;
}
.board-column h3 {
  font-size: 15px;
  margin: 0 0 12px;
}
.board-column h3 small {
  float: right;
}
.board-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  width: 100%;
  padding: 16px;
  margin-bottom: 12px;
  background: #fffdf6;
  border: 1px solid #d8dfd1;
  border-radius: 10px;
  color: #173f35;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.board-card strong {
  font-size: 16px;
}
.board-card small {
  line-height: 1.5;
  color: #617260;
}
.sales-badge {
  display: inline-block;
  border-radius: 6px;
  background: #e2eadb;
  padding: 5px 8px;
  font-size: 12px;
}
.mail-row {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #e1e6da;
  padding: 18px 10px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.mail-row small {
  display: block;
  margin-top: 8px;
  font-weight: normal;
  line-height: 1.5;
}
.mail-row.unread {
  background: #f2f5ec;
  border-left: 3px solid #b86d40;
}
.mail-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 14px/1.7 system-ui;
  color: inherit;
}
.mail-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  margin-bottom: 18px;
}
.mail-status span {
  padding: 8px 12px;
  background: #f3e8d7;
  border-radius: 8px;
}
.crm-panel {
  margin-bottom: 20px;
}
.crm-toolbar label {
  font-size: 12px;
  display: grid;
  gap: 6px;
}
.crm-toolbar input,
.crm-toolbar select {
  max-width: 100%;
  padding: 10px;
  border: 1px solid #d4ddce;
  border-radius: 6px;
  background: #fffdf8;
}
.check {
  display: flex !important;
  align-items: center;
  gap: 10px !important;
}
.check input {
  width: auto !important;
  flex: 0 0 auto;
}
.quote-editor-line {
  display: block !important;
  padding: 18px;
  border: 1px solid #d7dfd0;
  border-radius: 10px;
  background: #f8faf4;
  margin: 16px 0;
}
.quote-editor-line .crm-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.quote-editor-line label {
  margin-bottom: 10px;
}
.quote-editor-line button {
  width: auto !important;
  font-size: 12px;
  padding: 8px 12px;
}
.offer-line {
  display: flex;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid #d4ddce;
  align-items: start;
  cursor: pointer;
}
.offer-line input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 2px 0;
}
.offer-line span {
  flex: 1;
  min-width: 0;
}
.offer-line small {
  display: block;
  margin-top: 7px;
  line-height: 1.5;
}
.offer-total {
  text-align: right;
  background: #edf2e6;
  padding: 20px;
  margin: 20px 0;
  line-height: 1.8;
}
.customer-story {
  margin: 0 auto;
}
.customer-story input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1px solid #d4ddce;
  margin: 8px 0 16px;
}
.customer-story .crm-panel {
  padding: 28px;
}
@media (max-width: 1100px) {
  .sales-board {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}
@media (max-width: 700px) {
  .sales-board {
    grid-template-columns: 1fr;
  }
  .mail-row {
    flex-direction: column;
  }
  .offer-line {
    flex-wrap: wrap;
  }
  .offer-line > strong {
    margin-left: 34px;
  }
  .customer-story .crm-panel {
    padding: 18px;
  }
  .quote-editor-line .crm-grid {
    grid-template-columns: 1fr;
  }
  .crm-toolbar label {
    width: 100%;
  }
}
form label.check,
form label.offer-line {
  flex-direction: row;
}
.offer-line {
  font-size: 14px;
}
.offer-line > span {
  padding-right: 10px;
}
.offer-line > strong {
  white-space: nowrap;
}
.board-column { max-height: 65vh; overflow-y: auto; }
.board-column h3 { position: sticky; top: -16px; padding: 8px 0; background: #edf0e7; z-index: 1; }
