:root {
  color-scheme: light;
  --desk-canvas: #ecf0f4;
  --desk-surface: #ffffff;
  --desk-surface-muted: #f7f8fa;
  --desk-surface-strong: #edf1f5;
  --desk-sidebar: #0b132b;
  --desk-sidebar-hover: #17233f;
  --desk-sidebar-text: #d7deea;
  --desk-border: #e4e8ee;
  --desk-border-strong: #d3d9e2;
  --desk-text: #202342;
  --desk-body: #44526c;
  --desk-muted: #7f92a9;
  --desk-primary: #1b00ff;
  --desk-primary-hover: #100099;
  --desk-success: #28a745;
  --desk-warning: #f5a623;
  --desk-danger: #dc3545;
  --desk-shadow-card: 0 0 28px rgb(0 0 0 / 8%);
  --desk-shadow-menu: 0 12px 35px rgb(0 0 0 / 16%);
  --desk-radius: 10px;
  --desk-radius-sm: 8px;
  --desk-sidebar-width: 280px;
  --desk-sidebar-collapsed: 76px;
  --desk-header-height: 70px;
  --desk-content-width: 1440px;
  --desk-page-pad: 28px;
  --desk-section-gap: 28px;
  --desk-card-gap: 20px;
  --desk-card-pad: 22px;
  --desk-font: "Inter", "Segoe UI Variable", "Segoe UI", sans-serif;
}

body:not(.light-theme) {
  color-scheme: dark;
  --desk-canvas: #101828;
  --desk-surface: #182230;
  --desk-surface-muted: #1d2939;
  --desk-surface-strong: #243244;
  --desk-border: #344054;
  --desk-border-strong: #475467;
  --desk-text: #f2f4f7;
  --desk-body: #d0d5dd;
  --desk-muted: #98a2b3;
  --desk-shadow-card: 0 0 28px rgb(0 0 0 / 18%);
  --desk-shadow-menu: 0 16px 40px rgb(0 0 0 / 32%);
}

