/* Prime Manages admin panel - layered on Bootstrap 5. */

:root {
  --tr-sidebar-width: 248px;
  --tr-topbar-height: 56px;
  --tr-sidebar-bg: #1f2937;
  --tr-sidebar-bg-2: #111827;
  --tr-sidebar-text: #c7ced9;
  --tr-sidebar-muted: #7b8595;
  --tr-sidebar-active: #ffffff;
  --tr-accent: #2563eb;
  --tr-page-bg: #f3f5f8;
  --tr-border: #e3e7ed;
  --tr-text-muted: #6b7280;
}

html, body { height: 100%; }
body {
  background: var(--tr-page-bg);
  color: #1f2933;
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------- layout */

.tr-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--tr-sidebar-width);
  background: var(--tr-sidebar-bg);
  color: var(--tr-sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.2s ease;
}

.tr-brand {
  height: var(--tr-topbar-height);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1.25rem;
  background: var(--tr-sidebar-bg-2);
  color: #fff;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  flex-shrink: 0;
}
.tr-brand:hover { color: #fff; }
.tr-brand .tr-logo {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--tr-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.tr-nav { padding: 0.75rem 0; overflow-y: auto; flex: 1; }
.tr-nav-heading {
  padding: 1rem 1.25rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tr-sidebar-muted);
}
.tr-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1.25rem;
  color: var(--tr-sidebar-text);
  text-decoration: none;
  border-left: 3px solid transparent;
  font-size: 0.9rem;
}
.tr-nav a i { font-size: 1.05rem; width: 1.25rem; text-align: center; opacity: 0.85; }
/* A sidebar group heading, which opens and closes the pages under it. */
.tr-nav-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: 0;
  cursor: pointer;
}
.tr-nav-group i { font-size: 0.75rem; transition: transform 0.15s ease; opacity: 0.6; }
.tr-nav-group.collapsed i { transform: rotate(-90deg); }
.tr-nav-group:hover { color: rgba(255, 255, 255, 0.85); }
.tr-nav-group:hover i { opacity: 1; }

.tr-nav a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.tr-nav a.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--tr-sidebar-active);
  border-left-color: var(--tr-accent);
}
.tr-nav a.active i { opacity: 1; }

