:root {
  color-scheme: light;
  --bg: #eef3f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #edf2f8;
  --text: #111827;
  --muted: #667085;
  --line: #dce4ef;
  --primary: #2f7cf6;
  --primary-strong: #1f5ed6;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
  --popover-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  --bar-bg: #e7edf6;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b22;
  --surface: #101735;
  --surface-2: #151f44;
  --surface-3: #1b2752;
  --text: #f8fafc;
  --muted: #a8b3cf;
  --line: #283457;
  --primary: #7c5cff;
  --primary-strong: #6347e8;
  --success: #20d68b;
  --warning: #fbbf24;
  --danger: #ff6b6b;
  --shadow: 0 22px 58px rgba(0, 0, 0, 0.28);
  --popover-shadow: 0 22px 52px rgba(0, 0, 0, 0.42);
  --bar-bg: #263154;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  overflow: visible;
}

.brand-mark img {
  width: 46px;
  height: 46px;
  border-radius: 0;
  background: transparent;
}

.main-nav {
  display: grid;
  gap: 8px;
}

.main-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 650;
}

.main-nav a:hover,
.main-nav a.is-active {
  background: var(--surface-3);
  color: var(--text);
}

.main-nav a.is-active {
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.sidebar-footer {
  position: relative;
  margin-top: auto;
  padding: 0;
  border-radius: 16px;
}

.profile-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface-2) 92%, var(--primary)), var(--surface));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.profile-trigger:hover,
.profile-menu.is-open .profile-trigger {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  box-shadow: 0 14px 30px color-mix(in srgb, var(--primary) 13%, transparent);
}

.profile-trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.profile-menu.is-open .profile-trigger::after {
  transform: rotate(225deg) translateY(-2px);
}

.profile-trigger em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.profile-trigger-text {
  min-width: 0;
}

.profile-trigger strong {
  display: block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 14px);
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 96%, var(--primary));
  box-shadow: var(--popover-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transform-origin: bottom left;
  transition: opacity 160ms ease, transform 160ms ease;
}

.profile-popover::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transform: rotate(45deg);
}

.profile-menu.is-open .profile-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.profile-popover a,
.profile-popover button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 750;
}

.profile-popover a:hover,
.profile-popover button:hover {
  background: var(--surface-2);
}

.profile-popover .danger-link {
  color: var(--danger);
}

.profile-menu-icon {
  position: relative;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-2);
  color: currentColor;
}

.profile-menu-icon-user::before {
  content: "";
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transform: translateY(-3px);
}

.profile-menu-icon-user::after {
  content: "";
  position: absolute;
  bottom: 5px;
  width: 14px;
  height: 7px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
}

.profile-menu-icon-logout::before {
  content: "";
  width: 13px;
  height: 10px;
  border: 2px solid currentColor;
  border-right: 0;
  border-radius: 4px 0 0 4px;
}

.profile-menu-icon-logout::after {
  content: "";
  position: absolute;
  right: 5px;
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.page-wrap {
  min-width: 0;
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(420px, 760px) minmax(24px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px clamp(18px, 3vw, 34px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.top-date {
  display: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.content {
  display: grid;
  gap: 22px;
  min-width: 0;
  max-width: 100%;
  padding: clamp(18px, 3vw, 34px);
  opacity: 1;
  transition: opacity 150ms ease, transform 150ms ease;
}

main.content.is-transitioning {
  opacity: 0;
  transform: translateY(8px);
}

main.content.no-transition {
  transition: none !important;
}

.button,
button.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
  white-space: nowrap;
}

.button-icon {
  padding: 0;
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.button-sm {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.button-primary {
  background: var(--primary);
  color: #fff;
}

.button-primary:hover {
  background: var(--primary-strong);
}

.button-secondary {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--line);
}

.button-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.button-danger {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 34%, transparent);
}

.button-wide {
  width: 100%;
}

.button-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.button-icon .nav-icon {
  width: 16px;
  height: 16px;
  color: inherit;
}

.button-icon-ghost-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--line);
}

.button-icon-ghost-danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 34%, transparent);
}

.icon-button {
  width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.menu-button span {
  width: 18px;
  height: 2px;
  background: currentColor;
  display: block;
  margin: 3px 0;
}

.theme-button {
  display: grid;
  justify-self: end;
  grid-column: 3;
}

.theme-toggle-form {
  display: contents;
}

.theme-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid currentColor;
  box-shadow: inset -6px -4px 0 currentColor;
}

.top-search {
  width: 100%;
  max-width: 760px;
}

.top-search,
.filter-search {
  position: relative;
}

