:root {
  color-scheme: light;
  --bg: #eef5f9;
  --surface: #ffffff;
  --surface-soft: #f5f9fc;
  --text: #22313f;
  --muted: #718093;
  --line: #d9e7ef;
  --blue: #1f9bd1;
  --blue-dark: #147eaf;
  --cyan: #22c2dc;
  --green: #4fb06d;
  --amber: #f0b43c;
  --red: #e66b57;
  --shadow: 0 18px 45px rgba(36, 72, 98, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  background: linear-gradient(180deg, #e8f5fb 0%, var(--bg) 44%, #f7fafc 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.login-body {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 26px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card .brand-mark {
  background: var(--blue);
  border-color: var(--blue);
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-card input,
.login-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 40px;
  padding: 9px 11px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.language-switcher label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.language-switcher select {
  width: auto;
  min-height: 34px;
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 7px 30px 7px 10px;
  font-weight: 800;
}

.login-language {
  justify-self: end;
}

a {
  color: inherit;
}

a:visited {
  color: inherit;
}

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

button {
  cursor: pointer;
}

.sidebar {
  min-height: 100vh;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #1599d3 0%, #187caf 48%, #1d607f 100%);
  color: #fff;
  box-shadow: 12px 0 34px rgba(28, 96, 127, 0.18);
}

.brand,
.nav-item,
.user-menu,
.record-main,
.panel-heading,
.customer-profile-head,
.linked-record {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark,
.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-weight: 900;
}

.avatar {
  background: var(--blue);
  border-color: var(--blue);
}

.avatar.small {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.brand strong,
.brand small,
.user-menu strong,
.user-menu small {
  display: block;
}

.user-menu {
  position: relative;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brand small,
.user-menu small {
  opacity: 0.76;
  margin-top: 3px;
}

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

.nav-item {
  gap: 10px;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-weight: 700;
}

.nav-item span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.15);
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.shell {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 4px 0 6px;
}

.topbar p,
.panel-heading p,
.record-subtitle,
.customer-list-main span,
.stage-customer-card span {
  color: var(--muted);
}

.eyebrow {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel,
.metric {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-heading {
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  padding: 17px;
  overflow: hidden;
}

.metric-link {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.metric-link:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 155, 209, 0.45);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
  font-weight: 800;
}

.metric strong {
  display: block;
  font-size: 27px;
  margin-bottom: 6px;
}

.metric-currency-list,
.currency-total-list {
  display: grid;
  gap: 4px;
  margin: 6px 0;
}

.metric-currency-list strong,
.currency-total-list strong {
  font-size: 24px;
  line-height: 1.1;
  margin: 0;
}

.dashboard-layout,
.workspace,
.crm-activity-layout,
.sales-layout {
  display: grid;
  grid-template-columns: minmax(300px, 410px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.activity-feed,
.dashboard-chat {
  grid-column: 1 / -1;
}

.upcoming-activities {
  grid-column: 1 / -1;
}

.upcoming-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.upcoming-grid .record {
  min-width: 0;
}

.crm-workspace {
  display: grid;
  gap: 14px;
}

.crm-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  background: linear-gradient(135deg, rgba(16, 93, 151, 0.96), rgba(20, 126, 175, 0.9)), #126c9d;
  color: #fff;
}

.crm-hero .eyebrow,
.crm-hero p {
  color: rgba(255, 255, 255, 0.78);
}

.crm-actions {
  display: grid;
  grid-template-columns: minmax(260px, 420px) auto;
  gap: 10px;
  align-items: center;
}

.crm-work-tabs,
.customer-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.crm-work-tab-button,
.customer-tab-button {
  min-height: 42px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  padding: 10px 15px;
  text-decoration: none;
  font-weight: 900;
  white-space: nowrap;
}

.crm-work-tab-button:hover,
.crm-work-tab-button.active,
.customer-tab-button:hover,
.customer-tab-button.active {
  color: var(--blue-dark);
  border-bottom-color: var(--blue);
  background: rgba(31, 155, 209, 0.08);
}

.customer-stage-kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  overflow-x: auto;
}

.customer-stage-column {
  min-height: 300px;
  padding: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.customer-stage-column.drag-over {
  border-color: var(--blue);
  background: #eaf7fc;
}

.kanban-dropzone {
  display: grid;
  gap: 8px;
  min-height: 240px;
}

.kanban-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 4px solid var(--blue);
}

.stage-customer-card,
.record,
.linked-record {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.stage-customer-card {
  display: grid;
  gap: 4px;
  padding: 9px;
  font-size: 13px;
  line-height: 1.25;
}

.stage-customer-card strong {
  font-size: 11px;
  color: var(--muted);
}

.stage-customer-card.dragging {
  opacity: 0.55;
}

.stage-customer-card a,
.customer-name-link {
  color: var(--blue-dark);
  font-weight: 900;
  text-decoration: none;
}

.customer-results,
.timeline,
.feed,
.quote-list,
.table-list,
.linked-records {
  display: grid;
  gap: 10px;
}

.customer-list-row,
.quote-list-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1.25fr) minmax(280px, 1.1fr) auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.quote-list-row {
  grid-template-columns: minmax(220px, 1.4fr) minmax(120px, 0.5fr) auto minmax(100px, 0.35fr) auto;
}

.quote-list-row.quote-rich-row {
  position: relative;
  overflow: hidden;
  padding-left: 22px;
}

.quote-list-row .anchor-target {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.timeshare-quote-list-panel .quote-list-row.quote-rich-row {
  grid-template-columns: minmax(420px, 1fr) 130px 145px 205px 300px;
  column-gap: 20px;
}

.timeshare-quote-list-panel .quote-list-row.quote-rich-row .deal-amount {
  justify-self: end;
  white-space: nowrap;
}

.timeshare-quote-list-panel .quote-list-row.quote-rich-row > .badge {
  justify-self: center;
  white-space: nowrap;
}

.timeshare-quote-list-panel .quote-list-row.quote-rich-row .quote-date-pair {
  justify-self: start;
  min-width: 185px;
}

.timeshare-quote-list-panel .quote-list-row.quote-rich-row .record-actions {
  justify-self: end;
  flex-wrap: nowrap;
  min-width: 0;
}

.customer-quote-sales-list .quote-list-row.quote-rich-row {
  grid-template-columns: minmax(360px, 1fr) 130px 150px 230px auto;
  column-gap: 18px;
}

.customer-quote-sales-list .quote-list-row.quote-rich-row .deal-amount,
.customer-quote-sales-list .quote-list-row.quote-rich-row > .badge {
  white-space: nowrap;
}

.customer-quote-sales-list .quote-list-row.quote-rich-row .record-actions {
  justify-self: end;
  flex-wrap: nowrap;
}

.quote-list-row.quote-rich-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: #f59e0b;
}

.quote-list-row.quote-rich-row.quote-row-expired::before {
  background: #ef4444;
}

.quote-list-row.quote-rich-row.quote-row-converted::before {
  background: #16a34a;
}

.quote-list-row.quote-rich-row.quote-row-canceled::before {
  background: #ef4444;
}

.quote-list-row.quote-rich-row.quote-row-default::before {
  background: #f59e0b;
}

.quote-clickable-row {
  cursor: pointer;
}

.quote-clickable-row:hover {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.quote-row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 18px;
}

.quote-row-title span {
  color: var(--text);
  font-weight: 700;
}

.quote-list-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.quote-create-cta {
  min-height: 46px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 15px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.quote-list-actions .filter-strip {
  flex-wrap: wrap;
}

.quote-list-actions .filter-strip select {
  min-width: 170px;
}

.quote-date-pair {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.quote-date-pair b {
  color: var(--text);
}

.customer-list-main {
  display: grid;
  gap: 9px;
}

.customer-list-main span {
  display: block;
  margin-top: 3px;
}

.customer-list-meta,
.record-meta,
.record-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.record-main,
.linked-record {
  justify-content: space-between;
  gap: 12px;
}

.record-title {
  font-weight: 900;
}

.user-list-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.user-name-role {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
}

.user-role-name {
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 900;
}

.record-subtitle {
  margin-top: 4px;
  font-size: 13px;
}

.crm-activity-card {
  border-left: 4px solid var(--cyan);
}

.customer-card-panel {
  min-height: 640px;
}

.customer-assignee-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #d8e8f1;
  border-radius: 8px;
  background: linear-gradient(135deg, #f7fcff 0%, #eef8fc 100%);
}

.customer-assignee-card span {
  color: var(--muted);
}

.customer-assignee-card strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 16px;
}

.customer-assignee-card form {
  min-width: min(260px, 100%);
}

.customer-assignee-card select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  font-weight: 800;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.customer-profile-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 14px;
}

.customer-head-assignee {
  min-width: 220px;
  justify-self: end;
  padding: 10px 12px;
  border: 1px solid #d8e8f1;
  border-radius: 8px;
  background: #f7fcff;
  text-align: right;
}

.customer-head-assignee span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.customer-head-assignee strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
}

.inline-alert {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #f3d08a;
  background: #fff8e5;
  color: #8a5a00;
  font-weight: 900;
}

.form,
.deal-form,
.customer-general-form {
  display: grid;
  gap: 13px;
}

.deal-form {
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  align-items: center;
}

.customer-general-form {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

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

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

.form label,
.form-field,
.customer-general-form label,
.document-upload-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form input,
.form select,
.form textarea,
.form-field input,
.deal-form input,
.deal-form select,
.customer-general-form input,
.customer-general-form select,
.customer-general-form textarea,
.search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 40px;
  padding: 9px 11px;
}

textarea {
  resize: vertical;
}

.full {
  grid-column: 1 / -1;
}

.check {
  grid-template-columns: 18px 1fr !important;
  align-items: center;
  color: var(--text) !important;
}

.check input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.primary-button,
.secondary-button,
.small-button,
.danger-button {
  border: 0;
  border-radius: 8px;
  min-height: 38px;
  padding: 9px 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
}

button.primary-button,
button.secondary-button,
button.small-button,
button.danger-button {
  appearance: none;
}

.secondary-button,
.small-button {
  color: var(--blue-dark);
  background: #e8f6fc;
}

.danger-button {
  background: var(--red);
}

.small-button {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 13px;
}

.notifications-menu {
  position: relative;
}

.notifications-menu summary {
  list-style: none;
}

.notifications-menu summary::-webkit-details-marker {
  display: none;
}

.notification-button {
  gap: 7px;
}

.notification-button.has-new-notification {
  animation: notification-pulse 0.9s ease-in-out 2;
}

@keyframes notification-pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(31, 155, 209, 0.16);
  }
}

.notification-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
}

.notifications-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: min(360px, 88vw);
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  max-height: 286px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notification-item {
  display: block;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  position: relative;
  overflow: hidden;
}

.chat-thread-item[hidden],
.member-check-option[hidden],
.customer-mention-list[hidden] {
  display: none !important;
}

.notification-item.unread {
  border-color: rgba(31, 155, 209, 0.7);
  background: linear-gradient(90deg, rgba(31, 155, 209, 0.22), rgba(34, 194, 220, 0.08) 58%, #fff 100%);
  box-shadow: 0 10px 22px rgba(31, 155, 209, 0.14);
}

.notification-item.unread::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--blue);
}

