:root {
  --ba-navy: #082b53;
  --ba-navy-deep: #061f3d;
  --ba-text: #10213f;
  --ba-muted: #66758f;
  --ba-primary: #1769ff;
  --ba-primary-deep: #0b4bd3;
  --ba-primary-soft: #eaf2ff;
  --ba-green: #16a34a;
  --ba-green-deep: #0f7a36;
  --ba-green-soft: #e9f8ef;
  --ba-border: #dbe5f4;
  --ba-bg: #f8fbff;
  --ba-card-shadow: 0 16px 38px rgba(8, 43, 83, 0.08);
  --primary: var(--ba-primary);
  --secondary: var(--ba-navy);
  --accent: var(--ba-green);
  --body-fg: var(--ba-text);
  --body-bg: var(--ba-bg);
  --body-quiet-color: var(--ba-muted);
  --body-loud-color: #071f3d;
  --header-bg: var(--ba-navy);
  --header-color: #ffffff;
  --header-branding-color: #ffffff;
  --header-link-color: #ffffff;
  --breadcrumbs-bg: transparent;
  --breadcrumbs-fg: var(--ba-muted);
  --breadcrumbs-link-fg: var(--ba-primary);
  --link-fg: var(--ba-primary-deep);
  --link-hover-color: var(--ba-green-deep);
  --hairline-color: var(--ba-border);
  --border-color: var(--ba-border);
  --button-bg: var(--ba-primary);
  --button-hover-bg: var(--ba-primary-deep);
  --default-button-bg: var(--ba-green);
  --default-button-hover-bg: var(--ba-green-deep);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 80% 0%, rgba(23, 105, 255, 0.11), transparent 28rem),
    linear-gradient(180deg, #f8fbff 0%, #f4f8fd 100%);
  color: var(--ba-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body:not(.login) #container {
  min-height: 100vh;
}

/* Left rail, matching the old Next.js admin panel. */
body:not(.login) #header {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 288px;
  min-height: 100vh;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.10);
  background: linear-gradient(180deg, var(--ba-navy-deep) 0%, var(--ba-navy) 64%, #073764 100%);
  box-shadow: 20px 0 42px rgba(8, 43, 83, 0.16);
}

body:not(.login) #branding {
  display: flex;
  min-height: 82px;
  align-items: center;
  padding: 18px 20px 14px;
}

.ba-admin-brand,
.ba-sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ba-admin-mark {
  display: inline-flex;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--ba-green);
  color: #ffffff;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 0.02em;
  box-shadow: 0 14px 26px rgba(22, 163, 74, 0.24);
}

.ba-admin-copy,
.ba-sidebar-head > span:last-child {
  display: grid;
  gap: 2px;
}

.ba-admin-copy #site-name,
.ba-admin-copy #site-name a,
.ba-sidebar-head strong {
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
  text-decoration: none;
}

.ba-admin-copy small,
.ba-sidebar-head small {
  color: #bfdbfe;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body:not(.login) .ba-admin-branch {
  margin: 0 18px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #dbeafe;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
}

body:not(.login) #user-tools {
  margin-top: auto;
  padding: 16px 20px 22px;
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.8;
}

body:not(.login) #user-tools strong {
  color: #ffffff;
}

body:not(.login) #user-tools a,
body:not(.login) #logout-form button {
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

body:not(.login) #logout-form button {
  border: 0;
  background: transparent;
}

body:not(.login) #theme-toggle,
body:not(.login) .theme-toggle {
  display: none;
}

body:not(.login) .main {
  display: block;
  min-height: 100vh;
  margin-left: 288px;
  background: transparent;
}

body:not(.login) .content {
  min-width: 0;
  width: 100%;
}

body:not(.login) #content {
  width: auto !important;
  max-width: 1480px;
  padding: 26px;
}

body:not(.login) #content.colMS,
body:not(.login) #content.colM {
  margin-right: 0 !important;
}

body:not(.login) #content h1 {
  margin: 0 0 18px;
  color: var(--ba-text);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0;
}

body:not(.login) nav[aria-label="Breadcrumbs"] {
  margin-left: 288px;
}

div.breadcrumbs {
  border: 0;
  border-bottom: 1px solid var(--ba-border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ba-muted);
  padding: 14px 26px;
  font-size: 13px;
  font-weight: 800;
  backdrop-filter: blur(12px);
}

/* Custom sidebar nav inside the left rail. */
.toggle-nav-sidebar {
  display: none !important;
}

body:not(.login) #nav-sidebar {
  position: fixed;
  z-index: 40;
  top: 108px;
  bottom: 84px;
  left: 0;
  display: flex;
  width: 288px;
  min-width: 288px;
  max-width: 288px;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  border: 0;
  background: transparent;
  padding: 0 16px 14px;
}

.ba-sidebar-head {
  display: none;
}

#nav-filter {
  width: 100%;
  height: 40px;
  margin: 0 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 13px;
}

#nav-filter::placeholder {
  color: #bfdbfe;
}

.ba-nav-groups {
  display: grid;
  gap: 14px;
}

.ba-nav-group {
  display: grid;
  gap: 6px;
}