.top-search input,
.filter-search input {
  width: 100%;
  padding-left: 42px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  border: 2px solid var(--muted);
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  background: var(--muted);
  transform: rotate(45deg);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

label span {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  background:
    linear-gradient(135deg, rgba(47, 124, 246, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(34, 197, 94, 0.10), transparent 30%),
    var(--bg);
}

.auth-layout {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel,
.panel,
.page-section,
.table-panel,
.empty-state,
.detail-main,
.detail-side {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: clamp(28px, 4vw, 48px);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.auth-side {
  display: grid;
  align-items: end;
  padding: clamp(28px, 4vw, 48px);
  background:
    linear-gradient(140deg, rgba(47, 124, 246, 0.95), rgba(17, 24, 39, 0.96)),
    #111827;
  color: #fff;
}

.auth-side-inner {
  max-width: 360px;
}

.auth-side h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 0.98;
}

.auth-side p:not(.eyebrow) {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
  line-height: 1.45;
}

.auth-brand {
  margin-bottom: 28px;
}

.auth-panel h1 {
  margin: 0 0 8px;
  font-size: clamp(34px, 4vw, 46px);
}

.muted,
.auth-panel p {
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.color-field input[type="color"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.color-swatch {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background-color: var(--primary);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.color-swatch:hover {
  transform: scale(1.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.color-swatch:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.color-hex {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
}

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.notice {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.notice-success {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
}

.notice-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.notice-warning {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
}


.toast-stack {
  position: fixed;
  right: clamp(16px, 3vw, 34px);
  bottom: clamp(16px, 3vw, 34px);
  z-index: 80;
  display: grid;
  gap: 12px;
  width: min(460px, calc(100vw - 32px));
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--popover-shadow);
  animation: toast-in 180ms ease both;
}

.toast.is-hiding {
  animation: toast-out 180ms ease both;
}

.toast p {
  margin: 0;
  color: var(--text);
  line-height: 1.35;
}

.toast-status {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  position: relative;
}

.toast-status::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 2px;
  width: 5px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.toast.notice-danger .toast-status::after,
.toast.notice-warning .toast-status::after {
  content: "!";
  inset: auto;
  width: auto;
  height: auto;
  border: 0;
  transform: none;
  font-size: 12px;
  font-weight: 900;
  line-height: 14px;
  left: 5px;
  top: 0;
}

.toast button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.toast button:hover {
  background: var(--surface-2);
  color: var(--text);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}

.update-upload {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.update-upload .button {
  margin-top: 2px;
}

.help-text {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dashboard-hero,
.page-section {
  padding: 24px;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.dashboard-hero h2,
.section-header h2,
.panel h2,
.panel h3,
.empty-state h2 {
  margin: 0;
}

.dashboard-hero p {
  margin: 10px 0 0;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  position: relative;
  min-height: 142px;
  padding: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent);
}

.accent-blue {
  --accent: var(--primary);
}

.accent-green {
  --accent: var(--success);
}

.accent-amber {
  --accent: var(--warning);
}

.accent-red {
  --accent: var(--danger);
}

.accent-purple {
  --accent: #7c3aed;
}

.accent-teal {
  --accent: #0d9488;
}

.accent-orange {
  --accent: #ea580c;
}

.accent-pink {
  --accent: #db2777;
}

.stat-card span {
  color: var(--muted);
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin: 16px 0 8px;
  font-size: 38px;
  line-height: 1;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 22px;
}

.reports-grid {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.reports-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll .data-table {
  min-width: 100%;
}

.panel {
  padding: 22px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-header.compact {
  margin-bottom: 16px;
}

.link {
  color: var(--primary);
  font-weight: 750;
}

.chart-panel canvas {
  width: 100%;
  min-height: 260px;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.stack-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stack-item strong,
.stack-item small,
.stack-item em {
  display: block;
}

.stack-item small,
.stack-item em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.product-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.product-card-top,
.metric-row,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-card h3 {
  margin: 18px 0 6px;
  font-size: 21px;
}

.product-card p,
.metric-row {
  color: var(--muted);
}

.metric-row {
  margin: 18px 0;
  font-size: 14px;
  font-weight: 700;
}

.card-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.card-actions form {
  margin: 0;
}

.card-dropdown {
  position: relative;
}

.card-dropdown-caret {
  margin-left: 4px;
  transition: transform 160ms ease;
  vertical-align: middle;
}

.card-dropdown.is-open .card-dropdown-caret {
  transform: rotate(180deg);
}

.card-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--popover-shadow);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top left;
  transition: opacity 140ms ease, transform 140ms ease;
}

.card-dropdown.is-open .card-dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.card-dropdown-menu a {
  display: block;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.card-dropdown-menu a:hover {
  background: var(--surface-2);
}

.card-dropdown-menu a + a {
  border-top: 1px solid var(--line);
}

.product-icon {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--product-color, var(--primary)) 18%, var(--surface));
  color: var(--product-color, var(--primary));
  font-weight: 850;
}

.product-icon::before { content: none !important; }
.product-icon-large {
  width: 64px;
  height: 64px;
  flex-basis: 64px;
  font-size: 24px;
}

.filter-bar,
.filter-bar-wide {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-search {
  flex: 1 1 300px;
  min-width: 220px;
}

.filter-bar select,
.filter-bar-wide select {
  flex: 1 1 170px;
  max-width: 230px;
}

.filter-bar .button,
.filter-bar-wide .button {
  flex: 0 0 auto;
}

.responsive-table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.table-panel {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}


.licenses-table-panel {
  max-width: 100%;
}

.licenses-responsive-table {
  overflow-x: hidden;
}

.licenses-table {
  table-layout: fixed;
  min-width: 0;
}

.licenses-table th,
.licenses-table td {
  padding: 13px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.licenses-table th:nth-child(1),
.licenses-table td:nth-child(1) { width: 25%; }
.licenses-table th:nth-child(2),
.licenses-table td:nth-child(2) { width: 22%; }
.licenses-table th:nth-child(3),
.licenses-table td:nth-child(3) { width: 11%; }
.licenses-table th:nth-child(4),
.licenses-table td:nth-child(4) { width: 13%; }
.licenses-table th:nth-child(5),
.licenses-table td:nth-child(5) { width: 14%; }
.licenses-table th:nth-child(6),
.licenses-table td:nth-child(6) { width: 8%; }
.licenses-table th:nth-child(7),
.licenses-table td:nth-child(7) { width: 7%; }

.licenses-table .table-title,
.licenses-table td,
.licenses-table .muted-inline,
.licenses-table strong {
  min-width: 0;
}

.licenses-table .table-title > div,
.licenses-table td > strong,
.licenses-table .muted-inline {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.licenses-table .table-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.licenses-table .table-actions .button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}


th,
td {
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: var(--text);
}

.table-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-title span,
.muted-inline {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.table-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.table-actions form {
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.badge-neutral {
  background: var(--surface-3);
  color: var(--muted);
}

.badge-success {
  background: color-mix(in srgb, var(--success) 16%, var(--surface));
  color: var(--success);
}

.badge-warning {
  background: color-mix(in srgb, var(--warning) 16%, var(--surface));
  color: var(--warning);
}

.badge-danger {
  background: color-mix(in srgb, var(--danger) 16%, var(--surface));
  color: var(--danger);
}

.badge-banned,
.badge-revoked {
  background: color-mix(in srgb, var(--danger) 16%, var(--surface));
  color: var(--danger);
}

.badge-available {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--primary);
}

.badge-inactive,
.badge-archived {
  background: var(--surface-3);
  color: var(--muted);
}

.badge-trial {
  background: color-mix(in srgb, var(--warning) 16%, var(--surface));
  color: var(--warning);
}

.key-hint,
.mono,
.license-key-display {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.checkbox-line {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.checkbox-line span {
  margin: 0;
  color: var(--text);
}

.password-requirements {
  padding: 12px 14px;
  background: color-mix(in srgb, var(--bg-elevated) 60%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.password-requirements p {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.password-requirements ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.password-requirements li {
  font-size: 13px;
  color: var(--muted);
  position: relative;
  transition: color 150ms ease;
}

.password-requirements li::marker {
  content: '○ ';
  color: var(--muted);
}

.password-requirements li.is-valid {
  color: var(--success);
}

.password-requirements li.is-valid::marker {
  content: '✓ ';
  color: var(--success);
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 10px;
}

.is-hidden {
  display: none !important;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
}

.detail-main,
.detail-side {
  padding: 22px;
}

.detail-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.detail-hero h2 {
  margin: 0 0 6px;
  font-size: 30px;
}

.detail-hero p {
  margin: 0;
  color: var(--muted);
}

.secret-panel {
  padding: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.license-key-display {
  min-height: 110px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.65;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.tab-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tab-item {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.tab-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tab-item.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.code-block-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}

.code-block {
  margin: 0;
  padding: 20px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre;
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
}

.changelog-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.changelog-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  background: var(--surface);
}

.changelog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.changelog-notes {
  margin: 0;
  padding: 10px 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre-wrap;
  background: var(--surface-2);
  border-radius: 6px;
  color: var(--muted);
  border: 1px solid var(--line);
}

.tab-badge {
  display: none;
}

.code-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  gap: 0.5rem;
}

.code-file-header + .code-block-wrapper .code-block {
  border-radius: 0 0 10px 10px;
}

.code-file-name {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.helper-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.helper-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.helper-main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 1.25rem;
  align-items: start;
}

.helper-main-layout > div:first-child {
  min-width: 0;
  overflow: hidden;
}

.helper-endpoint-card {
  position: sticky;
  top: 80px;
  min-width: 0;
  overflow: hidden;
  word-break: break-all;
}

.endpoint-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.endpoint-row:last-of-type {
  border-bottom: none;
}

.method-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  margin-top: 2px;
}

.method-post {
  background: color-mix(in srgb, var(--primary) 15%, var(--surface));
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}

.endpoint-path {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  word-break: break-all;
  display: block;
  margin-bottom: 2px;
}

.info-grid div,
.side-list {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.info-grid span,
.side-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.detail-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.side-list h3 {
  margin: 0 0 12px;
}

.side-list p {
  margin: 0 0 12px;
}

.side-list p:last-child {
  margin-bottom: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 22px;
}

.settings-grid .panel-wide,
.dashboard-grid .panel-wide {
  grid-column: 1 / -1;
}

.qr-modal {
  border: none;
  border-radius: var(--radius-lg, 16px);
  padding: 1.5rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xl);
  max-width: min(90vw, 360px);
  text-align: center;
}

.qr-modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.qr-modal-close {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.qr-modal-content img {
  border-radius: var(--radius-md, 10px);
  margin-bottom: 1rem;
}

.qr-modal-content code {
  font-size: 1.05rem;
  word-break: break-all;
}

.avatar-chip {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 850;
}

.avatar-chip.small {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  font-size: 14px;
}

.avatar-chip-profile {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0 10%, transparent 11%),
    linear-gradient(135deg, #2f7cf6, #7c5cff 62%, #22c55e);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, #fff 24%, transparent), 0 10px 24px color-mix(in srgb, var(--primary) 24%, transparent);
  color: #fff;
  font-size: 15px;
}

.avatar-chip.large {
  width: 76px;
  height: 76px;
  font-size: 30px;
}

.profile-grid {
  grid-template-columns: 320px minmax(0, 1fr);
}

.profile-summary {
  display: grid;
  justify-items: start;
  gap: 18px;
}

.profile-summary h2 {
  margin: 0 0 6px;
}

.profile-summary p:not(.eyebrow) {
  margin: 0 0 12px;
  color: var(--muted);
}

.backup-panel {
  min-height: 260px;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 32px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}


@media (max-width: 1280px) {
  .licenses-table th:nth-child(3),
  .licenses-table td:nth-child(3),
  .licenses-table th:nth-child(6),
  .licenses-table td:nth-child(6) {
    display: none;
  }

  .licenses-table th:nth-child(1),
  .licenses-table td:nth-child(1) { width: 30%; }
  .licenses-table th:nth-child(2),
  .licenses-table td:nth-child(2) { width: 26%; }
  .licenses-table th:nth-child(4),
  .licenses-table td:nth-child(4) { width: 16%; }
  .licenses-table th:nth-child(5),
  .licenses-table td:nth-child(5) { width: 18%; }
  .licenses-table th:nth-child(7),
  .licenses-table td:nth-child(7) { width: 10%; }
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

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

  .menu-button {
    display: grid;
  }

  .topbar {
    grid-template-columns: auto minmax(280px, 1fr) auto;
  }

  .top-search {
    grid-column: auto;
    max-width: none;
  }

  .stat-grid,
  .product-grid,
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .settings-grid,
  .profile-grid,
  .detail-layout,
  .reports-row-2,
  .helper-main-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-side {
    display: none;
  }

  .content,
  .topbar {
    padding: 18px;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .top-search {
    grid-column: 1 / -1;
    max-width: none;
  }

  .dashboard-hero,
  .section-header,
  .detail-hero {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .stat-grid,
  .product-grid,
  .form-grid,
  .form-grid-3,
  .info-grid,
  .copy-field {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: span 1;
  }


  .licenses-responsive-table {
    overflow-x: visible;
  }

  .licenses-table,
  .licenses-table thead,
  .licenses-table tbody,
  .licenses-table tr,
  .licenses-table td {
    display: block;
    width: 100% !important;
  }

  .licenses-table thead {
    display: none;
  }

  .licenses-table tr {
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }

  .licenses-table td {
    padding: 8px 0;
    border-bottom: 0;
  }

  .licenses-table td:nth-child(3),
  .licenses-table td:nth-child(6) {
    display: none;
  }

  .licenses-table .table-actions {
    justify-content: flex-start;
  }

  .table-actions,
  .form-actions,
  .card-actions {
    justify-content: flex-start;
  }

  .stack-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .stack-item em {
    grid-column: 2;
  }
}


/* KeyPilot UI refinements - 2026-05 */
.page-wrap {
  min-width: 0;
  overflow-x: hidden;
}

.topbar {
  grid-template-columns: minmax(520px, 820px) minmax(16px, 1fr) auto;
}

.top-search {
  width: min(820px, 100%);
}

.top-search input {
  min-height: 48px;
  font-size: 16px;
}

/* Better sidebar profile menu; fixes cramped visual block in bottom-left. */
.sidebar-footer {
  background: transparent;
}

.profile-trigger {
  min-height: 64px;
  overflow: hidden;
}

.avatar-chip-profile {
  flex: 0 0 42px;
}

.profile-popover {
  right: auto;
  left: 0;
  width: min(300px, calc(100vw - 36px));
  padding: 8px;
  border-radius: 18px;
  overflow: visible;
  z-index: 90;
}

.profile-popover a,
.profile-popover button {
  font-size: 15px;
}

.profile-popover form {
  margin: 0;
}

.profile-popover .danger-link {
  color: var(--danger);
}

/* Toast/dialog notifications: bottom-right, Salesforce-like, auto-dismissed by JS. */
.toast-stack {
  position: fixed;
  right: 28px;
  bottom: 28px;
  top: auto;
  left: auto;
  z-index: 999;
  display: grid;
  gap: 12px;
  width: min(480px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-height: 64px;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
}

/* Licences page: remove page-wide horizontal and vertical overflow on desktop. */
body:has(.licenses-table-panel) {
  overflow-y: auto;
}

.content:has(.licenses-table-panel) {
  gap: 18px;
  padding-top: 24px;
}

.page-section:has(.licenses-table-panel),
.licenses-table-panel {
  min-width: 0;
  max-width: 100%;
}

.page-section:has(.licenses-table-panel) .section-header {
  gap: 12px;
}

.page-section:has(.licenses-table-panel) .section-header .button {
  flex: 0 0 auto;
}

.filter-bar-wide {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(4, minmax(130px, 0.75fr)) auto;
  align-items: center;
  gap: 10px;
}

.filter-bar-wide .filter-search,
.filter-bar-wide select,
.filter-bar-wide .button {
  min-width: 0;
  max-width: none;
  width: 100%;
}

.licenses-responsive-table {
  overflow-x: auto;
}

.licenses-table {
  table-layout: fixed;
  width: 100%;
  min-width: 980px;
}

.licenses-table th,
.licenses-table td {
  padding: 12px 10px;
}

.licenses-table th:nth-child(1),
.licenses-table td:nth-child(1) { width: 22%; }
.licenses-table th:nth-child(2),
.licenses-table td:nth-child(2) { width: 17%; }
.licenses-table th:nth-child(3),
.licenses-table td:nth-child(3) { width: 12%; }
.licenses-table th:nth-child(4),
.licenses-table td:nth-child(4) { width: 13%; }
.licenses-table th:nth-child(5),
.licenses-table td:nth-child(5) { width: 13%; }
.licenses-table th:nth-child(6),
.licenses-table td:nth-child(6) { width: 8%; }
.licenses-table th:nth-child(7),
.licenses-table td:nth-child(7) { width: 15%; }

.licenses-table .table-actions {
  flex-wrap: nowrap;
  gap: 6px;
}

.licenses-table .table-actions .button {
  min-height: 34px;
  padding: 0 9px;
  font-size: 13px;
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: minmax(360px, 680px) minmax(12px, 1fr) auto;
  }

  .filter-bar-wide {
    grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(145px, 0.75fr));
  }

  .filter-bar-wide .button {
    justify-self: start;
    width: auto;
  }
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .top-search {
    min-width: 0;
  }

  .filter-bar-wide {
    display: flex;
  }

  .licenses-responsive-table {
    overflow-x: auto;
  }
}



/* KeyPilot hotfix v2 - hard fixes for avatar/product initials, legacy notices and sidebar profile. */
.product-icon,
.avatar-chip,
.avatar-chip-profile {
  position: relative;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1 !important;
  overflow: hidden;
}

.product-icon::before,
.avatar-chip::before,
.avatar-chip-profile::before {
  position: static !important;
  display: block !important;
  margin: 0 !important;
  inset: auto !important;
  line-height: 1 !important;
  transform: none !important;
}

.product-icon {
  font-size: 18px;
  font-weight: 850;
}

.avatar-chip,
.avatar-chip-profile {
  font-size: 16px;
  font-weight: 850;
}

.avatar-chip.large {
  font-size: 30px;
}

.avatar-chip.small {
  font-size: 14px;
}

/* Clean bottom-left profile block, including older layout markup. */
.sidebar-footer {
  margin-top: auto !important;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 18px !important;
}

.sidebar-footer > div:not(.profile-popover),
.sidebar-footer .profile-card,
.sidebar-footer .user-card {
  min-width: 0;
}

.sidebar-footer a:not(.button),
.sidebar-footer form,
.sidebar-footer button:not(.profile-trigger),
.sidebar-footer .button {
  margin: 0 !important;
}

.profile-trigger {
  min-height: 68px !important;
  padding: 10px 12px !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface-2) 92%, var(--primary)), var(--surface)) !important;
}

.profile-trigger-text strong,
.profile-trigger-text em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-popover {
  bottom: calc(100% + 12px) !important;
  left: 0 !important;
  right: auto !important;
  width: 290px !important;
  max-width: calc(100vw - 36px) !important;
}

/* Make legacy top notices behave like bottom-right dialog/toast notifications. */
.notice[data-toast],
.toast {
  width: 100%;
}

.toast-stack {
  position: fixed !important;
  right: 28px !important;
  bottom: 28px !important;
  top: auto !important;
  left: auto !important;
  z-index: 9999 !important;
  pointer-events: none;
}

.toast-stack .toast,
.toast-stack .notice {
  pointer-events: auto;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px 16px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.24) !important;
}

.toast-stack .notice-success,
.toast-stack .toast.notice-success {
  border-left: 4px solid var(--success) !important;
}

.toast-stack .notice-danger,
.toast-stack .toast.notice-danger {
  border-left: 4px solid var(--danger) !important;
}

.toast-stack .notice-warning,
.toast-stack .toast.notice-warning {
  border-left: 4px solid var(--warning) !important;
}

/* Licences: keep the scroll inside the table only, not the whole page. */
.app-shell {
  overflow-x: hidden;
}

.page-wrap {
  overflow-x: hidden !important;
}

.licenses-table-panel {
  overflow: hidden !important;
}

.licenses-responsive-table {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

.licenses-table {
  min-width: 1040px !important;
}

@media (min-width: 1500px) {
  .licenses-table {
    min-width: 0 !important;
  }
}


/* KeyPilot UI polish v3: unified, cleaner profile popover style across the app. */
:root {
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.10);
  --popover-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}

body {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--primary) 10%, transparent), transparent 34rem),
    var(--bg);
}

.app-shell {
  min-height: 100svh;
  overflow-x: clip;
}

.sidebar {
  min-height: 100vh;
  height: 100svh;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, var(--bg));
}

.main-nav a,
.panel,
.table-panel,
.empty-state,
.detail-main,
.detail-side,
.top-search,
.theme-toggle,
.button,
input,
select,
textarea,
.toast,
.notice[data-toast] {
  border-radius: var(--radius-md);
}

.panel,
.table-panel,
.empty-state,
.detail-main,
.detail-side {
  box-shadow: var(--shadow);
}

.button {
  font-weight: 800;
}

.button-primary {
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 18%, transparent);
}

.button-primary:hover {
  box-shadow: 0 12px 26px color-mix(in srgb, var(--primary) 22%, transparent);
}

/* Clean and full-height left navigation. */
.sidebar-footer {
  margin-top: auto !important;
  padding-bottom: max(4px, env(safe-area-inset-bottom)) !important;
}

.profile-trigger {
  min-height: 74px !important;
  border-radius: 20px !important;
  background: color-mix(in srgb, var(--surface-2) 88%, var(--primary)) !important;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 40%, transparent) !important;
}

.profile-trigger:hover,
.profile-menu.is-open .profile-trigger {
  box-shadow: 0 12px 26px color-mix(in srgb, var(--primary) 12%, transparent), inset 0 1px 0 color-mix(in srgb, #fff 38%, transparent) !important;
}

.profile-popover {
  border-radius: 22px !important;
  overflow: hidden;
  box-shadow: var(--popover-shadow) !important;
}

.profile-popover a,
.profile-popover button {
  border-radius: 0 !important;
}

/* Avatar/product initials must stay centered. */
.product-icon,
.avatar-chip,
.avatar-chip-profile {
  display: inline-grid !important;
  place-items: center !important;
  text-align: center !important;
  line-height: 1 !important;
}

.product-icon::before,
.avatar-chip::before,
.avatar-chip-profile::before {
  position: static !important;
  inset: auto !important;
  margin: 0 !important;
  transform: none !important;
  line-height: 1 !important;
}

/* Profile page: remove summary column and let the form breathe. */
.profile-grid-single {
  grid-template-columns: minmax(0, 1fr) !important;
  max-width: 1180px;
}

.profile-grid-single > .panel {
  width: 100%;
}

.profile-grid-single .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Licence page: no page-level horizontal scroll, buttons visible on desktop. */
.licenses-table-panel {
  width: 100%;
  overflow: hidden !important;
}

.licenses-responsive-table {
  width: 100%;
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
}

.licenses-table {
  min-width: 920px !important;
  width: 100% !important;
  table-layout: fixed !important;
}

.licenses-table th,
.licenses-table td {
  white-space: normal;
}

.licenses-table th:nth-child(1),
.licenses-table td:nth-child(1) { width: 24% !important; }
.licenses-table th:nth-child(2),
.licenses-table td:nth-child(2) { width: 19% !important; }
.licenses-table th:nth-child(3),
.licenses-table td:nth-child(3) { width: 10% !important; }
.licenses-table th:nth-child(4),
.licenses-table td:nth-child(4) { width: 13% !important; }
.licenses-table th:nth-child(5),
.licenses-table td:nth-child(5) { width: 15% !important; }
.licenses-table th:nth-child(6),
.licenses-table td:nth-child(6) { width: 9% !important; }
.licenses-table th:nth-child(7),
.licenses-table td:nth-child(7) {
  width: 180px !important;
  min-width: 180px !important;
  overflow: visible !important;
}

.licenses-table .table-actions {
  display: flex !important;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: nowrap !important;
  white-space: nowrap;
}

.licenses-table .table-actions .button {
  min-width: 76px;
  padding-inline: 12px;
}

/* More compact licence filters so they do not cause an extra page scroll. */
.licenses-hero .section-header,
section.panel > .filter-bar-wide {
  align-items: center;
}

.filter-bar-wide {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) repeat(3, minmax(140px, .8fr)) auto;
  gap: 12px;
}

.filter-bar-wide .filter-search,
.filter-bar-wide select,
.filter-bar-wide .button {
  width: 100%;
  max-width: none;
}

.toast-stack {
  right: clamp(16px, 3vw, 30px) !important;
  bottom: clamp(16px, 3vw, 30px) !important;
}

.toast-stack .toast,
.toast-stack .notice,
.toast {
  border-radius: 18px !important;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18) !important;
}

/* Responsive layout. */
@media (max-width: 1380px) {
  .licenses-table th:nth-child(3),
  .licenses-table td:nth-child(3),
  .licenses-table th:nth-child(6),
  .licenses-table td:nth-child(6) {
    display: none !important;
  }

  .licenses-table {
    min-width: 780px !important;
  }

  .licenses-table th:nth-child(1),
  .licenses-table td:nth-child(1) { width: 27% !important; }
  .licenses-table th:nth-child(2),
  .licenses-table td:nth-child(2) { width: 22% !important; }
  .licenses-table th:nth-child(4),
  .licenses-table td:nth-child(4) { width: 17% !important; }
  .licenses-table th:nth-child(5),
  .licenses-table td:nth-child(5) { width: 18% !important; }
  .licenses-table th:nth-child(7),
  .licenses-table td:nth-child(7) { width: 170px !important; }
}

@media (max-width: 1180px) {
  .sidebar {
    height: 100dvh;
  }

  .filter-bar-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bar-wide .filter-search {
    grid-column: 1 / -1;
  }

  .filter-bar-wide .button {
    width: max-content;
  }
}

@media (max-width: 720px) {
  .content,
  .topbar {
    padding: 16px;
  }

  .panel,
  .table-panel,
  .empty-state {
    border-radius: 18px;
  }

  .profile-grid-single .form-grid,
  .filter-bar-wide {
    grid-template-columns: 1fr !important;
  }

  .filter-bar-wide .button {
    width: 100%;
  }

  .licenses-responsive-table {
    overflow-x: visible !important;
  }

  .licenses-table,
  .licenses-table tbody,
  .licenses-table tr,
  .licenses-table td {
    min-width: 0 !important;
  }

  .licenses-table .table-actions {
    justify-content: stretch !important;
  }

  .licenses-table .table-actions .button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .toast-stack {
    width: calc(100vw - 28px) !important;
    right: 14px !important;
    bottom: 14px !important;
  }
}



/* v4 polish: fixed sidebar, aligned filters, calmer unified UI */
@media (min-width: 901px) {
  .app-shell {
    display: block !important;
    min-height: 100vh;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: 248px !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    z-index: 30;
  }

  .page-wrap {
    margin-left: 248px !important;
    min-height: 100vh;
  }
}

body {
  background:
    radial-gradient(circle at 30% -10%, color-mix(in srgb, var(--primary) 8%, transparent), transparent 32rem),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 94%, #fff), var(--bg));
}

.sidebar {
  background: color-mix(in srgb, var(--surface) 98%, var(--primary));
  box-shadow: 18px 0 46px rgba(15, 23, 42, 0.04);
}

.brand-mark,
.brand-mark img {
  width: 46px;
  height: 46px;
  border-radius: 0;
  background: transparent;
}

.main-nav a {
  border-radius: 14px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.main-nav a:hover {
  transform: translateX(2px);
}

.main-nav a.is-active {
  background: color-mix(in srgb, var(--primary) 9%, var(--surface-3));
  box-shadow: inset 3px 0 0 var(--primary);
}

.panel,
.page-section,
.table-panel,
.empty-state,
.detail-main,
.detail-side,
.stat-card,
.dashboard-hero {
  border-radius: 16px !important;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08) !important;
}

.button,
button.button {
  min-height: 42px;
  border-radius: 14px;
  font-weight: 800;
}

.button-primary {
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 18%, transparent);
}

.button-secondary,
.button-ghost {
  background: color-mix(in srgb, var(--surface-3) 88%, var(--surface));
}

.profile-trigger {
  border-radius: 18px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  box-shadow: none !important;
}

.profile-trigger:hover,
.profile-menu.is-open .profile-trigger {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08) !important;
}

.profile-popover {
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
}

.profile-popover a,
.profile-popover button {
  border-radius: 14px;
}

.profile-menu-icon {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-2));
}

/* cleaner logout icon */
.profile-menu-icon-logout::before {
  content: "";
  position: absolute;
  left: 6px;
  width: 10px;
  height: 12px;
  border: 2px solid currentColor;
  border-right: 0;
  border-radius: 4px 0 0 4px;
}

.profile-menu-icon-logout::after {
  content: "";
  position: absolute;
  left: 12px;
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.avatar-chip-profile {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, #fff 25%, transparent), 0 8px 18px rgba(47, 124, 246, 0.16);
}

/* Licence filters: same size as products/users; never huge */
.license-filter-bar {
  display: grid !important;
  grid-template-columns: minmax(240px, 1.45fr) repeat(4, minmax(128px, .8fr)) auto !important;
  align-items: center;
  gap: 12px;
}

.license-filter-bar .filter-search,
.license-filter-bar select {
  width: 100%;
  max-width: none;
}

.license-filter-bar .button {
  width: auto !important;
  min-width: 110px;
  padding-inline: 18px;
  justify-self: start;
}

/* License table: keep action buttons visible on desktop and allow table scroll only when needed. */
.licenses-table-panel {
  overflow: hidden !important;
}

.licenses-responsive-table {
  overflow-x: auto !important;
  overflow-y: visible !important;
}

.licenses-table {
  min-width: 940px !important;
  table-layout: auto !important;
}

.licenses-table th:last-child,
.licenses-table td:last-child {
  width: 190px !important;
  min-width: 190px !important;
}

.licenses-table .table-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
}

.licenses-table .table-actions .button {
  min-width: 78px;
  padding-inline: 12px;
}

@media (max-width: 1180px) {
  .license-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .license-filter-bar .filter-search {
    grid-column: 1 / -1;
  }

  .license-filter-bar .button {
    width: max-content !important;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block !important;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: min(82vw, 300px) !important;
    height: 100dvh !important;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    z-index: 40;
  }

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

  .page-wrap {
    margin-left: 0 !important;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .top-search {
    min-width: 0;
  }

  .content {
    padding: 16px;
  }
}

@media (max-width: 720px) {
  .license-filter-bar {
    grid-template-columns: 1fr !important;
  }

  .license-filter-bar .filter-search {
    grid-column: auto;
  }

  .license-filter-bar .button {
    width: 100% !important;
  }

  .section-header {
    align-items: stretch;
  }

  .section-header .button {
    width: 100%;
  }
}


/* === KeyPilot v5 modern UI refresh === */
:root {
  --bg: #eef4fb;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --surface-3: #eef4fb;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe5f1;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  --soft-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}
body {
  background:
    radial-gradient(circle at 24% 12%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 36rem),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 94%, #fff), var(--bg));
}
.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}
.sidebar {
  position: fixed !important;
  inset: 0 auto 0 0 !important;
  z-index: 30;
  width: 248px;
  height: 100dvh !important;
  min-height: 100dvh;
  padding: 26px 18px;
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
  border-right: 1px solid var(--line);
  box-shadow: none;
  overflow-y: auto;
}
.page-wrap {
  min-width: 0;
  margin-left: 248px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  grid-template-columns: minmax(360px, 780px) minmax(24px, 1fr) auto;
  padding: 18px clamp(24px, 3vw, 42px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px);
}
.content {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: clamp(24px, 3vw, 42px);
  gap: 22px;
}
.brand-mark,
.brand-mark img {
  width: 46px;
  height: 46px;
  border-radius: 0;
  background: transparent;
}
.main-nav {
  gap: 7px;
}
.main-nav a {
  min-height: 44px;
  border-radius: 13px;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}
.main-nav a:hover {
  transform: translateX(2px);
}
.main-nav a.is-active {
  background: #0f172a;
  color: #fff;
  box-shadow: none;
}
:root[data-theme="dark"] .main-nav a.is-active {
  background: color-mix(in srgb, var(--primary) 20%, var(--surface-3));
  color: var(--text);
}
.main-nav a.is-active .nav-icon {
  color: currentColor;
}
.sidebar-footer {
  margin-top: auto;
}
.profile-trigger {
  border-radius: 18px;
  padding: 11px 12px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 14%, var(--line));
  box-shadow: none;
}
.profile-trigger:hover,
.profile-menu.is-open .profile-trigger {
  box-shadow: 0 10px 24px rgba(37, 99, 235, .10);
  transform: translateY(-1px);
}
.avatar-chip-profile {
  background: linear-gradient(135deg, #2563eb, #06b6d4 58%, #14b8a6);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.22);
}
.profile-popover {
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 36px rgba(15, 23, 42, .14);
}
.profile-menu-icon-logout {
  position: relative;
}
.profile-menu-icon-logout::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 9px;
  height: 12px;
  border: 2px solid currentColor;
  border-right: 0;
  border-radius: 4px 0 0 4px;
}
.profile-menu-icon-logout::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 8px;
  width: 12px;
  height: 2px;
  background: currentColor;
  box-shadow: 4px 0 0 currentColor;
  transform: translateY(1px);
}
.profile-popover .danger-link .profile-menu-icon-logout {
  color: var(--danger);
}
.panel,
.page-section,
.table-panel,
.empty-state,
.detail-main,
.detail-side,
.dashboard-hero,
.stat-card,
.product-card {
  border-radius: var(--radius-xl) !important;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent) !important;
  background: color-mix(in srgb, var(--surface) 94%, transparent) !important;
  box-shadow: var(--soft-shadow) !important;
}
.page-section,
.dashboard-hero,
.panel,
.table-panel {
  padding: 22px;
}
.button,
button.button {
  min-height: 42px;
  border-radius: 14px;
  padding-inline: 18px;
  box-shadow: none;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}
.button:hover {
  transform: translateY(-1px);
}
.button-primary {
  background: linear-gradient(135deg, #2563eb, #2f7cf6);
  border-color: transparent;
}
.button-secondary,
.button-ghost {
  background: var(--surface-3);
  border-color: var(--line);
}
input,
select,
textarea,
.filter-search,
.top-search {
  border-radius: 14px !important;
}
.top-search {
  max-width: 780px;
}
.top-search input {
  min-height: 50px;
}
.filter-bar,
.filter-bar-wide {
  align-items: center;
}
.license-filter-bar {
  grid-template-columns: minmax(260px, 1.65fr) repeat(4, minmax(130px, .8fr)) auto !important;
}
.license-filter-bar .button {
  min-width: 104px !important;
  width: auto !important;
  min-height: 42px !important;
  padding-inline: 18px !important;
  justify-self: start;
}
.stat-grid {
  gap: 18px;
}
.stat-card {
  overflow: hidden;
}
.product-card {
  padding: 22px;
}
.table-panel {
  overflow: hidden !important;
}
.responsive-table,
.licenses-responsive-table {
  overflow-x: auto !important;
  overflow-y: hidden !important;
}
table {
  border-collapse: collapse !important;
  border-spacing: 0 !important;
}
th,
td {
  border-bottom: 1px solid var(--line) !important;
}
tbody tr:last-child td {
  border-bottom: 0 !important;
}
.licenses-table {
  width: 100%;
  min-width: 1040px !important;
  table-layout: fixed !important;
}
.licenses-table th,
.licenses-table td {
  padding: 15px 14px !important;
  vertical-align: middle !important;
  overflow: visible !important;
}
.licenses-table th:nth-child(1),
.licenses-table td:nth-child(1) { width: 25% !important; }
.licenses-table th:nth-child(2),
.licenses-table td:nth-child(2) { width: 18% !important; }
.licenses-table th:nth-child(3),
.licenses-table td:nth-child(3) { width: 10% !important; }
.licenses-table th:nth-child(4),
.licenses-table td:nth-child(4) { width: 14% !important; }
.licenses-table th:nth-child(5),
.licenses-table td:nth-child(5) { width: 15% !important; }
.licenses-table th:nth-child(6),
.licenses-table td:nth-child(6) { width: 8% !important; }
.licenses-table th:nth-child(7),
.licenses-table td:nth-child(7) { width: 190px !important; min-width: 190px !important; }
.licenses-table .table-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  height: 100%;
}
.licenses-table .table-actions .button {
  min-height: 38px !important;
  min-width: 78px !important;
  padding-inline: 14px !important;
  font-size: 14px !important;
}
.product-icon {
  border-radius: 12px;
  width: 42px;
  height: 42px;
}
.toast {
  border-radius: 16px;
}
@media (max-width: 1280px) {
  .content { width: 100%; }
  .licenses-table th:nth-child(3),
  .licenses-table td:nth-child(3),
  .licenses-table th:nth-child(6),
  .licenses-table td:nth-child(6) {
    display: table-cell !important;
  }
}
@media (max-width: 1180px) {
  .app-shell {
    display: block !important;
  }
  .page-wrap {
    margin-left: 0 !important;
  }
  .sidebar {
    width: 280px !important;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 50px rgba(15, 23, 42, .16);
  }
  .app-shell.nav-open .sidebar {
    transform: translateX(0);
  }
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .top-search {
    min-width: 0;
  }
}
@media (max-width: 900px) {
  .license-filter-bar {
    grid-template-columns: 1fr !important;
  }
  .license-filter-bar .button {
    width: 100% !important;
  }
  .section-header {
    align-items: stretch;
  }
  .section-header .button {
    width: 100%;
  }
}
@media (max-width: 720px) {
  .content,
  .topbar {
    padding: 16px;
  }
  .topbar {
    gap: 10px;
  }
  .top-search input {
    min-height: 44px;
  }
  .stat-grid,
  .product-grid,
  .info-grid {
    grid-template-columns: 1fr !important;
  }
  .page-section,
  .dashboard-hero,
  .panel,
  .table-panel {
    padding: 18px;
  }
}


/* v6 UI/UX refinement: playful modern polish, aligned license rows, clearer icons */
:root {
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --soft-shadow: 0 20px 55px rgba(15, 23, 42, 0.08);
  --tiny-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

body {
  background:
    radial-gradient(circle at 16% 12%, color-mix(in srgb, #8b5cf6 11%, transparent), transparent 28rem),
    radial-gradient(circle at 78% 18%, color-mix(in srgb, #22d3ee 10%, transparent), transparent 30rem),
    linear-gradient(180deg, #f4f7fc 0%, var(--bg) 100%) !important;
}

.sidebar {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, #eff6ff), color-mix(in srgb, var(--surface) 92%, #f5f3ff)) !important;
  border-right-color: color-mix(in srgb, var(--line) 82%, transparent) !important;
}

.brand-mark,
.brand-mark img {
  width: 46px;
  height: 46px;
  border-radius: 0;
  background: transparent;
}

.main-nav a {
  border-radius: 15px !important;
  min-height: 48px !important;
  position: relative;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.main-nav a:hover {
  transform: translateX(2px);
}

.main-nav a.is-active {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface)) !important;
  box-shadow: inset 4px 0 0 var(--primary), 0 12px 28px color-mix(in srgb, var(--primary) 8%, transparent) !important;
}

.nav-icon {
  padding: 2px;
  color: color-mix(in srgb, var(--primary) 58%, var(--muted));
}

/* Sidebar profile should feel part of the same system, not a separate glowing badge. */
.profile-trigger {
  border-radius: 20px !important;
  background:
    radial-gradient(circle at 18% 20%, color-mix(in srgb, #8b5cf6 16%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, #dbeafe 78%, var(--surface)), color-mix(in srgb, #ede9fe 44%, var(--surface))) !important;
  box-shadow: 0 16px 32px rgba(37, 99, 235, .10) !important;
  border-color: color-mix(in srgb, var(--primary) 18%, var(--line)) !important;
  padding: 12px !important;
}

.avatar-chip,
.avatar-chip-profile,
.avatar-chip.large {
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 26% 24%, rgba(255,255,255,.95) 0 9%, transparent 10%),
    conic-gradient(from 210deg, #22d3ee, #3b82f6, #8b5cf6, #22c55e, #22d3ee) !important;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.26), 0 12px 24px rgba(59,130,246,.18) !important;
  color: #fff !important;
  text-shadow: 0 1px 5px rgba(15,23,42,.28);
}

.profile-popover {
  border-radius: 20px !important;
  background: color-mix(in srgb, var(--surface) 97%, #eff6ff) !important;
}

.profile-popover a,
.profile-popover button {
  border-radius: 14px !important;
}

/* Open door logout icon */
.profile-menu-icon-logout::before {
  content: "" !important;
  position: absolute !important;
  left: 4px !important;
  top: 4px !important;
  width: 12px !important;
  height: 18px !important;
  border: 2px solid currentColor !important;
  border-right: 0 !important;
  border-radius: 3px 0 0 3px !important;
  background: transparent !important;
  transform: none !important;
  box-shadow: none !important;
}

.profile-menu-icon-logout::after {
  content: "" !important;
  position: absolute !important;
  left: 13px !important;
  top: 6px !important;
  width: 10px !important;
  height: 16px !important;
  border: 2px solid currentColor !important;
  border-radius: 3px !important;
  background: color-mix(in srgb, currentColor 10%, transparent) !important;
  transform: perspective(24px) rotateY(-34deg) !important;
  transform-origin: left center !important;
  box-shadow: -3px 7px 0 -6px currentColor !important;
}

.panel,
.page-section,
.table-panel,
.empty-state,
.detail-main,
.detail-side,
.dashboard-hero,
.stat-card,
.product-card {
  border-radius: 24px !important;
  box-shadow: var(--soft-shadow) !important;
}

.dashboard-hero,
.page-section {
  background:
    radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 18rem),
    var(--surface) !important;
}

.stat-card,
.product-card {
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.stat-card:hover,
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.11) !important;
}

.product-icon {
  position: relative;
  overflow: hidden;
  width: 44px !important;
  height: 44px !important;
  border-radius: 15px !important;
  display: inline-grid !important;
  place-items: center !important;
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,.80) 0 11%, transparent 12%),
    linear-gradient(135deg, color-mix(in srgb, var(--product-color, var(--primary)) 22%, #fff), color-mix(in srgb, var(--product-color, var(--primary)) 12%, #fff)) !important;
  border: 1px solid color-mix(in srgb, var(--product-color, var(--primary)) 16%, var(--line));
  color: color-mix(in srgb, var(--product-color, var(--primary)) 72%, #0f172a) !important;
  font-size: 0 !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.7), 0 10px 20px color-mix(in srgb, var(--product-color, var(--primary)) 10%, transparent);
}

.product-icon::before {
  font-size: 15px !important;
  line-height: 1;
  font-weight: 900 !important;
  z-index: 2;
}

.product-icon::after {
  content: "";
  position: absolute;
  right: -8px;
  bottom: -9px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--product-color, var(--primary)) 24%, transparent);
}

.product-icon-shield::before { content: "🛡" !important; font-size: 17px !important; }
.product-icon-monitor::before { content: "▣" !important; font-size: 18px !important; }
.product-icon-briefcase::before { content: "◼" !important; font-size: 16px !important; }
.product-icon-spark::before { content: "✦" !important; font-size: 18px !important; }
.product-icon-box::before { content: "◈" !important; font-size: 17px !important; }

.product-icon-large {
  width: 64px !important;
  height: 64px !important;
  border-radius: 20px !important;
}

.button,
button.button {
  border-radius: 16px !important;
}

.button-secondary,
.button-ghost {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-3) 94%, #fff), var(--surface-3)) !important;
}

/* Fix license table row separators: keep table cells as table-cells; flex on td caused broken horizontal lines. */
.licenses-table {
  border-collapse: collapse !important;
  border-spacing: 0 !important;
}

.licenses-table tr {
  border-bottom: 1px solid var(--line) !important;
}

.licenses-table tbody tr:last-child {
  border-bottom: 0 !important;
}

.licenses-table th,
.licenses-table td {
  border-bottom: 0 !important;
  background-clip: padding-box;
}

.licenses-table td.table-actions,
.licenses-table .table-actions {
  display: table-cell !important;
  text-align: right !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
}

.licenses-table td.table-actions .button {
  display: inline-flex !important;
  vertical-align: middle;
  margin-left: 8px;
  min-height: 38px !important;
}

.licenses-table td.table-actions .button:first-child {
  margin-left: 0;
}

.licenses-table .muted-inline {
  line-height: 1.25;
}

/* More compact filter button on license page */
.license-filter-bar .button {
  min-width: 104px !important;
  width: auto !important;
  padding-inline: 18px !important;
  justify-self: start !important;
}

@media (max-width: 1180px) {
  .licenses-table td.table-actions,
  .licenses-table .table-actions {
    min-width: 190px !important;
  }
}

@media (max-width: 720px) {
  .profile-trigger {
    box-shadow: 0 10px 24px rgba(37, 99, 235, .08) !important;
  }

  .product-icon {
    width: 40px !important;
    height: 40px !important;
  }
}


/* v7 language, readability and UI polish */
:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #edf2f7;
  --text: #111827;
  --muted: #667085;
  --line: #d9e3ef;
  --primary: #2f6fed;
  --primary-strong: #245dcc;
  --soft-shadow: 0 18px 46px rgba(15, 23, 42, 0.08);
}

.app-shell {
  display: block !important;
  min-height: 100vh;
}

.sidebar {
  position: fixed !important;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 248px;
  min-height: 100vh;
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 32px rgba(15, 23, 42, 0.04);
}

.page-wrap {
  margin-left: 248px;
  min-height: 100vh;
}

.main-nav a {
  border-radius: 14px;
  color: #58657a;
}

.main-nav a.is-active {
  background: #eef4fb;
  color: #111827;
  box-shadow: inset 3px 0 0 var(--primary);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  overflow: visible;
}

.profile-trigger {
  border-radius: 18px;
  background: #f5f8fc !important;
  border-color: #dbe5f2 !important;
  box-shadow: none !important;
}

.profile-trigger:hover,
.profile-menu.is-open .profile-trigger {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08) !important;
}

.avatar-chip,
.product-icon {
  position: relative;
  overflow: hidden;
  display: inline-grid !important;
  place-items: center !important;
  border-radius: 14px !important;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--product-color, var(--primary)) 13%, #fff), #f8fafc) !important;
  border: 1px solid color-mix(in srgb, var(--product-color, var(--primary)) 20%, var(--line)) !important;
  color: color-mix(in srgb, var(--product-color, var(--primary)) 68%, #172033) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 18px rgba(15, 23, 42, 0.05) !important;
}

.avatar-chip-profile {
  --product-color: var(--primary);
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50% !important;
  font-size: 15px;
  font-weight: 850;
}

.avatar-chip.large {
  width: 76px;
  height: 76px;
  font-size: 30px;
}

.product-icon {
  width: 44px !important;
  height: 44px !important;
  font-size: 0 !important;
}

.product-icon::before {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif !important;
  font-size: 15px !important;
  font-weight: 850 !important;
  line-height: 1 !important;
  z-index: 2;
}

.product-icon::after,
.avatar-chip::after {
  content: "";
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--product-color, var(--primary)) 12%, transparent);
}

.product-icon::before { content: none !important; }
.button,
button.button {
  border-radius: 14px !important;
  box-shadow: none !important;
}

.button-primary {
  background: var(--primary) !important;
}

.button-secondary,
.button-ghost {
  background: #f0f5fb !important;
  border-color: #d9e3ef !important;
}

.button-danger {
  background: #fff1f2 !important;
  color: #c81e1e !important;
  border-color: #ffd5d8 !important;
}

.profile-menu-icon {
  width: 22px !important;
  height: 22px !important;
  border-radius: 8px !important;
  background: transparent !important;
}

.profile-menu-icon-logout::before {
  content: "";
  position: absolute;
  left: 4px;
  width: 10px;
  height: 12px;
  border: 1.8px solid currentColor;
  border-right: 0;
  border-radius: 3px 0 0 3px;
}

.profile-menu-icon-logout::after {
  content: "";
  position: absolute;
  right: 4px;
  width: 8px;
  height: 8px;
  border-top: 1.8px solid currentColor;
  border-right: 1.8px solid currentColor;
  transform: rotate(45deg);
}

/* License table: line must span through the action buttons */
.licenses-table {
  border-collapse: collapse !important;
  table-layout: fixed !important;
}

.licenses-table tr {
  border-bottom: 0 !important;
}

.licenses-table th,
.licenses-table td {
  border-bottom: 1px solid var(--line) !important;
}

.licenses-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

.licenses-table .actions-cell {
  text-align: right !important;
  white-space: nowrap;
  overflow: visible !important;
}

.licenses-table .actions-cell .table-actions {
  display: inline-flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap !important;
}

.licenses-table .actions-cell .button {
  min-height: 38px !important;
  padding: 0 14px !important;
  margin: 0 !important;
}

/* Modern custom confirmation dialog */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(5px);
}