.notification-item a {
  display: block;
  color: var(--blue-dark);
  text-decoration: none;
}

.notification-item strong {
  display: block;
  font-weight: 900;
}

.notification-item.unread strong {
  color: #0f5f8c;
}

.notification-item span,
.notification-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.customer-chat {
  display: grid;
  gap: 14px;
}

.chat-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 360px);
  gap: 10px;
}

.chat-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.chat-toolbar select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  font-weight: 800;
}

.chat-thread {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 460px;
  min-height: 260px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(247, 252, 255, 0.95), rgba(240, 247, 251, 0.95)),
    #f7fbfd;
}

.chat-message {
  width: min(620px, 88%);
  padding: 12px;
  border: 1px solid #d6e7f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.chat-message.own {
  justify-self: end;
  border-color: rgba(31, 155, 209, 0.35);
  background: #eaf7fc;
}

.chat-message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 13px;
}

.chat-message-head span,
.chat-message-to {
  color: var(--muted);
  font-size: 12px;
}

.chat-message-to {
  margin-top: 4px;
}

.chat-message p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.chat-compose {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) minmax(180px, 240px) auto;
  gap: 12px;
  align-items: end;
}

.chat-compose label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.chat-compose select,
.chat-compose textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
}

.chat-message-field textarea {
  resize: vertical;
}

.chat-attachment {
  display: inline-flex;
  margin-top: 10px;
  text-decoration: none;
}

.chat-attachment.file {
  align-items: center;
  border: 1px solid #cfe4ee;
  border-radius: 10px;
  background: #f7fcff;
  color: var(--blue-dark);
  padding: 9px 11px;
  font-weight: 900;
}

.chat-attachment.image {
  display: block;
  width: min(260px, 100%);
}

.chat-attachment.image img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border: 1px solid #cfe4ee;
  border-radius: 10px;
}

