:root {
  --ppp-bg: #f4f6fb;
  --ppp-sidebar: #11203b;
  --ppp-sidebar-muted: #8a9bbd;
  --ppp-primary: #3b6ef5;
  --ppp-border: #e6e9f2;
  --ppp-card: #ffffff;
  --ppp-muted: #666f7d;
}

* { box-sizing: border-box; }

body.admin-body {
  margin: 0;
  background: var(--ppp-bg);
  color: #1f2933;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

/* ── Layout ───────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  background: var(--ppp-sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  transition: transform .2s ease;
}
.sidebar-brand {
  padding: 20px 22px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { color: #6ea0ff; font-size: 22px; }
.sidebar-brand strong { color: #fff; }
.sidebar-nav { padding: 14px 12px; flex: 1; }
.sidebar-nav .nav-link {
  color: var(--ppp-sidebar-muted);
  padding: 10px 14px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 4px;
  font-size: 14.5px;
  transition: background .15s, color .15s;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--ppp-primary); color: #fff; }
.sidebar-footer { padding: 16px 22px; border-top: 1px solid rgba(255,255,255,.08); }

.content { margin-left: 248px; flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--ppp-border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.topbar-title { font-size: 19px; margin: 0; font-weight: 600; }
.topbar-spacer { flex: 1; }
.content-inner { padding: 26px 28px; max-width: 1200px; width: 100%; }

/* ── Cards & components ───────────────────────────────── */
.card {
  border: 1px solid var(--ppp-border);
  border-radius: 13px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--ppp-border);
  font-weight: 600;
  font-size: 14.5px;
  border-radius: 13px 13px 0 0 !important;
}