.confirm-dialog {
  width: min(440px, 100%);
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.20);
}

.confirm-dialog h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #fff1f2;
  border: 1px solid #ffd5d8;
  position: relative;
}

.confirm-icon::before,
.confirm-icon::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 21px;
  height: 2px;
  background: #dc2626;
  border-radius: 2px;
}

.confirm-icon::before { transform: rotate(45deg); }
.confirm-icon::after { transform: rotate(-45deg); }

.confirm-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

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

  .page-wrap {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .confirm-dialog {
    grid-template-columns: 1fr;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .confirm-actions .button {
    width: 100%;
  }
}


/* KeyPilot v8 polish: quieter palette, unified initials, license table alignment, sidebar profile. */
:root {
  --bg: #eef4fb;
  --surface: #ffffff;
  --surface-2: #f6f9fd;
  --surface-3: #eaf0f7;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe5f0;
  --primary: #2f6ff2;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 18px 40px rgba(15, 23, 42, .08);
}

body {
  background:
    radial-gradient(circle at 18% 8%, rgba(47, 111, 242, .10), transparent 34rem),
    linear-gradient(180deg, #f5f8fc 0%, var(--bg) 100%);
}

.sidebar {
  background: #ffffff !important;
  border-right: 1px solid var(--line) !important;
  box-shadow: 8px 0 30px rgba(15, 23, 42, .04);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  overflow: visible;
}

.main-nav a {
  border-radius: 14px !important;
  color: #526174;
}

.main-nav a.is-active {
  color: #0f172a !important;
  background: #eef4fb !important;
  box-shadow: inset 3px 0 0 var(--primary);
}

.panel,
.dashboard-hero,
.product-card,
.table-panel,
.page-section,
.stat-card {
  border-radius: 18px !important;
  border-color: rgba(203, 213, 225, .78) !important;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .07) !important;
}

.button,
button,
input,
select,
textarea {
  border-radius: 14px !important;
}

.button.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  box-shadow: 0 10px 20px rgba(47, 111, 242, .18);
}