.inline-assign-form {
  display: inline-grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.inline-assign-form select {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 6px 8px;
}

.badge,
.pill {
  border-radius: 999px;
  background: #e8f6fc;
  color: var(--blue-dark);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.badge.success {
  background: #e7f6ec;
  color: #257044;
}

.badge.warning {
  background: #fff6df;
  color: #976b10;
}

.badge.danger {
  background: #fdecea;
  color: #ad3b2c;
}

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

.empty.compact {
  padding: 10px;
}

.flash {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: #e8f6fc;
  color: var(--blue-dark);
  font-weight: 800;
}

.flash.danger {
  background: #fdecea;
  border-color: #f4c0b8;
  color: #ad3b2c;
}

.flash.success {
  background: #e7f6ec;
  border-color: #bfe8cc;
  color: #257044;
}

.flash.info {
  background: #e8f6fc;
  border-color: #b9e4f4;
  color: var(--blue-dark);
}

.flash.warning {
  background: #fff8e5;
  border-color: #f3d08a;
  color: #8a5a00;
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.confirm-dialog {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.confirm-dialog-wide {
  width: min(560px, 100%);
}

.confirm-dialog strong {
  font-size: 18px;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-textarea-label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.confirm-textarea-label textarea {
  width: 100%;
  min-height: 122px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  outline: none;
  background: #fff;
}

.confirm-textarea-label textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.prompt-error {
  color: #b42318;
  font-weight: 800;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.calendar-panel {
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.calendar-toolbar,
.calendar-actions,
.calendar-day-head {
  display: flex;
  align-items: center;
}

.calendar-toolbar {
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.calendar-toolbar h2,
.calendar-toolbar p {
  margin: 0;
}

.calendar-toolbar p {
  margin-top: 5px;
  color: var(--muted);
}

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

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

.calendar-weekdays span {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--blue-dark);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.calendar-month-weekdays {
  margin-bottom: 8px;
}

.calendar-day {
  min-width: 0;
  min-height: 154px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.calendar-day.muted {
  background: #f8fafc;
  color: var(--muted);
}

.calendar-day.today {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.14);
}

.calendar-day-head {
  justify-content: space-between;
  gap: 8px;
}

.calendar-day-head strong,
.calendar-day-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.calendar-day.today .calendar-day-head strong,
.calendar-day.today .calendar-day-number,
.calendar-day.selected .calendar-day-number {
  background: var(--blue);
  color: #fff;
}

.calendar-day-head span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-weight: 900;
}

.calendar-events {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.calendar-event {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 7px;
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  background: #f0f9ff;
  color: var(--text);
  text-decoration: none;
}

.calendar-event-task {
  border-left-color: var(--blue);
  background: #eef4ff;
}

.calendar-event-activity {
  border-left-color: var(--cyan);
}

.calendar-event:hover {
  background: #e0f2fe;
}

.calendar-event-task:hover {
  background: #dbeafe;
}

.calendar-type-badge {
  width: fit-content;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  background: #cffafe;
  color: #0e7490;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
}

.calendar-event-task .calendar-type-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.calendar-event strong,
.calendar-event span,
.calendar-event small,
.calendar-more {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event strong {
  color: var(--blue-dark);
  font-size: 12px;
}

.calendar-event span,
.calendar-event small {
  color: var(--muted);
  font-size: 11px;
}

.calendar-event .calendar-type-badge {
  color: #0e7490;
  font-size: 10px;
}

.calendar-event-task .calendar-type-badge {
  color: #1d4ed8;
}

.calendar-more {
  padding: 5px 7px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.feed-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.feed-icon {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f6fc;
  color: var(--blue-dark);
  font-weight: 900;
}

.pagination,
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pagination {
  margin-top: 14px;
}

.pagination a,
.admin-tabs a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  font-weight: 900;
}

.pagination a.active,
.admin-tabs a.active,
.pagination a:hover,
.admin-tabs a:hover {
  border-color: rgba(31, 155, 209, 0.45);
  background: #eaf7fc;
  color: var(--blue-dark);
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.sales-summary strong {
  display: block;
  font-size: 34px;
  margin: 10px 0;
}

.sales-list-panel .panel-heading {
  align-items: flex-start;
  gap: 14px;
}

.sales-filter-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: end;
}

.sales-filter-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.sales-filter-form select,
.sales-filter-form input {
  min-width: 150px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 7px 10px;
}

.sales-filter-form select {
  min-width: 190px;
}

.sale-record {
  cursor: pointer;
}

.sale-record-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 18px;
}

.sale-record-title strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.sale-record:hover {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

@media (max-width: 1100px) {
  .metrics,
  .dashboard-layout,
  .workspace,
  .crm-activity-layout,
  .sales-layout {
    grid-template-columns: 1fr;
  }

  .deal-form {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

  .shell {
    padding: 16px;
  }

  .topbar,
  .crm-hero {
    display: grid;
  }

  .crm-actions,
  .form-grid,
  .deal-form,
  .customer-general-form,
  .customer-list-row,
  .quote-list-row,
  .customer-profile-head,
  .feed-item,
  .notification-item,
  .inline-assign-form {
    grid-template-columns: 1fr;
  }
}

/* Bitrix-style CRM workspace */
body.bitrix-shell {
  grid-template-columns: 58px minmax(0, 1fr);
  background:
    linear-gradient(125deg, rgba(4, 44, 107, 0.98) 0%, rgba(4, 28, 77, 0.96) 44%, rgba(8, 155, 190, 0.88) 100%),
    linear-gradient(180deg, #073b87, #08265f);
  color: #263241;
  overflow-x: hidden;
}

.bitrix-shell .sidebar {
  min-height: 100vh;
  padding: 12px 8px;
  background: rgba(2, 39, 93, 0.58);
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.14);
}

.bitrix-shell .brand {
  display: grid;
  place-items: center;
  margin: 0 0 12px;
}

.bitrix-shell .brand > div {
  display: none;
}

.bitrix-shell .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #56d8ff;
  font-size: 13px;
}

.bitrix-shell .nav {
  gap: 8px;
}

.bitrix-shell .nav-item {
  justify-content: center;
  min-height: 38px;
  padding: 7px;
  font-size: 0;
  border-radius: 10px;
  background: transparent;
}

.bitrix-shell .nav-item span {
  width: 28px;
  height: 28px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.12);
}

.bitrix-shell .nav-item:hover,
.bitrix-shell .nav-item.active {
  background: rgba(255, 255, 255, 0.16);
}

.bitrix-shell .shell {
  padding: 0;
}

.bitrix-shell .topbar {
  min-height: 63px;
  display: grid;
  grid-template-columns: auto minmax(260px, 450px) auto minmax(360px, auto);
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 10px 14px;
  color: #fff;
  background: rgba(4, 47, 112, 0.74);
}

.portal-brand strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.portal-brand span {
  color: #42c8ff;
}

.portal-brand small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 11px;
}

.global-search {
  min-height: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.17);
  overflow: hidden;
}

.global-search input {
  min-height: 36px;
  border: 0;
  padding: 0 16px;
  background: transparent;
  color: #fff;
}

.global-search input::placeholder {
  color: rgba(255, 255, 255, 0.66);
}

.global-search button {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  font-size: 20px;
}

.work-clock {
  display: grid;
  grid-template-columns: auto auto;
  gap: 12px;
  align-items: center;
  white-space: nowrap;
}

.work-clock strong {
  font-size: 32px;
  font-weight: 400;
}

.work-clock span {
  font-size: 12px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.82);
}

.bitrix-shell .user-menu {
  justify-content: end;
  color: #fff;
}

.bitrix-shell .user-menu small {
  color: rgba(255, 255, 255, 0.72);
}

.plan-button,
.invite-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 18px;
  color: #fff;
  text-decoration: none;
  font-weight: 900;
}

.plan-button {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.invite-button {
  background: #18c6d8;
}

.bitrix-shell .user-menu > .small-button,
.bitrix-shell .notification-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.module-nav {
  min-height: 52px;
  display: flex;
  align-items: stretch;
  gap: 18px;
  margin: 0 8px;
  padding: 0 18px;
  border-radius: 0 0 8px 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(0, 24, 70, 0.18);
  overflow-x: auto;
}

.module-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  color: #525e70;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

.module-nav a.active,
.module-nav a:hover {
  color: #145db6;
}

.module-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: #2f82ff;
}

.module-nav span {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 5px;
  border-radius: 999px;
  background: #ff6b3d;
  color: #fff;
  font-size: 11px;
}

.module-nav .more-link {
  margin-left: auto;
}

.page-caption {
  display: none;
}

.bitrix-shell .flash {
  margin: 12px 18px;
}

.lead-workspace {
  gap: 8px;
  padding: 14px 8px 0;
  color: #fff;
}

.lead-toolbar {
  display: grid;
  gap: 12px;
}

.lead-title-row {
  display: grid;
  grid-template-columns: auto 130px 44px minmax(260px, 1fr) 42px;
  gap: 10px;
  align-items: center;
}

.lead-title-row h2 {
  margin: 0;
  color: #dfefff;
  font-size: 27px;
  font-weight: 400;
}

.lead-title-row h2 span {
  color: rgba(255, 255, 255, 0.58);
}

.create-button,
.create-split,
.settings-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 900;
}

.create-button,
.create-split {
  background: #a9eb13;
  color: #23551a;
}

.create-split {
  width: 44px;
}

.settings-button {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.lead-search {
  min-height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 42px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.search-filter-chip {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  background: #28a8df;
  color: #fff;
  font-weight: 800;
}

.lead-search input {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 0 12px;
}

.lead-search input::placeholder {
  color: rgba(255, 255, 255, 0.72);
}

.lead-search button {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
}

.lead-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
}

.bitrix-shell .crm-work-tabs,
.quick-filters {
  display: inline-flex;
  min-height: 36px;
  gap: 0;
  align-items: center;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.bitrix-shell .crm-work-tab-button,
.quick-filters a {
  min-height: 36px;
  padding: 8px 14px;
  border: 0;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-weight: 800;
}

.bitrix-shell .crm-work-tab-button.active,
.bitrix-shell .crm-work-tab-button:hover,
.quick-filters a.active,
.quick-filters a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

.quick-filters span {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  font-size: 11px;
}

.lead-kanban-shell {
  min-width: 0;
}

.bitrix-shell .customer-stage-kanban {
  grid-template-columns: repeat(4, minmax(280px, 1fr));
  gap: 6px;
  min-height: calc(100vh - 215px);
  padding-bottom: 18px;
}

.bitrix-shell .customer-stage-column {
  min-height: 620px;
  padding: 0 0 10px;
  border: 0;
  border-left: 1px dashed rgba(255, 255, 255, 0.26);
  border-radius: 0;
  background: rgba(0, 30, 86, 0.12);
}

.bitrix-shell .customer-stage-column.drag-over {
  background: rgba(255, 255, 255, 0.14);
}

.bitrix-shell .kanban-head {
  min-height: 31px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  color: #172435;
  font-size: 13px;
}

.bitrix-shell .kanban-head a {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: #405064;
  font-weight: 900;
  text-decoration: none;
}

.stage-green .kanban-head {
  background: #8bd222;
}

.stage-yellow .kanban-head {
  background: #f0df58;
}

.stage-ice .kanban-head {
  background: #bdeff4;
}

.stage-turquoise .kanban-head {
  background: #21c8bd;
}

.stage-total {
  padding: 12px 10px 8px;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  font-size: 26px;
  font-weight: 300;
}

.quick-lead-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  margin: 4px 10px 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  text-decoration: none;
  font-weight: 900;
}

.customer-stage-column:not(:first-child) .quick-lead-button {
  display: none;
}

.stage-plus {
  width: 34px;
  height: 30px;
  display: grid;
  place-items: center;
  margin: 2px auto 10px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  text-decoration: none;
}

.bitrix-shell .kanban-dropzone {
  gap: 6px;
  min-height: 360px;
  padding: 0 8px;
}

.bitrix-shell .stage-customer-card {
  gap: 6px;
  min-height: 156px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 19, 58, 0.2);
  color: #2d3948;
}

.stage-customer-card .card-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 8px;
  align-items: center;
}

.stage-customer-card .counter {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #c6d0d8;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.stage-customer-card .card-amount {
  color: #5f6e7f;
  font-size: 15px;
}

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

.contact-icons {
  color: #72aadc;
  letter-spacing: 0;
}

.stage-customer-card small {
  color: #97a2ae;
  font-size: 12px;
}

.stage-customer-card strong {
  color: #2472ad;
  font-size: 13px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  color: #9aa5b1;
}

.card-footer a {
  color: #7d8793;
  text-decoration: none;
}

.bitrix-shell .empty {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.bitrix-shell .panel:not(.login-card),
.bitrix-shell .metric,
.bitrix-shell .record,
.bitrix-shell .customer-list-row,
.bitrix-shell .quote-list-row,
.bitrix-shell .linked-record {
  box-shadow: 0 8px 24px rgba(0, 22, 70, 0.16);
}

.bitrix-shell .metrics,
.bitrix-shell .dashboard-layout,
.bitrix-shell .workspace,
.bitrix-shell .sales-layout,
.bitrix-shell .deal-toolbar,
.bitrix-shell .customer-card-panel {
  margin: 14px 18px;
}

@media (max-width: 1180px) {
  .bitrix-shell .topbar {
    grid-template-columns: 1fr minmax(220px, 1fr);
  }

  .work-clock {
    display: none;
  }

  .bitrix-shell .user-menu {
    grid-column: 1 / -1;
    justify-content: start;
  }

  .lead-title-row {
    grid-template-columns: 1fr auto auto;
  }

  .lead-search,
  .settings-button {
    grid-column: 1 / -1;
  }
}

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

  .bitrix-shell .sidebar {
    display: none;
  }

  .bitrix-shell .topbar,
  .lead-title-row,
  .lead-filter-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .module-nav {
    margin: 0;
    border-radius: 0;
  }

  .bitrix-shell .customer-stage-kanban {
    grid-template-columns: repeat(4, minmax(260px, 84vw));
  }
}

/* Modern CRM refresh */
:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #182230;
  --muted: #667085;
  --line: #d9e2ec;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --cyan: #06b6d4;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #ef4444;
  --shadow: 0 16px 36px rgba(15, 23, 42, 0.09);
}

body:not(.login-body) {
  grid-template-columns: 248px minmax(0, 1fr);
  background: linear-gradient(180deg, #f7f9fd 0%, #edf3f8 100%);
}

.sidebar {
  background: linear-gradient(180deg, #111827 0%, #172033 48%, #0f766e 100%);
  box-shadow: 10px 0 28px rgba(15, 23, 42, 0.16);
}

.brand-mark {
  border-radius: 12px;
  background: linear-gradient(135deg, #22d3ee, #2563eb);
  border: 0;
}

.nav-item {
  border-radius: 10px;
}

.nav-item span {
  border-radius: 9px;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.14);
}

.shell {
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  align-items: center;
  margin: -22px -22px 20px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(217, 226, 236, 0.86);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  font-size: 26px;
  letter-spacing: 0;
}

.topbar p {
  max-width: 680px;
}

.user-menu {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.notification-button,
.small-button {
  border-radius: 10px;
}

.modern-crm-workspace {
  gap: 16px;
}

.crm-hero {
  border: 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.96), rgba(37, 99, 235, 0.9)),
    #155e75;
  box-shadow: 0 18px 40px rgba(15, 118, 110, 0.16);
}

.crm-hero h2 {
  margin: 4px 0 6px;
  font-size: 24px;
}

.crm-actions {
  grid-template-columns: minmax(280px, 440px) auto;
}

.search {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.modern-tabbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 4px 2px;
}

.modern-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.modern-filter-pills a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.modern-filter-pills a.active,
.modern-filter-pills a:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eef4ff;
  color: var(--blue-dark);
}

.kanban-panel {
  padding: 16px;
  overflow: hidden;
}

.kanban-panel .panel-heading {
  margin-bottom: 14px;
}

.customer-stage-kanban {
  grid-template-columns: repeat(var(--stage-columns, 4), minmax(180px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.customer-stage-column {
  --stage: var(--blue);
  min-height: 540px;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--stage);
  border-radius: 12px;
  background: #f8fafc;
}

.stage-green {
  --stage: #16a34a;
}

.stage-yellow {
  --stage: #f59e0b;
}

.stage-ice {
  --stage: #06b6d4;
}

.stage-turquoise {
  --stage: #2563eb;
}

.stage-green .kanban-head,
.stage-yellow .kanban-head,
.stage-ice .kanban-head,
.stage-turquoise .kanban-head {
  background: transparent;
}

.kanban-head {
  padding: 0 0 10px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
}

.kanban-head strong {
  color: var(--text);
}

.stage-count {
  background: #eef4ff;
  color: var(--stage);
}

.stage-total {
  padding: 12px 0;
  color: var(--text);
  text-align: left;
  font-size: 22px;
  font-weight: 900;
}

.kanban-dropzone {
  gap: 10px;
}

.stage-customer-card {
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(217, 226, 236, 0.9);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.stage-customer-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
}

.stage-customer-card .card-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  gap: 8px;
  align-items: center;
}

.stage-customer-card .counter {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.card-amount {
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

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

.contact-icons {
  color: #98a2b3;
}

.stage-customer-card small {
  color: var(--muted);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.card-footer a {
  color: var(--blue-dark);
  text-decoration: none;
  font-weight: 900;
}

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

.add-stage-form,
.stage-title-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.stage-management {
  min-width: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}

.add-stage-form input,
.stage-title-form input {
  width: min(190px, 42vw);
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.stage-title-form input {
  width: min(150px, 36vw);
}

.stage-title-form button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #e8f6fc;
  color: var(--blue-dark);
  font-weight: 900;
}

.stage-delete-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: #fee2e2;
  color: #b42318;
  font-weight: 900;
}

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

.document-upload-field {
  display: grid;
  gap: 8px;
}

.file-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.file-upload-button {
  width: fit-content;
}

.file-upload-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.document-manager {
  grid-column: 1 / -1;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.document-manager h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.document-item,
.permission-chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.document-item {
  display: flex;
  width: 100%;
  justify-content: space-between;
}

.document-list a,
.permission-chip span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 6px 9px;
  color: var(--blue-dark);
  text-decoration: none;
  font-weight: 800;
}

.permission-chip button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: #fee2e2;
  color: #b42318;
  font-weight: 900;
}

.inline-edit {
  position: relative;
}

.inline-edit summary {
  list-style: none;
}

.inline-edit summary::-webkit-details-marker {
  display: none;
}

.inline-edit-form {
  min-width: min(520px, 88vw);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.inline-edit-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inline-edit-form input,
.inline-edit-form select,
.inline-edit-form textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.role-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.role-card label:not(.check) {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.role-card input:not([type="checkbox"]) {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font-weight: 800;
}

.admin-workspace {
  grid-template-columns: minmax(280px, 0.8fr) minmax(280px, 0.8fr);
}

.full-admin-panel {
  grid-column: 1 / -1;
}

.user-search {
  margin-bottom: 12px;
}

.project-record {
  gap: 12px;
}

.notification-symbol {
  font-size: 18px;
  line-height: 1;
}

.flash {
  position: fixed;
  right: 22px;
  top: 22px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 32px));
  border: 0;
  border-left: 5px solid currentColor;
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
  animation: toast-in 0.22s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stage-violet {
  --stage: #7c3aed;
}

.stage-rose {
  --stage: #e11d48;
}

.stage-violet .kanban-head,
.stage-rose .kanban-head {
  background: transparent;
}

.stage-customer-card.locked {
  cursor: default;
  opacity: 0.82;
}

.stage-customer-card.locked:hover {
  transform: none;
}

.feed-link {
  width: 100%;
  border: 1px solid var(--line);
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.feed-link:hover {
  border-color: rgba(37, 99, 235, 0.28);
  background: #f8fbff;
}

.log-detail-dialog {
  width: min(720px, 100%);
}

.log-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

.log-detail-grid div,
.log-detail-changes {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.log-detail-grid span,
.log-detail-changes > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.log-detail-changes ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--text);
  line-height: 1.45;
}

.admin-workspace {
  grid-template-columns: minmax(320px, 0.78fr) minmax(420px, 1fr);
  gap: 18px;
}

.admin-workspace > .admin-tabs {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(217, 231, 239, 0.95);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 38px rgba(36, 72, 98, 0.1);
}

.admin-workspace > .admin-tabs a {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #52657a;
  padding: 10px 14px;
}

.admin-workspace > .admin-tabs a.active {
  background: linear-gradient(135deg, #1f9bd1, #4f46e5);
  color: #fff;
  box-shadow: 0 10px 22px rgba(31, 155, 209, 0.24);
}

.admin-workspace > .admin-tabs a:hover:not(.active) {
  background: #eef7fc;
  color: var(--blue-dark);
}

.admin-workspace > .full-admin-panel,
.admin-workspace > .workspace {
  grid-column: 1 / -1;
}

.user-search {
  display: grid;
  gap: 10px;
}

.inline-toggle {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modern-kanban-card {
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  border-color: rgba(205, 220, 232, 0.9);
  background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
}

.modern-kanban-card .kanban-card-title {
  grid-template-columns: minmax(0, 1fr) 30px;
}

.modern-kanban-card .kanban-card-title a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.kanban-card-summary,
.kanban-card-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.kanban-card-summary strong {
  color: #172033;
  font-size: 18px;
  font-weight: 900;
}

.kanban-card-summary span,
.kanban-card-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.kanban-card-line strong {
  min-width: 0;
  color: #255f8f;
  font-size: 13px;
  text-align: right;
}

.kanban-project-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kanban-project-chips span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #dcecf5;
  border-radius: 999px;
  background: #eef8fc;
  color: #23657f;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 900;
}

.kanban-assignee-form {
  min-width: 0;
}

.kanban-assignee-form select {
  max-width: 155px;
  min-height: 32px;
  border: 1px solid #d6e6ef;
  border-radius: 8px;
  background: #fff;
  color: #21445e;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.modern-kanban-card a,
.modern-kanban-card span,
.modern-kanban-card strong,
.modern-kanban-card small {
  min-width: 0;
}

.kanban-card-line {
  flex-wrap: nowrap;
}

.kanban-card-line span {
  flex: 0 0 auto;
}

.kanban-card-line strong {
  flex: 1 1 auto;
}

.modern-kanban-card .card-contact {
  grid-template-columns: minmax(0, 1fr);
  padding-top: 8px;
  border-top: 1px dashed #dce7ef;
}

.modern-kanban-card .card-contact a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #567083;
  font-size: 12px;
  font-weight: 800;
}

.modern-kanban-card .contact-icons {
  display: none;
}

@media (max-width: 1100px) {
  body:not(.login-body) {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .modern-tabbar {
    display: grid;
  }

  .kanban-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  body:not(.login-body) {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
    margin: 0 0 16px;
  }

  .modern-tabbar {
    grid-template-columns: 1fr;
  }

  .customer-stage-kanban {
    grid-template-columns: repeat(var(--stage-columns, 4), minmax(220px, 72vw));
  }

  .crm-actions,
  .deal-form,
  .upcoming-grid,
  .customer-general-form,
  .chat-toolbar,
  .chat-compose,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .kanban-panel {
    padding: 12px;
  }

  .customer-stage-column {
    min-height: 480px;
  }

  .topbar,
  .user-menu,
  .panel-heading,
  .record-main,
  .record-actions,
  .kanban-actions {
    align-items: stretch;
  }

  .sales-filter-form,
  .sales-filter-form label,
  .sales-filter-form select,
  .sales-filter-form input,
  .sales-filter-form .small-button {
    width: 100%;
  }

  .add-stage-form {
    width: 100%;
  }

  .add-stage-form input {
    width: 100%;
  }

  .admin-workspace {
    grid-template-columns: 1fr;
  }

  .admin-workspace > .admin-tabs a {
    flex: 1 1 100%;
  }
}

/* Fluid kanban: fit every column into the available viewport without horizontal scroll */
.kanban-panel {
  width: 100%;
  max-width: 100%;
  padding: clamp(12px, 1.4vw, 18px);
  overflow-x: hidden;
}

.kanban-panel .panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
}

.kanban-panel .panel-heading > * {
  min-width: 0;
}

.customer-stage-kanban {
  --kanban-gap: clamp(8px, 1vw, 14px);
  display: grid !important;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: repeat(var(--stage-columns, 4), minmax(0, 1fr)) !important;
  gap: var(--kanban-gap);
  overflow-x: hidden !important;
  overflow-y: visible;
  padding: 4px 0 10px;
}

.customer-stage-column {
  min-width: 0;
  max-width: none;
  min-height: clamp(420px, 58vh, 680px);
  padding: clamp(8px, 0.9vw, 12px);
  overflow-x: hidden;
}

.kanban-dropzone,
.stage-customer-card,
.modern-kanban-card {
  width: 100%;
  min-width: 0;
}

.modern-kanban-card {
  display: grid;
  align-content: start;
  overflow: hidden;
}

.kanban-card-summary,
.kanban-card-line,
.card-footer,
.stage-management,
.stage-title-form,
.add-stage-form {
  min-width: 0;
}

.kanban-card-line strong,
.kanban-card-summary strong,
.card-footer span,
.stage-management,
.stage-title-form,
.stage-title-form form,
.stage-delete-button,
.stage-title-form input,
.add-stage-form input,
.kanban-assignee-form select {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-title-form input {
  width: clamp(80px, 7vw, 150px);
}

.stage-title-form button,
.stage-delete-button {
  width: clamp(26px, 2.4vw, 32px);
  min-width: clamp(26px, 2.4vw, 32px);
}

.kanban-head {
  min-width: 0;
}

.kanban-head .badge {
  flex: 0 0 auto;
}

.kanban-assignee-form,
.kanban-assignee-form select {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 1199px) {
  .customer-stage-kanban {
    gap: 10px;
  }

  .modern-kanban-card {
    padding: 10px;
  }

  .stage-total {
    font-size: 18px;
  }
}

@media (max-width: 991px) {
  .crm-hero,
  .crm-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .calendar-weekdays span {
    padding: 6px 4px;
    font-size: 10px;
  }

  .activity-calendar-grid {
    grid-template-columns: repeat(7, minmax(36px, 1fr));
    gap: 4px;
    overflow-x: auto;
  }

  .calendar-day {
    min-height: 112px;
    padding: 6px;
  }

  .customer-stage-kanban {
    font-size: 12px;
  }

  .modern-kanban-card .kanban-card-title a,
  .kanban-card-summary strong {
    font-size: 13px;
  }

  .stage-customer-card .counter {
    min-width: 20px;
    height: 20px;
    font-size: 11px;
  }
}

@media (max-width: 575px) {
  .shell {
    padding: 12px;
  }

  .kanban-panel {
    padding: 10px;
  }

  .customer-stage-kanban {
    gap: 8px;
    padding-left: 0;
    padding-right: 0;
  }

  .customer-stage-column {
    min-height: 420px;
    padding: 8px;
  }

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

  .calendar-day {
    min-height: 140px;
  }

  .kanban-actions,
  .add-stage-form,
  .stage-management {
    width: 100%;
  }

  .stage-title-form {
    flex: 1 1 auto;
  }

  .stage-title-form input,
  .add-stage-form input {
    width: 100%;
  }
}

.top-language {
  align-self: center;
}

.top-language select {
  background-color: var(--surface-soft);
}

[dir="rtl"] body {
  direction: rtl;
}

[dir="rtl"] .sidebar {
  box-shadow: -10px 0 28px rgba(15, 23, 42, 0.16);
}

[dir="rtl"] .brand,
[dir="rtl"] .nav-item,
[dir="rtl"] .user-menu,
[dir="rtl"] .record-main,
[dir="rtl"] .panel-heading,
[dir="rtl"] .customer-profile-head,
[dir="rtl"] .linked-record,
[dir="rtl"] .language-switcher label {
  flex-direction: row-reverse;
}

[dir="rtl"] .topbar {
  direction: rtl;
}

[dir="rtl"] .notifications-panel {
  left: 0;
  right: auto;
  text-align: right;
}

[dir="rtl"] .notification-item.unread::before {
  left: auto;
  right: 0;
}

[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
  text-align: right;
}

[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="url"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="number"] {
  direction: ltr;
  text-align: left;
}

@media (max-width: 760px) {
  .language-switcher,
  .language-switcher label,
  .language-switcher select {
    width: 100%;
  }

  .login-language {
    justify-self: stretch;
  }
}

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

.nav-group summary {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 12px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 800;
  cursor: pointer;
}

.nav-group summary span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.15);
}

.nav-group .nav-item.child {
  margin-left: 18px;
  padding-left: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.collaboration-workspace {
  display: grid;
  gap: 16px;
}

.collab-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px;
  border-radius: 16px;
  background: rgba(13, 71, 102, 0.12);
}

.collab-tabs span {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 900;
}

.collab-tabs .active {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.chat-app {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.1);
}

.chat-list-pane {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding: 18px;
  border-right: 1px solid var(--line);
  min-width: 0;
}

.chat-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: #e7f8ff;
  color: var(--blue-dark);
  font-size: 24px;
  font-weight: 900;
}

.new-chat-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  padding: 10px;
}

.new-chat-box summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--text);
}

