:root {
  --admin-sidebar-width: 292px;
  --admin-bg: #f5f7fb;
  --admin-card: #ffffff;
  --admin-text: #163047;
  --admin-muted: #5e7288;
  --admin-accent: #0f5ea8;
  --admin-accent-soft: #e6f0fb;
  --admin-border: #dbe3ef;
}

body.admin-body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  color: var(--admin-text);
}

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

.admin-sidebar {
  width: var(--admin-sidebar-width);
  background: linear-gradient(180deg, #0f2233 0%, #173349 100%);
  color: #e8eef6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  min-height: 100vh;
}

.admin-brand {
  padding: 1.35rem 1.35rem 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}

.admin-brand-logo {
  width: 100%;
  max-width: 150px;
  height: auto;
  max-height: 78px;
  object-fit: contain;
  display: block;
  margin: 0 auto 0.85rem;
}

.admin-brand-placeholder {
  width: 96px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  margin: 0 auto 0.85rem;
  background: rgba(255,255,255,0.1);
  font-size: 1.6rem;
}

.admin-company-name {
  font-size: 1.08rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
}

.admin-system-name {
  margin-top: 0.25rem;
  color: rgba(232, 238, 246, 0.82);
  font-size: 0.92rem;
  line-height: 1.35;
}

.admin-brand-subtitle {
  color: rgba(232, 238, 246, 0.72);
  font-size: 0.84rem;
}

.admin-signed-user {
  color: #ffffff;
  font-weight: 700;
}

.admin-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 0.82rem;
  margin-top: 0.85rem;
}

.admin-nav {
  padding: 0.75rem 0.9rem 0.95rem;
  display: grid;
  gap: 0.05rem;
}

.admin-nav-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(232, 238, 246, 0.56);
  margin: 0.45rem 0 0.18rem;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.58rem;
  padding: 0.44rem 0.78rem;
  border-radius: 12px;
  color: #e8eef6;
  text-decoration: none;
  transition: background 0.18s ease, transform 0.18s ease;
  line-height: 1.1;
}

.admin-nav-link:hover,
.admin-nav-link.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  transform: translateX(2px);
}

.admin-nav-link-danger {
  color: #ffd0d0;
}

.admin-nav-link-danger:hover,
.admin-nav-link-danger.active {
  background: rgba(180, 35, 24, 0.18);
  color: #ffffff;
}

.admin-sidebar-footer {
  margin-top: auto;
  padding: 1.2rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.82rem;
  color: rgba(232, 238, 246, 0.72);
}

.admin-main {
  flex: 1;
  min-width: 0;
}

.admin-topbar {
  padding: 1.3rem 1.75rem 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.admin-topbar h2 {
  margin: 0;
  font-size: 1.7rem;
  color: #123047;
}

.admin-topbar p {
  margin: 6px 0 0;
  color: var(--admin-muted);
}

.admin-user-pill {
  background: rgba(255,255,255,0.9);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(17, 35, 57, 0.08);
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-content {
  padding: 1.4rem 1.75rem 2rem;
}

.panel-card,
.metric-card,
.record-card {
  background: var(--admin-card);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(18, 52, 77, 0.08);
  border: 1px solid var(--admin-border);
}

.metric-card {
  padding: 22px;
  height: 100%;
}

.metric-label {
  color: var(--admin-muted);
  font-size: 0.92rem;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 10px;
}

.metric-card i {
  color: var(--admin-accent);
  font-size: 1.4rem;
}

.panel-card {
  padding: 24px;
}

.panel-card h3 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.panel-card .text-muted {
  color: var(--admin-muted) !important;
}

.admin-image-preview {
  width: 100%;
  max-width: 280px;
  max-height: 160px;
  object-fit: contain;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(23,48,77,0.08);
  padding: 12px;
}

.table td,
.table th {
  vertical-align: middle;
}

.badge-soft {
  background: var(--admin-accent-soft);
  color: var(--admin-accent);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.82rem;
}

.admin-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 991px) {
  .admin-shell {
    flex-direction: column;
  }

  .admin-sidebar {
    width: auto;
    position: static;
    min-height: auto;
  }

  .admin-topbar,
  .admin-content {
    padding-left: 18px;
    padding-right: 18px;
  }
}

.admin-form-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.admin-help-marker {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--admin-accent-soft);
  color: var(--admin-accent);
  font-size: 0.9rem;
  line-height: 1;
}

.admin-help-text {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--admin-muted);
  margin-top: 6px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.admin-help-text-icon {
  color: var(--admin-accent);
  font-weight: 700;
  line-height: 1.2;
}

.theme-preview-panel {
  --theme-preview-primary: #103628;
  --theme-preview-secondary: #1E7A56;
  --theme-preview-accent: #28B779;
  --theme-preview-heading: #10233D;
  --theme-preview-background: #F5FBF8;
  --theme-preview-surface: #FFFFFF;
  --theme-preview-text: #4B5F70;
  --theme-preview-panel-text: #10233D;
  --theme-preview-panel-muted: #5E7489;
  --theme-preview-surface-text: #4B5F70;
  --theme-preview-heading-safe: #10233D;
  --theme-preview-secondary-text: #103628;
  --theme-preview-accent-contrast: #0F172A;
  --theme-preview-contrast: #FFFFFF;
  background: var(--theme-preview-background);
  color: var(--theme-preview-panel-text);
  border: 1px solid color-mix(in srgb, var(--theme-preview-primary), transparent 88%);
  border-radius: 24px;
  padding: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}

