/* Multi-Tenant Management Board & Tenant Member Permission Styles */
.tn-work {
  padding: clamp(14px, 1.8vw, 26px);
  display: grid;
  gap: 16px;
  align-content: start;
}
.tn-loading,
.tn-empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted, #5c7063);
  font-size: 0.9rem;
}
.tn-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tn-kpi-card {
  background: #ffffff;
  border: 1px solid #d9e4db;
  border-radius: 12px;
  padding: 15px 18px;
  box-shadow: 0 1px 3px rgba(20, 48, 36, 0.04);
}
.tn-kpi-card dt {
  font-size: 0.78rem;
  color: #5a6f62;
  font-weight: 550;
}
.tn-kpi-card dd {
  margin-top: 6px;
  font-size: 1.55rem;
  font-weight: 700;
  color: #16362b;
  font-variant-numeric: tabular-nums;
}
.tn-kpi-card dd.tn-kpi-name {
  font-size: 1.12rem;
  line-height: 1.35;
}
.tn-kpi-card dd.is-ok {
  color: #15803d;
}
.tn-kpi-card dd small {
  font-size: 0.84rem;
  font-weight: 500;
  color: #607569;
}
.tn-kpi-sub {
  margin-top: 4px;
  font-size: 0.76rem;
  color: #6a7e72;
}
.tn-list-panel {
  padding: 16px 18px;
  display: grid;
  gap: 14px;
}
.tn-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.tn-search {
  flex: 1 1 260px;
  max-width: 380px;
}
.tn-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tn-filter-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #d5e0d7;
  background: #f6faf7;
  color: #465d50;
  font-size: 0.82rem;
  font-weight: 550;
  cursor: pointer;
}
.tn-filter-btn.active {
  background: #183b32;
  border-color: #183b32;
  color: #ffffff;
}
.tn-cards-grid {
  display: grid;
  gap: 14px;
}
.tn-card {
  border: 1px solid #d8e4da;
  border-radius: 13px;
  background: #fbfdfb;
  padding: 16px 18px;
  display: grid;
  gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tn-card:hover {
  border-color: #9ec5ad;
  box-shadow: 0 4px 14px rgba(24, 59, 50, 0.06);
}
.tn-card.is-suspended {
  background: #faf9f8;
  border-color: #e5d8d6;
  opacity: 0.88;
}
.tn-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.tn-card-title-wrap {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.tn-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tn-card-title-row h3 {
  font-size: 1.04rem;
  font-weight: 700;
  color: #143227;
}
.tn-plan-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f1ff;
  color: #1d4ed8;
  font-size: 11.5px;
  font-weight: 600;
}
.tn-status-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.tn-status-pill.on {
  background: #dcfce7;
  color: #15803d;
}
.tn-status-pill.off {
  background: #fee2e2;
  color: #b91c1c;
}
.tn-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
  color: #54695d;
}
.tn-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tn-card-note {
  color: #6b7d72;
}
.tn-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tn-quota-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.tn-quota-box {
  background: #ffffff;
  border: 1px solid #e4ede6;
  border-radius: 9px;
  padding: 9px 12px;
  display: grid;
  gap: 6px;
}
.tn-quota-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  color: #566b5f;
}
.tn-quota-label b {
  color: #1a382c;
  font-variant-numeric: tabular-nums;
}
.tn-bar {
  height: 6px;
  border-radius: 999px;
  background: #e7efe9;
  overflow: hidden;
}
.tn-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #2563eb;
}
.tn-bar-fill.ok {
  background: #16a34a;
}
.tn-bar-fill.warn {
  background: #d97706;
}
.tn-mod-matrix {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tn-mod-chip {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 550;
}
.tn-mod-chip.on {
  background: #e7f6ec;
  color: #166534;
  border: 1px solid #c5e8d0;
}
.tn-mod-chip.off {
  background: #f3f5f4;
  color: #93a39a;
  border: 1px dashed #d7e0da;
  text-decoration: line-through;
}

/* Tenant Members & Permissions Panel */
.tn-members-panel {
  padding: 18px 20px;
  display: grid;
  gap: 14px;
}
.tn-members-panel.is-embedded {
  border: none;
  box-shadow: none;
  padding: 16px 18px;
}
.tn-members-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.tn-members-head h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #16362b;
  margin-top: 4px;
}
.tn-members-head p {
  margin-top: 4px;
  font-size: 0.82rem;
  color: #5b7063;
}
.tn-back-btn {
  margin-bottom: 6px;
}
.tn-members-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tn-seat-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf5ef;
  color: #1f543b;
  font-size: 0.8rem;
  font-weight: 600;
}
.tn-seat-pill.warn {
  background: #fef3c7;
  color: #b45309;
}
.tn-tenant-ceiling {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #f5f9f6;
  border: 1px solid #e2ece4;
}
.tn-ceiling-label {
  font-size: 0.78rem;
  font-weight: 650;
  color: #466052;
  white-space: nowrap;
}
.tn-users-list {
  display: grid;
  gap: 10px;
}
.tn-user-row {
  display: grid;
  grid-template-columns: minmax(210px, 240px) 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border-radius: 11px;
  border: 1px solid #dce6de;
  background: #ffffff;
}
.tn-user-row.is-disabled {
  background: #f9f8f8;
  opacity: 0.78;
}
.tn-user-ident {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.tn-user-av {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #e6f0eb;
  color: #1d4c39;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.tn-user-av.is-admin {
  background: #183b32;
  color: #d7f5b4;
}
.tn-user-info {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.tn-user-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.tn-user-info small {
  font-size: 0.76rem;
  color: #63776c;
}
.tn-role-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.tn-role-badge.admin {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.tn-role-badge.member {
  background: #eef3f0;
  color: #465d50;
}
.tn-user-grants {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.tn-grant-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tn-grant-k {
  font-size: 11.5px;
  font-weight: 600;
  color: #63786c;
  white-space: nowrap;
}
.tn-grant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tn-user-mod {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 5px;
  background: #eaf5ee;
  color: #175c3c;
  font-weight: 550;
}
.tn-perm-tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 5px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 550;
}
.tn-muted {
  font-size: 11.5px;
  color: #8c9c93;
}
.tn-user-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.tn-admin-lock {
  font-size: 11.5px;
  color: #1c6444;
  background: #ebf7ef;
  padding: 4px 10px;
  border-radius: 7px;
  font-weight: 600;
}

/* Modals */
.tn-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(15, 36, 28, 0.56);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: auto;
}
.tn-modal-card {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 15px;
  border: 1px solid #d5e1d7;
  box-shadow: 0 24px 60px rgba(14, 38, 29, 0.28);
}
.tn-modal-card.wide {
  width: min(740px, 100%);
}
.tn-modal-head {
  padding: 13px 18px;
  background: linear-gradient(135deg, #17382f, #225442);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.tn-modal-head h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffffff;
}
.tn-modal-head p {
  margin-top: 2px;
  font-size: 0.77rem;
  color: #c5ddcc;
}
.tn-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #d6e9dc;
  display: grid;
  place-items: center;
}
.tn-modal-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}
.tn-modal-body {
  padding: 14px 18px;
  display: grid;
  gap: 11px;
}
.tn-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 12px;
}
.tn-span-2 {
  grid-column: 1 / -1;
}
.tn-modal-section {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #e6eee7;
}
.tn-modal-section h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1c3f31;
}
.tn-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.tn-tpl-btns {
  display: flex;
  gap: 6px;
}
.tn-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.tn-check-card {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid #d9e5dc;
  background: #fbfdfb;
  cursor: pointer;
}
.tn-check-card:hover {
  border-color: #7db494;
  background: #f3faf5;
}
.tn-check-card.is-locked {
  opacity: 0.52;
  background: #f3f5f4;
  cursor: not-allowed;
}
.tn-check-card input {
  margin-top: 3px;
  accent-color: #1b5c3e;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.tn-check-card span {
  display: grid;
  gap: 2px;
}
.tn-check-card b {
  font-size: 0.82rem;
  color: #1b382c;
}
.tn-check-card small {
  font-size: 0.73rem;
  color: #61766a;
  line-height: 1.35;
}
.tn-slot-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tn-slot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #d5e2d8;
  background: #f8fbf9;
  font-size: 0.82rem;
  cursor: pointer;
}
.tn-current-admin {
  padding: 9px 12px;
  border-radius: 8px;
  background: #f4f8f5;
  border: 1px solid #dce8df;
  font-size: 0.84rem;
  color: #264436;
}
.tn-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #e6eee7;
}
.tn-no-access {
  max-width: 520px;
  margin: 48px auto;
  padding: 28px 24px;
  text-align: center;
  background: #ffffff;
  border: 1px solid #dce6de;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.tn-no-access h3 {
  font-size: 1.05rem;
  color: #183b32;
}
.tn-no-access p {
  font-size: 0.85rem;
  color: #5b7063;
}

@media (max-width: 980px) {
  .tn-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tn-quota-row {
    grid-template-columns: 1fr;
  }
  .tn-user-row {
    grid-template-columns: 1fr;
  }
  .tn-check-grid,
  .tn-form-grid {
    grid-template-columns: 1fr;
  }
}
