/* Remote Product — panel design system */
:root {
  --rp-bg: #f3f4f6;
  --rp-surface: #ffffff;
  --rp-ink: #111827;
  --rp-muted: #6b7280;
  --rp-border: #e5e7eb;
  --rp-accent: #d97706;
  --rp-accent-soft: #fff7ed;
  --rp-accent-ink: #9a3412;
  --rp-rail: #ffffff;
  --rp-rail-w: 232px;
  --rp-rail-w-collapsed: 72px;
  --rp-radius: 12px;
  --rp-shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 8px 24px rgba(17, 24, 39, 0.04);
  --rp-shadow-hover: 0 2px 4px rgba(17, 24, 39, 0.06), 0 12px 28px rgba(17, 24, 39, 0.08);
  --rp-font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body.rp-panel {
  margin: 0;
  font-family: var(--rp-font);
  color: var(--rp-ink);
  background: var(--rp-bg);
  min-height: 100vh;
}

.rp-shell {
  display: flex;
  min-height: 100vh;
}

/* —— Icon rail —— */
.rp-rail {
  position: sticky;
  top: 0;
  align-self: flex-start;
  z-index: 1030;
  width: var(--rp-rail-w);
  height: 100vh;
  background: var(--rp-rail);
  border-right: 1px solid var(--rp-border);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
  flex-shrink: 0;
}

.rp-panel.rp-rail-collapsed .rp-rail {
  width: var(--rp-rail-w-collapsed);
}

.rp-panel.rp-rail-collapsed .rp-rail__brand {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.rp-panel.rp-rail-collapsed .rp-nav a {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.rp-panel.rp-rail-collapsed .rp-nav a.is-active::before {
  display: none;
}

.rp-panel.rp-rail-collapsed .rp-rail__toggle {
  justify-content: center;
}

.rp-rail__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0.9rem;
  border-bottom: 1px solid var(--rp-border);
  text-decoration: none;
  color: var(--rp-ink);
  min-height: 64px;
}

.rp-rail__mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--rp-ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.85rem;
}

.rp-rail__title {
  font-weight: 650;
  font-size: 0.92rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
}

.rp-panel.rp-rail-collapsed .rp-rail__title,
.rp-panel.rp-rail-collapsed .rp-nav-label,
.rp-panel.rp-rail-collapsed .rp-rail__toggle-label {
  display: none;
}

.rp-nav {
  list-style: none;
  margin: 0.75rem 0;
  padding: 0 0.55rem;
  flex: 1;
  overflow-y: auto;
}

.rp-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  margin-bottom: 0.25rem;
  border-radius: 10px;
  color: var(--rp-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}

.rp-nav a i {
  font-size: 1.15rem;
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.rp-nav a:hover {
  background: #f9fafb;
  color: var(--rp-ink);
}

.rp-nav a.is-active {
  background: var(--rp-accent-soft);
  color: var(--rp-accent-ink);
}

.rp-nav a.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--rp-accent);
}

.rp-rail__foot {
  padding: 0.75rem;
  border-top: 1px solid var(--rp-border);
}

.rp-rail__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 0;
  background: transparent;
  color: var(--rp-muted);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.rp-rail__toggle:hover {
  background: #f9fafb;
  color: var(--rp-ink);
}

/* —— Workspace —— */
.rp-workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.rp-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rp-border);
  min-height: 64px;
}

.rp-topbar__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--rp-ink);
}

.rp-topbar__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rp-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  border-radius: 999px;
  background: var(--rp-surface);
  border: 1px solid var(--rp-border);
  color: var(--rp-ink);
  text-decoration: none;
  font-size: 0.82rem;
}

.rp-user-chip__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--rp-ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 650;
}

.rp-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--rp-border);
  background: var(--rp-surface);
  color: var(--rp-muted);
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  text-decoration: none;
}

.rp-btn-ghost:hover {
  color: var(--rp-ink);
  border-color: #d1d5db;
}

.rp-main {
  padding: 1.5rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* —— Cards / modules —— */
.rp-card {
  background: var(--rp-surface);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius);
  box-shadow: var(--rp-shadow);
  overflow: hidden;
}

.rp-card:hover {
  box-shadow: var(--rp-shadow-hover);
}

.rp-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--rp-border);
  background: #fff;
}

.rp-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rp-card__body {
  padding: 1.15rem;
}

.rp-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.rp-page-head h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.rp-page-head p {
  margin: 0.25rem 0 0;
  color: var(--rp-muted);
  font-size: 0.9rem;
}

.rp-stat {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.2rem;
  height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.rp-stat:hover {
  transform: translateY(-2px);
}

.rp-stat__icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--rp-accent-soft);
  color: var(--rp-accent);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.rp-stat__icon.is-ink {
  background: #1118270d;
  color: var(--rp-ink);
}