.tr-sidebar-footer {
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  color: var(--tr-sidebar-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.tr-main {
  margin-left: var(--tr-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.tr-topbar {
  height: var(--tr-topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--tr-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.tr-topbar h1 { font-size: 1.1rem; font-weight: 600; margin: 0; }
.tr-topbar .tr-toggle { display: none; }

.tr-content { padding: 1.5rem; flex: 1; }
.tr-content > .tr-page { max-width: 1400px; }

.tr-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 1035;
}

@media (max-width: 991.98px) {
  .tr-sidebar { transform: translateX(-100%); }
  body.tr-nav-open .tr-sidebar { transform: none; }
  body.tr-nav-open .tr-backdrop { display: block; }
  .tr-main { margin-left: 0; }
  .tr-topbar { padding: 0 1rem; }
  .tr-topbar .tr-toggle { display: inline-flex; }
  .tr-content { padding: 1rem; }
}

/* ---------------------------------------------------------------- cards */

.card {
  border-color: var(--tr-border);
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.card-header {
  background: #fff;
  border-bottom-color: var(--tr-border);
  font-weight: 600;
  padding: 0.8rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-header .card-actions { margin-left: auto; display: flex; gap: 0.4rem; align-items: center; }
.card-body { padding: 1.1rem; }

.tr-stat {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.tr-stat .tr-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.tr-stat .tr-stat-value { font-size: 1.45rem; font-weight: 600; line-height: 1.1; }
.tr-stat .tr-stat-label { color: var(--tr-text-muted); font-size: 0.8rem; }

.tr-tint-blue { background: #e8f0fe; color: #1d4ed8; }
.tr-tint-green { background: #e6f6ec; color: #15803d; }
.tr-tint-amber { background: #fff4e0; color: #b45309; }
.tr-tint-gray { background: #eef0f3; color: #4b5563; }
.tr-tint-red { background: #fde8e8; color: #b91c1c; }

.tr-kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; margin: 0; }
.tr-kv dt { color: var(--tr-text-muted); font-weight: 400; }
.tr-kv dd { margin: 0; word-break: break-word; }

/* ---------------------------------------------------------------- tables */

.table { margin-bottom: 0; font-size: 0.86rem; }
.table > thead th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tr-text-muted);
  background: #f9fafb;
  border-bottom-width: 1px;
  white-space: nowrap;
}
.table td { vertical-align: middle; }
.table-card { border-radius: 0 0 0.5rem 0.5rem; overflow: hidden; }
th.tr-sortable { cursor: pointer; user-select: none; }
th.tr-sortable:hover { color: #111827; }
th.tr-sortable .bi { font-size: 0.7rem; }

.tr-thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--tr-border);
  border-radius: 6px;
  flex-shrink: 0;
}
.tr-thumb-empty {
  width: 44px;
  height: 44px;
  border: 1px dashed var(--tr-border);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  flex-shrink: 0;
}
.tr-title-cell { min-width: 260px; max-width: 460px; }
.tr-title-cell .tr-title { font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tr-mono { font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; }
.tr-muted { color: var(--tr-text-muted); }
.tr-nowrap { white-space: nowrap; }
.tr-reasons { margin: 0.25rem 0 0; padding-left: 1rem; color: #7c2d12; font-size: 0.8rem; }
.tr-reasons li + li { margin-top: 0.15rem; }

.badge { font-weight: 500; }
.badge.text-bg-soft-green { background: #e6f6ec; color: #166534; }
.badge.text-bg-soft-amber { background: #fff4e0; color: #92400e; }
.badge.text-bg-soft-red { background: #fde8e8; color: #991b1b; }
.badge.text-bg-soft-gray { background: #eef0f3; color: #374151; }
.badge.text-bg-soft-blue { background: #e8f0fe; color: #1e40af; }

/* ---------------------------------------------------------------- forms */

.form-label { font-weight: 500; font-size: 0.85rem; margin-bottom: 0.3rem; }
.form-text { font-size: 0.78rem; }
.tr-form-section + .tr-form-section { border-top: 1px solid var(--tr-border); margin-top: 1.25rem; padding-top: 1.25rem; }
.tr-form-section h6 { font-weight: 600; margin-bottom: 0.9rem; }

.tr-dropzone {
  border: 2px dashed #cbd2dc;
  border-radius: 0.5rem;
  background: #fafbfc;
  padding: 1.75rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tr-dropzone:hover, .tr-dropzone.tr-drag { border-color: var(--tr-accent); background: #f3f7ff; }
.tr-dropzone i { font-size: 1.8rem; color: #94a3b8; }

.nav-tabs .nav-link { color: #4b5563; font-weight: 500; }
.nav-tabs .nav-link.active { color: #111827; }

.tr-settings-nav .list-group-item { border: 0; border-radius: 0.375rem !important; padding: 0.55rem 0.9rem; color: #374151; }
.tr-settings-nav .list-group-item i { width: 1.4rem; display: inline-block; }
.tr-settings-nav .list-group-item.active { background: #e8f0fe; color: #1d4ed8; font-weight: 500; }

/* ---------------------------------------------------------------- misc */

.tr-empty { text-align: center; color: var(--tr-text-muted); padding: 2.5rem 1rem; }
.tr-empty i { font-size: 2rem; display: block; margin-bottom: 0.5rem; color: #b6bdc8; }

.tr-loading { display: flex; align-items: center; justify-content: center; gap: 0.6rem; padding: 3rem 1rem; color: var(--tr-text-muted); }

.progress { height: 0.55rem; }
.tr-step-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; display: inline-block; }

.toast-container { z-index: 1090; }

.tr-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--tr-page-bg);
}
.tr-login-card { width: 100%; max-width: 400px; }
.tr-login-brand { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-bottom: 1.4rem; font-size: 1.5rem; font-weight: 600; }
.tr-login-welcome {
  text-align: center;
  margin-bottom: 0.2rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--tr-text-muted);
}
.tr-login-tagline {
  text-align: center;
  margin: 1.25rem 0 0;
  color: var(--tr-text-muted);
  font-size: 0.95rem;
}
.tr-login-brand .tr-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--tr-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tr-code { background: #f6f8fa; border: 1px solid var(--tr-border); border-radius: 0.375rem; padding: 0.6rem 0.75rem; font-size: 0.78rem; white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; }

.tr-checklist { list-style: none; padding: 0; margin: 0; }
.tr-checklist li { display: flex; gap: 0.7rem; padding: 0.6rem 0; border-bottom: 1px solid var(--tr-border); }
.tr-checklist li:last-child { border-bottom: 0; }
.tr-checklist .bi { font-size: 1.1rem; margin-top: 0.05rem; }