.new-chat-box form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.new-chat-box select[multiple] {
  min-height: 140px;
}

.chat-thread-list {
  display: grid;
  gap: 8px;
  align-content: start;
  overflow: auto;
  min-height: 0;
  padding-right: 4px;
}

.chat-thread-item {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
}

.chat-thread-item:hover,
.chat-thread-item.active {
  background: linear-gradient(135deg, #09a9d7, #1677d2);
  color: #fff;
}

.chat-avatar {
  width: 50px;
  height: 50px;
  display: inline-grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #7c6bd6, #12b7df);
  color: #fff;
  font-weight: 900;
}

.chat-avatar.large {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  font-size: 24px;
}

.thread-summary {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.thread-summary strong,
.thread-summary small,
.thread-summary em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-summary small,
.chat-thread-item time {
  color: var(--muted);
  font-size: 12px;
}

.chat-thread-item.active small,
.chat-thread-item.active time,
.chat-thread-item.active em,
.chat-thread-item:hover small,
.chat-thread-item:hover time,
.chat-thread-item:hover em {
  color: rgba(255, 255, 255, 0.82);
}

.chat-main-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  background: linear-gradient(135deg, rgba(9, 169, 215, 0.16), rgba(22, 119, 210, 0.12)), #eef8ff;
}

.chat-main-header {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
}

.chat-main-header h2 {
  margin: 0;
  font-size: 22px;
}

.chat-main-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.customer-tag {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e7f8ff;
  color: var(--blue-dark);
  text-decoration: none;
  font-weight: 900;
  font-size: 12px;
}

.chat-conversation {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
}

.thread-compose {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) minmax(150px, 190px) auto;
  gap: 10px;
  align-items: end;
  margin: 0 24px 24px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.thread-compose textarea {
  min-height: 54px;
  resize: vertical;
}

.chat-empty-state {
  place-self: center;
}

.message-tag {
  margin: 6px 0 0;
}

.calendar-workspace {
  display: grid;
  gap: 18px;
}

.calendar-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 490px);
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, rgba(7, 89, 133, 0.98), rgba(13, 148, 136, 0.88)), #075985;
}

