:root {
  --color-background: #f5f7fb;
  --color-surface: #ffffff;
  --color-surface-alt: #eef2ff;
  --color-header: #ffffff;
  --color-sidebar: #0b1f4b;
  --color-sidebar-muted: rgba(255, 255, 255, 0.65);
  --color-sidebar-hover: rgba(13, 59, 236, 0.18);
  --color-primary: #0b60ff;
  --color-primary-dark: #073bd2;
  --color-primary-muted: rgba(11, 96, 255, 0.12);
  --color-secondary: #7048ff;
  --color-accent: #f0ecff;
  --color-text: #19213d;
  --color-text-muted: #6b7190;
  --color-border: #d9e1f2;
  --color-line-soft: rgba(217, 225, 242, 0.6);
  --color-success: #0f9c7e;
  --color-warning: #d99300;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 24px 60px rgba(15, 46, 108, 0.12);
  --shadow-soft: 0 16px 32px rgba(15, 46, 108, 0.08);
  --shadow-pop: 0 18px 40px rgba(11, 96, 255, 0.18);
  --font-family-base: "Inter", "Noto Sans SC", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  /* legacy aliases */
  --primary: var(--color-primary);
  --primary-dark: var(--color-primary-dark);
  --muted: var(--color-text-muted);
  --text: var(--color-text);
  --card: var(--color-surface);
  --card-border: rgba(217, 225, 242, 0.65);
  --line: var(--color-border);
  --shadow: var(--shadow-soft);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-family-base);
  color: var(--color-text);
  background: var(--color-background);
  line-height: 1.6;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.site-header {
  background: var(--color-header);
  border-bottom: 1px solid rgba(10, 60, 180, 0.12);
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 10px 30px rgba(15, 46, 108, 0.08);
}

.site-header .container,
.site-header--app .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
}

.site-header .brand,
.site-header--app .site-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-header .logo,
.site-header--app .logo {
  font-weight: 800;
  font-size: 22px;
  color: var(--color-primary);
  letter-spacing: 0.02em;
}

.site-header .tagline,
.site-header--app .tagline {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.site-header .nav,
.site-header--app .nav {
  display: flex;
  gap: 20px;
  font-weight: 600;
  font-size: 14px;
  align-items: center;
}

.site-header .nav a,
.site-header--app .nav a {
  color: var(--color-text);
  position: relative;
}

.site-header .nav a::after,
.site-header--app .nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 160ms ease;
}

.site-header .nav a:hover::after,
.site-header--app .nav a:hover::after,
.site-header .nav a[aria-current="page"]::after,
.site-header--app .nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav-cta,
.btn,
.button,
.button.primary,
.button.ghost,
.button.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 6px 12px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  font-size: 14px;
}

.nav-cta,
.btn.primary,
.button.primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 14px 24px rgba(11, 96, 255, 0.22);
}

.nav-cta:hover,
.btn.primary:hover,
.button.primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-1px);
}

.btn.secondary,
.button.secondary {
  background: var(--color-primary-muted);
  color: var(--color-primary);
}

.btn.ghost,
.button.ghost {
  background: #fff;
  border-color: var(--color-border);
  color: var(--color-primary);
  box-shadow: none;
}

.btn.ghost:hover,
.button.ghost:hover {
  background: rgba(11, 96, 255, 0.08);
  border-color: var(--color-primary);
}

.button.small,
.btn.small {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(11, 96, 255, 0.15);
}

label {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text-muted);
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.status-banner,
.notice-banner {
  background: var(--color-secondary);
  color: #fff;
  padding: 18px 0;
}

.notice-banner .container,
.status-banner .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.card,
.panel,
.section,
.content-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(217, 225, 242, 0.7);
}

.section-head,
.section header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 6px;
}

.section-head h2,
.section header h2 {
  margin: 0;
  font-size: 22px;
  color: var(--color-text);
}

.section-head p,
.section header p {
  margin: 4px 0 0;
  color: var(--color-text-muted);
}