.rp-stat__label {
  color: var(--rp-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.rp-stat__value {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.rp-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--rp-muted);
}

.rp-empty i {
  font-size: 1.75rem;
  display: block;
  margin-bottom: 0.5rem;
  color: #9ca3af;
}

.rp-btn-accent {
  --bs-btn-bg: var(--rp-accent);
  --bs-btn-border-color: var(--rp-accent);
  --bs-btn-hover-bg: #b45309;
  --bs-btn-hover-border-color: #b45309;
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #92400e;
  --bs-btn-active-border-color: #92400e;
  --bs-btn-active-color: #fff;
  border-radius: 10px;
  font-weight: 600;
}

.btn-primary {
  --bs-btn-bg: var(--rp-ink);
  --bs-btn-border-color: var(--rp-ink);
  --bs-btn-hover-bg: #000;
  --bs-btn-hover-border-color: #000;
  --bs-btn-active-bg: #000;
  --bs-btn-active-border-color: #000;
  border-radius: 10px;
  font-weight: 600;
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger,
.btn-outline-success {
  border-radius: 10px;
}

.form-control,
.form-select {
  border-radius: 10px;
  border-color: var(--rp-border);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--rp-accent);
  box-shadow: 0 0 0 0.2rem rgba(217, 119, 6, 0.15);
}

.table > :not(caption) > * > * {
  background: transparent;
}

.rp-card .table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rp-muted);
  font-weight: 600;
  border-bottom-color: var(--rp-border);
}

.badge {
  border-radius: 8px;
  font-weight: 600;
}

.rp-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
}

.rp-media-thumb {
  height: 140px;
  object-fit: cover;
}

.rp-media-file {
  height: 140px;
}

.rp-status-published { background-color: #198754 !important; }
.rp-status-designed { background-color: #0d6efd !important; }
.rp-status-mapped { background-color: #0dcaf0 !important; color: #000 !important; }
.rp-status-imported { background-color: #6c757d !important; }
.rp-status-error { background-color: #dc3545 !important; }
.rp-status-draft { background-color: #adb5bd !important; }

/* Auth */
.rp-auth {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff7ed 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e5e7eb 0%, transparent 50%),
    var(--rp-bg);
  font-family: var(--rp-font);
}

.rp-auth-card {
  border: 1px solid var(--rp-border);
  border-radius: 16px;
  box-shadow: var(--rp-shadow);
  background: #fff;
}

.rp-auth-card .rp-auth-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--rp-ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin: 0 auto 0.75rem;
}

/* Editor shell — full workspace, rail starts collapsed */
.rp-panel.rp-editor-page .rp-topbar {
  display: none;
}

.rp-panel.rp-editor-page .rp-main {
  max-width: none;
  padding: 0;
  margin: 0;
  height: 100vh;
  overflow: hidden;
}

.rp-panel.rp-editor-page .rp-workspace {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.rp-panel.rp-editor-page .rp-shell {
  height: 100vh;
  overflow: hidden;
}

.rp-panel.rp-editor-page .rp-rail {
  height: 100vh;
}

.rp-editor-shell {
  background: #e9ecef;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.rp-editor-body {
  min-height: 0;
  min-width: 0;
  flex: 1 1 auto;
}
.rp-editor-toolbar {
  flex-shrink: 0;
}
.rp-device-frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 320px;
  overflow: hidden;
  background: #fff;
}
.rp-device-frame iframe {
  display: block;
  border: 0;
  background: #fff;
  transform-origin: top left;
  width: 1280px;
  height: 100%;
  min-height: 100%;
}

.rp-style-panel {
  background: #fafafa;
  width: 340px;
  max-width: 36vw;
  min-width: 260px;
  flex: 0 1 340px;
  min-height: 0;
  overflow: hidden;
}
.rp-editor-blocks {
  width: 200px;
  max-width: 22vw;
  min-width: 160px;
  flex: 0 1 200px;
  min-height: 0;
  overflow: auto;
}
.rp-editor-blocks .btn.active {
  background: #111827;
  border-color: #111827;
  color: #fff;
}
.rp-style-panel__head {
  background: #fff;
}
.rp-style-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border-bottom: 1px solid #dee2e6;
  background: #fff;
}
.rp-style-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0.55rem 0.25rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6c757d;
  font-size: 0.68rem;
  line-height: 1.1;
  cursor: pointer;
}

@media (max-width: 991.98px) {
  .rp-rail {
    position: fixed;
    transform: translateX(-100%);
    box-shadow: var(--rp-shadow-hover);
  }
  .rp-panel.rp-rail-open .rp-rail {
    transform: translateX(0);
  }
  .rp-panel.rp-rail-collapsed .rp-rail {
    width: var(--rp-rail-w);
  }
  .rp-panel.rp-rail-collapsed .rp-rail__title,
  .rp-panel.rp-rail-collapsed .rp-nav-label,
  .rp-panel.rp-rail-collapsed .rp-rail__toggle-label {
    display: inline;
  }
  .rp-rail-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.35);
    z-index: 1025;
  }
  .rp-panel.rp-rail-open .rp-rail-backdrop {
    display: block;
  }
}