.calendar-hero h2 {
  margin: 0 0 6px;
  font-size: 34px;
}

.calendar-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.calendar-top-actions,
.calendar-view-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.calendar-top-actions {
  justify-content: space-between;
}

.calendar-view-tabs {
  padding: 6px;
  border-radius: 14px;
  background: rgba(15, 71, 102, 0.1);
}

.calendar-view-tabs a {
  padding: 10px 16px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 900;
}

.calendar-view-tabs a.active {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

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

.calendar-board,
.mini-calendar {
  border-radius: 18px;
}

.calendar-board-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.day-agenda {
  display: grid;
  border-top: 1px solid var(--line);
}

.agenda-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 74px;
  border-bottom: 1px solid var(--line);
}

.agenda-row time {
  padding: 14px 10px;
  color: var(--muted);
}

.agenda-row > div {
  padding: 10px;
}

.agenda-items {
  display: grid;
  align-content: start;
  gap: 8px;
}

.week-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 10px;
  overflow-x: auto;
}

.week-day-card {
  min-height: 240px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.modern-month-grid {
  min-height: 580px;
}

.mini-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 34px));
  justify-content: center;
  gap: 6px;
}

.mini-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 34px));
  justify-content: center;
  gap: 6px;
  margin: 10px 0 8px;
}

