/* =============================================
   ADMIN COMPANIES — admin-companies.css
   Superadmin tenant management page
   ============================================= */

/* ── Stats bar additions ───────────────────── */
.sec-stat-ok    { color: #059669; }
.sec-stat-muted { color: var(--text-muted, #64748b); }

/* ── Company name + email cell ─────────────── */
.co-company-name  { font-weight: 600; color: var(--text-color, #1e293b); display: block; }
.co-company-email { font-size: 0.75rem; color: var(--text-muted, #64748b); }

/* ── Modules badge ─────────────────────────── */
.co-modules-all {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
  background: rgba(16,185,129,0.1);
  color: #059669;
  border-radius: 20px;
}
.co-modules-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  cursor: default;
}
body.dark .co-modules-all { background: rgba(52,211,153,0.12); color: #6ee7b7; }

/* ── Plan badges ───────────────────────────── */
.plan-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.plan-basic      { background: rgba(100,116,139,0.12); color: #475569; }
.plan-starter    { background: rgba(100,116,139,0.12); color: #475569; }
.plan-pro        { background: rgba(29,78,216,0.1);    color: #1d4ed8; }
.plan-enterprise { background: rgba(124,58,237,0.1);   color: #7c3aed; }

body.dark .plan-basic      { background: rgba(148,163,184,0.12); color: #94a3b8; }
body.dark .plan-starter    { background: rgba(148,163,184,0.12); color: #94a3b8; }
body.dark .plan-pro        { background: rgba(96,165,250,0.12);  color: #93c5fd; }
body.dark .plan-enterprise { background: rgba(167,139,250,0.12); color: #a78bfa; }

/* ── Status badge ──────────────────────────── */
.co-status-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
}

.co-status-active   { background: rgba(16,185,129,0.1); color: #059669; }
.co-status-inactive { background: rgba(100,116,139,0.1); color: #64748b; }

body.dark .co-status-active   { background: rgba(52,211,153,0.12);  color: #6ee7b7; }
body.dark .co-status-inactive { background: rgba(148,163,184,0.1); color: #94a3b8; }

/* ── User count chip ───────────────────────── */
.user-count-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}

.user-count-chip i { font-size: 0.9rem; }

/* ── Action buttons ────────────────────────── */
.action-btns {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
}
@media (max-width: 640px) {
  .action-btns { flex-direction: row; }
}

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.co-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
}

.co-modal-overlay.hidden { display: none; }

.co-modal {
  background: var(--sidebar-color, #fff);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
  animation: coModalIn 0.2s ease;
}

@keyframes coModalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.co-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem;
  position: sticky;
  top: 0;
  background: var(--sidebar-color, #fff);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  z-index: 1;
  flex-shrink: 0;
}

.co-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-color, #1e293b);
  margin: 0;
}

.co-modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.co-modal-close:hover {
  color: var(--text-color, #1e293b);
  background: rgba(0,0,0,0.05);
}

#company-form {
  padding: 1.25rem 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.co-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.co-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-color, #1e293b);
}

.co-required { color: #dc2626; }

.co-input {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-color, #1e293b);
  background: var(--body-color, #f8fafc);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.co-input:focus {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}

body.dark .co-input {
  background: var(--body-color);
  border-color: var(--border-color);
  color: var(--text-color);
}

.co-field-error {
  font-size: 0.75rem;
  color: #dc2626;
  font-weight: 500;
}

.co-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  margin-top: auto;
  flex-shrink: 0;
  background: var(--sidebar-color, #fff);
  border-top: 1px solid var(--border-color, #e2e8f0);
  position: sticky;
  bottom: 0;
}

.co-btn-cancel {
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.co-btn-cancel:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text-color, #1e293b);
}

body.dark .co-btn-cancel {
  border-color: var(--border-color);
  color: var(--text-muted);
}

/* ── Company name cell ─────────────────────── */
.co-company-name {
  font-weight: 600;
  color: var(--text-color, #1e293b);
}

/* ── Module checkboxes ─────────────────────── */
.co-modules-hint {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  margin: 0.1rem 0 0.6rem;
}

.co-modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem 1rem;
}

.co-module-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-color, #1e293b);
  cursor: pointer;
  user-select: none;
}

.co-module-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #1d4ed8;
  cursor: pointer;
  flex-shrink: 0;
}

body.dark .co-module-check {
  color: var(--text-color);
}

/* ── Wider modal ───────────────────────────── */
.co-modal-wide {
  max-width: 600px !important;
}

/* ── Notebook / tablet friendly sizing ─────── */
@media (max-width: 840px) {
  .co-modal, .co-modal-wide {
    max-width: calc(100vw - 2rem) !important;
    margin: 0 auto;
  }
}
@media (max-width: 540px) {
  .co-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .co-modal, .co-modal-wide {
    max-width: 100% !important;
    border-radius: 16px 16px 0 0;
    max-height: 92dvh;
  }
}

/* ── Two-col field row in modal ────────────── */
.co-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.co-field-grow {
  grid-column: 1 / -1;
}

@media (max-width: 540px) {
  .co-field-row {
    grid-template-columns: 1fr;
  }
  .co-field-grow { grid-column: auto; }
}

/* ── Optional badge ────────────────────────── */
.co-optional {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted, #64748b);
}

/* ── Textarea field ────────────────────────── */
.co-textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  line-height: 1.5;
}

/* ── Responsive table: hide columns on mobile ── */
@media (max-width: 640px) {
  .admin-table th:nth-child(5), .admin-table td:nth-child(5),
  .admin-table th:nth-child(6), .admin-table td:nth-child(6) { display: none; }
}
@media (max-width: 400px) {
  .admin-table th:nth-child(4), .admin-table td:nth-child(4) { display: none; }
}
