:root {
  --bg: #f4f8fd;
  --card: #fff;
  --text: #10213b;
  --muted: #7788a3;
  --line: #d9e5f3;
  --accent: #2f6fe8;
  --accent2: #1e4f9e;
  --danger: #c93b4e;
  --success: #168451;
  --nav: #091a31;
  --shadow: 0 18px 55px rgba(22, 59, 113, 0.08);
}
* {
  box-sizing: border-box;
}
html {
  background: var(--bg);
}
body {
  margin: 0;
  font-family: Kalameh, Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.cp-shell {
  min-height: 100vh;
}
.cp-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 264px;
  z-index: 40;
  background: linear-gradient(180deg, #07182c, #0d2850);
  padding: 24px;
  color: #fff;
  overflow: auto;
}
.cp-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}
.cp-brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(145deg, #eff7ff, #2f70e7);
  color: #123871;
  font-weight: 900;
  font-size: 24px;
}
.cp-brand-logo {
  width: 112px;
  height: 48px;
  object-fit: contain;
  object-position: right center;
}
.cp-brand div {
  display: grid;
}
.cp-brand small {
  opacity: 0.58;
  font-size: 10px;
  margin-top: 3px;
}
.cp-nav {
  display: grid;
  gap: 6px;
}
.cp-nav a {
  color: #cbd9ed;
  text-decoration: none;
  padding: 11px 13px;
  border-radius: 14px;
  font-size: 13px;
  transition: 0.18s;
}
.cp-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(-2px);
}
.cp-main {
  margin-right: 264px;
  min-height: 100vh;
  padding: 0 28px 40px;
}
.cp-topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.cp-topbar-start {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cp-topbar-start > div {
  display: grid;
}
.cp-topbar small {
  color: var(--muted);
  margin-top: 4px;
}
.cp-theme,
.cp-menu {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 13px;
  padding: 10px 13px;
  cursor: pointer;
}
.cp-menu {
  display: none;
}
.cp-topbar-actions { display: flex; align-items: center; gap: 8px; }
.cp-topbar-actions a { text-decoration: none; }
.cp-backdrop { display: none; }
.cp-page-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 18px;
}
.cp-page-head h1 {
  margin: 0;
  font-size: 28px;
}
.cp-page-head p,
.cp-panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.cp-search {
  min-width: 300px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 15px;
  outline: none;
}
.cp-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 111, 232, 0.08);
}
.cp-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.cp-stats article,
.cp-panel,
.cp-price-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.cp-stats article {
  padding: 18px;
  display: grid;
  gap: 8px;
}
.cp-stats small,
.cp-muted {
  color: var(--muted);
}
.cp-stats strong {
  font-size: 25px;
}
.cp-stats em {
  font-size: 10px;
  color: var(--muted);
  font-style: normal;
}
.cp-panel {
  margin-top: 18px;
  padding: 18px;
}
.cp-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.cp-panel-head h2 {
  margin: 0;
  font-size: 18px;
}
.cp-panel-head a {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
}
.cp-head-actions { display: flex; align-items: center; gap: 8px; }
.cp-head-actions form { margin: 0; }
.cp-kicker { margin: 0 0 6px !important; color: var(--accent) !important; font-size: 10px !important; font-weight: 800; letter-spacing: .08em; }
.cp-seo-stats { grid-template-columns: repeat(5,minmax(0,1fr)); }
.cp-seo-tools { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:18px; }
.cp-seo-tools a { display:grid; gap:7px; min-width:0; padding:18px; border:1px solid var(--line); border-radius:20px; background:var(--card); color:var(--text); text-decoration:none; box-shadow:var(--shadow); transition:.18s ease; }
.cp-seo-tools a:hover { border-color:var(--accent); transform:translateY(-2px); }
.cp-seo-tools b { font-size:14px; }
.cp-seo-tools span { color:var(--muted); font-size:10px; line-height:1.8; }
.cp-badge--error { background:#feecef; color:var(--danger); }
.cp-badge--warning { background:#fff4df; color:#a96500; }
.cp-table-wrap {
  overflow: auto;
}
.cp-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
.cp-table th,
.cp-table td {
  text-align: right;
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
}
.cp-table th {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.cp-table td {
  font-size: 12px;
}
.cp-badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eaf2ff;
  color: #1f5fc4;
  font-size: 10px;
  font-weight: 800;
}
.cp-actions {
  display: flex;
  gap: 6px;
}
.cp-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.cp-btn-sm {
  padding: 7px 10px;
  font-size: 10px;
}
.cp-btn-primary {
  background: linear-gradient(135deg, #3d7ce8, #204f9e);
  color: white;
}
.cp-btn-ghost {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
}
.cp-btn-danger {
  background: #feecef;
  color: var(--danger);
}
.cp-btn-success {
  background: #e6f7ee;
  color: var(--success);
}
.cp-empty {
  text-align: center !important;
  color: var(--muted);
  padding: 28px !important;
}
.cp-toast {
  background: #e5f7ed;
  color: #176b45;
  border: 1px solid #c8ecd9;
  padding: 11px 14px;
  border-radius: 14px;
  margin-bottom: 14px;
}
.cp-price-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.cp-price-card {
  padding: 18px;
}
.cp-price-card h2 {
  margin: 5px 0 16px;
}
.cp-price-form {
  display: grid;
  gap: 10px;
}
.cp-price-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}
.cp-price-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 12px;
  padding: 11px;
}
.cp-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 21, 0.68);
  z-index: 99;
  place-items: center;
  padding: 16px;
}
.cp-modal.open {
  display: grid;
}
.cp-modal-card {
  width: min(430px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
}
.cp-modal-card h3 {
  margin-top: 0;
}
.cp-modal-card p {
  color: var(--muted);
}
.cp-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
body.dark {
  --bg: #071426;
  --card: #0d1e34;
  --text: #eef5ff;
  --muted: #93a8c4;
  --line: #203b60;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.12);
}
body.dark .cp-badge {
  background: #112f5c;
  color: #8bb9ff;
}
body.dark .cp-btn-danger {
  background: #421c27;
}
body.dark .cp-btn-success {
  background: #153a2a;
}
@media (max-width: 1280px) {
  .cp-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .cp-price-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 1023px) {
  .cp-sidebar {
    transform: translateX(110%);
    transition: 0.2s;
  }
  .cp-sidebar-open .cp-sidebar {
    transform: translateX(0);
  }
  .cp-sidebar-open .cp-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    border: 0;
    background: rgba(3, 10, 21, .56);
  }
  .cp-main {
    margin-right: 0;
    padding: 0 18px 32px;
  }
  .cp-menu {
    display: block;
  }
  .cp-page-head-row {
    align-items: stretch;
    flex-direction: column;
  }
  .cp-search {
    min-width: 0;
    width: 100%;
  }
  .cp-table {
    white-space: normal;
  }
  .cp-table thead {
    display: none;
  }
  .cp-table,
  .cp-table tbody,
  .cp-table tr,
  .cp-table td {
    display: block;
    width: 100%;
  }
  .cp-table tr {
    border: 1px solid var(--line);
    border-radius: 16px;
    margin-bottom: 10px;
    padding: 8px;
  }
  .cp-table td {
    border: 0;
    display: flex;
    justify-content: space-between;
    gap: 16px;
  }
  .cp-table td:before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
  }
  .cp-actions {
    justify-content: flex-end;
  }
}
@media (max-width: 640px) {
  .cp-main {
    padding: 0 12px 24px;
  }
  .cp-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .cp-price-grid {
    grid-template-columns: 1fr;
  }
  .cp-page-head {
    align-items: stretch;
    flex-direction: column;
  }
  .cp-page-head h1 {
    font-size: 23px;
  }
}
.cp-modal-field {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}
.cp-modal-field input,
.cp-modal-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  padding: 11px 12px;
  outline: 0;
  resize: vertical;
}
.cp-modal-field input:focus,
.cp-modal-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 111, 232, 0.08);
}

