:root {
  --bg: #efe7da;
  --bg-deep: #e4d6c1;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --sidebar-bg: rgba(22, 44, 44, 0.94);
  --sidebar-ink: #f4f3ee;
  --sidebar-muted: rgba(244, 243, 238, 0.66);
  --ink: #1f2933;
  --muted: #52606d;
  --brand: #0f766e;
  --brand-deep: #134e4a;
  --accent: #d97706;
  --border: rgba(15, 118, 110, 0.14);
  --shadow: 0 24px 60px rgba(31, 41, 51, 0.12);
  --shell-gap: 1rem;
  --sidebar-width: 252px;
  --sidebar-collapsed-width: 78px;
}

html {
  font-size: 15px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(217, 119, 6, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.18), transparent 26%),
    linear-gradient(180deg, #faf6ef 0%, var(--bg) 100%);
}

body.sidebar-open {
  overflow: hidden;
}

a {
  color: inherit;
}

.mobile-topbar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  gap: var(--shell-gap);
  align-items: flex-start;
  padding: 1rem;
}

.sidebar-shell {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  position: sticky;
  top: 1rem;
  z-index: 20;
  overflow: visible;
  transition: width 0.22s ease, flex-basis 0.22s ease;
}

.sidebar-panel {
  min-height: calc(100vh - 2rem);
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.15rem;
  border-radius: 1.5rem;
  background:
    linear-gradient(180deg, rgba(19, 78, 74, 0.98) 0%, rgba(22, 44, 44, 0.94) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 26px 60px rgba(19, 40, 40, 0.22);
  color: var(--sidebar-ink);
  overflow: hidden;
  transition: width 0.22s ease, padding 0.22s ease, border-radius 0.22s ease, box-shadow 0.22s ease;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--sidebar-ink);
  text-decoration: none;
}

.sidebar-brand-short,
.sidebar-link-short {
  display: none;
}