.ba-nav-label {
  margin: 6px 4px 3px;
  color: #93c5fd;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ba-nav-dashboard,
.ba-nav-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  border-radius: 12px;
  padding: 10px 12px;
  color: #dbeafe !important;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none !important;
  transition: 160ms ease;
}

.ba-nav-dashboard:hover,
.ba-nav-item:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff !important;
}

.ba-nav-dashboard.current-model,
.ba-nav-item.current-model {
  background: #ffffff;
  color: var(--ba-navy-deep) !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

.ba-nav-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 11px;
  font-weight: 950;
}

.current-model .ba-nav-icon {
  background: var(--ba-green-soft);
  color: var(--ba-green-deep);
}

.ba-sidebar-foot {
  display: grid;
  gap: 3px;
  margin-top: auto;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px;
}

.ba-sidebar-foot strong {
  color: #ffffff;
  font-size: 12px;
}

.ba-sidebar-foot span {
  color: #bfdbfe;
  font-size: 11px;
}

/* Dashboard */
.ba-dashboard #content {
  width: auto !important;
  max-width: 1500px;
  margin: 0;
  padding: 26px;
}

.ba-dashboard #content-main,
.ba-dashboard #content-related {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  position: static !important;
}

.ba-dashboard .colMS {
  margin-right: 0 !important;
}

.ba-dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 320px);
  gap: 28px;
  align-items: center;
  min-height: 220px;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--ba-border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 82% 20%, rgba(22, 163, 74, 0.18), transparent 22rem),
    radial-gradient(circle at 12% 90%, rgba(23, 105, 255, 0.11), transparent 20rem),
    linear-gradient(135deg, #ffffff 0%, #f3f8ff 64%, #eaf7f0 100%);
  padding: 28px 30px;
  box-shadow: 0 20px 54px rgba(8, 43, 83, 0.10);
}

.ba-eyebrow {
  margin: 0 0 6px;
  color: var(--ba-green-deep);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ba-dashboard-hero h1 {
  margin: 0;
  color: var(--ba-text);
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 950;
  line-height: 1.05;
}

.ba-dashboard-hero p:not(.ba-eyebrow) {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--ba-muted);
  font-size: 15px;
  line-height: 1.7;
}

.ba-dashboard-contact {
  display: grid;
  gap: 9px;
  min-width: 230px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(22, 163, 74, 0.25), transparent 9rem),
    var(--ba-navy);
  padding: 20px;
  color: #ffffff;
  box-shadow: 0 18px 34px rgba(8, 43, 83, 0.20);
}

.ba-dashboard-contact strong {
  font-size: 16px;
  font-weight: 950;
}

.ba-dashboard-contact span {
  color: #bfdbfe;
  font-size: 13px;
  font-weight: 800;
}

.ba-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.ba-stat-grid article {
  position: relative;
  min-height: 124px;
  overflow: hidden;
  border: 1px solid var(--ba-border);
  border-radius: 20px;
  background: #ffffff;
  padding: 20px;
  box-shadow: 0 16px 38px rgba(8, 43, 83, 0.08);
}

.ba-stat-grid article::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -32px;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: rgba(23, 105, 255, 0.08);
}

.ba-stat-grid article:nth-child(2)::after,
.ba-stat-grid article:nth-child(4)::after {
  background: rgba(22, 163, 74, 0.10);
}

.ba-stat-grid span {
  color: var(--ba-muted);
  font-size: 13px;
  font-weight: 800;
}

.ba-stat-grid strong {
  display: block;
  margin-top: 14px;
  color: var(--ba-text);
  font-size: 34px;
  font-weight: 950;
}

.ba-dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  align-items: start;
  gap: 22px;
}

.ba-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ba-section-heading h2 {
  margin: 0;
  color: var(--ba-text);
  font-size: 22px;
  font-weight: 900;
}

.ba-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.ba-app-card {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--ba-border);
  border-radius: 20px;
  background: #ffffff;
  padding: 18px;
  box-shadow: var(--ba-card-shadow);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.ba-app-card:hover {
  transform: translateY(-2px);
  border-color: rgba(23, 105, 255, 0.34);
  box-shadow: 0 20px 44px rgba(8, 43, 83, 0.12);
}

.ba-app-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ba-app-icon {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: var(--ba-primary-soft);
  color: var(--ba-primary-deep);
  font-size: 17px;
  font-weight: 950;
}

.ba-app-meta {
  color: var(--ba-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ba-app-card h2 {
  margin: 18px 0 0;
  background: transparent;
  color: var(--ba-text);
  font-size: 21px;
  font-weight: 900;
  line-height: 1.15;
}

.ba-app-card h2 a {
  color: inherit !important;
  text-decoration: none;
}

.ba-app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.ba-app-actions a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none !important;
}

.ba-app-actions .addlink {
  background: var(--ba-green);
  color: #ffffff !important;
}

.ba-app-actions .changelink,
.ba-app-actions .viewlink {
  border: 1px solid rgba(23, 105, 255, 0.28);
  background: #ffffff;
  color: var(--ba-primary-deep) !important;
}

.ba-recent-panel .module {
  position: sticky;
  top: 26px;
  height: fit-content;
  padding-bottom: 12px;
}

.ba-recent-panel #recent-actions-module h2 {
  margin: 0;
}