/* Vendor System DeskApp migration - single visual system (tokens.css linked first) */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--desk-canvas); }
body { min-height: 100vh; margin: 0; overflow: hidden; background: var(--desk-canvas); color: var(--desk-body); font: 400 14px/1.55 var(--desk-font); -webkit-font-smoothing: antialiased; }
body.deskapp-ui { background: var(--desk-canvas); }
[hidden], .hidden, .svg-sprite { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { border: 0; }
svg { display: block; vertical-align: middle; }
p { margin: 0; color: var(--desk-muted); }
small { color: var(--desk-muted); font-size: 12px; }
h1, h2, h3 { margin: 0; color: var(--desk-text); letter-spacing: -.015em; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 700; }
h2 { font-size: 19px; line-height: 1.35; font-weight: 700; }
h3 { font-size: 15px; line-height: 1.4; font-weight: 650; }
code { color: var(--desk-body); font-size: 12px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { border-radius: 12px; background: var(--desk-border-strong); }
::-webkit-scrollbar-track { background: transparent; }
.icon-sm, .icon { width: 16px; height: 16px; flex: 0 0 16px; }
.icon-md, .nav-icon { width: 18px; height: 18px; flex: 0 0 18px; }
.icon-lg { width: 20px; height: 20px; flex: 0 0 20px; }

/* Buttons */
.btn-primary, .primary-button, button.primary, #new-plan, #refresh, #save-profile, #save-plan, #save-entity,
.btn-secondary, .secondary-button, button.secondary, .btn-danger, button.danger, .danger-button, #logout,
.btn-ghost, .ghost-icon, .link-button, .download-button, .user-menu button, menu button, .dialog-actions button,
.row-action, .table-action, button.ghost, .compact-btn, dialog .section-head > button {
  display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--desk-border); border-radius: var(--desk-radius-sm); padding: 0 14px;
  background: var(--desk-surface); color: var(--desk-body); font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer; transition: .2s ease;
}
:is(.btn-primary, .primary-button, button.primary, #new-plan, #refresh, #save-profile, #save-plan, #save-entity) { border-color: var(--desk-primary); background: var(--desk-primary); color: #fff; }
:is(.btn-primary, .primary-button, button.primary, #new-plan, #refresh, #save-profile, #save-plan, #save-entity):hover { border-color: var(--desk-primary-hover); background: var(--desk-primary-hover); }
:is(.btn-secondary, .secondary-button, button.secondary, .btn-ghost, .ghost-icon, .link-button, .download-button, .user-menu button, menu button, .dialog-actions button, .row-action, .table-action, button.ghost, .compact-btn, dialog .section-head > button):hover { border-color: var(--desk-primary); background: color-mix(in srgb, var(--desk-primary) 7%, var(--desk-surface)); color: var(--desk-primary); }
:is(.btn-danger, button.danger, .danger-button, #logout) { border-color: color-mix(in srgb, var(--desk-danger) 30%, var(--desk-border)); color: var(--desk-danger); }
.btn-icon, .icon-only, .primary-icon, .orb-button, .menu-toggle { display: inline-flex; width: 38px; height: 38px; min-width: 38px; align-items: center; justify-content: center; border: 1px solid var(--desk-border); border-radius: var(--desk-radius-sm); background: var(--desk-surface); color: var(--desk-body); padding: 0; cursor: pointer; transition: .2s ease; }
:is(.btn-icon, .icon-only, .primary-icon, .orb-button, .menu-toggle):hover { border-color: var(--desk-primary); color: var(--desk-primary); }
:is(button, a):focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--desk-primary); outline-offset: 2px; }
button:disabled, .nav-button:disabled { opacity: .45; cursor: not-allowed; }
:is(.btn-primary, .primary-button, .btn-secondary, .secondary-button, .btn-danger, .btn-ghost, .download-button, .user-menu button, .row-action, .table-action, .compact-btn, .btn-icon, .icon-only, .primary-icon, .orb-button) svg { width: 16px; height: 16px; flex: 0 0 16px; }

/* DeskApp shell — FASE 1 visual system */
.left-side-bar {
  background: var(--desk-sidebar) !important;
  box-shadow: 2px 0 18px rgb(0 0 0 / 12%);
  z-index: 1000;
}

.left-side-bar .brand-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--desk-header-height);
  padding: 0 18px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.left-side-bar .brand-logo a {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-logo-img { max-height: 38px; border-radius: 6px; vertical-align: middle; }
.brand-title { color: #fff; font-size: 16px; font-weight: 700; letter-spacing: .5px; margin-left: 0; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-container.shell {
  min-height: 100vh;
  padding: var(--desk-header-height) 20px 0 calc(var(--desk-sidebar-width) + 20px) !important;
}

.shell-content {
  height: calc(100vh - var(--desk-header-height));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 0 32px;
  scrollbar-gutter: stable;
}

.main-container.shell > .header {
  position: fixed;
  top: 0;
  right: 0;
  left: auto;
  width: calc(100% - var(--desk-sidebar-width)) !important;
  height: var(--desk-header-height);
  background: var(--desk-surface);
  box-shadow: 0 2px 12px rgb(0 0 0 / 6%);
  border-bottom: 1px solid var(--desk-border);
  padding: 0 22px;
  z-index: 1001;
}

@media (min-width: 1025px) {
  .main-container.shell > .header {
    position: fixed;
    z-index: 1001;
  }
}

.sidebar-menu .dropdown.show > .submenu { display: block !important; }

.menu-switch-input, .theme-switch-input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }

#menu-toggle {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--desk-border);
  border-radius: var(--desk-radius-sm);
  background: var(--desk-surface);
  color: var(--desk-body);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

#menu-toggle:hover {
  border-color: var(--desk-primary);
  color: var(--desk-primary);
}

.header .header-left {
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.header .header-right {
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header .header-search {
  flex: 1;
  max-width: 420px;
}

.header .header-search .search-input {
  min-height: 42px;
  padding-left: 44px;
  border-radius: 999px;
  border-color: var(--desk-border);
  background: var(--desk-surface-muted);
}

.header .header-search .search-input:focus {
  background: var(--desk-surface);
}

.header .header-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--desk-muted);
  pointer-events: none;
}

.header .header-dropdown { position: relative; }

.header-icon-button,
.header-user-toggle {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.header-user-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.user-meta {
  display: grid;
  gap: 2px;
  line-height: 1.2;
  text-align: left;
}

.user-meta .user-name { color: var(--desk-text); font-weight: 600; font-size: 13px; }
.user-meta .user-role { color: var(--desk-muted); font-size: 11px; }

.header-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 220;
  border: 0;
  border-radius: var(--desk-radius);
  background: var(--desk-surface);
  box-shadow: var(--desk-shadow-menu);
  padding: 12px;
}

#notification-menu { width: min(320px, calc(100vw - 24px)); }
.header-panel-user { width: min(260px, calc(100vw - 24px)); }

.header-panel:not([hidden]) { display: block; }

.header-panel .alert-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 0;
  background: transparent;
  padding: 8px 6px;
  border-radius: var(--desk-radius-sm);
}

.header-panel .alert-item:hover {
  background: var(--desk-surface-muted);
}

.header-panel .alert-item span:first-child {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--desk-primary) 10%, var(--desk-surface));
  color: var(--desk-primary);
}

