/* ============================================================================
 * Infinity CMMS — Platform Admin specific styles
 * Layered ON TOP of /css/app.css. Only contains what differs from the tenant app.
 * ========================================================================== */

/* Platform marker — a thin tinted strip in the topbar so admins see they're not
   in a tenant's UI */
.admin-hdr {
  background: linear-gradient(180deg, #1d2540, #14193a);
}
.admin-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  background: rgba(255,255,255,.18);
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #fff;
  vertical-align: 2px;
}

/* Auth gate — full-screen login overlay */
.auth-gate {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0f1638, #1a2b56);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.auth-card {
  width: 380px;
  max-width: 92vw;
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}
.auth-brand .logo-icon {
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1c89ff, #4a6cf7);
  border-radius: 14px;
  margin-bottom: 12px;
}
.auth-brand .logo-icon svg { width: 30px; height: 30px; }
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.auth-title em { font-style: normal; color: #1c89ff; font-weight: 800; }

.auth-card form label { display: block; font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 6px; }
.auth-card form input { width: 100%; padding: 10px 12px; border: 1px solid #d0d5dd; border-radius: 8px; font-size: 14px; font-family: inherit; box-sizing: border-box; }
.auth-card form input:focus { outline: none; border-color: #1c89ff; box-shadow: 0 0 0 3px rgba(28,137,255,.15); }
.auth-err { color: #b42318; background: #fee4e2; padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-top: 12px; }
.btn.big { width: 100%; padding: 12px; margin-top: 20px; font-size: 14px; font-weight: 600; }

/* Page header with action bar on the right */
.page-hd {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  gap: 20px;
}
.page-hd h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.page-hd .muted { font-size: 13px; }
.action-bar { display: flex; gap: 8px; flex-shrink: 0; }

/* Generic button if not already defined elsewhere */
.btn { padding: 8px 14px; border: 1px solid #d0d5dd; background: #fff; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; color: #344054; }
.btn:hover { background: #f2f4f7; }
.btn.primary { background: #1c89ff; color: #fff; border-color: #1c89ff; }
.btn.primary:hover { background: #156acc; }
.btn.danger { color: #b42318; border-color: #fda19b; }
.btn.danger:hover { background: #fef3f2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Cards */
.card { background: #fff; border: 1px solid #e4e7ec; border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.card-hd { font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* Key/value layout used in tenant detail */
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; }
.kv > div { display: flex; flex-direction: column; gap: 2px; }
.kv label { font-size: 11px; font-weight: 600; color: #98a2b3; text-transform: uppercase; letter-spacing: .05em; }
.kv span { font-size: 14px; color: #101828; }
.mono { font-family: 'DM Mono', monospace; font-size: 13px; }

/* Module list */
.modules { display: flex; flex-direction: column; gap: 6px; }
.module-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 8px; background: #f9fafb; }
.module-row:hover { background: #f2f4f7; }
.module-row .mod-name { font-weight: 500; }
.module-row .mod-desc { font-size: 12px; color: #6b7280; }
.module-row .toggle { width: 36px; height: 20px; background: #d0d5dd; border-radius: 12px; position: relative; cursor: pointer; transition: background .15s; }
.module-row .toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.module-row .toggle.on { background: #12b76a; }
.module-row .toggle.on::after { transform: translateX(16px); }
.module-row.disabled .toggle { cursor: not-allowed; opacity: .5; }

/* Status pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pill.active        { background: #ecfdf3; color: #027a48; }
.pill.suspended     { background: #fef3c7; color: #b54708; }
.pill.provisioning  { background: #eff8ff; color: #175cd3; }
.pill.failed        { background: #fee4e2; color: #b42318; }
.pill.success       { background: #ecfdf3; color: #027a48; }
.pill.backfilled    { background: #f4ebff; color: #5925dc; }
.pill.pending       { background: #f2f4f7; color: #475467; }

/* Table styling additions */
.tbl.sm { font-size: 13px; }
.tbl tr.row-click { cursor: pointer; }
.tbl tr.row-click:hover { background: #f9fafb; }

/* Migration grid */
.tbl#mg-tbl th { white-space: nowrap; min-width: 90px; text-align: center; font-size: 11px; }
.tbl#mg-tbl th:first-child { text-align: left; }
.tbl#mg-tbl td { text-align: center; padding: 8px 6px; }
.tbl#mg-tbl td:first-child { text-align: left; font-weight: 500; }
.tbl#mg-tbl td .pill { font-size: 10px; padding: 1px 6px; }

/* Output panel — for shell-out stdout/stderr */
pre.output {
  background: #1d2540;
  color: #cad2e2;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 14px 16px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}

/* Toast (defensive — usually shipped in /css/app.css) */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 18px; background: #1d2540; color: #fff; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; transform: translateY(8px); z-index: 10000; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { background: #027a48; }
.toast.err { background: #b42318; }

/* Modal overlay (defensive — usually in app.css) */
.ov { position: fixed; inset: 0; background: rgba(15,22,56,.6); display: none; align-items: center; justify-content: center; z-index: 9000; }
.ov.open { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px 26px; width: 500px; max-width: 92vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.modal h2 { margin: 0 0 12px; font-size: 18px; }
.modal label { display: block; font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .06em; margin: 14px 0 6px; }
.modal input, .modal select, .modal textarea { width: 100%; padding: 9px 12px; border: 1px solid #d0d5dd; border-radius: 8px; font-size: 14px; font-family: inherit; box-sizing: border-box; }
.modal input:focus, .modal select:focus, .modal textarea:focus { outline: none; border-color: #1c89ff; box-shadow: 0 0 0 3px rgba(28,137,255,.15); }
.modal .hint { font-size: 12px; color: #6b7280; margin-top: 4px; }
.modal .err { color: #b42318; font-size: 13px; margin-top: 8px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Search input */
.srch { padding: 8px 12px; border: 1px solid #d0d5dd; border-radius: 8px; font-size: 13px; font-family: inherit; min-width: 220px; }
.srch:focus { outline: none; border-color: #1c89ff; }

/* Display-name + reveal-password block for "password generated" modal output */
.password-display { background: #f9fafb; border: 1px solid #e4e7ec; border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
.password-display .mono { font-size: 15px; user-select: all; word-break: break-all; }
.password-display .copy-hint { font-size: 11px; color: #6b7280; margin-top: 4px; }
