:root {
  --nav: #10243a;
  --nav2: #17334f;
  --nav3: #244965;
  --ink: #1a2b40;
  --muted: #708096;
  --line: #dfE7ef;
  --line2: #e9eef4;
  --bg: #f3f6fb;
  --white: #fff;
  --teal: #087d80;
  --teal2: #e3f4f3;
  --blue: #2862a2;
  --blue2: #e7f0fb;
  --green: #148057;
  --green2: #e6f7ef;
  --red: #bd4453;
  --red2: #fff0f1;
  --amber: #a87318;
  --amber2: #fff6e2;
  --shadow: 0 14px 42px rgba(25, 45, 70, 0.15), 0 2px 8px rgba(24, 43, 62, 0.05);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 13px;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.42; cursor: not-allowed; }
input, select, textarea { color: var(--ink); }
:focus-visible { outline: 3px solid #5dc4cc; outline-offset: 2px; }

.ico {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  flex: none;
}
.ico.sm { width: 13px; height: 13px; }
.ico.lg { width: 21px; height: 21px; }

#app {
  height: 100vh;
  min-height: 570px;
  display: flex;
  overflow: hidden;
}

.side {
  width: 250px;
  flex: none;
  background: linear-gradient(175deg, #10243a 0%, #102f49 72%, #0a253c 100%);
  color: #ccdaea;
  display: flex;
  flex-direction: column;
  box-shadow: inset -1px 0 #ffffff14;
  z-index: 3200;
  transition: width 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.brand {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 20px;
  border-bottom: 1px solid #ffffff14;
  flex-shrink: 0;
}

.mark {
  background: linear-gradient(145deg, #18b8af, #087f8a);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -1.7px;
  box-shadow: 0 6px 20px #07a4a430;
  border: 0;
  cursor: pointer;
}
.mark:hover { filter: brightness(1.12); }

.brand strong { color: #fff; letter-spacing: 0.13em; font-size: 13px; }
.brand small { display: block; color: #89a9c2; font-size: 10px; letter-spacing: 0.065em; margin-top: 3px; }

.side-find {
  padding: 12px 12px 6px;
  background: #10283f;
  flex-shrink: 0;
}
.side-find input {
  background: #ffffff11;
  border: 1px solid #ffffff20;
  border-radius: 9px;
  color: #fff;
  width: 100%;
  height: 34px;
  padding: 0 11px;
  font-size: 11px;
}
.side-find input::placeholder { color: #93afc4; }

.side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px;
  scrollbar-width: thin;
  scrollbar-color: #7693ad88 transparent;
}
.side-scroll::-webkit-scrollbar { width: 6px; }
.side-scroll::-webkit-scrollbar-thumb { background: #5b78966b; border-radius: 6px; }

.side-caption {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #81a4bf;
  font-weight: 700;
  padding: 12px 13px 6px;
}

/* Sovereign Accordion Left Menu Styles */
.menu-group {
  margin-bottom: 6px;
}

.menu-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #a4c4d7;
  padding: 8px 11px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.menu-group-header:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(48, 208, 196, 0.3);
}

.menu-group-header.expanded {
  background: linear-gradient(90deg, rgba(12, 138, 123, 0.35), rgba(8, 36, 43, 0.6));
  color: #56ddd0;
  border-color: rgba(48, 208, 196, 0.45);
}

.group-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-chevron {
  font-size: 10px;
  transition: transform 0.2s ease;
  opacity: 0.8;
}

.menu-group-header.expanded .group-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.menu-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 6px 8px;
  border-left: 2px solid rgba(48, 208, 196, 0.2);
  margin-left: 10px;
  margin-top: 3px;
}

.menu-group.collapsed .menu-group-items {
  display: none;
}

.menu-sub-item {
  position: relative;
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c7dbe8;
  background: transparent;
  border-radius: 7px;
  padding: 7px 10px;
  text-align: left;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.menu-sub-item:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  transform: translateX(2px);
}

.menu-sub-item.active {
  background: rgba(12, 138, 123, 0.32);
  color: #ffffff;
  font-weight: 650;
  box-shadow: inset 3px 0 #d38b26;
  border: 1px solid rgba(48, 208, 196, 0.35);
}

.menu-sub-item.active svg {
  color: #ffdbab;
}

.menu-code-badge {
  margin-left: auto;
  font-size: 9px;
  background: rgba(0, 0, 0, 0.25);
  color: #8dafc3;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
}

.menu-sub-item.active .menu-code-badge {
  background: rgba(211, 139, 38, 0.3);
  color: #ffe8cc;
}

.navbtn {
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #d2e1eb;
  background: transparent;
  border-radius: 9px;
  padding: 9px 12px;
  text-align: left;
  margin: 2px 0;
  font-size: 12px;
  transition: 0.16s;
}
.navbtn svg { color: #94b8cc; }
.navbtn:hover, .navbtn.active { background: #ffffff18; color: #fff; }
.navbtn.active { box-shadow: inset 3px 0 #30d0c4; }
.navbtn:hover svg, .navbtn.active svg { color: #56ddd0; }

.nav-count {
  margin-left: auto;
  background: #f6ae4460;
  color: #ffdbab;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
}

.side-foot {
  border-top: 1px solid #ffffff17;
  padding: 13px 17px;
  font-size: 11px;
  line-height: 1.5;
  color: #91b1c6;
  flex-shrink: 0;
}
.secure-line { display: flex; align-items: center; gap: 7px; color: #78dccc; font-weight: 650; margin-bottom: 4px; }
.nav-scroll-controls { display: flex; gap: 8px; margin: 0 0 10px; }
.nav-scroll-controls button {
  flex: 1;
  background: #ffffff10;
  border: 1px solid #ffffff22;
  color: #d2e7f1;
  border-radius: 7px;
  padding: 5px 4px;
  font-size: 10px;
}

/* Collapsed menu */
#app.menu-collapsed .side {
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden;
  box-shadow: none;
  pointer-events: none;
}

.menu-toggle.menu-hidden-active {
  border-color: #169891;
  background: #effbfa;
  color: #0b7b76;
  box-shadow: 0 0 0 2px rgba(22, 152, 145, 0.14);
}

.shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top {
  height: 56px;
  min-height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 4500;
  position: relative;
  box-shadow: 0 1px 3px rgba(16, 36, 58, 0.04);
}

.top-title {
  min-width: 140px;
  flex-shrink: 0;
}
.top-title strong {
  font-size: 14px;
  display: block;
  letter-spacing: -0.02em;
  color: #10243a;
  white-space: nowrap;
}
.top-title small {
  display: block;
  color: #8393a7;
  font-size: 10px;
  white-space: nowrap;
}

.searchbar {
  flex: 1 1 220px;
  max-width: 340px;
  min-width: 140px;
  height: 35px;
  border: 1px solid var(--line);
  background: #f7f9fc;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: #667b93;
  cursor: pointer;
  transition: all 0.15s ease;
}
.searchbar:hover {
  background: #fff;
  border-color: #cbd8e5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.searchbar span {
  flex: 1;
  font-size: 11px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.key {
  border: 1px solid #d8e2ec;
  background: #fff;
  padding: 2px 5px;
  border-radius: 5px;
  color: #78889b;
  font-size: 9.5px;
  flex-shrink: 0;
}

.top-spacer { flex: 1; }

.top-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  color: #405b75;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.top-chip .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.roundbtn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: #667b92;
  flex-shrink: 0;
}
.roundbtn:hover, .tool:hover { background: #f2f7fa; }

/* ==========================================================================
   USER PROFILE COMPACT TRIGGER & PREMIUM POPUP CARD
   ========================================================================== */
.user-menu-wrapper {
  position: relative;
  flex-shrink: 0;
}

.user-profile-trigger {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid #d0deec;
  background: linear-gradient(145deg, #f0f7fd, #e2eef9);
  padding: 0;
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 5px rgba(16, 36, 58, 0.06);
}

.user-profile-trigger:hover,
.user-profile-trigger.active {
  border-color: #18b8af;
  box-shadow: 0 0 0 3px rgba(24, 184, 175, 0.2), 0 3px 8px rgba(16, 36, 58, 0.1);
  transform: translateY(-1px);
}

.avatar-compact, .avatar {
  font-size: 12px;
  font-weight: 800;
  color: #174c72;
  letter-spacing: -0.5px;
}

.online-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
}

/* Polished Premium Flyout Card */
.user-profile-flyout {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 320px;
  max-height: calc(100vh - 70px);
  background: #ffffff;
  border: 1px solid #d6e2ed;
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(14, 30, 48, 0.22), 0 4px 12px rgba(14, 30, 48, 0.08);
  z-index: 6000;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  animation: flyoutSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-profile-flyout.show {
  display: block;
}

@keyframes flyoutSlideDown {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.flyout-header {
  padding: 14px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--cbs-border, #e2e8f0);
  color: var(--cbs-text-primary, #0f172a);
  display: flex;
  align-items: center;
  gap: 11px;
}

.flyout-avatar {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(145deg, #0284c7, #0369a1);
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
  flex-shrink: 0;
}

.flyout-user-meta {
  flex: 1;
  overflow: hidden;
}

.flyout-user-meta strong {
  display: block;
  font-size: 13px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flyout-user-meta small {
  display: block;
  font-size: 10.5px;
  color: #64748b;
  margin-top: 1px;
}

.flyout-role-badge {
  display: inline-block;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  margin-top: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.flyout-body {
  padding: 12px 14px;
  background: #ffffff;
}

.flyout-section-title {
  display: block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  color: #657d97;
  margin-bottom: 5px;
}

.role-select-wrapper select, .role-select {
  width: 100%;
  height: 34px;
  background: #f4f8fc;
  border: 1px solid #d4e0ec;
  border-radius: 8px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 600;
  color: #17334f;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.role-select-wrapper select:focus, .role-select:focus {
  border-color: #18b8af;
}

.security-meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #edf2f7;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
}

.meta-row .meta-label {
  color: #7b8ea3;
}

.meta-row .meta-val {
  color: #1a2f47;
  font-weight: 600;
}

.meta-row .meta-val.text-success {
  color: #059669;
}

.flyout-actions {
  padding: 11px 14px;
  background: #f8fafc;
  border-top: 1px solid #e9eff5;
  display: flex;
  gap: 8px;
}

.flyout-btn {
  flex: 1;
  height: 32px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.change-key-btn {
  background: #ffffff;
  border: 1px solid #cfdbe8;
  color: #274768;
}

.change-key-btn:hover {
  background: #f0f5fa;
  border-color: #b7cadc;
}

.sign-out-btn {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #dc2626;
}

.sign-out-btn:hover {
  background: #fecaca;
  color: #b91c1c;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15);
}

/* Responsive Media Queries */
@media (max-width: 1080px) {
  .top-title small { display: none; }
  .top-chip span.chip-text { display: none; }
  .top-chip { padding: 6px; }
}

@media (max-width: 820px) {
  .top-title { min-width: auto; }
  .top-title strong { font-size: 13px; }
  .searchbar { max-width: 180px; }
  .searchbar kbd { display: none; }
}

@media (max-width: 640px) {
  .top { padding: 0 10px; gap: 8px; }
  .top-title { display: none; }
  .searchbar { flex: 1; min-width: 100px; }
}

.toolbar {
  height: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  z-index: 3100;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.shell.workspace-focused .toolbar {
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0 !important;
  border-bottom: none !important;
  pointer-events: none !important;
}

.shell.workspace-focused .toolbar.force-visible {
  position: absolute;
  top: 52px;
  left: 0;
  right: 0;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  padding: 0 20px !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  border-bottom: 1px solid var(--line) !important;
  background: #ffffff !important;
  box-shadow: 0 8px 24px rgba(16, 36, 58, 0.12) !important;
  z-index: 3300;
}

.tool {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  border: 1px solid transparent;
  color: #57718c;
  background: transparent;
  border-radius: 7px;
  font-size: 11px;
  padding: 6px 10px;
  white-space: nowrap;
}
.tool:disabled { opacity: 0.32; }
.tool.primary {
  background: #edf8f7;
  color: #087a78;
  border-color: #d2edeb;
  font-weight: 700;
}
.tool-sep { height: 18px; width: 1px; background: #dfe7ee; margin: 0 3px; }
.toolbar .layout-active {
  background: #e8f6f4;
  border: 1px solid #a9dcd8;
  color: #087776;
  font-weight: 800;
}
.layout-pill {
  font-size: 10px;
  background: #edf5f7;
  color: #387087;
  border: 1px solid #d9e9f0;
  border-radius: 7px;
  padding: 5px 8px;
  font-weight: 750;
  white-space: nowrap;
}
.toolbar .right { margin-left: auto; color: #8695a7; font-size: 10px; display: flex; gap: 7px; align-items: center; }

.desk {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 78% 10%, #e3edf9 0%, transparent 33%), radial-gradient(circle at 12% 90%, #e9f4f2 0%, transparent 38%), #f3f6fa;
}
.desk:after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background-image: radial-gradient(#8da9bf24 0.65px, transparent 0.65px);
  background-size: 18px 18px;
  opacity: 0.4;
}

.desk-dashboard {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 24px 30px 90px;
  z-index: 1;
}

.welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 20px;
}
.eyebrow {
  font-size: 10px;
  color: #0d8a86;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.welcome h1 {
  margin: 6px 0 5px;
  font-size: 25px;
  letter-spacing: -0.8px;
  font-weight: 750;
}
.sub {
  color: #7c8ca0;
  font-size: 12px;
  max-width: 670px;
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 7px;
  background: #e6f7ed;
  color: #16744b;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.blue { background: #e9f1fc; color: #2a609c; }
.badge.amber { background: #fff3dd; color: #9e6911; }
.badge.red { background: #fff0f0; color: #a93e4a; }
.badge.grey { background: #edf1f6; color: #60758b; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}
.card {
  background: #fff;
  border: 1px solid #dfe8f0;
  border-radius: 14px;
  box-shadow: 0 3px 12px #193d5408;
}
.kpi { padding: 16px 18px 14px; }
.kpi-top { display: flex; justify-content: space-between; color: #8291a5; font-size: 10px; align-items: center; }
.kpi-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eaf6f4;
  color: #13837c;
}
.kpi-val { font-size: 22px; font-weight: 800; margin: 8px 0 4px; letter-spacing: -0.5px; }
.kpi-foot { font-size: 10px; color: #7c8ba0; }
.kpi-foot b { color: var(--green); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 16px;
}
.dash-panel { padding: 18px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dash-head b { font-size: 13px; }
.dash-head span { font-size: 10px; color: #91a0af; }

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.shortcut-card {
  border: 1px solid #e5edf4;
  background: #fafdff;
  border-radius: 11px;
  padding: 12px;
  text-align: left;
  min-height: 80px;
}
.shortcut-card:hover { border-color: #b1d8da; background: #f2fbfa; }
.shortcut-card b { display: block; font-size: 11px; margin: 6px 0 2px; }
.shortcut-card small { color: #8394a6; font-size: 9px; }

.task-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-top: 1px solid #edf1f5;
}
.task-row:first-of-type { border-top: 0; }
.tiny-icon {
  width: 29px;
  height: 29px;
  background: #f0f5fa;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #3c6b8f;
}
.task-main { flex: 1; font-size: 11px; }
.task-main small { display: block; font-size: 10px; color: #94a1af; margin-top: 2px; }

.dashboard-note {
  margin-top: 14px;
  background: #f3f9f7;
  border: 1px solid #d7ebea;
  color: #55767a;
  border-radius: 11px;
  padding: 12px 14px;
  font-size: 11px;
  line-height: 1.55;
}

/* Windows Engine */
.win {
  position: absolute;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d3e1ed;
  border-radius: 13px;
  box-shadow: var(--shadow);
  z-index: 10;
  min-width: 365px;
  min-height: 255px;
  transition: box-shadow 0.12s;
}
#app.layout-free .win { position: fixed; }
#app.layout-canvas .win { position: absolute; }

.win.focused {
  border-color: #9dc8d0;
  box-shadow: 0 20px 55px rgba(16, 44, 74, 0.24), 0 2px 6px #17354f17;
}
.win.focused .win-header { background: linear-gradient(180deg, #fbffff, #f6fcfd); }
.win.maximized { border-radius: 7px; }
.win.hidden { display: none; }

.win-header {
  height: 46px;
  min-height: 46px;
  background: linear-gradient(180deg, #fff, #fbfcfe);
  border-bottom: 1px solid #e4ebf2;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  cursor: grab;
  user-select: none;
}
.win-header:active { cursor: grabbing; }

.win-glyph {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  background: #e8f6f4;
  color: #087d80;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px #d6ebe9;
}

.win-title { flex: 1; min-width: 0; }
.win-title b { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-title small { display: block; font-size: 9px; color: #8d9daf; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.win-controls { display: flex; gap: 3px; }
.win-control {
  width: 25px;
  height: 25px;
  background: transparent;
  border: 0;
  color: #7d90a4;
  border-radius: 6px;
  display: grid;
  place-items: center;
}
.win-control:hover { background: #edf3f8; }
.win-control.close:hover { background: #fff0f1; color: #b33b4b; }

.win-content {
  overflow: auto;
  flex: 1;
  padding: 16px 18px 14px;
  scrollbar-color: #d8e2ea transparent;
}
.win-footer {
  height: 42px;
  min-height: 42px;
  border-top: 1px solid var(--line2);
  background: linear-gradient(180deg, #f8fbfd, #fff);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  gap: 10px;
  font-size: 10px;
  color: #8a9cae;
}

.resizer {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 17px;
  height: 17px;
  cursor: nwse-resize;
  z-index: 11;
  background: linear-gradient(135deg, transparent 49%, #9ab3c6 50%, #9ab3c6 54%, transparent 55%, transparent 69%, #9ab3c6 70%, #9ab3c6 74%, transparent 75%);
  opacity: 0.75;
}
.win.maximized .resizer { display: none; }

.dock {
  min-height: 52px;
  height: 52px;
  background: #fff;
  border-top: 1px solid #dbe6ef;
  padding: 6px 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 3200;
  overflow-x: auto;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.shell.workspace-focused .dock {
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0 !important;
  border-top: none !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.shell.workspace-focused .dock.force-visible {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;
  padding: 6px 13px !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  border-top: 1px solid #dbe6ef !important;
  background: #ffffff !important;
  box-shadow: 0 -8px 24px rgba(16, 36, 58, 0.12) !important;
  z-index: 3300;
}

/* Floating Quick-Reveal Auxiliary Pills */
.aux-toggle-pill {
  display: none;
  position: absolute;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #0c8a7b;
  cursor: pointer;
  z-index: 3400;
  box-shadow: 0 4px 14px rgba(12, 138, 123, 0.18);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.aux-toggle-pill:hover {
  background: #f0fdfa;
  border-color: #0c8a7b;
  color: #096a5f;
  box-shadow: 0 6px 18px rgba(12, 138, 123, 0.28);
}

.aux-toggle-pill.active {
  background: #0c8a7b;
  border-color: #096a5f;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(12, 138, 123, 0.35);
}

.aux-toggle-pill.active svg {
  color: #ffffff;
}

.aux-toggle-pill.top-pill {
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
}

.aux-toggle-pill.top-pill:hover {
  transform: translateX(-50%) translateY(1px);
}

.aux-toggle-pill.bottom-pill {
  bottom: 8px;
  left: 20px;
}

.aux-toggle-pill.bottom-pill:hover {
  transform: translateY(-2px);
}

.shell.workspace-focused .aux-toggle-pill {
  display: inline-flex;
}
.dock-label { font-size: 10px; font-weight: 750; color: #8a9bad; padding: 0 10px; white-space: nowrap; }
.dock-item {
  border: 1px solid #dbe7ef;
  background: #f9fbfe;
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 10px;
  max-width: 185px;
  white-space: nowrap;
  color: #5e7185;
}
.dock-item span { overflow: hidden; text-overflow: ellipsis; }
.dock-item.focused { background: #e7f7f5; border-color: #a7d8d3; color: #087c77; font-weight: 700; }
.dock-item.min { opacity: 0.58; }
.dock-item:hover { background: #eef6f9; }
.dock-right { margin-left: auto; white-space: nowrap; color: #99a8b5; font-size: 10px; padding-right: 10px; }

/* Form & Table Elements */
.section-title { font-size: 15px; font-weight: 800; margin: 0 0 3px; letter-spacing: -0.3px; }
.section-desc { color: #8796a5; font-size: 11px; line-height: 1.5; margin-bottom: 12px; }

.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld label { font-size: 10px; font-weight: 750; color: #566a7f; }
.req { color: #d95962; }
.fld input, .fld select, .fld textarea {
  width: 100%;
  border: 1px solid #dbe5ed;
  border-radius: 7px;
  min-height: 34px;
  background: #fff;
  padding: 7px 10px;
  font-size: 11px;
}
.fld textarea { min-height: 60px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus {
  border-color: #38a7a7;
  outline: 2px solid #38a7a722;
}
.fld input[readonly] { background: #f5f8fb; color: #798a9d; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 10px 0; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.mini-head { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 8px; gap: 8px; }
.mini-head strong { font-size: 11px; }

.tabs-line { display: flex; gap: 5px; border-bottom: 1px solid #e8eef4; margin: 0 0 12px; overflow-x: auto; }
.subtab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 10px;
  color: #8190a3;
  font-size: 11px;
  white-space: nowrap;
}
.subtab.selected { color: #087f81; border-bottom-color: #087f81; font-weight: 750; }

.btn {
  border: 1px solid #d5e1eb;
  background: #fff;
  color: #416079;
  border-radius: 8px;
  font-size: 11px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 650;
}
.btn:hover { background: #f5f9fb; }
.btn.primary {
  background: #0a8585;
  color: #fff;
  border-color: #0a8585;
  box-shadow: 0 4px 10px #0a858524;
}
.btn.primary:hover { background: #086e73; }
.btn.danger { color: #b44550; background: #fff3f3; border-color: #f1d6d7; }
.btn.danger:hover { background: #ffe6e6; }
.btn.soft { background: #eaf7f6; color: #087e79; border-color: #d0eae8; }
.btn.tiny { font-size: 10px; padding: 5px 8px; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }

.hint {
  padding: 10px 12px;
  background: #f4f8fc;
  border: 1px solid #e1ebf4;
  border-radius: 9px;
  color: #657b90;
  font-size: 10.5px;
  line-height: 1.55;
}
.hint.warn { background: #fff9e9; border-color: #f5e5ba; color: #8a6c33; }
.hint.ok { background: #eff9f5; border-color: #cae9db; color: #277655; }

.filterbar { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.filterbar input {
  flex: 1;
  min-width: 0;
  border: 1px solid #dae5ee;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 11px;
}

.tablewrap { overflow: auto; border: 1px solid #e2eaf2; border-radius: 10px; }
table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: 10.5px; }
th {
  background: #f5f8fb;
  color: #70849a;
  text-align: left;
  font-size: 9.5px;
  letter-spacing: 0.025em;
  font-weight: 750;
  padding: 9px 11px;
  white-space: nowrap;
}
td { padding: 9px 11px; border-top: 1px solid #eef2f6; vertical-align: middle; }
tr:hover td { background: #fbfdff; }

.linkbtn { background: transparent; border: 0; color: #167e91; font-weight: 750; padding: 2px 0; text-align: left; }
.linkbtn:hover { text-decoration: underline; }
.empty { padding: 28px; text-align: center; color: #8b99a9; font-size: 11px; }

.statbar { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; font-size: 10px; color: #7d8fa3; }
.kv { display: grid; grid-template-columns: 135px 1fr; gap: 8px; font-size: 11px; padding: 8px 0; border-bottom: 1px solid #edf1f5; }
.kv strong { color: #7f90a2; font-size: 10px; }

.approval-card {
  padding: 13px;
  border: 1px solid #e1eaf2;
  border-radius: 11px;
  margin: 9px 0;
  background: #fff;
}
.approval-head { display: flex; align-items: center; gap: 9px; }
.approval-head b { font-size: 11px; }
.approval-desc { color: #7c8b9e; font-size: 10px; line-height: 1.55; margin: 9px 0; }
.approval-meta { font-size: 10px; color: #8a99ab; display: flex; gap: 11px; flex-wrap: wrap; }
.approval-card .actions { margin-top: 10px; }

.timeline { border-left: 2px solid #c7e7e3; padding-left: 15px; margin: 8px 6px; }
.timeline-item { position: relative; margin: 0 0 13px; }
.timeline-item:before {
  content: "";
  position: absolute;
  left: -21px;
  top: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #11a2a1;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #b8dedb;
}
.timeline-item b { font-size: 11px; }
.timeline-item small { display: block; color: #8a9aad; margin-top: 2px; font-size: 10px; }

/* Overlays & Modals */
.overlay {
  position: fixed;
  inset: 0;
  background: #0b243b95;
  z-index: 5000 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay.show { display: flex; }

.dialog {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 16px;
  border: 1px solid #dce6ef;
  box-shadow: 0 25px 90px #06172955;
  overflow: hidden;
}
.dialog-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dialog-head strong { font-size: 14px; }
.dialog-body { padding: 18px 20px; font-size: 11.5px; line-height: 1.6; color: #52687e; }
.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
}

.palette { width: min(610px, 100%); }
.palette .query {
  border: 0;
  outline: none;
  width: 100%;
  padding: 18px 22px;
  font-size: 16px;
  border-bottom: 1px solid #e4eaf1;
}
.palette-results { max-height: 380px; overflow: auto; padding: 10px; }
.palette-item {
  border: 0;
  background: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  border-radius: 8px;
  color: #435a70;
}
.palette-item:hover { background: #edf7f7; }
.palette-item small { margin-left: auto; color: #91a1af; }

.toastzone {
  position: fixed;
  bottom: 68px;
  right: 18px;
  z-index: 6000 !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 280px;
  max-width: 415px;
  border: 1px solid #d7e6e9;
  background: #fff;
  padding: 11px 13px;
  border-radius: 11px;
  box-shadow: 0 8px 35px #163b552c;
  font-size: 11px;
  color: #456077;
  display: flex;
  gap: 9px;
  line-height: 1.5;
  pointer-events: auto;
}
.toast svg { color: #0e978e; }

/* Diff viewer styling */
.diff-container { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; font-family: monospace; font-size: 10.5px; }
.diff-panel { border: 1px solid #e1eaf0; border-radius: 8px; overflow: hidden; background: #fff; }
.diff-title { background: #f4f7fb; padding: 6px 10px; font-weight: bold; border-bottom: 1px solid #e1eaf0; font-size: 10px; }
.diff-body { padding: 10px; max-height: 250px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.diff-before { background: #fff5f5; color: #9c2b38; }
.diff-after { background: #f3faf5; color: #1e7046; }