.table,
.pricing-rules-table,
.summary-table,
.table-grid {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.table thead,
.pricing-rules-table thead,
.summary-table thead {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.table th,
.table td,
.pricing-rules-table th,
.pricing-rules-table td,
.summary-table th,
.summary-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font-size: 14px;
}

.table tbody tr:hover,
.pricing-rules-table tbody tr:hover,
.summary-table tbody tr:hover {
  background: rgba(11, 96, 255, 0.06);
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(11, 96, 255, 0.08);
  color: var(--color-primary);
}

.badge.warning {
  background: rgba(217, 147, 0, 0.14);
  color: #925d00;
}

.badge.muted {
  background: rgba(107, 113, 144, 0.12);
  color: var(--color-text-muted);
}

.filters {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(217, 225, 242, 0.8);
  display: grid;
  gap: 18px;
}

.filters-grid {
  display: grid;
  gap: 16px;
}

.filters-primary {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.filter-advanced {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.filters-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.sidebar {
  background: linear-gradient(180deg, rgba(9, 28, 82, 0.98) 0%, rgba(10, 24, 62, 0.92) 100%);
  color: #fff;
  width: 280px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-soft);
}

.sidebar nav ul,
.sidebar .menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.sidebar nav li button,
.sidebar .menu button,
.sidebar nav a {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.92);
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.sidebar nav li button:hover,
.sidebar .menu button:hover,
.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateX(4px);
}

.sidebar nav li button.active,
.sidebar .menu button.active,
.sidebar nav a[aria-current="page"] {
  background: #fff;
  color: var(--color-primary);
  border-color: rgba(11, 96, 255, 0.6);
  box-shadow: var(--shadow-soft);
  transform: none;
}

.sidebar .brand .logo {
  font-size: 20px;
  color: #fff;
}

.sidebar .brand .tagline {
  color: var(--color-sidebar-muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-actions {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.main,
.app-main,
.dashboard-main {
  padding: 3px;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.section,
.card {
  padding: 24px;
}

.section + .section {
  margin-top: 20px;
}

.app-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  border: 1px solid rgba(217, 225, 242, 0.75);
  box-shadow: var(--shadow-soft);
}

.app-toolbar .search-box {
  background: rgba(240, 244, 255, 0.6);
  border: 1px solid rgba(217, 225, 242, 0.9);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: min(360px, 100%);
  flex: 1 1 320px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.app-toolbar .search-box input {
  border: 0;
  background: transparent;
  padding: 0;
  min-width: 200px;
  width: 100%;
}

.app-toolbar .search-box input:focus {
  box-shadow: none;
}

.app-toolbar .search-icon {
  font-size: 16px;
  color: var(--color-primary);
  opacity: 0.78;
}

.app-toolbar .toolbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.badge-list,
.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-row .tag,
.badge-list .tag {
  background: var(--color-primary-muted);
  color: var(--color-primary);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
}

.list,
ul.list {
  margin: 0;
  padding-left: 18px;
  color: var(--color-text-muted);
}

.steps,.grid,.cards {
  gap: 24px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width, 280px) minmax(0, 1fr);
}

.app-shell .sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}

.app-shell .main,
.app-shell .app-main {
  background: var(--color-background);
}

.status-table {
  display: grid;
  gap: 14px;
}

.status-table .item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-soft);
}

.alert {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: rgba(11, 96, 255, 0.08);
  color: var(--color-primary-dark);
  border: 1px solid rgba(11, 96, 255, 0.24);
}

.alert.warning {
  background: rgba(217, 147, 0, 0.12);
  border-color: rgba(217, 147, 0, 0.32);
  color: #8a5b00;
}

.empty-state {
  text-align: center;
  padding: 36px 0;
  color: var(--color-text-muted);
}

.empty-state strong {
  color: var(--color-text);
}

.footer {
  background: linear-gradient(180deg, #0b1f4b 0%, #09183a 100%);
  color: rgba(255, 255, 255, 0.82);
  padding: 48px 0 30px;
}

.footer a {
  color: #c8d6ff;
}

.footer a:hover {
  color: #fff;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width, 240px) 1fr;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    width: 260px;
    transition: transform 0.3s ease;
    z-index: 90;
  }

  .app-shell .sidebar.is-open {
    transform: translateX(0);
  }

  .app-shell .main,
  .app-shell .app-main {
    padding: 24px 3vw 32px;
  }
}

@media (max-width: 768px) {
  .site-header .container,
  .site-header--app .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .site-header .nav,
  .site-header--app .nav {
    flex-wrap: wrap;
    gap: 12px;
  }

  .filters {
    padding: 16px;
  }

  .filters-primary,
  .filter-advanced {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  body.dark,
  body[data-theme="dark"] {
    --color-background: #131b2d;
    --color-surface: #1c2337;
    --color-surface-alt: rgba(31, 52, 99, 0.5);
    --color-header: rgba(19, 27, 45, 0.96);
    --color-text: #f4f6ff;
    --color-text-muted: #a9b5d7;
    --color-border: rgba(93, 110, 168, 0.42);
    --shadow-card: 0 26px 40px rgba(4, 16, 51, 0.52);
  }
}