.header-panel .alert-item.danger span:first-child {
  background: color-mix(in srgb, var(--desk-danger) 12%, var(--desk-surface));
  color: var(--desk-danger);
}

.header-panel .alert-item strong {
  display: block;
  color: var(--desk-text);
  font-size: 13px;
  line-height: 1.3;
}

.header-panel .alert-item p {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
}

.header-menu-item {
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 4px;
  border-color: transparent;
  background: transparent;
  padding: 8px 12px;
  font-size: 13px;
  text-align: left;
}

.header-menu-item svg {
  flex: 0 0 16px;
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  border: 0;
  background: rgb(0 0 0 / 35%);
  cursor: pointer;
}

.mobile-menu-overlay:not([hidden]) { display: block; }

body.sidebar-desktop-collapsed .left-side-bar { width: var(--desk-sidebar-collapsed) !important; }
body.sidebar-desktop-collapsed .main-container.shell { padding-left: calc(var(--desk-sidebar-collapsed) + 20px) !important; }
body.sidebar-desktop-collapsed .main-container.shell > .header { width: calc(100% - var(--desk-sidebar-collapsed)) !important; }
body.sidebar-desktop-collapsed .brand-title,
body.sidebar-desktop-collapsed .sidebar-menu .dropdown-toggle .mtext { display: none !important; }
body.sidebar-desktop-collapsed .sidebar-menu .submenu { display: none !important; }
body.sidebar-desktop-collapsed .sidebar-menu .dropdown.show > .submenu { display: none !important; }
body.sidebar-desktop-collapsed .sidebar-menu .dropdown-toggle { padding-left: 15px; }
body.sidebar-desktop-collapsed .sidebar-menu .micon { left: 50%; transform: translate(-50%, -50%); }
body.sidebar-desktop-collapsed .left-side-bar .brand-logo a { justify-content: center; }
body.sidebar-desktop-collapsed .left-side-bar .brand-logo .brand-title { display: none !important; }