.actionlist {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
}

.actionlist li {
  border: 1px solid var(--ba-border);
  border-radius: 15px;
  background: #ffffff;
  padding: 12px;
  color: var(--ba-text);
  font-weight: 800;
}

.actionlist .mini {
  color: var(--ba-muted);
  font-size: 12px;
  font-weight: 700;
}

/* Tables, modules, forms. */
.module,
.inline-group,
.submit-row,
#changelist,
.paginator,
.messagelist li,
form .aligned {
  overflow: hidden;
  border: 1px solid var(--ba-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--ba-card-shadow);
}

.module h2,
.module caption,
.inline-group h2 {
  background: linear-gradient(120deg, var(--ba-primary), #0a73d9);
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.module caption a.section {
  color: #ffffff !important;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  background: #f3f8ff;
  color: var(--ba-text);
  font-size: 12px;
  font-weight: 900;
}

th,
td {
  border-bottom: 1px solid #edf3fb;
  vertical-align: middle;
}

tr:nth-child(even),
.row2 {
  background: #fbfdff;
}

tr:hover {
  background: var(--ba-green-soft);
}

a:link,
a:visited {
  color: var(--ba-primary-deep);
}

a:hover,
a:focus {
  color: var(--ba-green-deep);
}

#toolbar,
#changelist-search {
  border-radius: 18px;
  border-color: var(--ba-border);
  background: #ffffff;
  box-shadow: var(--ba-card-shadow);
}

#changelist-filter {
  border-left: 1px solid var(--ba-border);
  background: #f8fbff;
}

#changelist-filter h2 {
  background: var(--ba-navy);
  color: #ffffff;
  font-weight: 900;
}

#changelist-filter h3 {
  color: var(--ba-text);
  font-weight: 900;
}

.object-tools {
  margin-top: -2px;
}

.object-tools a,
.historylink,
.viewsitelink {
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ba-green), #22c55e);
  font-weight: 900;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="file"],
textarea,
select,
.vTextField {
  min-height: 40px;
  border: 1px solid var(--ba-border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ba-text);
  box-shadow: 0 1px 0 rgba(8, 43, 83, 0.03);
}

textarea {
  min-height: 108px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--ba-primary);
  box-shadow: 0 0 0 4px rgba(23, 105, 255, 0.12);
  outline: none;
}

.button,
input[type="submit"],
input[type="button"],
.submit-row input,
a.button {
  border-radius: 999px;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(23, 105, 255, 0.16);
}

.button.default,
input[type="submit"].default,
.submit-row input.default {
  background: linear-gradient(135deg, var(--ba-green), #22c55e);
  box-shadow: 0 12px 22px rgba(22, 163, 74, 0.22);
}

.delete-link {
  border-radius: 999px !important;
  font-weight: 900;
}

/* Login screen. */
body.login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    radial-gradient(circle at 78% 18%, rgba(23, 105, 255, 0.16), transparent 25rem),
    radial-gradient(circle at 20% 80%, rgba(22, 163, 74, 0.14), transparent 24rem),
    linear-gradient(135deg, #f8fbff 0%, #eaf2ff 100%);
}

.login #container {
  overflow: hidden;
  width: min(440px, calc(100vw - 32px));
  border: 1px solid var(--ba-border);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(8, 43, 83, 0.16);
}

.login #header {
  justify-content: center;
  min-height: 128px;
  background: linear-gradient(120deg, var(--ba-navy), var(--ba-primary-deep));
}

.login #branding {
  display: flex;
  justify-content: center;
}

.login #content {
  padding: 28px;
}

.login .form-row {
  padding: 0 0 18px;
}

.login label {
  color: var(--ba-text);
  font-weight: 900;
}

.login .submit-row {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.login input[type="submit"] {
  width: 100%;
  min-height: 46px;
}

@media (max-width: 1024px) {
  body:not(.login) #header {
    position: static;
    width: 100%;
    min-height: auto;
  }

  body:not(.login) .main,
  body:not(.login) nav[aria-label="Breadcrumbs"] {
    margin-left: 0;
  }

  body:not(.login) #nav-sidebar {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: none;
    border-bottom: 1px solid var(--ba-border);
    background: var(--ba-navy);
    padding: 12px;
  }

  .ba-nav-groups {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .ba-sidebar-foot {
    display: none;
  }

  .ba-dashboard-layout {
    grid-template-columns: 1fr;
  }

  .ba-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  body:not(.login) #content,
  .ba-dashboard #content {
    padding: 16px;
  }

  .ba-admin-branch {
    display: none;
  }

  .ba-dashboard-hero,
  .ba-stat-grid {
    grid-template-columns: 1fr;
  }

  .ba-dashboard-contact {
    min-width: 0;
  }

  .ba-app-grid {
    grid-template-columns: 1fr;
  }

  body:not(.login) #content h1 {
    font-size: 24px;
  }
}