.stat-card {
  background: var(--ppp-card);
  border: 1px solid var(--ppp-border);
  border-radius: 13px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { color: #6b7280; font-size: 13px; }

.app-search { flex: 1 1 320px; min-width: 240px; max-width: 440px; margin: 0; }

.empty-state { text-align: center; padding: 48px 20px; color: #6b7280; }
.empty-state i { font-size: 42px; color: #c3cad9; display: block; margin-bottom: 12px; }

.btn-primary { background: var(--ppp-primary); border-color: var(--ppp-primary); }
.btn-primary:hover { background: #2f5fe0; border-color: #2f5fe0; }

/* ── Wizard ───────────────────────────────────────────── */
.wizard-steps {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0 0 22px;
  flex-wrap: wrap;
}
.wizard-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8a93a6;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px 6px 6px;
  border-radius: 30px;
  background: #fff;
  border: 1px solid var(--ppp-border);
}
.wizard-steps li span {
  width: 26px; height: 26px; border-radius: 50%;
  background: #e9edf6; color: #6b7280;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
}
.wizard-steps li.active { color: var(--ppp-primary); border-color: #bcd0ff; }
.wizard-steps li.active span { background: var(--ppp-primary); color: #fff; }
.wizard-steps li.done span { background: #16a34a; color: #fff; }

.toggle-card input, .sdk-card input { position: absolute; opacity: 0; }
.toggle-card { display: block; cursor: pointer; margin: 0; }
.toggle-card-body {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--ppp-border);
  border-radius: 10px; background: #fff; transition: all .15s; font-size: 14px;
}
.toggle-card-body i { font-size: 18px; color: #8a93a6; }
.toggle-card input:checked + .toggle-card-body {
  border-color: var(--ppp-primary); background: #eef3ff; color: var(--ppp-primary);
}
.toggle-card input:checked + .toggle-card-body i { color: var(--ppp-primary); }

.sdk-group { margin-bottom: 18px; }
.sdk-group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #8a93a6; margin-bottom: 8px; font-weight: 600; }
.sdk-card { display: block; cursor: pointer; margin: 0; height: 100%; }
.sdk-card-body {
  display: block; padding: 10px 13px; border: 1px solid var(--ppp-border);
  border-radius: 10px; background: #fff; transition: all .15s; height: 100%;
}
.sdk-card .sdk-name { display: block; font-weight: 600; font-size: 13.5px; }
.sdk-card .sdk-meta { display: block; font-size: 11.5px; color: #98a2b3; line-height: 1.4; margin-top: 2px; }
.sdk-card input:checked + .sdk-card-body { border-color: var(--ppp-primary); background: #eef3ff; }

/* ── AAB import dropzone ──────────────────────────────── */
.aab-import { border-style: dashed; }
.aab-dropzone {
  border: 2px dashed #c7d0e0; border-radius: 12px; padding: 22px;
  cursor: pointer; transition: border-color .15s, background .15s; outline: none;
}
.aab-dropzone:hover, .aab-dropzone:focus-visible { border-color: var(--ppp-primary); background: #f5f8ff; }
.aab-dropzone.is-dragover { border-color: var(--ppp-primary); background: #eef3ff; }
.aab-dz-idle { display: flex; align-items: center; gap: 16px; }
.aab-dz-idle > i { font-size: 34px; color: var(--ppp-primary); }
.aab-dz-text { display: flex; flex-direction: column; }
.aab-dz-text strong { font-size: 15px; }
.aab-dz-text span { font-size: 13px; color: #6b7280; }
.aab-dz-busy .progress { height: 8px; border-radius: 6px; margin: 8px 0 6px; }
.aab-file-name { font-size: 13.5px; font-weight: 600; }
.aab-status { font-size: 12.5px; color: #6b7280; }
.aab-summary {
  border: 1px solid var(--ppp-border); border-radius: 10px; padding: 12px 14px; height: 100%;
}
.aab-summary-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #8a93a6; font-weight: 600; margin-bottom: 8px; }
.aab-summary-group + .aab-summary-group { margin-top: 10px; }
.aab-summary-sub { font-size: 11.5px; color: #6b7280; font-weight: 600; margin-bottom: 4px; }

/* ── Permission tags ──────────────────────────────────── */
.perm-chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 8px; }
.perm-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eef3ff; border: 1px solid #cfe0ff; color: #1f3a8a;
  border-radius: 20px; padding: 4px 6px 4px 12px; font-size: 12.5px; line-height: 1.4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.perm-chip-label { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-chip-remove {
  border: 0; background: transparent; color: #5b6b9a; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 4px; border-radius: 50%;
}
.perm-chip-remove:hover { color: #b91c1c; background: #fde2e2; }
/* Origin tag: where a permission most likely came from (app vs merged-in SDK). */
.perm-chip-origin {
  font-family: var(--bs-body-font-family, system-ui, sans-serif);
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  padding: 1px 7px; border-radius: 20px; white-space: nowrap;
  background: #e5e7eb; color: #4b5563;
}
.perm-origin-app { background: #dcfce7; color: #15803d; }
.perm-origin-sdk { background: #e0e7ff; color: #4338ca; }
.perm-origin-common { background: #e5e7eb; color: #4b5563; }
.perm-origin-internal { background: #f1f5f9; color: #64748b; }
.perm-origin-invalid { background: #fef3c7; color: #92400e; }
.perm-add { max-width: 460px; }

.preview-card { position: sticky; top: 92px; }
.preview-body {
  max-height: 70vh; overflow-y: auto; font-size: 13px; line-height: 1.6;
  background: #fbfcfe; border-radius: 0 0 13px 13px;
}
.preview-body h1 { font-size: 20px; }
.preview-body h2 { font-size: 15px; border-bottom: 1px solid var(--ppp-border); padding-bottom: 4px; margin-top: 18px; }
.preview-body h3 { font-size: 13.5px; }

/* ── Auth ─────────────────────────────────────────────── */
body.auth-body {
  margin: 0; min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #1b2a4a 0%, #2f4d8f 100%);
  font-family: "Segoe UI", system-ui, sans-serif; padding: 20px;
}
.auth-card { background: #fff; width: 100%; max-width: 400px; padding: 36px 34px; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-logo { width: 56px; height: 56px; border-radius: 14px; background: #eef3ff; color: var(--ppp-primary); display: grid; place-items: center; font-size: 26px; margin: 0 auto 14px; }

/* ── Public policy page ───────────────────────────────── */
/* Typography mirrors the reference site (privacypolicycenter.com). */
body.public-body {
  margin: 0; background: #ffffff; color: #1b1b1b;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}
.public-header { background: #fff; border-bottom: 1px solid var(--ppp-border); padding: 14px 0; position: sticky; top: 0; z-index: 10; }
.public-header .brand { font-weight: 600; font-size: 17px; }
.public-header .brand i { color: var(--ppp-primary); }
.policy-layout {
  display: grid;
  grid-template-columns: 350px minmax(0, 860px);
  gap: 50px;
  justify-content: center;
  align-items: start;
  margin: 30px auto;
}

/* Quick navigation — sticky, sized to its content, no internal scrollbar. */
.policy-nav { position: sticky; top: 30px; align-self: start; }
.policy-nav.is-empty { display: none; }
.policy-nav-inner {
  background: #fff; border: 1px solid #d9d9d9; border-radius: 10px;
  padding: 22px 26px;
}
.policy-nav-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ppp-muted, #666f7d); font-weight: 700; padding-bottom: 12px; margin-bottom: 8px;
  border-bottom: 1px solid #ececec;
}
.policy-nav-list { display: block; counter-reset: navitem; }
.policy-nav-item {
  display: block; color: #1b1b1b; text-decoration: none; font-size: 15px;
  line-height: 1.5; padding: 6px 0; transition: color .12s;
}
.policy-nav-item::before {
  counter-increment: navitem; content: counter(navitem) ". ";
  color: #666f7d; font-weight: 700;
}
.policy-nav-item:hover { color: var(--ppp-primary); text-decoration: underline; }
.policy-nav-item.active { color: var(--ppp-primary); font-weight: 700; }
.policy-nav-item.active::before { color: var(--ppp-primary); }

.policy-document {
  background: #fff; margin: 0; padding: 0; line-height: 1.6; word-break: break-word;
}
.policy-document h1 { font-size: 28px; line-height: 1.15; letter-spacing: .3px; margin: 0 0 6px; }
.policy-document h2 {
  font-size: 24px; margin: 30px 0 6px; padding-bottom: 6px;
  border-bottom: 1px solid #ececec; scroll-margin-top: 25px;
}
.policy-document h3 { font-size: 22px; margin: 28px 0 12px; }
.policy-document h4 { font-size: 18px; margin: 22px 0 8px; }
.policy-document .policy-meta { color: var(--ppp-muted, #666f7d); font-size: 14px; }
.policy-document code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; }
.public-footer { padding: 26px 0 40px; }

.status-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.status-code { font-size: 64px; font-weight: 800; color: var(--ppp-primary); line-height: 1; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .preview-card { position: static; }

  /* Quick-nav is supplementary — hide it and let the document use full width. */
  .policy-layout { grid-template-columns: minmax(0, 860px); }
  .policy-nav { display: none; }
}

@media (max-width: 575.98px) {
  .policy-document { padding: 28px 22px; }
}
