/* Final control contract: explicit native-select sizing, structured forms, and data tables. */
:root {
  --control-border: #d9dfe9;
  --control-focus: #1b84ff;
  --control-bg: var(--surface);
  --control-height: 40px;
}
:root[data-theme="dark"] {
  --control-border: #363843;
  --control-focus: #6ca7ff;
}
body input.kt-input:not([type="checkbox"]):not([type="file"]),
body select.kt-select,
body .picker-trigger.kt-select {
  display: block;
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  box-sizing: border-box;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  background-color: var(--control-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 20px;
  padding: 9px 12px;
  box-shadow: 0 1px 2px #00000003;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
body select.kt-select,
body .picker-trigger.kt-select {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  cursor: pointer;
  padding: 9px 36px 9px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378829d' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
body select.kt-select option {
  background: var(--surface);
  color: var(--text);
  padding: 8px;
}
body textarea.kt-textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  min-height: 104px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.65;
  background: var(--control-bg);
  color: var(--text);
  border: 1px solid var(--control-border);
  border-radius: 6px;
  outline: none;
  resize: vertical;
  box-shadow: none;
}
body .kt-input:focus-visible,
body select.kt-select:focus-visible,
body .kt-textarea:focus-visible,
body .picker-trigger:focus-visible {
  border-color: var(--control-focus);
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--control-focus) 13%, transparent);
  outline: none;
}
body .kt-input:disabled,
body .kt-select:disabled,
body .kt-textarea:disabled {
  background-color: var(--surface-soft);
  color: var(--text-secondary);
  opacity: 0.7;
  cursor: not-allowed;
}
body .kt-input[readonly],
body .kt-textarea[readonly] {
  background: var(--surface-soft);
}
body input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  accent-color: #1b84ff;
  vertical-align: middle;
}
.check {
  font-size: 12px !important;
  line-height: 1.7;
  align-items: flex-start;
  gap: 9px;
}
.check input {
  margin-top: 3px !important;
}
.kt-input::placeholder,
.kt-textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.75;
}
.mt-field.kt-form-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 20px;
  min-width: 0;
}
.mt-field > .kt-form-label {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.5;
  color: var(--text);
  width: auto;
  margin: 0;
  padding: 0;
}
.required-mark {
  color: #d34155;
  font-size: 12px;
}
.mt-field > .kt-input,
.mt-field > .kt-select,
.mt-field > .kt-textarea {
  margin: 0;
}
.mt-field .kt-form-message {
  display: none;
  margin: 0;
  font-size: 11px;
  color: #db4b61;
  line-height: 1.6;
}
.mt-field.has-error .kt-form-message {
  display: block;
}
.mt-field.has-error > .kt-input,
.mt-field.has-error > .kt-select,
.mt-field.has-error > .kt-textarea {
  border-color: #db4b61;
}
form .columns {
  column-gap: 28px;
  align-items: start;
}
.columns > div {
  min-width: 0;
}
#task-form,
#rule-form {
  max-width: 100%;
  overflow: visible;
}
#task-form {
  padding: 0 20px 20px;
  max-width: 1100px;
  border-radius: 10px;
}
#task-form > .section-heading {
  min-height: 54px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 18px;
  padding: 10px 0;
}
#task-form > .section-heading h2 {
  font-size: 16px;
}
#task-form > .section-heading button {
  min-height: 32px;
  padding: 7px 11px;
  font-size: 12px;
}
#task-form > .primary {
  margin-left: auto;
  display: flex;
  min-width: 124px;
  min-height: 38px;
  font-size: 12px;
}
#task-form .columns {
  gap: 24px 30px;
}
#task-form textarea.kt-textarea {
  min-height: 118px;
}
#rule-form .columns {
  gap: 32px;
}
#rule-form > .actions {
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
#rule-form .primary {
  min-width: 130px;
  min-height: 38px;
}
#rule-form .note {
  margin-top: 18px;
}
.card:has(> #rule-form) {
  padding: 24px 28px;
}
.card:has(> #rule-form) > h2 {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 24px;
  font-size: 16px;
}
#account-form {
  max-width: 650px;
  padding-top: 12px;
}
#account-form > .primary {
  min-height: 38px;
  min-width: 140px;
  font-size: 12px;
  margin-top: 8px;
}
#account-form .check {
  margin: 8px 0 18px;
}
#auth-form .mt-field {
  margin-bottom: 20px;
}
#auth-form .kt-form-label {
  font-size: 13px;
}
#auth-form input.kt-input {
  height: 44px;
  min-height: 44px;
}
.customer-picker {
  position: relative;
  min-width: 0;
}
.picker-trigger {
  position: relative;
}
.picker-trigger > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-panel.kt-card {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 8px;
  box-shadow: 0 8px 28px #00000018;
  max-height: 310px;
}
.picker-panel > input.kt-input {
  height: 36px;
  min-height: 36px;
  font-size: 12px;
  padding: 7px 10px;
}
.picker-options {
  overflow: auto;
  max-height: 240px;
  margin-top: 6px;
  overscroll-behavior: contain;
}
.picker-option {
  display: block;
  white-space: normal;
  text-align: left;
  line-height: 1.5;
  padding: 10px;
  width: 100%;
  border: 0;
  font-size: 12px;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
}
.picker-option:hover,
.picker-option.highlighted {
  background: var(--surface-hover);
}
.picker-option[aria-selected="true"] {
  background: var(--brand-soft);
  color: var(--brand);
}
.picker-empty {
  padding: 18px 10px;
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
}
body .crm-toolbar {
  align-items: center;
  gap: 12px;
}
.crm-toolbar > input.kt-input {
  max-width: 340px;
  flex: 1;
  min-width: 200px;
  padding-left: 14px;
}
.crm-toolbar > select.kt-select {
  width: 200px;
  min-width: 165px;
  flex: 0 0 auto;
  font-size: 12px;
}
.crm-toolbar > .check {
  margin-left: auto;
  max-width: 220px;
}
.customer-table-wrap.kt-card {
  padding: 0 !important;
  overflow: hidden;
}
.customer-table-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.customer-table-heading h2 {
  font-size: 14px;
  margin: 0 0 3px;
  font-weight: 600;
}
.customer-table-heading p {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0;
}
.customer-table-heading > label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  white-space: nowrap;
  margin: 0;
  color: var(--text-secondary);
}
.customer-table-heading select.kt-select {
  height: 34px;
  min-height: 34px;
  font-size: 11px;
  width: 190px;
  padding-block: 6px;
}
.customer-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  white-space: nowrap;
}
.customer-table thead {
  background: var(--surface-soft);
}
.customer-table th {
  position: sticky;
  top: 0;
  padding: 14px 18px;
  font-size: 10px;
  letter-spacing: 0.3px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.customer-table td {
  padding: 15px 18px;
  font-size: 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.customer-table th:first-child,
.customer-table td:first-child {
  padding-left: 24px;
  width: 29%;
}
.customer-table th:last-child,
.customer-table td:last-child {
  padding-right: 24px;
  text-align: right;
}
.customer-table tr:last-child td {
  border-bottom: 0;
}
.customer-table tbody tr:hover {
  background: color-mix(in srgb, var(--brand) 3%, var(--surface));
}
.customer-table .crm-identity {
  gap: 11px;
}
.customer-table .crm-identity strong {
  font-size: 13px;
  font-weight: 550;
  max-width: 220px;
}
.customer-table .crm-identity .small {
  font-size: 11px;
  margin-top: 3px;
}
.customer-table .avatar {
  height: 38px;
  width: 38px;
  border-radius: 7px;
}
.customer-table td select.kt-select {
  width: 160px;
  max-width: 175px;
  min-width: 145px;
  height: 34px;
  min-height: 34px;
  line-height: 20px;
  font-size: 11px;
  padding: 6px 30px 6px 10px;
  background-color: var(--surface);
  border-color: var(--border);
  box-shadow: none;
  background-position: right 8px center;
}
.customer-table .text-button {
  padding: 7px 10px;
  min-height: 32px;
  font-size: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.customer-table .text-button:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: transparent;
}
.customer-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  color: var(--text-secondary);
  font-size: 11px;
  background: var(--surface);
}
.table-pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}
.table-pagination label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 11px;
}
.table-pagination select.kt-select {
  width: 72px;
  height: 32px;
  min-height: 32px;
  font-size: 11px;
  padding: 5px 27px 5px 9px;
  background-position: right 7px center;
}
.table-pagination button {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 5px;
}
.table-pagination button:hover:not(:disabled) {
  background: var(--brand-soft);
  color: var(--brand);
}
.table-pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.table-pagination > span {
  min-width: 38px;
  text-align: center;
}
.crm-list-row select.kt-select,
.task-card > select.kt-select {
  height: 36px;
  min-height: 36px;
  font-size: 11px;
  padding: 7px 30px 7px 10px;
}
.crm-list-row select.kt-select {
  width: 138px;
  max-width: none;
}
.task-card > select.kt-select {
  width: 100%;
}
#theme-select.kt-select {
  height: 32px;
  min-height: 32px;
  width: 130px;
  font-size: 11px;
  padding: 5px 28px 5px 9px;
  background-position: right 7px center;
}
.inbox-crm-filter select.kt-select {
  height: 32px;
  min-height: 32px;
  font-size: 10px;
  padding: 5px 25px 5px 8px;
  background-position: right 6px center;
}
.list-account select.kt-select {
  height: 34px;
  min-height: 34px;
  font-size: 11px;
  padding: 6px 30px 6px 10px;
}
.list-filters select.kt-select {
  width: 92px;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  font-size: 10px;
  padding: 6px 23px 6px 5px;
  border: 0;
  background-position: right 4px center;
  box-shadow: none;
}
.search-wrap input.kt-input {
  height: 38px;
  min-height: 38px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
}
.search-wrap input.kt-input:focus {
  box-shadow: none;
}
.chat-body #conversation-details .mt-field {
  margin: 0 0 16px;
  gap: 7px;
}
.chat-body #conversation-details .kt-form-label {
  font-size: 11px;
}
.chat-body #conversation-details select.kt-select,
.chat-body #conversation-details input.kt-input {
  height: 36px;
  min-height: 36px;
  font-size: 12px;
  padding-block: 7px;
}
.chat-body #conversation-details textarea.kt-textarea {
  font-size: 12px;
  min-height: 108px;
}
.chat-body #conversation-details .mt-field + button.primary {
  margin-top: 8px;
}
#message-search-wrap input.kt-input {
  height: 36px;
  min-height: 36px;
  font-size: 12px;
}
#send-form textarea.kt-textarea {
  height: auto;
  min-height: 45px;
  max-height: 140px;
  border: 0;
  box-shadow: none;
  padding: 3px 0;
  resize: none;
  outline: none;
  border-radius: 0;
  font-size: 14px;
}
#send-form textarea.kt-textarea:focus {
  box-shadow: none;
}
.card:has(> #account-form) > h2 {
  font-size: 16px;
  margin-bottom: 12px;
}
@media (max-width: 1250px) {
  .customer-table-wrap.kt-card {
    overflow-x: auto;
  }
  .customer-table {
    min-width: 920px;
  }
  .customer-table-heading,
  .customer-table-footer {
    min-width: 0;
  }
  .customer-table-heading {
    padding: 12px 16px;
  }
  .customer-table th,
  .customer-table td {
    padding: 13px 14px;
  }
  .crm-toolbar > select.kt-select {
    width: 180px;
    min-width: 155px;
  }
  .crm-toolbar > .check {
    margin-left: 0;
  }
}
@media (max-width: 700px) {
  :root {
    --control-height: 44px;
  }
  body input.kt-input:not([type="checkbox"]):not([type="file"]),
  body select.kt-select,
  body textarea.kt-textarea,
  body .picker-trigger.kt-select {
    font-size: 16px;
    line-height: 22px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .mt-field.kt-form-item {
    gap: 8px;
    margin-bottom: 18px;
  }
  .mt-field > .kt-form-label {
    font-size: 13px;
  }
  form .columns {
    grid-template-columns: 1fr;
    gap: 0 !important;
  }
  #task-form {
    padding: 0 18px 18px;
  }
  #task-form > .section-heading {
    margin: 0 0 16px;
    padding: 10px 0;
    min-height: 54px;
  }
  #task-form > .primary {
    width: 100%;
    min-height: 42px;
    font-size: 13px;
  }
  .card:has(> #rule-form) {
    padding: 18px;
  }
  #rule-form > .actions {
    justify-content: stretch;
  }
  #rule-form > .actions button {
    flex: 1;
    min-height: 42px;
  }
  .picker-panel.kt-card {
    max-height: 340px;
    box-shadow: 0 8px 24px #0002;
  }
  .picker-panel > input.kt-input {
    height: 42px;
    min-height: 42px;
    font-size: 16px;
  }
  .picker-option {
    padding: 12px;
    font-size: 14px;
    min-height: 44px;
  }
  .picker-options {
    max-height: 260px;
  }
  .crm-toolbar {
    gap: 10px;
  }
  .crm-toolbar > input.kt-input {
    flex-basis: 100%;
    max-width: none;
    min-width: 0;
  }
  .crm-toolbar > select.kt-select {
    width: auto;
    min-width: 0;
    flex: 1 1 calc(50% - 8px);
    font-size: 12px;
    height: 40px;
    min-height: 40px;
    padding: 9px 28px 9px 10px;
  }
  .crm-toolbar > .check {
    font-size: 11px !important;
    flex-basis: 100%;
    max-width: none;
  }
  .customer-table-wrap.kt-card {
    overflow: visible !important;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .customer-table-heading {
    align-items: flex-start;
    padding: 10px 0;
    flex-direction: column;
    gap: 8px;
  }
  .customer-table-heading p {
    font-size: 11px;
    line-height: 1.7;
  }
  .customer-table-heading label {
    width: 100%;
    justify-content: space-between;
  }
  .customer-table-heading select.kt-select {
    height: 36px;
    min-height: 36px;
    font-size: 12px;
    width: 205px;
    padding: 7px 30px 7px 10px;
  }
  .customer-table {
    min-width: 0;
    width: 100%;
    display: block;
    white-space: normal;
  }
  .customer-table thead {
    display: none;
  }
  .customer-table tbody {
    display: block;
  }
  .customer-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 16px;
    margin: 0 0 12px;
    gap: 15px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 9px;
  }
  .customer-table td,
  .customer-table th:first-child,
  .customer-table td:first-child,
  .customer-table td:last-child {
    padding: 0;
    width: auto;
    text-align: left;
    border: 0;
  }
  .customer-table td:first-child {
    grid-column: 1/-1;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
  }
  .customer-table .crm-identity strong {
    font-size: 14px;
    max-width: 240px;
  }
  .customer-table .crm-identity .small {
    font-size: 11px;
  }
  .customer-table .avatar {
    height: 40px;
    width: 40px;
  }
  .customer-table td select.kt-select {
    height: 40px;
    min-height: 40px;
    width: 100%;
    min-width: 0;
    max-width: none;
    font-size: 12px;
    padding: 9px 27px 9px 10px;
  }
  .customer-table td:last-child {
    grid-column: 1/-1;
  }
  .customer-table .text-button {
    width: 100%;
    min-height: 38px;
    font-size: 12px;
    text-align: center;
    background: var(--brand-soft);
    color: var(--brand);
  }
  .customer-table-footer {
    flex-direction: column;
    padding: 16px 0;
    border-color: var(--border);
    background: transparent;
    align-items: stretch;
    font-size: 11px;
    gap: 12px;
  }
  .table-pagination {
    justify-content: space-between;
    gap: 8px;
  }
  .table-pagination select.kt-select {
    height: 36px;
    min-height: 36px;
    font-size: 12px;
    padding: 7px 25px 7px 9px;
  }
  .table-pagination button {
    height: 36px;
    width: 36px;
  }
  .table-pagination label {
    font-size: 11px;
  }
  .task-card > select.kt-select {
    height: 40px;
    min-height: 40px;
    font-size: 13px;
    padding: 9px 32px 9px 11px;
  }
  .crm-list-row select.kt-select {
    height: 36px;
    min-height: 36px;
    font-size: 12px;
    padding: 7px 28px 7px 10px;
    width: 132px;
  }
  #theme-select.kt-select {
    height: 32px;
    min-height: 32px;
    font-size: 10px;
    width: 99px;
    padding: 5px 24px 5px 8px;
  }
  .inbox-crm-filter select.kt-select {
    height: 32px;
    min-height: 32px;
    font-size: 10px;
    padding: 5px 25px 5px 8px;
  }
  .list-account select.kt-select {
    height: 36px;
    min-height: 36px;
    font-size: 12px;
    padding: 7px 29px 7px 10px;
  }
  .list-filters select.kt-select {
    height: 34px;
    min-height: 34px;
    font-size: 11px;
    padding: 6px 24px 6px 4px;
  }
  .search-wrap input.kt-input {
    height: 40px;
    min-height: 40px;
    font-size: 16px;
    padding: 9px 0;
  }
  .chat-body #conversation-details .kt-form-label {
    font-size: 12px;
  }
  .chat-body #conversation-details select.kt-select,
  .chat-body #conversation-details input.kt-input {
    height: 42px;
    min-height: 42px;
    font-size: 16px;
    padding-top: 9px;
    padding-bottom: 9px;
  }
  .chat-body #conversation-details textarea.kt-textarea {
    font-size: 16px;
    min-height: 112px;
  }
  #send-form textarea.kt-textarea {
    font-size: 16px;
    min-height: 42px;
    padding: 4px 0;
  }
  #message-search-wrap input.kt-input {
    font-size: 16px;
    height: 40px;
    min-height: 40px;
  }
  .check input[type="checkbox"] {
    height: 18px;
    width: 18px;
    min-width: 18px;
  }
}