.theme-preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.theme-preview-heading strong {
  color: var(--theme-preview-panel-text);
}

.theme-preview-heading .small {
  color: var(--theme-preview-panel-muted) !important;
}

.theme-preview-canvas {
  background: linear-gradient(180deg, color-mix(in srgb, var(--theme-preview-accent), var(--theme-preview-background) 88%) 0%, var(--theme-preview-background) 100%);
  border-radius: 20px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--theme-preview-primary), transparent 88%);
}

.theme-preview-browser {
  background: var(--theme-preview-surface);
  color: var(--theme-preview-surface-text);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.theme-preview-browser-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--theme-preview-surface), var(--theme-preview-background) 25%);
  border-bottom: 1px solid color-mix(in srgb, var(--theme-preview-primary), transparent 90%);
}

.theme-preview-dots {
  display: flex;
  gap: 6px;
}

.theme-preview-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-preview-primary), #ffffff 70%);
}

.theme-preview-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--theme-preview-surface-text);
  font-size: 0.82rem;
}

.theme-preview-hero {
  padding: 22px 20px 16px;
}

.theme-preview-kicker {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--theme-preview-accent), var(--theme-preview-background) 78%);
  color: var(--theme-preview-accent-contrast);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-preview-hero h4,
.theme-preview-card strong {
  color: var(--theme-preview-heading-safe);
}

.theme-preview-hero h4 {
  margin: 14px 0 10px;
  font-size: 1.35rem;
}

.theme-preview-hero p,
.theme-preview-card p {
  color: var(--theme-preview-surface-text);
  margin: 0;
  line-height: 1.6;
}

.theme-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.theme-preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.88rem;
}

.theme-preview-btn.is-primary {
  background: linear-gradient(135deg, var(--theme-preview-primary) 0%, var(--theme-preview-secondary) 100%);
  color: var(--theme-preview-contrast);
}

.theme-preview-btn.is-secondary {
  background: color-mix(in srgb, var(--theme-preview-surface), var(--theme-preview-background) 8%);
  color: var(--theme-preview-secondary-text);
  border: 1px solid color-mix(in srgb, var(--theme-preview-primary), transparent 78%);
}

.theme-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 20px 20px;
}

.theme-preview-card {
  background: color-mix(in srgb, var(--theme-preview-surface), var(--theme-preview-background) 12%);
  border: 1px solid color-mix(in srgb, var(--theme-preview-primary), transparent 90%);
  border-radius: 16px;
  padding: 16px;
}

.theme-preview-card.alt {
  background: linear-gradient(180deg, color-mix(in srgb, var(--theme-preview-accent), var(--theme-preview-background) 88%) 0%, var(--theme-preview-surface) 100%);
}

.theme-preview-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  margin-bottom: 10px;
  background: color-mix(in srgb, var(--theme-preview-accent), transparent 78%);
  color: var(--theme-preview-accent-contrast);
  font-size: 0.75rem;
  font-weight: 700;
}

.theme-preview-swatches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.theme-preview-swatch {
  background: color-mix(in srgb, var(--theme-preview-surface), var(--theme-preview-background) 40%);
  border-radius: 16px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--theme-preview-primary), transparent 88%);
}

.theme-preview-swatch span {
  display: block;
  color: var(--theme-preview-panel-muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.theme-preview-swatch strong {
  display: block;
  font-size: 0.84rem;
  color: var(--theme-preview-panel-text);
  margin-top: 8px;
}

.theme-preview-swatch-box {
  height: 40px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--theme-preview-primary), transparent 88%);
}

@media (max-width: 991px) {
  .theme-preview-heading {
    flex-direction: column;
  }

  .theme-preview-grid,
  .theme-preview-swatches {
    grid-template-columns: 1fr;
  }
}

.admin-sidebar-footer strong {
  display: block;
  color: #fff;
  margin-bottom: 4px;
}

.admin-powered-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.68);
  margin-bottom: 4px;
}

.admin-sidebar-footer a {
  color: #e8eef6;
  text-decoration: none;
}

.admin-sidebar-footer a:hover,
.admin-sidebar-footer a:focus {
  color: #ffffff;
  text-decoration: underline;
}

.admin-help-trigger {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: var(--admin-accent-soft);
  color: var(--admin-accent);
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.admin-help-trigger:hover,
.admin-help-trigger:focus {
  background: color-mix(in srgb, var(--admin-accent-soft), #ffffff 20%);
  color: #0f5132;
}

.admin-help-inline {
  display: flex;
  justify-content: flex-start;
  margin-top: 6px;
  margin-bottom: 8px;
}

.admin-help-inline .admin-help-trigger {
  width: 22px;
  height: 22px;
  font-size: 0.88rem;
}

.popover {
  max-width: 280px;
  border: 0;
  box-shadow: 0 16px 40px rgba(15, 35, 57, 0.18);
}

.popover-header {
  display: none;
}

.popover-body {
  color: var(--theme-preview-panel-text);
  line-height: 1.55;
  font-size: 0.92rem;
}

.admin-brand {
  padding: 1.5rem;
}

.admin-brand-logo {
  width: min(100%, 188px);
  height: 104px;
  max-width: none;
  max-height: none;
  object-fit: contain;
  display: block;
  margin: 0 auto 1rem;
  padding: 0.35rem;
}

.admin-brand-placeholder {
  width: 120px;
  height: 92px;
  margin: 0 auto 1rem;
}

.admin-sidebar-footer .suite-launcher-fab {
  position: static;
  width: 100%;
  justify-content: center;
  margin-top: 0.85rem;
}