/* Minimal, consistent product/license/user icons. */
.product-icon,
.avatar-chip {
  border-radius: 14px !important;
  background:
    linear-gradient(145deg, rgba(255,255,255,.76), rgba(255,255,255,.20)),
    color-mix(in srgb, var(--product-color, var(--primary)) 18%, #eef4fb) !important;
  color: color-mix(in srgb, var(--product-color, var(--primary)) 76%, #0f172a) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.65), 0 8px 18px rgba(15,23,42,.08) !important;
  letter-spacing: -.02em;
}

.product-icon::before,
.product-icon-key::before,
.product-icon-shield::before,
.product-icon-monitor::before,
.product-icon-briefcase::before,
.product-icon-spark::before,
.product-icon-box::before {
  content: none !important;
}

.avatar-chip-profile {
  border-radius: 16px !important;
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,.85) 0 8%, transparent 9%),
    linear-gradient(135deg, #30445f, #2563eb 72%) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.30), 0 12px 26px rgba(37, 99, 235, .20) !important;
}

/* Sidebar bottom menu: same language as the rest of UI, calmer and less "floating badge". */
.profile-trigger {
  background: #f4f8fd !important;
  border: 1px solid var(--line) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
  gap: 11px;
}

.profile-trigger::after {
  opacity: .65;
}

.profile-trigger-text em {
  color: var(--muted) !important;
  font-size: 12px !important;
}

.profile-trigger-text strong {
  color: var(--text) !important;
  font-size: 14px !important;
}

.profile-popover {
  background: #ffffff !important;
  border: 1px solid var(--line) !important;
  border-radius: 16px !important;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .14) !important;
}