.sidebar-brand-short {
  width: 2.65rem;
  height: 2.65rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.95rem;
  background: rgba(255, 248, 234, 0.12);
  color: #fff8ea;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.sidebar-brand-full {
  display: inline;
  font-size: 1.04rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-brand:hover,
.sidebar-brand:focus {
  color: #fff8ea;
}

.sidebar-summary {
  display: block;
  margin: 0.75rem 0 0;
  color: var(--sidebar-muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.sidebar-toggle,
.sidebar-close,
.mobile-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-ink);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.sidebar-close {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  font-size: 1.3rem;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus,
.sidebar-close:hover,
.sidebar-close:focus,
.mobile-menu-button:hover,
.mobile-menu-button:focus {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-section {
  margin-top: 1.05rem;
}

.sidebar-label {
  display: inline-block;
  margin-bottom: 0.62rem;
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 0.38rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.68rem;
  padding: 0.74rem 0.84rem;
  border-radius: 0.9rem;
  border: 1px solid transparent;
  color: var(--sidebar-ink);
  text-decoration: none;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.sidebar-link:hover,
.sidebar-link:focus {
  transform: translateX(4px);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-link.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.96) 0%, rgba(180, 83, 9, 0.92) 100%);
  border-color: rgba(255, 248, 234, 0.18);
  box-shadow: 0 10px 24px rgba(102, 55, 6, 0.28);
}

.sidebar-link-text {
  display: inline;
  min-width: 0;
  white-space: nowrap;
}

.sidebar-link-short {
  width: 1.95rem;
  height: 1.95rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.68rem;
  background: rgba(255, 255, 255, 0.11);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.sidebar-account {
  margin-top: auto;
  padding-top: 1rem;
}

.account-card {
  display: grid;
  gap: 0.8rem;
  padding: 0.95rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.account-card strong {
  display: block;
  color: #fff;
}

.account-meta {
  margin-top: 0.45rem;
}

.account-note {
  color: var(--sidebar-muted);
  line-height: 1.55;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.14);
  color: #fff8ea;
  font-size: 0.78rem;
  font-weight: 700;
}

.account-logout-short {
  display: none;
}

.main-shell {
  flex: 1;
  min-width: 0;
}

.main-canvas {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0.25rem 0 2rem;
}

body.sidebar-collapsed .sidebar-shell {
  width: var(--sidebar-collapsed-width);
  flex-basis: var(--sidebar-collapsed-width);
  z-index: 70;
}

body.sidebar-collapsed .sidebar-panel {
  width: var(--sidebar-collapsed-width);
  padding: 0.9rem 0.58rem;
  border-radius: 1.3rem;
}

body.sidebar-collapsed .sidebar-brand-full,
body.sidebar-collapsed .sidebar-summary,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-link-text,
body.sidebar-collapsed .account-card {
  display: none;
}

body.sidebar-collapsed .sidebar-brand-short,
body.sidebar-collapsed .sidebar-link-short {
  display: inline-flex;
}

body.sidebar-collapsed .sidebar-header {
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

body.sidebar-collapsed .sidebar-header-actions {
  display: none;
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  width: 100%;
}

body.sidebar-collapsed .sidebar-section {
  margin-top: 0.85rem;
}

body.sidebar-collapsed .sidebar-link {
  justify-content: center;
  width: 100%;
  padding: 0.66rem 0;
}

body.sidebar-collapsed .sidebar-link:hover,
body.sidebar-collapsed .sidebar-link:focus {
  transform: none;
}

body.sidebar-collapsed .sidebar-nav {
  justify-items: center;
}

body.sidebar-collapsed .sidebar-account {
  padding-top: 0.7rem;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) {
  z-index: 90;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-panel {
  width: var(--sidebar-width);
  padding: 1.15rem;
  border-radius: 1.5rem;
  box-shadow: 0 30px 72px rgba(19, 40, 40, 0.28);
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-brand-full {
  display: inline;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-label {
  display: inline-block;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-link-text {
  display: inline;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .account-card {
  display: grid;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-brand-short,
body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-link-short {
  display: none;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-header {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.9rem;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-brand {
  justify-content: flex-start;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-section {
  margin-top: 1.05rem;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-nav {
  justify-items: stretch;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-link {
  justify-content: flex-start;
  padding: 0.74rem 0.84rem;
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-link:hover,
body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-link:focus {
  transform: translateX(4px);
}

body.sidebar-collapsed .sidebar-shell:is(:hover, :focus-within) .sidebar-account {
  padding-top: 1rem;
}

.hero-panel,
.content-card,
.metric-card {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 2.2rem;
}

.hero-panel h1,
.page-header h1 {
  font-size: clamp(2rem, 3vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.metric-card {
  padding: 1.5rem;
}

.metric-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.metric-card strong {
  font-size: 2.2rem;
  line-height: 1;
}

.content-card {
  padding: 1.5rem;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.85rem;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lead {
  color: var(--muted);
}

.feature-grid {
  display: grid;
  gap: 0.9rem;
}

.feature-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  background: var(--panel-strong);
  border: 1px solid rgba(82, 96, 109, 0.12);
}

.feature-chip.active strong {
  color: var(--brand-deep);
}

.feature-chip.inactive strong {
  color: #b45309;
}

.price-pill {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--brand-deep);
  font-weight: 700;
}

.narrow-card {
  max-width: 700px;
  margin: 2rem auto 0;
}

.table > :not(caption) > * > * {
  background: transparent;
}

.table thead th {
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.alert {
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 1rem;
  box-shadow: 0 12px 30px rgba(31, 41, 51, 0.08);
}

.btn-primary {
  border-color: var(--brand);
  background-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
  border-color: var(--brand-deep);
  background-color: var(--brand-deep);
}

.btn-outline-secondary {
  border-color: rgba(82, 96, 109, 0.24);
  color: var(--ink);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background-color: rgba(82, 96, 109, 0.1);
  border-color: rgba(82, 96, 109, 0.32);
  color: var(--ink);
}

.account-logout {
  border-color: #dc3545;
  background-color: #dc3545;
  color: #fff;
}

.account-logout:hover,
.account-logout:focus {
  border-color: #b02a37;
  background-color: #b02a37;
  color: #fff;
}

.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 1080;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(250, 246, 239, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(15, 118, 110, 0.1);
}

.mobile-menu-button {
  padding: 0.7rem 0.95rem;
  flex-shrink: 0;
  background: rgba(19, 78, 74, 0.96);
  color: #fff;
  border-color: rgba(19, 78, 74, 0.96);
}

.mobile-menu-icon {
  display: inline-block;
  width: 0.95rem;
  height: 0.7rem;
  position: relative;
}

.mobile-menu-icon::before,
.mobile-menu-icon::after,
.mobile-menu-icon {
  background: transparent;
}

.mobile-menu-icon::before,
.mobile-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 0.95rem;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
}

.mobile-menu-icon::before {
  top: 0.05rem;
  box-shadow: 0 0.28rem 0 currentColor, 0 0.56rem 0 currentColor;
}

.mobile-topbar-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-end;
}

.mobile-topbar-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.mobile-topbar-title {
  font-size: 1rem;
  line-height: 1.2;
  max-width: min(56vw, 18rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  .mobile-topbar {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1085;
    background: rgba(21, 34, 34, 0.36);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }

  .app-shell {
    display: block;
    padding: 0;
  }

  .sidebar-shell {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1090;
    width: min(86vw, 304px);
    max-width: calc(100vw - 0.65rem);
    flex-basis: auto;
    transform: translateX(-104%);
    transition: transform 0.24s ease;
    padding: 0.75rem 0.75rem 0.75rem 0;
    overflow: hidden;
  }

  .sidebar-panel {
    min-height: auto;
    height: 100%;
    border-radius: 0 1.35rem 1.35rem 0;
    padding: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.sidebar-collapsed .sidebar-shell {
    width: min(86vw, 304px);
    flex-basis: auto;
  }

  body.sidebar-collapsed .sidebar-panel {
    padding: 1rem;
  }

  .sidebar-header {
    align-items: flex-start;
  }

  body.sidebar-collapsed .sidebar-header {
    flex-direction: row;
    align-items: flex-start;
  }

  body.sidebar-collapsed .sidebar-header-actions {
    display: flex;
    width: auto;
  }

  body.sidebar-collapsed .sidebar-brand {
    justify-content: flex-start;
  }

  body.sidebar-collapsed .sidebar-nav {
    justify-items: stretch;
  }

  .sidebar-brand-short,
  .sidebar-link-short,
  .account-logout-short {
    display: none !important;
  }

  .sidebar-brand-full,
  .sidebar-summary,
  .sidebar-label,
  .sidebar-link-text,
  .account-copy strong,
  .account-meta,
  .account-note,
  .account-logout-text {
    display: initial;
  }

  body.sidebar-collapsed .sidebar-link {
    justify-content: flex-start;
    padding: 0.82rem 0.92rem;
  }

  body.sidebar-collapsed .account-card {
    display: grid;
    padding: 0.95rem;
  }

  body.sidebar-open .sidebar-shell {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .main-shell {
    width: 100%;
  }

  .main-canvas {
    max-width: none;
    padding: 1rem;
  }
}

@media (max-width: 767.98px) {
  .hero-panel,
  .content-card,
  .metric-card {
    border-radius: 1.15rem;
  }

  .hero-panel {
    padding: 1.5rem;
  }

  .sidebar-shell {
    width: min(90vw, 300px);
  }

  .main-canvas {
    padding: 0.9rem;
  }

  .mobile-topbar {
    padding: 0.75rem 0.9rem;
  }
}