:is(.page-heading, .status-line, #dashboard-view, #table-view, #profile-view, #reports-view) { width: 100%; max-width: var(--desk-content-width); margin-inline: auto; padding-inline: 2px; }
.topbar-breadcrumb { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--desk-muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
.topbar-breadcrumb span::after { content: "/"; margin-left: 8px; color: var(--desk-border-strong); }
.topbar-breadcrumb strong { overflow: hidden; color: var(--desk-text); text-overflow: ellipsis; }
.theme-switch { position: relative; display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid var(--desk-border); border-radius: var(--desk-radius-sm); background: var(--desk-surface); color: var(--desk-body); cursor: pointer; margin-bottom: 0; }
.theme-switch span { display: grid; place-items: center; font-size: 20px; }
.header-icon-button { position: relative; display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid var(--desk-border); border-radius: var(--desk-radius-sm); background: var(--desk-surface); }
#notification-dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border: 2px solid var(--desk-surface); border-radius: 50%; background: var(--desk-danger); }
.admin-avatar, .user-icon.admin-avatar { display: inline-flex; width: 38px; height: 38px; flex: 0 0 38px; align-items: center; justify-content: center; border-radius: 50%; background: var(--desk-primary); color: #fff; font-size: 12px; font-weight: 700; }
.notification-head, .user-menu-head { display: flex; align-items: center; gap: 11px; border-bottom: 1px solid var(--desk-border); padding: 4px 4px 12px; margin-bottom: 8px; }
.user-menu-head div { min-width: 0; display: grid; gap: 2px; }
.user-menu-head strong, .user-menu-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notification-list { display: grid; gap: 5px; max-height: 280px; overflow: auto; }

/* Navigation */
.brand { position: sticky; top: 0; z-index: 2; display: flex; min-height: var(--desk-header-height); align-items: center; gap: 11px; margin: 0 -15px 18px; background: var(--desk-sidebar); padding: 0 20px; }
.brand-mark { display: inline-flex; width: 38px; height: 38px; flex: 0 0 38px; align-items: center; justify-content: center; border-radius: 9px; background: #fff; }
.brand-mark img { width: 26px; height: 26px; object-fit: contain; }
.brand > span:last-child { min-width: 0; display: grid; line-height: 1.25; }
.brand strong { color: #fff; }
.brand small { color: #9ca9bf; }
.brand strong, .brand small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-caption { margin: 22px 11px 8px; color: #75829a; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-caption:first-of-type { margin-top: 0; }
.sidebar nav { display: grid; gap: 4px; }
.nav-button { display: flex; width: 100%; min-height: 42px; align-items: center; gap: 12px; border-radius: 8px; background: transparent; color: var(--desk-sidebar-text); padding: 0 11px; text-align: left; cursor: pointer; transition: .2s ease; }
.nav-button:hover { background: var(--desk-sidebar-hover); color: #fff; }
.nav-button.active { background: var(--desk-primary); color: #fff; box-shadow: 0 7px 18px rgb(27 0 255 / 25%); }
.nav-button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sidebar-menu .nav-button .nav-icon.micon { width: 18px !important; height: 18px !important; min-width: 18px; flex: 0 0 18px; margin: 0; font-size: 18px; line-height: 1; }

/* Page rhythm and DeskApp card-box surfaces */
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.page-heading > div:first-child { display: grid; gap: 5px; }
.page-heading .eyebrow { display: none; }
.page-heading p { max-width: 720px; }
.heading-actions { display: flex; gap: 8px; }
.status-line { min-height: 20px; margin-bottom: 22px; font-size: 12px; }
#dashboard-view, #table-view, #profile-view, #reports-view { display: none; padding-bottom: 32px; }
#dashboard-view.active, #table-view.active, #profile-view.active, #reports-view.active { display: block; }
.metrics, .card-grid, .dashboard-row, .dashboard-grid, .dashboard-hero-grid, .analytics-grid, .notices-sections, .users-layout, .subscriptions-grid, .orders-command-grid, .reports-layout { display: grid; gap: var(--desk-section-gap); margin-bottom: var(--desk-section-gap); }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.dashboard-grid, .dashboard-hero-grid, .analytics-grid, .users-layout, .notices-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.analytics-grid { grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr); }
.dashboard-chart-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.metric-card, .panel-card, .table-card, .form-card { min-width: 0; border: 0; border-radius: var(--desk-radius); background: var(--desk-surface); box-shadow: var(--desk-shadow-card); padding: var(--desk-card-pad); }
.metric-card { position: relative; display: grid; min-height: 120px; align-content: space-between; gap: 10px; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: var(--desk-primary); opacity: .75; }
.metric-card > span:first-child, .metric-top span { color: var(--desk-muted); font-size: 12px; font-weight: 600; }
.metric-card strong, .metric-value { color: var(--desk-text); font-size: 27px; line-height: 1.15; letter-spacing: -.025em; }
.metric-top, .section-head, .card-head, .panel-head, .table-card-head, .dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.metric-top i, .metric-card > span:first-child:has(svg) { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 9px; background: color-mix(in srgb, var(--desk-primary) 9%, var(--desk-surface)); color: var(--desk-primary); }
.metric-top svg, .metric-card > span svg { width: 20px; height: 20px; }
.panel-card, .table-card, .form-card { display: grid; gap: var(--desk-card-gap); }
.metric-card, .panel-card { transition: transform .2s ease, box-shadow .2s ease; }
.metric-card:hover, .panel-card:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgb(0 0 0 / 10%); }
.metric-card strong { overflow-wrap: anywhere; }
.section-head { align-items: center; border-bottom: 1px solid var(--desk-border); padding-bottom: 15px; }
.section-head h2 + p, .section-head h3 + p { margin-top: 4px; }
.entity-panel-grid, .role-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
#table-panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.alert-list, .event-list, .channel-list, .permission-list { display: grid; gap: 10px; }
.alert-item, .event-item, .activity-item, .notification-item, .permission-list article { display: grid; gap: 5px; border: 1px solid var(--desk-border); border-radius: var(--desk-radius-sm); background: var(--desk-surface-muted); padding: 12px; }
.permission-list article strong { color: var(--desk-primary); font-size: 13px; }
.permission-list article p { margin: 0; font-size: 12px; }
#entity-form .form-card > h3 { margin: 0 0 4px; color: var(--desk-text); font-size: 14px; }
.notices-sections { gap: 32px; }
.notices-sections > *:first-child { grid-column: 1 / -1; }
.notices-sections .entity-panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sales-total { color: var(--desk-text); font-size: 27px; font-weight: 700; }
.bar-chart, .chart-bars, .audit-bars { display: flex; min-height: 230px; align-items: end; gap: 8px; overflow-x: auto; border-radius: var(--desk-radius-sm); background: var(--desk-surface-muted); padding: 18px; }
.bar-column, .chart-bar, .audit-bars article { display: grid; min-width: 24px; flex: 1; align-items: end; gap: 7px; color: var(--desk-muted); text-align: center; font-size: 10px; }
.bar-column span, .chart-bar span, .audit-bars article > span { display: block; width: 100%; min-height: 3px; border-radius: 5px 5px 2px 2px; background: var(--desk-primary); }
.sales-empty { width: 100%; min-height: 180px; display: grid; place-content: center; gap: 6px; text-align: center; }
.apex-chart { width: 100%; min-height: 285px; }
.apexcharts-canvas, .apexcharts-svg { max-width: 100% !important; }
.apexcharts-text, .apexcharts-legend-text { fill: var(--desk-body) !important; color: var(--desk-body) !important; }
.apexcharts-gridline { stroke: var(--desk-border); }
.donut-wrap, .funnel, .audit-grid, .audit-metrics, .dashboard-summary, .order-timeline, .legend-list, .report-grid { min-width: 0; }
.legend-list, .dashboard-summary, .order-timeline { display: grid; gap: 10px; }

/* Tables */
#table-view { position: relative; }
#table-view.table-card { padding: var(--desk-card-pad); gap: var(--desk-card-gap); }
.table-card-head.section-head { align-items: center; margin-bottom: 4px; }
.table-card-title { display: grid; gap: 4px; min-width: 0; }
.table-card-subtitle { margin: 0; color: var(--desk-muted); font-size: 13px; }
.table-filters { margin-bottom: 4px; }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--desk-border); border-radius: var(--desk-radius-sm); background: var(--desk-surface); }
table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }
.dataTables_wrapper { width: 100%; color: var(--desk-body); }
.dataTables_wrapper .row { margin: 0; align-items: center; }
.dataTables_wrapper .row:first-child { gap: 12px; border-bottom: 1px solid var(--desk-border); padding: 12px 14px; }
.dataTables_wrapper .row:last-child { gap: 12px; padding: 12px 14px; }
.dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate { padding: 0; }
.dataTables_wrapper .dataTables_filter label, .dataTables_wrapper .dataTables_length label { display: flex; align-items: center; gap: 8px; }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select { min-height: 36px; }
.page-item.active .page-link { border-color: var(--desk-primary); background: var(--desk-primary); }
.page-link { color: var(--desk-primary); }
thead th { position: sticky; top: 0; z-index: 2; height: 46px; background: var(--desk-surface-muted); color: var(--desk-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
th, td { height: 52px; border-bottom: 1px solid var(--desk-border); padding: 10px 14px; vertical-align: middle; }
tbody tr { transition: background-color .2s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--desk-primary) 4%, var(--desk-surface)); }
tbody tr:last-child td { border-bottom: 0; }
.table-actions-compact { display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px; white-space: nowrap; }
.compact-btn { min-height: 32px; padding: 0 10px; font-size: 12px; }
.table-pagination, .pagination, #activity-pagination, #sales-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; padding-top: 14px; }
.action-dropdown { display: inline-flex; }
.action-dropdown-menu { position: fixed; z-index: 9999; min-width: 210px; max-width: min(280px, calc(100vw - 20px)); max-height: min(360px, calc(100vh - 20px)); overflow: auto; display: grid; gap: 3px; border-radius: var(--desk-radius); background: var(--desk-surface); box-shadow: var(--desk-shadow-menu); padding: 7px; }
.action-dropdown-menu[hidden] { display: none !important; }
.action-dropdown-menu button { min-height: 36px; display: grid; grid-template-columns: 16px minmax(0, 1fr); align-items: center; gap: 9px; border-radius: 7px; background: transparent; color: var(--desk-body); padding: 0 10px; text-align: left; font-size: 12px; font-weight: 600; cursor: pointer; }
.action-dropdown-menu button:hover { background: var(--desk-surface-strong); color: var(--desk-primary); }
.action-dropdown-menu button.danger { color: var(--desk-danger); }
.action-dropdown-menu button svg { width: 16px; height: 16px; }
.action-dropdown-menu button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Forms */
.form-grid, .table-toolbar, .filters-row, .filter-row, #table-filters, .sales-filter-grid, .sales-filters, .sales-filters-clean { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: end; }
.form-section, .field-group, #reseller-fields, #vendor-fields, #object-fields, #centova-server-fields, #vendor-product-fields, #plan-form .form-grid { display: grid; gap: 16px; border: 1px solid var(--desk-border); border-radius: var(--desk-radius); background: var(--desk-surface-muted); padding: var(--desk-card-pad); }
label { display: grid; gap: 6px; color: var(--desk-body); font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid var(--desk-border-strong); border-radius: var(--desk-radius-sm); background: var(--desk-surface); color: var(--desk-text); padding: 0 12px; outline: none; transition: border-color .2s ease, box-shadow .2s ease; }
textarea { min-height: 110px; padding: 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--desk-primary); box-shadow: 0 0 0 3px rgb(27 0 255 / 10%); }
input::placeholder, textarea::placeholder { color: var(--desk-muted); }
input[type=checkbox], input[type=radio] { width: auto; min-height: auto; accent-color: var(--desk-primary); }
#plan-form, #entity-form, .automation-settings-form { display: grid; gap: 20px; }
menu, .dialog-actions, .card-actions, .table-actions, .panel-actions, .action-row, .filter-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; margin: 0; padding: 0; }
.action-row button, .segmented button { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--desk-border); border-radius: 7px; background: var(--desk-surface); color: var(--desk-body); padding: 0 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.action-row button:hover, .segmented button:hover { border-color: var(--desk-primary); color: var(--desk-primary); }
.automation-switches { display: flex; flex-wrap: wrap; gap: 12px 20px; border: 1px solid var(--desk-border); border-radius: var(--desk-radius-sm); background: var(--desk-surface-muted); padding: 14px; }
.automation-switches label { display: inline-flex; align-items: center; gap: 8px; }

/* Dialogs and tabs */
dialog { width: min(760px, calc(100vw - 28px)); max-width: calc(100vw - 28px); max-height: calc(100vh - 28px); border: 0; background: transparent; color: var(--desk-body); padding: 0; }
dialog::backdrop { background: rgb(11 19 43 / 60%); }
.wide-dialog { width: min(1180px, calc(100vw - 28px)); }
.dialog-panel, #plan-form, #entity-form { max-height: calc(100vh - 36px); overflow: auto; border-radius: var(--desk-radius); background: var(--desk-surface); box-shadow: var(--desk-shadow-menu); padding: 24px; }
#streams-dialog .dialog-panel { display: grid; gap: 22px; }
.tab-list { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--desk-border); }
.tab-button { min-height: 40px; border-bottom: 2px solid transparent; background: transparent; color: var(--desk-muted); padding: 0 13px; font-size: 12px; font-weight: 600; cursor: pointer; }
.tab-button:hover, .tab-button.active { border-bottom-color: var(--desk-primary); color: var(--desk-primary); }
.tab-panel { display: none; }
.tab-panel.active { display: grid; gap: 20px; padding-top: 4px; }
.customer-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

/* Status and utility */
.badge, .status-badge, .pill, .tag, .status-chip { display: inline-flex; width: fit-content; align-items: center; gap: 5px; border: 1px solid var(--desk-border); border-radius: 99px; background: var(--desk-surface-muted); color: var(--desk-body); padding: 3px 8px; font-size: 10px; font-weight: 700; white-space: nowrap; }
:is(.badge.active, .badge.paid, .badge.completed, .badge.received, .badge.success, .status-chip.success) { border-color: rgb(40 167 69 / 22%); background: rgb(40 167 69 / 9%); color: var(--desk-success); }
:is(.badge.pending, .badge.warning, .badge.waiting_config, .badge.pendiente, .status-chip.warning) { border-color: rgb(245 166 35 / 28%); background: rgb(245 166 35 / 10%); color: #b56d00; }
:is(.badge.failed, .badge.inactive, .badge.disabled, .badge.expired, .badge.cancelled, .badge.fallida, .status-chip.danger) { border-color: rgb(220 53 69 / 24%); background: rgb(220 53 69 / 9%); color: var(--desk-danger); }
.profile-cover { height: 150px; overflow: hidden; border-radius: var(--desk-radius); background: var(--desk-surface-muted); }
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero, .profile-box, .profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.profile-hero .admin-avatar { width: 54px; height: 54px; flex-basis: 54px; }
.profile-info-grid, .report-grid, .sales-summary-grid, .quick-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.profile-info-grid section, .report-grid article { display: grid; gap: 11px; border: 1px solid var(--desk-border); border-radius: var(--desk-radius-sm); background: var(--desk-surface-muted); padding: 18px; }
dl { display: grid; gap: 10px; margin: 0; }
dl div { display: grid; gap: 3px; }
dt { color: var(--desk-muted); font-size: 11px; text-transform: uppercase; }
dd { margin: 0; color: var(--desk-text); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.stack { display: grid; gap: 24px; }
.stack-md { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 10px; }
.muted, .hint, .empty-state, .dialog-subtitle { color: var(--desk-muted); }

/* DeskApp login composition */
body.login-page { min-height: 100vh; overflow: auto; background: var(--desk-canvas); }
body.login-page::before { display: none; }
.login-page-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 480px); min-height: 100vh; }
.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  background: var(--desk-sidebar);
  color: #fff;
  padding: 48px clamp(24px, 5vw, 64px);
}
.login-aside-copy { display: grid; gap: 10px; max-width: 520px; }
.login-aside-copy h1 { color: #fff; font-size: clamp(28px, 4vw, 38px); }
.login-aside-copy p { color: rgb(255 255 255 / 72%); max-width: 46ch; }
.login-illustration { max-width: 500px; width: 100%; margin-inline: auto; }
.login-shell { position: relative; z-index: 1; display: grid; place-items: center; width: 100%; min-width: 0; padding: 42px 32px; }
.login-card { min-width: 0; width: 100%; max-width: 430px; display: grid; gap: 24px; border-radius: var(--desk-radius); background: var(--desk-surface); box-shadow: var(--desk-shadow-card); padding: 38px; }
.login-card > * { min-width: 0; }
.login-card-head { display: flex; align-items: center; gap: 11px; }
.login-card-head div { display: grid; line-height: 1.3; }
.login-card-head strong { color: var(--desk-text); font-size: 16px; }
.login-card-head small { color: var(--desk-muted); font-size: 12px; }
.login-intro { display: grid; gap: 7px; padding-top: 4px; }
.login-kicker { width: fit-content; color: rgb(255 255 255 / 72%); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.login-aside .login-kicker { color: rgb(255 255 255 / 55%); }
.login-intro h1 { font-size: 27px; overflow-wrap: anywhere; }
.login-form { min-width: 0; display: grid; gap: 16px; }
.login-form label { min-width: 0; }
.input-icon-wrap { position: relative; display: grid; }
.input-icon-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--desk-muted); pointer-events: none; }
.input-icon-wrap .form-control { padding-left: 40px; }
.login-form button { width: 100%; min-height: 44px; margin-top: 4px; }
.login-status { min-height: 18px; font-size: 12px; color: var(--desk-muted); }
.login-status.error { color: var(--desk-danger); }
.login-footer { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--desk-border); color: var(--desk-muted); padding-top: 16px; font-size: 11px; }