.profile-popover a,
.profile-popover button {
  border-radius: 12px !important;
  color: var(--text) !important;
  min-height: 44px !important;
}

.profile-popover .danger-link {
  color: #b91c1c !important;
}

.profile-menu-icon {
  width: 20px !important;
  height: 20px !important;
  border-radius: 8px !important;
  background: #eef4fb !important;
  border: 1px solid var(--line);
  position: relative;
}

.profile-menu-icon-user::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px solid #334155;
  border-radius: 50%;
  box-shadow: 0 8px 0 -3px #334155;
}

.profile-menu-icon-logout::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 8px;
  height: 12px;
  border: 2px solid #334155;
  border-right: 0;
  border-radius: 2px 0 0 2px;
}

.profile-menu-icon-logout::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 9px;
  width: 8px;
  height: 2px;
  background: #334155;
  box-shadow: 3px -3px 0 -1px #334155, 3px 3px 0 -1px #334155;
}

/* License table row/border alignment. */
.licenses-table {
  border-collapse: collapse !important;
}

.licenses-table tr {
  border-bottom: 1px solid var(--line) !important;
}

.licenses-table td,
.licenses-table th {
  border-bottom: 0 !important;
}

.licenses-table .table-actions {
  align-items: center !important;
}

.licenses-table .button {
  min-width: 74px;
}

