/* Tenant Users — create / edit modals (premium layout) */

.tum-backdrop.members-modal-backdrop {
  z-index: 12040;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 16px;
}

.tum-modal {
  width: min(980px, 100%);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 20px;
  box-shadow:
    0 28px 80px rgba(15, 23, 42, 0.22),
    0 0 0 1px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #111827;
  -webkit-font-smoothing: antialiased;
}

.tum-modal--create {
  width: min(640px, 100%);
}

.tum-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  padding: 22px 26px 14px;
  border-bottom: 1px solid #eef2f7;
}

.tum-modal__header-text {
  min-width: 0;
  flex: 1;
}

.tum-modal__kicker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #6366f1;
  text-transform: none;
}

.tum-modal__header h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: #0f172a;
}

.tum-modal__subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
  max-width: 52ch;
}

.tum-modal__close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #475569;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tum-modal__close:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.tum-modal__body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.tum-modal--create .tum-modal__body {
  display: block;
}

.tum-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 16px 12px 16px 16px;
  background: #f8fafc;
  border-right: 1px solid #eef2f7;
}

.tum-nav__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.tum-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tum-nav__item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.tum-nav__item span {
  line-height: 1.35;
  white-space: normal;
}

.tum-nav__item:hover {
  background: #fff;
  color: #334155;
}

.tum-nav__item.is-active {
  background: #fff;
  border-color: #c7d2fe;
  color: #4f46e5;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.08);
}

.tum-nav__security {
  margin-top: auto;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #eff6ff 0%, #eef2ff 100%);
  border: 1px solid #dbeafe;
}

.tum-nav__security-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: #fff;
  color: #2563eb;
}

.tum-nav__security-icon svg {
  width: 18px;
  height: 18px;
}

.tum-nav__security strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #1e3a8a;
}

.tum-nav__security p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: #475569;
}

.tum-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.tum-form__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 24px 8px;
  -webkit-overflow-scrolling: touch;
}

.tum-modal--create .tum-form__scroll {
  padding-top: 8px;
}

.tum-panel {
  display: none;
}

.tum-panel.is-active {
  display: block;
}

.tum-panel__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.tum-panel__head-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: #eef2ff;
  color: #4f46e5;
}

.tum-panel__head-icon svg {
  width: 18px;
  height: 18px;
}

.tum-panel__head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.tum-panel__head p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #64748b;
}

.tum-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin-bottom: 18px;
}

.tum-grid .tum-toggle {
  grid-column: 1 / -1;
}

.tum-modal .tum-toggle.security-admin-field input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}

.tum-grid--single {
  grid-template-columns: 1fr;
}

.tum-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tum-field--span-2 {
  grid-column: 1 / -1;
}

.tum-field > span,
.tum-field > label > span:first-child {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
}

.tum-field .tum-required {
  color: #ef4444;
}

.tum-field input:not([type='checkbox']):not([type='file']),
.tum-field select,
.tum-field textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tum-field input:not([type='checkbox']):not([type='file']):focus,
.tum-field select:focus,
.tum-field textarea:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.tum-field input[readonly] {
  background: #f8fafc;
  color: #64748b;
}

.tum-field input[type='file'] {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 13px;
}

.tum-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
}

.tum-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.tum-toggle__box {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tum-toggle input:checked + .tum-toggle__box {
  border-color: #4f46e5;
  background: #4f46e5;
  box-shadow: inset 0 0 0 3px #fff;
}

.tum-toggle__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tum-toggle__text strong {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}

.tum-toggle__text small {
  font-size: 12px;
  line-height: 1.45;
  color: #64748b;
}

.tum-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 24px 18px;
  border-top: 1px solid #eef2f7;
  background: #fff;
}

.tum-form__footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.tum-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tum-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tum-btn--ghost {
  border-color: #c7d2fe;
  background: #fff;
  color: #4338ca;
}

.tum-btn--ghost:hover {
  background: #eef2ff;
}

.tum-btn--primary {
  border-color: #4f46e5;
  background: #4f46e5;
  color: #fff;
}

.tum-btn--primary:hover {
  background: #4338ca;
  border-color: #4338ca;
}

.tum-btn--danger {
  border-color: #fecaca;
  background: #fff;
  color: #dc2626;
}

.tum-btn--danger:hover {
  background: #fef2f2;
}

.tum-btn:disabled,
.tum-btn[hidden] {
  display: none;
}

.tum-modal .security-admin-field input[type='checkbox'] {
  width: auto !important;
  min-height: auto !important;
}

@media (max-width: 860px) {
  .tum-modal__body {
    grid-template-columns: 1fr;
  }

  .tum-nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid #eef2f7;
    padding: 12px;
  }

  .tum-nav__list {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
  }

  .tum-nav__item {
    width: auto;
    flex: 1 1 calc(50% - 4px);
  }

  .tum-nav__security {
    display: none;
  }

  .tum-grid {
    grid-template-columns: 1fr;
  }

  .tum-field--span-2 {
    grid-column: auto;
  }

  .tum-form__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .tum-form__footer-right {
    width: 100%;
    margin-left: 0;
  }

  .tum-form__footer-right .tum-btn {
    flex: 1;
  }
}