/* Standalone Second Life vendor pages */
body.vendor-setup-page, body.vendor-success-page { min-height: 100vh; overflow: auto; background: var(--desk-canvas); }
.vendor-setup-page .wrap { width: min(900px, calc(100% - 32px)); margin: 34px auto; }
.vendor-setup-page .card, .vendor-success-page .card { border-radius: var(--desk-radius); background: var(--desk-surface); box-shadow: var(--desk-shadow-card); padding: 28px; }
.vendor-setup-page .card { display: grid; gap: 10px; }
.vendor-setup-page h2, .vendor-setup-page h3 { margin: 0; }
.vendor-setup-page hr { width: 100%; border: 0; border-top: 1px solid var(--desk-border) !important; }
.vendor-setup-page .vendor-divider { margin: 16px 0; }
.vendor-setup-page .vendor-section-title { margin-bottom: 8px; }
.vendor-setup-page .vendor-help { margin-bottom: 10px; color: var(--desk-muted); font-size: 13px; }
.vendor-setup-page #object-key, .vendor-setup-page .status { color: var(--desk-muted); font-size: 12px; overflow-wrap: anywhere; }
.vendor-setup-page .pay-row { display: grid; grid-template-columns: 96px 130px minmax(0, 1fr) 160px 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.vendor-setup-page button { min-height: 40px; border-radius: var(--desk-radius-sm); background: var(--desk-primary) !important; border-color: var(--desk-primary) !important; color: #fff; font-weight: 600; cursor: pointer; }
.vendor-setup-page .vendor-add-option { margin-top: 8px; }
.vendor-setup-page .pay-row button { background: var(--desk-danger) !important; border-color: var(--desk-danger) !important; }
.vendor-success-page { display: grid; place-items: center; padding: 24px; }
.vendor-success-page .card { width: min(560px, 100%); display: grid; gap: 14px; text-align: center; }
.vendor-success-page .mark { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto; border-radius: 50%; background: rgb(40 167 69 / 10%); color: var(--desk-success); font-size: 34px; font-weight: 700; }
.vendor-success-page code { display: block; border-radius: var(--desk-radius-sm); background: var(--desk-surface-muted); padding: 12px; overflow-wrap: anywhere; }

@media (max-width: 1366px) {
  :root { --desk-page-pad: 22px; }
  .metrics, .grid-4, .role-grid, .entity-panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-info-grid, .report-grid, .sales-summary-grid, .quick-info-grid, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .left-side-bar { left: calc(-1 * var(--desk-sidebar-width) - 1px) !important; }
  .left-side-bar.open { left: 0 !important; z-index: 1002 !important; }
  .left-side-bar .close-sidebar { display: inline-flex; }
  .main-container.shell { padding-left: 20px !important; }
  .main-container.shell > .header { width: 100% !important; left: 0; }
  .user-meta .user-role { display: none; }
  .header .header-search { display: none; }
  .dashboard-grid, .dashboard-hero-grid, .analytics-grid, .users-layout, .notices-sections, .subscriptions-grid, .grid-2 { grid-template-columns: 1fr; }
  .notices-sections > *:first-child { grid-column: auto; }
  .customer-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  :root { --desk-page-pad: 16px; --desk-section-gap: 22px; --desk-card-pad: 18px; }
  .header { gap: 9px; padding-inline: 14px; }
  .topbar-breadcrumb span { display: none; }
  .page-heading { align-items: flex-start; }
  .metrics, .grid-3, .grid-4, .role-grid, .entity-panel-grid, #table-panels, .profile-info-grid, .report-grid, .sales-summary-grid, .quick-info-grid, .form-grid, .table-toolbar, .filters-row, .filter-row, #table-filters, .sales-filter-grid, .sales-filters, .sales-filters-clean, .customer-summary-grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .section-head, .metric-top, .card-head, .panel-head, .dialog-head { align-items: stretch; flex-direction: column; }
  menu, .dialog-actions, .card-actions, .table-actions, .panel-actions, .action-row, .filter-actions { justify-content: flex-start; }
  table { min-width: 680px; }
  .login-page-grid { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .login-shell { padding: 27px 16px; }
  .login-card { padding: 27px; }
  .vendor-setup-page .pay-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  h1 { font-size: 23px; }
  .header-panel { right: -6px; }
  .user-meta { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* DeskApp sidebar nav — FASE 1 */
.left-side-bar {
  background: var(--desk-sidebar) !important;
}

.left-side-bar .close-sidebar {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: rgb(255 255 255 / 8%);
  color: #c9d2e2;
  cursor: pointer;
}

.left-side-bar .close-sidebar:hover {
  background: rgb(255 255 255 / 14%);
  color: #fff;
}

.sidebar-menu .dropdown-toggle {
  position: relative;
  display: block;
  padding: 12px 38px 12px 67px;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: background .2s ease;
}

.sidebar-menu .dropdown-toggle:hover {
  background: rgb(255 255 255 / 6%);
}

.sidebar-menu .dropdown.show > .dropdown-toggle {
  background: rgb(255 255 255 / 8%);
}

.sidebar-menu .dropdown-toggle::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid rgb(255 255 255 / 70%);
  border-bottom: 2px solid rgb(255 255 255 / 70%);
  transform: translateY(-65%) rotate(45deg);
  transition: transform .2s ease;
}

.sidebar-menu .dropdown.show > .dropdown-toggle::after {
  transform: translateY(-35%) rotate(-135deg);
}

.sidebar-menu .micon {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  border-radius: 8px;
  background: rgb(255 255 255 / 6%);
  color: #fff;
}

.sidebar-menu .micon .nav-icon {
  width: 20px;
  height: 20px;
}

.sidebar-menu .submenu { display: none; padding-top: 4px; padding-bottom: 6px; }
.sidebar-menu .submenu button.nav-button {
  display: block;
  width: 100%;
  padding: 10px 15px 10px 58px;
  font-size: 13.5px;
  color: #c9d2e2;
  font-weight: 400;
  border: none;
  background: transparent;
  text-align: left;
  border-radius: 0;
  min-height: auto;
  cursor: pointer;
  transition: all .3s ease;
  box-shadow: none;
}
.sidebar-menu .submenu button.nav-button:hover {
  color: #fff;
  background: transparent;
  padding-left: 64px;
}
.sidebar-menu .submenu button.nav-button.active {
  font-weight: 700;
  color: #fff;
  background: var(--desk-primary);
  box-shadow: none;
}
.sidebar-menu .submenu button.nav-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Modal and dialog customizations to match Bootstrap/DeskApp */
dialog.modal-content, dialog.dialog-panel, dialog {
  border: 0;
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(0,0,0,0.18);
  padding: 0;
  background: var(--desk-surface);
  overflow: hidden;
  max-width: 600px;
  width: 100%;
}
dialog.wide-dialog {
  max-width: 960px;
}
dialog form.dialog-panel, dialog .dialog-panel, dialog form {
  padding: 0 !important;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
dialog .section-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--desk-border);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
dialog .section-head h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--desk-text);
  margin: 0;
}
dialog .section-head button {
  background: transparent;
  border: 0;
  font-size: 14px;
  color: var(--desk-muted);
  cursor: pointer;
  padding: 5px;
}
dialog .section-head button:hover {
  color: var(--desk-text);
}
dialog .form-card, dialog .profile-box, dialog .profile-actions, dialog .tab-panel, dialog .form-grid {
  padding: 24px !important;
  margin: 0;
  border: 0;
  background: transparent;
}
dialog menu, dialog .dialog-actions {
  padding: 15px 24px;
  border-top: 1px solid var(--desk-border);
  background: var(--desk-surface-muted);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
dialog menu button, dialog .dialog-actions button {
  min-height: 38px;
}

/* User Menu styling improvements */
#user-menu.dropdown-menu, #notification-menu.dropdown-menu {
  display: none;
}
#user-menu:not([hidden]), #notification-menu:not([hidden]) {
  display: block !important;
}