.badge {
  border-radius: 11px !important;
}

/* Confirmation dialog polish. */
.confirm-dialog,
.delete-dialog,
dialog {
  border-radius: 20px !important;
}

@media (max-width: 720px) {
  .sidebar {
    width: min(300px, 86vw) !important;
  }

  .panel,
  .dashboard-hero,
  .product-card,
  .table-panel,
  .page-section,
  .stat-card {
    border-radius: 16px !important;
  }
}
/* v9 polish fixes */
.product-icon {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(circle at 76% 76%, color-mix(in srgb, var(--product-color, var(--primary)) 26%, transparent) 0 18%, transparent 19%),
    linear-gradient(135deg, color-mix(in srgb, var(--product-color, var(--primary)) 12%, var(--surface)) 0%, color-mix(in srgb, var(--product-color, var(--primary)) 7%, var(--surface-2)) 100%);
  border: 1px solid color-mix(in srgb, var(--product-color, var(--primary)) 28%, var(--line));
  color: color-mix(in srgb, var(--product-color, var(--primary)) 70%, var(--text));
  font-size: 15px;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.36);
}
.product-icon::before { content: none !important; }
.product-icon-large { border-radius: 18px; font-size: 24px; }

.sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 58%, #eef4fb 100%);
  border-right: 1px solid var(--line);
}
:root[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #0d132b 0%, #101735 58%, #151f44 100%);
}
.sidebar-footer {
  padding: 0;
  margin-top: auto;
}
.profile-trigger {
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, var(--primary));
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
}
.profile-trigger:hover,
.profile-menu.is-open .profile-trigger {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15,23,42,.12);
}
.avatar-chip-profile {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 76% 76%, rgba(255,255,255,.25) 0 20%, transparent 21%),
    linear-gradient(135deg, #334155, #2563eb);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
  font-size: 16px;
}
.profile-trigger em { font-size: 11px; }
.profile-trigger strong { font-size: 13px; line-height: 1.15; }
.profile-popover {
  border-radius: 18px;
  padding: 8px;
  background: var(--surface);
}
.profile-popover a,
.profile-popover button {
  min-height: 38px;
  font-size: 13px;
  border-radius: 12px;
}
.profile-menu-icon {
  width: 26px !important;
  height: 26px !important;
  flex: 0 0 26px !important;
  border-radius: 10px !important;
  background-color: color-mix(in srgb, var(--surface-3) 80%, var(--primary)) !important;
  position: relative;
}
.profile-menu-icon-user::before {
  content: "";
  position: absolute;
  left: 8px; top: 7px;
  width: 10px; height: 10px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  box-sizing: border-box;
}
.profile-menu-icon-user::after {
  content: "";
  position: absolute;
  left: 6px; bottom: 6px;
  width: 14px; height: 7px;
  border: 2px solid var(--muted);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  border-bottom: 0;
  box-sizing: border-box;
}
.profile-menu-icon-logout::before {
  content: "";
  position: absolute;
  left: 7px; top: 7px;
  width: 10px; height: 12px;
  border: 2px solid var(--danger);
  border-right: 0;
  border-radius: 3px 0 0 3px;
  box-sizing: border-box;
}
.profile-menu-icon-logout::after {
  content: "";
  position: absolute;
  right: 6px; top: 12px;
  width: 10px; height: 2px;
  background: var(--danger);
  border-radius: 2px;
  box-shadow: 3px -3px 0 -1px var(--danger), 3px 3px 0 -1px var(--danger);
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.stack-item .badge {
  align-self: center;
  min-height: 32px;
  padding-top: 0;
  padding-bottom: 0;
}
.card, .panel, .table-panel, .product-card {
  border-color: color-mix(in srgb, var(--line) 82%, var(--primary));
}
.button {
  box-shadow: none;
}
.button-primary {
  box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 18%, transparent);
}
.confirm-dialog[data-mode="update"] .confirm-icon {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 25%, var(--line));
}
.confirm-dialog[data-mode="update"] .confirm-icon::before,
.confirm-dialog[data-mode="update"] .confirm-icon::after {
  background: var(--primary);
}
.confirm-dialog[data-mode="update"] .confirm-icon::before {
  left: 12px; right: 12px; top: 21px; transform: rotate(0);
}
.confirm-dialog[data-mode="update"] .confirm-icon::after {
  left: 19px; right: auto; top: 14px; width: 8px; height: 8px;
  border-right: 2px solid var(--primary); border-bottom: 2px solid var(--primary);
  background: transparent; transform: rotate(45deg);
}

.product-icon-key::before,.product-icon-shield::before,.product-icon-monitor::before,.product-icon-briefcase::before,.product-icon-spark::before,.product-icon-box::before,.product-icon::before{content:none!important;display:none!important;}


/* v10 targeted polish/fixes */
.main-nav a.is-active{
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, var(--surface-3)), var(--surface-3)) !important;
  color: var(--text) !important;
  box-shadow: inset 4px 0 0 var(--primary), 0 10px 22px color-mix(in srgb, var(--primary) 10%, transparent) !important;
  font-weight: 850 !important;
}
.main-nav a.is-active .nav-icon{ color: var(--primary) !important; }