@media (max-width: 1280px) {
  .cp-seo-stats { grid-template-columns:repeat(3,1fr); }
  .cp-seo-tools { grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 640px) {
  .cp-head-actions { display:grid; grid-template-columns:1fr 1fr; }
  .cp-head-actions .cp-btn { text-align:center; }
  .cp-head-actions form,.cp-head-actions form button { width:100%; }
  .cp-seo-stats,.cp-seo-tools { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

.cp-toast,
.messagelist li {
  position: fixed !important;
  right: 22px;
  left: auto;
  bottom: 22px;
  z-index: 1000;
  width: min(420px, calc(100vw - 32px));
  margin: 0 !important;
  padding: 14px 16px !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 55px rgba(16, 24, 40, 0.2);
  animation: cpToastIn 0.35s cubic-bezier(0.22, 0.8, 0.22, 1), cpToastOut 0.35s ease 6.65s forwards;
}
.cp-toast.is-leaving,
.messagelist li.is-leaving { animation: cpToastOut 0.35s ease forwards; }
@keyframes cpToastIn { from { transform: translateX(calc(100% + 32px)); opacity: 0; } }
@keyframes cpToastOut { to { transform: translateX(calc(100% + 32px)); opacity: 0; } }

/* Django admin */
body:not(:has(.cp-shell)) {
  --primary: #173f82;
  --secondary: #2f6fe8;
  --accent: #e7f0ff;
  --header-color: #fff;
  --header-branding-color: #fff;
  --breadcrumbs-bg: #112f62;
  --link-fg: #245fc4;
  --link-hover-color: #123e86;
  --hairline-color: #dce7f4;
  --border-color: #d7e3f1;
  --body-bg: #f3f7fc;
  --darkened-bg: #eaf1f9;
  --selected-bg: #e5efff;
}
#header {
  min-height: 68px;
  padding: 0 28px;
  background: linear-gradient(120deg, #07182c, #173f82);
  box-shadow: 0 10px 30px rgba(7, 24, 44, .15);
}
#branding h1, #branding h1 a:link, #branding h1 a:visited { color: #fff; }
#site-name a { display: flex; align-items: center; gap: 10px; font-weight: 900; }
.admin-brand-logo { width:110px; height:42px; object-fit:contain; object-position:right center; }
.admin-brand-mark {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: 13px; color: #123871; background: linear-gradient(145deg, #fff, #75a8ff);
}
#user-tools { font-size: 12px; }
#user-tools a { border-bottom: 0; opacity: .86; }
.admin-dashboard-link {
  display: inline-flex; align-items: center; color: #fff !important; text-decoration: none;
  border: 1px solid rgba(255,255,255,.2); border-radius: 11px; padding: 8px 12px; margin-inline-start: 14px;
}
div.breadcrumbs { padding: 13px 28px; background: #112f62; }
#content { padding: 28px; }
#content h1 { font-size: 26px; color: #10213b; }
.module, .inline-group, #changelist-filter, .submit-row {
  overflow: hidden; border: 1px solid #d9e5f3 !important; border-radius: 16px !important;
  background: #fff; box-shadow: 0 12px 38px rgba(22, 59, 113, .07);
}
.module h2, .module caption, .inline-group h2 {
  padding: 13px 16px; background: linear-gradient(120deg, #173f82, #2f6fe8); color: #fff;
}
input, textarea, select, .vTextField {
  min-height: 42px; border-color: #cfdef0 !important; border-radius: 10px !important; padding: 8px 11px !important;
}
input:focus, textarea:focus, select:focus { border-color: #2f6fe8 !important; box-shadow: 0 0 0 3px rgba(47,111,232,.12); outline: 0; }
.button, input[type=submit], input[type=button], .submit-row input, a.button {
  border: 0 !important; border-radius: 10px !important; background: linear-gradient(135deg, #3778e7, #1e4f9e) !important; padding: 10px 16px !important;
}
.button.default, input[type=submit].default { background: linear-gradient(135deg, #2f6fe8, #173f82) !important; }
#changelist table thead th { background: #eef4fb; padding: 12px 10px; }
#changelist table tbody td, #changelist table tbody th { padding: 12px 10px; }
.login #container { width: min(420px, calc(100% - 28px)); border: 1px solid #d9e5f3; border-radius: 22px; overflow: hidden; box-shadow: 0 24px 70px rgba(15,49,96,.14); }
.login #header { height: auto; padding: 24px; justify-content: center; }
.login #content { padding: 28px; }

@media (max-width: 767px) {
  #header { padding: 12px 16px; height: auto; align-items: flex-start; gap: 12px; }
  #branding, #user-tools { width: 100%; text-align: right; }
  .admin-dashboard-link { margin: 0; font-size: 11px; }
  div.breadcrumbs, #content { padding: 14px; }
  #content-main { min-width: 0; }
  .change-list .filtered .results, .change-list .filtered .paginator, .filtered #toolbar, .filtered div.xfull { margin-right: 0 !important; }
  #changelist-filter { position: static !important; width: auto !important; margin-top: 14px; }
  .form-row { overflow-wrap: anywhere; }
}