.mini-calendar-weekdays span {
  display: inline-grid;
  place-items: center;
  height: 22px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.mini-month-grid .calendar-day {
  min-height: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
}

.mini-month-grid .calendar-day-head {
  justify-content: center;
  width: 100%;
  height: 100%;
}

.mini-month-grid .calendar-day-number {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
}

.mini-month-grid .calendar-day.muted .calendar-day-number {
  color: #94a3b8;
  background: #f8fafc;
}

.mini-month-grid .calendar-day.today .calendar-day-number,
.mini-month-grid .calendar-day.selected .calendar-day-number {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.task-workspace {
  display: grid;
  gap: 16px;
}

.task-command-bar {
  display: flex;
  justify-content: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.task-view-switcher {
  display: inline-flex;
  width: fit-content;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eef4ff;
}

.task-view-switcher a {
  padding: 9px 16px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 900;
}

.task-view-switcher a.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.task-create-panel {
  max-width: 780px;
}

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

.task-tabs {
  margin-bottom: 0;
}

.task-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  max-width: 100%;
  overflow: visible;
}

.task-filter-form .search {
  flex: 1 1 240px;
  min-width: min(100%, 220px);
}

.task-filter-form select,
.task-filter-form input[type="date"] {
  flex: 1 1 136px;
  min-width: 120px;
  max-width: 180px;
}

.task-filter-form button {
  flex: 0 0 auto;
}

.task-assignee-picker {
  gap: 8px;
}

.task-assignee-combobox {
  position: relative;
}

.task-assignee-combobox summary {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.task-assignee-combobox summary::-webkit-details-marker {
  display: none;
}

.task-assignee-combobox summary::after {
  content: "⌄";
  color: var(--blue);
  font-size: 18px;
  font-weight: 900;
}

.task-assignee-combobox[open] summary::after {
  transform: rotate(180deg);
}

.task-assignee-combobox summary strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-assignee-dropdown {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.task-assignee-list {
  max-height: 220px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.activity-customer-picker-field {
  position: relative;
}

.searchable-select {
  position: relative;
  display: block;
}

.native-searchable-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.searchable-select-trigger {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.searchable-select.is-disabled .searchable-select-trigger,
.searchable-select-trigger:disabled {
  cursor: not-allowed;
  background: #f1f5f9;
  color: var(--muted);
  opacity: 0.72;
}

.searchable-select-trigger::after {
  content: "⌄";
  color: var(--blue);
  font-size: 18px;
  font-weight: 900;
}

.searchable-select-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-select-menu {
  position: absolute;
  z-index: 35;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
}

.searchable-select-options {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
}

.searchable-select-options[data-empty="true"]::after {
  content: attr(data-empty-message);
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.searchable-select-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.searchable-select-option {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.searchable-select-option:hover,
.searchable-select-option.active {
  background: #eaf6ff;
  color: var(--blue);
}

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

.task-card.is-deleted {
  opacity: 0.68;
}

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

.task-detail-grid > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.task-detail-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-detail-grid strong {
  color: var(--text);
}

.task-notes {
  padding: 12px;
  border-radius: 12px;
  background: #f8fafc;
}

.task-kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 6px;
}

.task-kanban-column {
  min-height: 420px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.task-kanban-column header,
.task-kanban-meta,
.task-document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-kanban-column header {
  margin-bottom: 12px;
}

.task-kanban-column header span {
  min-width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #e0f2fe;
  color: var(--blue-dark);
  font-weight: 900;
}

.task-kanban-column-body {
  display: grid;
  gap: 10px;
}

.task-kanban-column.drag-over {
  outline: 2px dashed var(--blue);
  outline-offset: -5px;
  background: #eff6ff;
}

.task-kanban-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(205, 220, 232, 0.9);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.task-kanban-card:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.1);
}

.task-kanban-card[draggable="true"] {
  cursor: pointer;
}

.task-kanban-card .kanban-card-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.task-kanban-card .kanban-card-title strong {
  overflow: hidden;
  color: #172033;
  font-size: 15px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-kanban-card .counter {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.task-kanban-card .kanban-card-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-kanban-title {
  color: var(--blue);
  font-weight: 900;
  text-decoration: none;
}

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

.task-kanban-meta span,
.task-kanban-assignees {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-document-panel {
  margin-top: 12px;
}

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

.task-document-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.task-document-row a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.task-calendar .task-calendar-card {
  cursor: grab;
}

.task-calendar.calendar-view-day .calendar-weekdays,
.task-calendar.calendar-view-day .activity-calendar-grid {
  grid-template-columns: minmax(0, 1fr);
}

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

.task-drop-day.drag-over {
  outline: 2px dashed var(--blue);
  outline-offset: -5px;
  background: #eff6ff;
}

@media (max-width: 1100px) {
  .chat-app,
  .calendar-page-grid,
  .calendar-hero {
    grid-template-columns: 1fr;
  }

  .chat-list-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .thread-compose {
    grid-template-columns: 1fr;
  }

  .task-layout,
  .task-detail-layout,
  .task-filter-form {
    grid-template-columns: 1fr;
  }

  .task-kanban-board {
    grid-template-columns: repeat(4, minmax(230px, 1fr));
  }
}

.bitrix-chat-shell .collab-tabs {
  display: none;
}

.chat-list-pane {
  position: relative;
  grid-template-rows: auto 1fr;
}

.member-picker-popover {
  position: absolute;
  z-index: 20;
  top: 74px;
  left: 18px;
  right: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
}

.member-picker-popover form {
  display: grid;
  gap: 10px;
}

.member-check-list {
  display: grid;
  gap: 6px;
  max-height: 270px;
  overflow: auto;
}

.member-check-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.member-check-option input {
  grid-row: span 2;
}

.member-check-option span,
.member-check-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-check-option small {
  color: var(--muted);
}

.chat-conversation .chat-message {
  align-self: flex-start;
  width: min(620px, 82%);
  border-radius: 16px 16px 16px 4px;
  background: #fff;
}

.chat-conversation .chat-message.own {
  align-self: flex-end;
  border-color: rgba(34, 197, 94, 0.22);
  border-radius: 16px 16px 4px 16px;
  background: #dcf8c6;
}

.chat-conversation .chat-message-head {
  gap: 18px;
}

.message-customer-link {
  color: var(--blue-dark);
  font-weight: 900;
  text-decoration: none;
}

.message-customer-link:hover {
  text-decoration: underline;
}

.thread-compose {
  position: relative;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  border-radius: 22px;
  margin: 0 20px 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.thread-compose .chat-message-field {
  display: block;
}

.thread-compose .chat-message-field textarea {
  min-height: 56px;
  max-height: 130px;
  resize: none;
  border: 0;
  background: #f8fafc;
  border-radius: 18px;
  padding: 16px 16px;
}

.chat-file-icon {
  position: relative;
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.chat-file-icon:hover,
.chat-file-icon.has-file {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
}

.chat-file-icon.has-file::after {
  content: "";
  position: absolute;
  right: 3px;
  top: 3px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #22c55e;
}

.chat-file-icon img {
  width: 24px;
  height: 24px;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.chat-file-icon input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.customer-mention-list {
  position: absolute;
  left: 64px;
  right: 12px;
  bottom: calc(100% + 8px);
  z-index: 15;
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.customer-mention-list button {
  border: 0;
  border-radius: 10px;
  padding: 9px 11px;
  background: #f3f8ff;
  color: var(--text);
  text-align: left;
  font-weight: 900;
}

.customer-mention-list button:hover {
  background: #e7f8ff;
  color: var(--blue-dark);
}

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

@media (max-width: 760px) {
  .chat-app {
    min-height: calc(100vh - 190px);
  }

  .chat-thread-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .chat-thread-item time {
    grid-column: 2;
  }

  .chat-main-header {
    padding: 14px;
  }

  .chat-conversation {
    padding: 14px;
  }

  .thread-compose {
    margin: 0 12px 12px;
  }
}

.quote-module-panel {
  margin-bottom: 18px;
}

.quote-wizard-form {
  gap: 16px;
}

.quote-wizard-form small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.timeshare-quote-form {
  display: grid;
  gap: 18px;
}

.quote-form-section {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}

.quote-form-section h3 {
  margin: 0;
  color: var(--text);
}

.quote-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  align-items: end;
}

.quote-form-grid .full {
  grid-column: 1 / -1;
}

.timeshare-quote-main-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, .82fr);
  gap: 18px;
  align-items: start;
}

.timeshare-quote-side {
  display: grid;
  gap: 12px;
}

.timeshare-info-section .quote-form-grid,
.timeshare-property-section .quote-form-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.price-currency-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 8px;
}

.quote-discount-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quote-discount-row label {
  min-width: 0;
}

.timeshare-save-actions {
  justify-content: flex-start;
  margin: 0;
}

.timeshare-save-actions .primary-button {
  min-width: 160px;
}

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

.quote-file-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.quote-file-field > span:first-child {
  width: 100%;
}

.quote-customer-modal {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.quote-customer-modal::backdrop {
  background: rgba(15, 23, 42, 0.36);
}

.quote-customer-modal .form {
  padding: 20px;
}

.quote-detail-modal {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.quote-detail-modal::backdrop {
  background: rgba(15, 23, 42, 0.36);
}

.quote-detail-content {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.quote-detail-content h3 {
  margin: 4px 0 0;
}

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

.quote-detail-grid > div,
.quote-detail-grid > label {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
}

.quote-detail-grid .full {
  grid-column: 1 / -1;
}

.quote-detail-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quote-detail-edit-field input,
.quote-detail-edit-field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font-weight: 800;
}

.sale-edit-form .form-actions {
  justify-content: flex-end;
}

.readonly-table {
  display: grid;
  gap: 4px;
}

.readonly-table > div {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(110px, .8fr) minmax(120px, .8fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.readonly-table-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.quote-detail-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-plan-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #f8fbfe;
}

.panel-heading.compact {
  margin-bottom: 10px;
  padding-bottom: 0;
}

.panel-heading.compact h3 {
  margin: 0;
}

.payment-plan-table {
  display: grid;
  gap: 5px;
  overflow-x: visible;
}

.payment-plan-head,
.payment-plan-row {
  display: grid;
  grid-template-columns: 28px minmax(115px, .9fr) minmax(126px, .78fr) minmax(120px, .84fr) minmax(62px, .38fr);
  gap: 6px;
  min-width: 0;
  align-items: center;
}

.payment-plan-head {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.payment-plan-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-plan-row input,
.payment-plan-row select {
  min-width: 0;
  width: 100%;
  height: 34px;
  padding: 7px 9px;
}

.payment-plan-row .icon-button {
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  justify-self: start;
}

.payment-plan-actions {
  margin-top: 10px;
}

.payment-plan-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  color: var(--text);
  font-size: 13px;
}

.payment-plan-summary span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.payment-plan-summary em {
  font-style: normal;
  font-weight: 800;
}

.payment-plan-summary[data-state="equal"] em {
  color: #15803d;
}

.payment-plan-summary[data-state="under"] em,
.payment-plan-summary[data-state="over"] em {
  color: #b45309;
}

.quote-config-form {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
}

.compact-list .record {
  padding: 10px 12px;
}

.quote-rich-row small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 1120px) {
  .timeshare-quote-main-grid {
    grid-template-columns: 1fr;
  }

  .timeshare-quote-list-panel .quote-list-row.quote-rich-row,
  .customer-quote-sales-list .quote-list-row.quote-rich-row {
    grid-template-columns: minmax(0, 1fr) 120px 145px;
  }

  .timeshare-quote-list-panel .quote-list-row.quote-rich-row > div:first-child,
  .customer-quote-sales-list .quote-list-row.quote-rich-row > div:first-child {
    grid-column: 1 / -1;
  }

  .timeshare-quote-list-panel .quote-list-row.quote-rich-row .quote-date-pair,
  .customer-quote-sales-list .quote-list-row.quote-rich-row .quote-date-pair {
    grid-column: 1 / 2;
  }

  .timeshare-quote-list-panel .quote-list-row.quote-rich-row .record-actions,
  .customer-quote-sales-list .quote-list-row.quote-rich-row .record-actions {
    grid-column: 2 / -1;
  }
}

@media (max-width: 760px) {
  .quote-list-row.quote-rich-row,
  .timeshare-quote-list-panel .quote-list-row.quote-rich-row,
  .customer-quote-sales-list .quote-list-row.quote-rich-row {
    grid-template-columns: 1fr;
  }

  .timeshare-quote-list-panel .quote-list-row.quote-rich-row .deal-amount,
  .timeshare-quote-list-panel .quote-list-row.quote-rich-row > .badge,
  .timeshare-quote-list-panel .quote-list-row.quote-rich-row .quote-date-pair,
  .timeshare-quote-list-panel .quote-list-row.quote-rich-row .record-actions,
  .customer-quote-sales-list .quote-list-row.quote-rich-row .deal-amount,
  .customer-quote-sales-list .quote-list-row.quote-rich-row > .badge,
  .customer-quote-sales-list .quote-list-row.quote-rich-row .quote-date-pair,
  .customer-quote-sales-list .quote-list-row.quote-rich-row .record-actions {
    grid-column: auto;
    justify-self: start;
  }

  .timeshare-quote-list-panel .quote-list-row.quote-rich-row .record-actions,
  .customer-quote-sales-list .quote-list-row.quote-rich-row .record-actions {
    flex-wrap: wrap;
  }

  .timeshare-quote-main-grid {
    grid-template-columns: 1fr;
  }

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

  .quote-detail-grid,
  .readonly-table > div {
    grid-template-columns: 1fr;
  }

  .payment-plan-head,
  .payment-plan-row {
    grid-template-columns: 26px minmax(86px, .85fr) minmax(108px, .95fr) minmax(96px, 1fr) minmax(50px, .4fr);
    gap: 5px;
    min-width: 0;
  }

  .payment-plan-row input,
  .payment-plan-row select {
    padding: 6px 7px;
    font-size: 12px;
  }
}

.quote-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eef6fb;
}

.quote-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 900;
  text-decoration: none;
}

.quote-tabs a.active,
.quote-tabs a:hover {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.timeshare-form {
  gap: 18px;
}

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

.timeshare-form-grid .full {
  grid-column: 1 / -1;
}

.timeshare-period-section {
  display: grid;
  gap: 12px;
}

.timeshare-period-section h3 {
  margin: 0;
  text-align: center;
  letter-spacing: 0.08em;
}

.timeshare-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.timeshare-period-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.timeshare-period-table th,
.timeshare-period-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
}

.timeshare-period-table th {
  background: #f8fbfe;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
}

.timeshare-period-table input,
.timeshare-period-table select,
.timeshare-period-table textarea {
  width: 100%;
  min-height: 40px;
}

.timeshare-management-workspace {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.timeshare-sub-tabs {
  justify-self: start;
}

.timeshare-real-estate-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.timeshare-panel,
.timeshare-unit-list-panel {
  min-width: 0;
}

.timeshare-real-estate-layout .timeshare-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
}

.timeshare-unit-list-panel .panel-heading {
  align-items: flex-start;
  flex-wrap: wrap;
}

.timeshare-price-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(560px, 1.28fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.timeshare-price-import-panel {
  margin-bottom: 14px;
}

.timeshare-price-import-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.timeshare-price-import-form .document-upload-field {
  margin: 0;
}

.primary-link-button {
  background: var(--blue) !important;
  color: #fff !important;
  border: 1px solid var(--blue) !important;
  box-shadow: 0 10px 22px rgba(31, 155, 209, 0.22);
}

.primary-link-button:hover {
  background: var(--blue-dark) !important;
  border-color: var(--blue-dark) !important;
}

.timeshare-price-form,
.timeshare-price-list-panel {
  min-width: 0;
}

.timeshare-price-list-panel,
.timeshare-price-list-panel .table-list,
.timeshare-price-list-panel .record,
.timeshare-price-list-panel .record-meta,
.timeshare-price-list-panel .price-list-edit,
.timeshare-price-list-panel .timeshare-price-edit-form,
.timeshare-price-list-panel .timeshare-price-table-section,
.timeshare-price-list-panel .timeshare-price-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.timeshare-price-list-panel .record {
  display: block;
}

.timeshare-price-list-panel .record-meta {
  display: block;
  width: 100%;
}

.price-list-edit,
.price-list-edit[open],
.inline-edit-form.timeshare-price-edit-form {
  display: block;
  width: 100%;
}

.inline-edit-form.timeshare-price-edit-form {
  min-width: 0;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr) !important;
}

.timeshare-price-edit-form .form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.timeshare-price-edit-form .timeshare-price-table-section {
  grid-column: 1 / -1;
  display: block;
}

.timeshare-price-edit-form .form-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
  margin-top: 10px;
}

.timeshare-price-form .full {
  grid-column: 1 / -1;
}

.timeshare-price-table-section {
  display: grid;
  gap: 10px;
}

.timeshare-price-table-section h3 {
  margin: 4px 0 0;
  text-align: center;
  letter-spacing: 0.08em;
}

.timeshare-price-table-wrap {
  display: block;
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.timeshare-price-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.timeshare-price-edit-form .timeshare-price-table {
  min-width: 980px;
}

.timeshare-price-table th,
.timeshare-price-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: middle;
}

.timeshare-price-table th {
  background: #f8fbfe;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
}

.timeshare-price-table input,
.timeshare-price-table select {
  width: 100%;
  min-height: 40px;
}

.timeshare-price-table td:first-child {
  width: 86px;
  white-space: nowrap;
}

.timeshare-price-table td:first-child {
  display: flex;
  gap: 8px;
  align-items: center;
}

.timeshare-price-table .icon-button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
}

.project-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.project-type-card {
  align-items: stretch;
}

.project-type-permissions {
  margin-top: 10px;
}

.project-admin-workspace {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.project-sub-tabs {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.sub-tabs {
  width: fit-content;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(207, 225, 237, 0.95);
  border-radius: 14px;
  background: #edf6fb;
}

.sub-tabs a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 10px;
  color: #5b6d80;
  font-weight: 900;
  text-decoration: none;
}

.sub-tabs a.active,
.sub-tabs a:hover {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 12px 24px rgba(23, 91, 128, 0.1);
}

.project-definition-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.project-list-panel,
.project-types-panel {
  min-width: 0;
}

.project-definition-form,
.project-type-add-form {
  grid-column: 1;
}

.project-list-panel {
  grid-column: 2;
}

.project-definition-grid .project-list-panel:only-child {
  grid-column: 1 / -1;
}

.project-record {
  display: grid;
  gap: 12px;
}

.project-record .record-main {
  align-items: flex-start;
}

.project-permission-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  max-width: 520px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.project-permission-form select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  background: #fff;
}

.project-permissions-list {
  gap: 8px;
}

.project-admin-workspace .inline-edit-form {
  min-width: 0;
  width: 100%;
  box-shadow: none;
}

.project-type-management-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.project-type-add-form {
  min-width: 0;
}

.project-types-panel {
  grid-column: 2;
}

.project-type-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.project-type-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.project-type-card-head > div {
  min-width: 0;
}

.project-type-card .record-title,
.project-type-card .record-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-type-permissions {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.project-type-permissions .small-button,
.project-type-inline-edit .small-button {
  justify-self: start;
}

.project-type-card .checkbox-list {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 0;
  background: #f8fafc;
}

.project-type-inline-edit .inline-edit-form {
  margin-top: 10px;
  border-radius: 10px;
  background: #fbfdff;
}

.payment-method-form,
.payment-method-list-panel,
.discount-authority-form,
.discount-authority-list-panel {
  min-width: 0;
}

.payment-method-record .record-main,
.discount-authority-record .record-main {
  align-items: flex-start;
}

.payment-method-record .record-badges,
.discount-authority-record .record-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.payment-method-record .record-title,
.payment-method-record .record-subtitle,
.discount-authority-record .record-title,
.discount-authority-record .record-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
}

.payment-method-inline-form [data-payment-interim-fields] {
  grid-column: 1 / -1;
}

.payment-method-inline-form .check {
  align-self: center;
}

@media (max-width: 760px) {
  .project-admin-workspace,
  .project-definition-grid,
  .project-type-management-grid {
    grid-template-columns: 1fr;
  }

  .project-definition-form,
  .project-type-add-form,
  .project-list-panel,
  .project-types-panel,
  .payment-method-form,
  .payment-method-list-panel,
  .discount-authority-form,
  .discount-authority-list-panel {
    grid-column: 1;
  }

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

  .sub-tabs {
    width: 100%;
  }

  .sub-tabs a {
    flex: 1 1 150px;
  }

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

  .timeshare-price-layout {
    grid-template-columns: 1fr;
  }

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

  .timeshare-real-estate-layout {
    grid-template-columns: 1fr;
  }

  .quote-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}

@media (max-width: 980px) {
  .timeshare-price-layout {
    grid-template-columns: 1fr;
  }

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