.product-icon{
  font-size: 16px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  color: color-mix(in srgb, var(--product-color, var(--primary)) 74%, #0f172a) !important;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif !important;
}
.product-icon::before{ content: none !important; display:none !important; }
.product-icon::after{ z-index:0 !important; pointer-events:none !important; }
.product-icon{ position:relative !important; z-index:1 !important; }
.product-icon-large{ font-size:24px !important; }

.profile-trigger{
  min-height: 58px !important;
  padding: 8px 10px !important;
  gap: 10px !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface-2) 92%, var(--primary)), var(--surface)) !important;
}
.avatar-chip-profile{
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  flex: 0 0 38px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  line-height: 1 !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  background: linear-gradient(135deg, #2f7cf6 0%, #6d5dfc 100%) !important;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.24), 0 8px 18px rgba(47,124,246,.16) !important;
}
.avatar-chip-profile::before,.avatar-chip-profile::after{ content:none !important; display:none !important; }
.profile-trigger em{ font-size:11px !important; line-height:1.1 !important; }
.profile-trigger strong{ font-size:14px !important; line-height:1.2 !important; max-width:128px !important; }
.profile-popover{ border-radius:16px !important; padding:8px !important; }
.profile-popover a,.profile-popover button{ min-height:38px !important; padding:8px 10px !important; border-radius:12px !important; gap:9px !important; }
.profile-menu-icon{ width:22px !important; height:22px !important; border-radius:7px !important; background: color-mix(in srgb, var(--primary) 8%, var(--surface-2)) !important; }
.profile-menu-icon-user::before{ width:6px !important; height:6px !important; border-width:1.8px !important; transform:translateY(-3px) !important; }
.profile-menu-icon-user::after{ bottom:4px !important; width:12px !important; height:6px !important; border-width:1.8px !important; border-bottom:0 !important; }
.profile-menu-icon-logout::before{
  content:"" !important; width:12px !important; height:12px !important; border:2px solid currentColor !important;
  border-radius:4px !important; background:transparent !important; position:absolute !important; left:3px !important; top:5px !important;
}
.profile-menu-icon-logout::after{
  content:"" !important; position:absolute !important; left:10px !important; top:7px !important; width:8px !important; height:8px !important;
  border-top:2px solid currentColor !important; border-right:2px solid currentColor !important; transform:rotate(45deg) !important;
  border-left:0 !important; border-bottom:0 !important; background:transparent !important; box-shadow:none !important;
}

.badge{ display:inline-flex !important; align-items:center !important; justify-content:center !important; line-height:1.15 !important; min-height:30px !important; padding-top:0 !important; padding-bottom:0 !important; }
.stack-item .badge{ align-self:center !important; min-height:36px !important; padding:0 14px !important; }

.confirm-dialog[data-mode="update"] .confirm-icon{
  background: color-mix(in srgb, var(--success) 12%, var(--surface)) !important;
  border-color: color-mix(in srgb, var(--success) 28%, var(--line)) !important;
}
.confirm-dialog[data-mode="update"] .confirm-icon::before{
  content:"" !important; width:18px !important; height:10px !important; border-left:3px solid var(--success) !important; border-bottom:3px solid var(--success) !important;
  transform:rotate(-45deg) translate(1px,-1px) !important; background:transparent !important; border-radius:0 !important;
}
.confirm-dialog[data-mode="update"] .confirm-icon::after{ content:none !important; }

.page-wrap{ background:
  radial-gradient(circle at 22% 0%, color-mix(in srgb, var(--primary) 8%, transparent), transparent 26rem),
  linear-gradient(180deg, color-mix(in srgb, var(--bg) 92%, #fff), var(--bg)) !important;
}
.panel,.page-section,.table-panel,.product-card,.stat-card,.dashboard-hero{
  border-color: color-mix(in srgb, var(--line) 82%, var(--primary)) !important;
}


/* v11 polish fixes */
.product-icon,
.avatar-chip {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  line-height: 1 !important;
  text-indent: 0 !important;
  font-size: 15px !important;
  font-weight: 850 !important;
  color: color-mix(in srgb, var(--product-color, var(--primary)) 72%, #0f172a) !important;
}
.product-icon {
  border-radius: 16px !important;
  background:
    radial-gradient(circle at 74% 76%, color-mix(in srgb, var(--product-color, var(--primary)) 20%, transparent) 0 24%, transparent 25%),
    linear-gradient(145deg, color-mix(in srgb, var(--product-color, var(--primary)) 12%, #ffffff), color-mix(in srgb, var(--product-color, var(--primary)) 7%, #f8fbff)) !important;
  border: 1px solid color-mix(in srgb, var(--product-color, var(--primary)) 34%, var(--line)) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 10px 26px rgba(15,23,42,.04) !important;
}
.product-icon::before,
.product-icon::after {
  pointer-events: none !important;
}
.product-icon::before { content: none !important; }
.product-icon::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 42%;
  height: 42%;
  border-radius: 16px 0 14px 0;
  background: color-mix(in srgb, var(--product-color, var(--primary)) 16%, transparent);
  z-index: -1;
}
.product-icon-large {
  font-size: 26px !important;
}

.avatar-chip-profile {
  border-radius: 16px !important;
  background:
    radial-gradient(circle at 72% 76%, rgba(255,255,255,.30) 0 22%, transparent 23%),
    linear-gradient(145deg, #eef5ff, #dceaff) !important;
  border: 1px solid #b8cff6 !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.70), 0 10px 22px rgba(47,124,246,.10) !important;
  color: #1f5ed6 !important;
  display: grid !important;
  place-items: center !important;
  font-size: 16px !important;
  font-weight: 850 !important;
  text-shadow: none !important;
}
.profile-trigger .avatar-chip-profile {
  width: 42px !important;
  height: 42px !important;
  flex: 0 0 42px !important;
}

.sidebar-footer {
  border: 0 !important;
}
.profile-trigger {
  min-height: 62px !important;
  padding: 9px 11px !important;
  border-radius: 18px !important;
  background: #f4f8ff !important;
  border: 1px solid #d7e3f3 !important;
  box-shadow: none !important;
}
.profile-trigger:hover,
.profile-menu.is-open .profile-trigger {
  background: #eef5ff !important;
  border-color: #b9cff0 !important;
  transform: none !important;
}
.profile-popover {
  width: 260px !important;
  padding: 10px !important;
  border-radius: 18px !important;
  background: #ffffff !important;
  border-color: #d7e3f3 !important;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .13) !important;
}
.profile-popover a,
.profile-popover button {
  min-height: 44px !important;
  border-radius: 13px !important;
  font-size: 15px !important;
}
.profile-menu-icon {
  width: 30px !important;
  height: 30px !important;
  flex: 0 0 30px !important;
  border-radius: 10px !important;
  background: #edf4ff !important;
  color: #475569 !important;
}
.profile-menu-icon-user::before {
  width: 7px !important;
  height: 7px !important;
  border-width: 2px !important;
  transform: translateY(-4px) !important;
}
.profile-menu-icon-user::after {
  bottom: 6px !important;
  width: 13px !important;
  height: 7px !important;
  border-width: 2px !important;
}
.profile-menu-icon-logout {
  background: #fff1f1 !important;
  color: #dc2626 !important;
}
.profile-menu-icon-logout::before {
  content: "" !important;
  position: absolute;
  left: 7px;
  width: 10px !important;
  height: 10px !important;
  border: 2px solid currentColor !important;
  border-radius: 4px !important;
  background: transparent !important;
}
.profile-menu-icon-logout::after {
  content: "" !important;
  position: absolute;
  right: 6px !important;
  width: 9px !important;
  height: 9px !important;
  border: 0 !important;
  border-top: 2px solid currentColor !important;
  border-right: 2px solid currentColor !important;
  transform: rotate(45deg) !important;
}
.profile-popover .danger-link {
  color: #b91c1c !important;
}
.badge,
.stack-item .badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  min-height: 30px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}
.confirm-dialog .confirm-icon,
.confirm-icon.confirm-icon-success {
  display: grid !important;
  place-items: center !important;
  line-height: 1 !important;
}
.confirm-dialog .confirm-icon svg,
.confirm-icon.confirm-icon-success svg {
  display: block !important;
  margin: auto !important;
}
.main-nav a.is-active {
  background: #eaf2ff !important;
  color: #0f172a !important;
  border-color: #c5d8f4 !important;
  box-shadow: inset 4px 0 0 var(--primary), 0 8px 22px rgba(47,124,246,.10) !important;
}
:root[data-theme="dark"] .profile-trigger,
:root[data-theme="dark"] .profile-popover {
  background: var(--surface-2) !important;
  border-color: var(--line) !important;
}

.confirm-dialog[data-mode="update"] .confirm-icon {
  background: #eaf8ef !important;
  border-color: #bde8ca !important;
}
.confirm-dialog[data-mode="update"] .confirm-icon::before {
  content: "" !important;
  position: absolute !important;
  left: 13px !important;
  top: 20px !important;
  width: 17px !important;
  height: 9px !important;
  border-left: 4px solid #16a34a !important;
  border-bottom: 4px solid #16a34a !important;
  background: transparent !important;
  transform: translateY(-2px) rotate(-45deg) !important;
  border-radius: 0 0 0 2px !important;
}
.confirm-dialog[data-mode="update"] .confirm-icon::after {
  content: none !important;
}


/* v12 focused fixes */
.product-icon,
.avatar-chip,
.avatar-chip-profile {
  text-indent: 0 !important;
  color: color-mix(in srgb, var(--product-color, var(--primary)) 78%, #0f172a) !important;
}
.product-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  vertical-align: middle !important;
  font-size: 17px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  z-index: 0 !important;
}
.product-icon > * { position: relative; z-index: 2; }
.product-icon::before { content: none !important; display: none !important; }
.product-icon::after { z-index: -1 !important; }
.product-icon-large { font-size: 26px !important; }

.confirm-dialog[data-mode="update"] .confirm-icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.confirm-dialog[data-mode="update"] .confirm-icon::before {
  left: 50% !important;
  top: 50% !important;
  width: 20px !important;
  height: 11px !important;
  margin-left: -11px !important;
  margin-top: -8px !important;
  transform: rotate(-45deg) !important;
  border-left: 4px solid #16a34a !important;
  border-bottom: 4px solid #16a34a !important;
  border-top: 0 !important;
  border-right: 0 !important;
  background: transparent !important;
  border-radius: 0 0 0 3px !important;
}

.profile-trigger {
  width: calc(100% - 8px) !important;
  margin: 0 4px !important;
  min-height: 58px !important;
  padding: 8px 10px !important;
}
.profile-popover {
  left: 4px !important;
  right: 4px !important;
  width: auto !important;
  max-width: calc(100% - 8px) !important;
  overflow: visible !important;
}
.profile-popover::after { left: 26px !important; }

.profile-trigger .avatar-chip-profile,
.avatar-chip-profile {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  flex: 0 0 40px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 14px !important;
  background:
    radial-gradient(circle at 72% 76%, rgba(47,124,246,.14) 0 24%, transparent 25%),
    linear-gradient(145deg, #eef5ff, #dceaff) !important;
  border: 1px solid #b8cff6 !important;
  color: #1f5ed6 !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-shadow: none !important;
  transform: none !important;
  filter: none !important;
  overflow: hidden !important;
}
.avatar-chip-profile::before,
.avatar-chip-profile::after { content: none !important; display: none !important; }

.profile-menu-icon {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  width: 28px !important;
  height: 28px !important;
  flex: 0 0 28px !important;
  border-radius: 9px !important;
}
.profile-menu-icon-user::before {
  content: "" !important;
  position: absolute !important;
  width: 7px !important;
  height: 7px !important;
  top: 6px !important;
  left: 50% !important;
  margin-left: -3.5px !important;
  border: 2px solid currentColor !important;
  border-radius: 50% !important;
  background: transparent !important;
  transform: none !important;
}
.profile-menu-icon-user::after {
  content: "" !important;
  position: absolute !important;
  width: 14px !important;
  height: 8px !important;
  left: 50% !important;
  bottom: 5px !important;
  margin-left: -7px !important;
  border: 2px solid currentColor !important;
  border-bottom: 0 !important;
  border-radius: 10px 10px 0 0 !important;
  background: transparent !important;
  transform: none !important;
}
.profile-menu-icon-logout::before {
  content: "" !important;
  position: absolute !important;
  left: 5px !important;
  top: 7px !important;
  width: 10px !important;
  height: 14px !important;
  border: 2px solid currentColor !important;
  border-radius: 4px !important;
  background: transparent !important;
  transform: none !important;
}
.profile-menu-icon-logout::after {
  content: "" !important;
  position: absolute !important;
  left: 13px !important;
  top: 10px !important;
  width: 8px !important;
  height: 8px !important;
  border-top: 2px solid currentColor !important;
  border-right: 2px solid currentColor !important;
  border-left: 0 !important;
  border-bottom: 0 !important;
  transform: rotate(45deg) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.product-icon-letter{position:relative!important;z-index:2!important;display:block!important;line-height:1!important;}


/* v14 final download/build fixes */
.product-icon,
.avatar-chip,
.avatar-chip-profile {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

.product-icon {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  color: color-mix(in srgb, var(--product-color, var(--primary)) 72%, #0f172a) !important;
  font-size: 17px !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-indent: 0 !important;
  font-weight: 900 !important;
  isolation: isolate !important;
}

.product-icon::before,
.product-icon-key::before,
.product-icon-shield::before,
.product-icon-monitor::before,
.product-icon-briefcase::before,
.product-icon-spark::before,
.product-icon-box::before {
  content: "" !important;
  display: none !important;
}

.product-icon::after {
  content: "" !important;
  position: absolute !important;
  right: -7px !important;
  bottom: -7px !important;
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  background: rgba(255,255,255,.36) !important;
  z-index: -1 !important;
}

.product-icon-large {
  font-size: 24px !important;
}

/* Keep the profile photo/chip clean, compact and consistent */
.sidebar-footer.profile-menu {
  padding: 0 !important;
}

.profile-trigger {
  border-radius: 18px !important;
  min-height: 60px !important;
  padding: 9px 10px !important;
  gap: 11px !important;
  overflow: hidden !important;
}

.profile-trigger .avatar-chip-profile,
.avatar-chip-profile {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  flex: 0 0 42px !important;
  border-radius: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  color: #173d8f !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  background:
    radial-gradient(circle at 72% 76%, rgba(255,255,255,.36) 0 28%, transparent 29%),
    linear-gradient(135deg, #dce9ff 0%, #bcd3ff 100%) !important;
  border: 1px solid #aac3f5 !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 10px 22px rgba(37,99,235,.14) !important;
}

.profile-popover {
  left: 8px !important;
  right: 8px !important;
  bottom: calc(100% + 12px) !important;
  width: auto !important;
  max-width: calc(100% - 16px) !important;
  padding: 10px !important;
  border-radius: 18px !important;
  overflow: visible !important;
}

.profile-popover::after {
  left: 48px !important;
}

.profile-popover a,
.profile-popover button {
  min-height: 42px !important;
  gap: 10px !important;
  padding: 8px 10px !important;
  border-radius: 12px !important;
}

.profile-menu-icon {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  border-radius: 9px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  overflow: hidden !important;
}

.profile-menu-icon-user {
  color: #334155 !important;
  background: #eef4fb !important;
  border: 1px solid #d6e3f2 !important;
}

.profile-menu-icon-user::before {
  content: "" !important;
  position: absolute !important;
  top: 6px !important;
  left: 50% !important;
  width: 7px !important;
  height: 7px !important;
  border: 2px solid currentColor !important;
  border-radius: 50% !important;
  transform: translateX(-50%) !important;
  background: transparent !important;
}

.profile-menu-icon-user::after {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  bottom: 5px !important;
  width: 14px !important;
  height: 8px !important;
  border: 2px solid currentColor !important;
  border-bottom: 0 !important;
  border-radius: 9px 9px 0 0 !important;
  transform: translateX(-50%) !important;
}

.profile-menu-icon-logout {
  color: #dc2626 !important;
  background: #fff1f2 !important;
  border: 1px solid #fecdd3 !important;
}

.profile-menu-icon-logout::before {
  content: "" !important;
  position: absolute !important;
  left: 6px !important;
  top: 7px !important;
  width: 9px !important;
  height: 14px !important;
  border: 2px solid currentColor !important;
  border-radius: 3px !important;
  background: transparent !important;
}

.profile-menu-icon-logout::after {
  content: "" !important;
  position: absolute !important;
  left: 13px !important;
  top: 50% !important;
  width: 10px !important;
  height: 10px !important;
  border-right: 2.4px solid currentColor !important;
  border-top: 2.4px solid currentColor !important;
  transform: translateY(-50%) rotate(45deg) !important;
  background: transparent !important;
  border-radius: 1px !important;
  box-shadow: -5px 5px 0 -3px currentColor !important;
}

.confirm-dialog[data-mode="update"] .confirm-icon,
.confirm-dialog.is-update .confirm-icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.confirm-dialog[data-mode="update"] .confirm-icon::before,
.confirm-dialog.is-update .confirm-icon::before {
  left: auto !important;
  right: auto !important;
  top: auto !important;
  width: 20px !important;
  height: 11px !important;
  border-left: 4px solid #16a34a !important;
  border-bottom: 4px solid #16a34a !important;
  background: transparent !important;
  transform: translateY(-2px) rotate(-45deg) !important;
}

.confirm-dialog[data-mode="update"] .confirm-icon::after,
.confirm-dialog.is-update .confirm-icon::after {
  display: none !important;
}

.renewal-card .badge,
.renewal-item .badge,
.expiry-pill,
.status-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}


/* v16 final icon/update alignment fixes */
.confirm-icon,
.confirm-dialog .confirm-icon {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 56px !important;
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  min-height: 56px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.confirm-dialog[data-mode="update"] .confirm-icon::before,
.confirm-dialog.is-update .confirm-icon::before,
.confirm-icon.confirm-icon-success::before,
.confirm-icon.success::before {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  width: 24px !important;
  height: 13px !important;
  border-left: 4px solid #16a34a !important;
  border-bottom: 4px solid #16a34a !important;
  transform: translate(-50%, -60%) rotate(-45deg) !important;
  transform-origin: center !important;
  background: transparent !important;
  border-radius: 1px !important;
  margin: 0 !important;
}

.confirm-dialog[data-mode="update"] .confirm-icon::after,
.confirm-dialog.is-update .confirm-icon::after,
.confirm-icon.confirm-icon-success::after,
.confirm-icon.success::after {
  display: none !important;
  content: none !important;
}

.profile-menu-icon,
.profile-menu-panel .profile-menu-icon,
.profile-popover .profile-menu-icon {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  border-radius: 11px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.profile-menu-icon-user {
  color: #0f172a !important;
  background: linear-gradient(180deg, #f1f7ff, #e8f0fb) !important;
  border: 1px solid #d4e0f0 !important;
}

.profile-menu-icon-user::before {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  top: 8px !important;
  width: 8px !important;
  height: 8px !important;
  border: 2.2px solid currentColor !important;
  border-radius: 999px !important;
  transform: translateX(-50%) !important;
  background: transparent !important;
  box-sizing: border-box !important;
}

.profile-menu-icon-user::after {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  bottom: 7px !important;
  width: 17px !important;
  height: 9px !important;
  border: 2.2px solid currentColor !important;
  border-bottom: 0 !important;
  border-radius: 11px 11px 0 0 !important;
  transform: translateX(-50%) !important;
  background: transparent !important;
  box-sizing: border-box !important;
}

.profile-menu-icon-logout {
  color: #dc2626 !important;
  background: linear-gradient(180deg, #fff7f7, #fff0f0) !important;
  border: 1px solid #fecaca !important;
}

.profile-menu-icon-logout::before {
  content: "" !important;
  position: absolute !important;
  left: 8px !important;
  top: 8px !important;
  width: 11px !important;
  height: 18px !important;
  border: 2.3px solid currentColor !important;
  border-right: 0 !important;
  border-radius: 4px 0 0 4px !important;
  background: transparent !important;
  box-sizing: border-box !important;
}

.profile-menu-icon-logout::after {
  content: "" !important;
  position: absolute !important;
  left: 14px !important;
  top: 50% !important;
  width: 14px !important;
  height: 10px !important;
  transform: translateY(-50%) !important;
  background:
    linear-gradient(currentColor,currentColor) 0 50% / 12px 2.4px no-repeat,
    linear-gradient(45deg, transparent 45%, currentColor 46% 58%, transparent 59%) right 1px top 0 / 10px 10px no-repeat,
    linear-gradient(-45deg, transparent 45%, currentColor 46% 58%, transparent 59%) right 1px bottom 0 / 10px 10px no-repeat !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* Keep profile popover compact and inside sidebar */
.profile-menu-panel,
.profile-popover,
.user-popover {
  max-width: 230px !important;
  width: max-content !important;
  min-width: 200px !important;
  overflow: visible !important;
}



/* v17: final lower-left profile/logout menu fixes */
.sidebar-footer.profile-menu {
  position: relative !important;
  margin-top: auto !important;
}

.profile-trigger {
  min-height: 64px !important;
  padding: 10px 12px !important;
  gap: 12px !important;
  border-radius: 18px !important;
  overflow: hidden !important;
}

.avatar-chip-profile {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  flex: 0 0 42px !important;
  border-radius: 50% !important;
  display: grid !important;
  place-items: center !important;
  line-height: 1 !important;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.96) 0 9%, transparent 10%),
    linear-gradient(135deg, #2563eb 0%, #4f46e5 58%, #7c3aed 100%) !important;
  color: #eaf1ff !important;
  font-size: 15px !important;
  font-weight: 850 !important;
  box-shadow:
    inset 0 0 0 3px rgba(255,255,255,.22),
    0 8px 18px rgba(37,99,235,.22) !important;
  text-shadow: none !important;
}

.profile-popover {
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  bottom: calc(100% + 12px) !important;
  padding: 10px !important;
  gap: 6px !important;
  border-radius: 18px !important;
  overflow: visible !important;
}

.profile-popover a,
.profile-popover button {
  min-height: 42px !important;
  height: 42px !important;
  padding: 0 10px !important;
  gap: 10px !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  line-height: 1 !important;
}

.profile-menu-icon {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  flex: 0 0 30px !important;
  display: grid !important;
  place-items: center !important;
  border-radius: 10px !important;
  background: #eef4fb !important;
  color: #0f172a !important;
  position: relative !important;
  overflow: hidden !important;
}

.profile-popover .danger-link .profile-menu-icon,
.profile-menu-icon-logout {
  background: #fff1f2 !important;
  color: #dc2626 !important;
}

.profile-menu-icon svg {
  width: 20px !important;
  height: 20px !important;
  display: block !important;
  overflow: visible !important;
  stroke: currentColor !important;
  stroke-width: 2.15 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
}

/* Disable old pseudo drawn icons so inline SVG icons render cleanly. */
.profile-menu-icon-user::before,
.profile-menu-icon-user::after,
.profile-menu-icon-logout::before,
.profile-menu-icon-logout::after {
  content: none !important;
  display: none !important;
}

/* v17: keep update/check icon perfectly centered */
.confirm-dialog[data-mode="update"] .confirm-icon {
  display: grid !important;
  place-items: center !important;
  background: #ecfdf3 !important;
  border-color: #bbf7d0 !important;
}

.confirm-dialog[data-mode="update"] .confirm-icon::before {
  content: "" !important;
  position: static !important;
  width: 19px !important;
  height: 10px !important;
  border-left: 4px solid #16a34a !important;
  border-bottom: 4px solid #16a34a !important;
  background: transparent !important;
  border-radius: 2px !important;
  transform: rotate(-45deg) translate(1px, -1px) !important;
}

.confirm-dialog[data-mode="update"] .confirm-icon::after {
  content: none !important;
  display: none !important;
}

/* Dark theme final overrides */
:root[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #0d132b 0%, #101735 58%, #151f44 100%) !important;
  border-right-color: #283457 !important;
}

:root[data-theme="dark"] .main-nav a.is-active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, var(--surface-3)), var(--surface-3)) !important;
  color: var(--text) !important;
  box-shadow: inset 4px 0 0 var(--primary), 0 10px 22px color-mix(in srgb, var(--primary) 10%, transparent) !important;
}

:root[data-theme="dark"] .main-nav a.is-active .nav-icon {
  color: var(--primary) !important;
}

:root[data-theme="dark"] .button-primary {
  background: var(--primary-strong) !important;
  color: #ffffff !important;
}

:root[data-theme="dark"] .button-primary:hover {
  background: var(--primary) !important;
}

:root[data-theme="dark"] .button-danger {
  background: var(--danger) !important;
  color: #ffffff !important;
}

:root[data-theme="dark"] .button-danger:hover {
  background: color-mix(in srgb, var(--danger) 86%, #000) !important;
  color: #ffffff !important;
}

:root[data-theme="dark"] .product-icon {
  background:
    radial-gradient(circle at 74% 76%, color-mix(in srgb, var(--product-color, var(--primary)) 20%, transparent) 0 24%, transparent 25%),
    linear-gradient(145deg, color-mix(in srgb, var(--product-color, var(--primary)) 12%, var(--surface)), color-mix(in srgb, var(--product-color, var(--primary)) 7%, var(--surface-2))) !important;
  border-color: color-mix(in srgb, var(--product-color, var(--primary)) 34%, var(--line)) !important;
  color: color-mix(in srgb, var(--product-color, var(--primary)) 78%, #ffffff) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 10px 26px rgba(0, 0, 0, 0.15) !important;
}

:root[data-theme="dark"] .button-secondary,
:root[data-theme="dark"] .button-ghost {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

:root[data-theme="dark"] .button-ghost:hover {
  background: var(--surface-3) !important;
}

/* Confirm dialog icon fixes */
.confirm-dialog {
  gap: 18px !important;
}

.confirm-dialog[data-mode="delete"] .confirm-icon::before,
.confirm-dialog[data-mode="delete"] .confirm-icon::after,
.confirm-dialog[data-mode="generic"] .confirm-icon::before,
.confirm-dialog[data-mode="generic"] .confirm-icon::after {
  top: 27px !important;
  left: 14px !important;
  right: 14px !important;
  width: auto !important;
  height: 2px !important;
  background: #dc2626 !important;
  border: none !important;
  border-radius: 2px !important;
  transform-origin: center !important;
}

.confirm-dialog[data-mode="delete"] .confirm-icon::before,
.confirm-dialog[data-mode="generic"] .confirm-icon::before {
  transform: rotate(45deg) !important;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 0 4px;
  flex-wrap: wrap;
}

.pagination-disabled {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

.pagination .button[aria-disabled="true"],
.pagination span.button {
  cursor: default;
  opacity: 0.45;
  pointer-events: none;
}

.pagination-info {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 8px;
}

.pagination .button {
  min-height: 34px;
  padding: 0 14px;
  font-size: 0.85rem;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-pages a,
.pagination-pages span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  background: transparent;
  transition: background 120ms;
}

.pagination-pages a:hover {
  background: var(--surface-2);
}

.pagination-pages span.is-current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination-ellipsis {
  border: none !important;
  background: transparent !important;
  color: var(--muted);
  min-width: 20px;
}

.confirm-dialog[data-mode="delete"] .confirm-icon::after,
.confirm-dialog[data-mode="generic"] .confirm-icon::after {
  transform: rotate(-45deg) !important;
}

.demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  background: color-mix(in srgb, var(--warning) 14%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  color: var(--warning);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  position: sticky;
  top: 0;
  z-index: 25;
}

.demo-banner svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
