* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #0f1720;
  color: #e5edf3;
}

.login-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

.login-panel {
  background: #121a24;
  border-right: 1px solid #203041;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-panel h1 {
  margin: 0 0 10px;
  font-size: 24px;
}

.login-panel p {
  margin: 0 0 24px;
  color: #9db0c0;
}

.login-panel .input {
  margin-bottom: 12px;
}

.input {
  width: 100%;
  border: 1px solid #2a3b4c;
  background: #0f1720;
  color: #e5edf3;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  outline: none;
  border-color: #16b9d4;
  box-shadow: 0 0 0 2px rgba(22, 185, 212, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, #18c2df 0%, #10a8c2 100%);
  border: 1px solid #0fa2b9;
  color: #041217;
  font-weight: 700;
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  min-height: 38px;
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 2px 10px rgba(6, 121, 140, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b 0%, #e54848 100%);
  border-color: #c93d3d;
  color: #fff;
  box-shadow: 0 2px 10px rgba(175, 44, 44, 0.35);
}

.btn-muted {
  background: #1a2735;
  border: 1px solid #314257;
  color: #c7d6e3;
  box-shadow: none;
}

.btn-sm {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.section-title {
  margin: 0 0 10px;
  color: #d8e7f3;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.stack-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 800px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 8px;
  max-width: 900px;
}

.panel hr {
  border-color: #203041;
  margin: 12px 0;
}

.panel .input,
.right-panel .input {
  margin-bottom: 0;
}

.login-cover {
  background: radial-gradient(circle at 12% 12%, rgba(56, 189, 248, 0.22), transparent 34%),
              radial-gradient(circle at 88% 18%, rgba(34, 211, 238, 0.22), transparent 38%),
              linear-gradient(160deg, #083344 0%, #0b3b52 35%, #102238 100%);
  padding: 34px;
  display: flex;
  align-items: center;
}

.login-marketing {
  max-width: 900px;
}

.marketing-chip {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #083344;
  background: linear-gradient(135deg, #67e8f9 0%, #a5f3fc 100%);
  border: 1px solid rgba(207, 250, 254, 0.6);
}

.login-marketing h2 {
  margin: 0 0 12px;
  font-size: clamp(26px, 3.1vw, 44px);
  line-height: 1.14;
  letter-spacing: 0.2px;
  color: #f0fbff;
}

.login-marketing > p {
  margin: 0 0 20px;
  max-width: 760px;
  color: #c9e7f2;
  font-size: 15px;
  line-height: 1.6;
}

.marketing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.marketing-card {
  padding: 14px 14px 12px;
  border-radius: 12px;
  background: rgba(9, 26, 42, 0.44);
  border: 1px solid rgba(113, 216, 236, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.marketing-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: #8cecff;
}

.marketing-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #d4eff7;
}

.marketing-list {
  margin: 0;
  padding-left: 18px;
  color: #d2edf6;
}

.marketing-list li {
  margin-bottom: 6px;
  line-height: 1.5;
}

@media (max-width: 1080px) {
  .login-shell {
    grid-template-columns: 360px 1fr;
  }

  .marketing-grid {
    grid-template-columns: 1fr;
  }
}

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

  .login-cover {
    min-height: 46vh;
    border-top: 1px solid #244257;
  }
}

.map-layout {
  height: 100vh;
  display: grid;
  grid-template-columns: 360px 1fr 280px;
}

.panel {
  background: linear-gradient(180deg, #121a24 0%, #101722 100%);
  border-right: 1px solid #203041;
  padding: 14px;
  overflow: auto;
}

.panel h2 {
  font-size: 34px;
  margin: 2px 0 10px;
  letter-spacing: 0.2px;
}

.panel > .input {
  margin-bottom: 8px;
  padding: 9px 11px;
}

.panel > .action-row {
  margin-top: 0;
  margin-bottom: 10px;
}

.tree-item {
  background: linear-gradient(180deg, #0b4454 0%, #083f4d 100%);
  border: 1px solid #157086;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  font-size: 15px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.tree-item:hover {
  border-color: #1e8da8;
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 12px 24px rgba(0, 0, 0, 0.22);
}

.tree-item strong {
  color: #e9f8ff;
}

.tree-item small {
  color: #a9c9d8;
}

.tree-item .btn-primary {
  min-height: 28px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
}

#map {
  height: 100vh;
}

.right-panel {
  background: linear-gradient(180deg, #121a24 0%, #101722 100%);
  border-left: 1px solid #203041;
  padding: 14px;
}

.right-panel h3 {
  margin-top: 2px;
  margin-bottom: 10px;
}

.right-panel p {
  margin: 6px 0;
  color: #abc0cf;
}

.topbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, 85vw);
  z-index: 11;
  display: flex;
}

.topbar input {
  flex: 1;
  border: 0;
  border-radius: 8px 0 0 8px;
  padding: 12px;
}

.topbar button {
  border: 0;
  background: #1ec8be;
  color: white;
  border-radius: 0 8px 8px 0;
  width: 54px;
}

.toolbar {
  position: absolute;
  left: 402px;
  top: 120px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#draw-quick-actions {
  position: absolute;
  right: 14px;
  top: 74px;
  z-index: 12;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #d6dee7;
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
}

#draw-quick-actions .btn-primary {
  color: #f2f7f3;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 3px 10px rgba(25, 40, 58, 0.24);
}

#draw-quick-actions #quick-draw-start {
  color: #eaf3ff;
  background: linear-gradient(135deg, #4b78b8 0%, #355f9b 100%);
  border-color: #2f5286;
}

#draw-quick-actions #quick-draw-cancel {
  color: #fff1f1;
  background: linear-gradient(135deg, #c87c7c 0%, #a95f5f 100%);
  border-color: #944f4f;
}

#draw-quick-actions #quick-save-zone {
  color: #effbf1;
  background: linear-gradient(135deg, #5f9f74 0%, #477c59 100%);
  border-color: #3e6e4f;
}

#draw-quick-actions .btn-primary:hover {
  filter: brightness(1.06);
}

#zone-context-menu {
  position: fixed;
  z-index: 1400;
  min-width: 178px;
  background: #ffffff;
  border: 1px solid #d4dfeb;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
  padding: 8px;
  display: none;
  gap: 6px;
}

#zone-context-menu.is-open {
  display: grid;
}

#zone-context-menu .btn-primary {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.toolbtn {
  background: #12b2cf;
  color: #032932;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 7px;
  font-size: 18px;
  font-weight: 700;
}

.user-menu {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 11;
  width: max-content;
}

#user-dropdown {
  display: none;
  width: 260px;
  background: linear-gradient(180deg, #121a24 0%, #101722 100%);
  border: 1px solid #25455a;
  padding: 12px;
  border-radius: 10px;
  margin-top: 8px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

#user-dropdown .btn-primary {
  width: 100%;
  margin-top: 6px;
  display: flex;
  justify-content: flex-start;
  text-align: left;
  padding: 8px 10px;
  min-height: 34px;
  font-size: 13px;
}

#user-dropdown .menu-title {
  font-weight: 700;
  color: #cde4f2;
  margin-bottom: 8px;
  font-size: 14px;
  border-bottom: 1px solid #223b4d;
  padding-bottom: 6px;
}

#tree-list {
  padding-right: 2px;
}

.panel hr {
  border: 0;
  border-top: 1px solid #224055;
  margin: 14px 0;
}

#tree-list .tree-item {
  padding: 9px 10px;
  border-radius: 9px;
  margin-bottom: 8px;
  font-size: 14px;
}

#tree-list .tree-item strong {
  font-size: 16px;
}

#tree-list .tree-item small {
  font-size: 12px;
}

#tree-list .tree-item .btn-primary {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
}

#tree-list .tree-node .node-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

#tree-list .tree-toggle {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid #2d5f74;
  background: #0f2c39;
  color: #bde8f5;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex: 0 0 18px;
}

#tree-list .tree-toggle:disabled {
  opacity: 0.35;
  cursor: default;
}

#tenant-users-nav-panel {
  position: absolute;
  top: 64px;
  right: 14px;
  z-index: 12;
  width: min(360px, 92vw);
  max-height: calc(100vh - 86px);
  overflow: auto;
  display: none;
  background: #121a24;
  border: 1px solid #203041;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  padding: 12px;
}

#trash-nav-panel {
  position: absolute;
  top: 64px;
  right: 14px;
  z-index: 12;
  width: min(380px, 92vw);
  max-height: calc(100vh - 86px);
  overflow: auto;
  display: none;
  background: #121a24;
  border: 1px solid #203041;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  padding: 12px;
}

#tenant-users-nav-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#trash-nav-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#tenant-users-nav-panel .panel-head h3 {
  margin: 0;
}

#trash-nav-panel .panel-head h3 {
  margin: 0;
}

#data-io-nav-panel {
  position: absolute;
  top: 64px;
  right: 390px;
  z-index: 12;
  width: min(420px, 94vw);
  max-height: calc(100vh - 86px);
  overflow: auto;
  display: none;
  background: #121a24;
  border: 1px solid #203041;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  padding: 12px;
}

#data-io-nav-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#data-io-nav-panel .panel-head h3 {
  margin: 0;
}

#reports-panel {
  position: absolute;
  left: 56px;
  top: 120px;
  z-index: 12;
  width: min(320px, 88vw);
  max-height: calc(100vh - 150px);
  overflow: auto;
  display: none;
  background: #121a24;
  border: 1px solid #203041;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  padding: 12px;
}

#reports-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#reports-panel .panel-head h3 {
  margin: 0;
}

#measure-panel {
  position: absolute;
  left: 56px;
  top: 120px;
  z-index: 12;
  width: min(320px, 88vw);
  max-height: calc(100vh - 150px);
  overflow: auto;
  display: none;
  background: #121a24;
  border: 1px solid #203041;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  padding: 12px;
}

#measure-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#measure-panel .panel-head h3 {
  margin: 0;
}

#queries-panel {
  position: absolute;
  left: 56px;
  top: 120px;
  z-index: 12;
  width: min(320px, 88vw);
  max-height: calc(100vh - 150px);
  overflow: auto;
  display: none;
  background: #121a24;
  border: 1px solid #203041;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  padding: 12px;
}

#queries-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#queries-panel .panel-head h3 {
  margin: 0;
}

#user-guide-panel,
#shortcuts-panel {
  position: absolute;
  top: 64px;
  right: 14px;
  z-index: 12;
  width: min(420px, 94vw);
  max-height: calc(100vh - 86px);
  overflow: auto;
  display: none;
  background: #121a24;
  border: 1px solid #203041;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  padding: 12px;
}

#user-guide-panel .panel-head,
#shortcuts-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#user-guide-panel .panel-head h3,
#shortcuts-panel .panel-head h3 {
  margin: 0;
}

@media (max-width: 992px) {
  .map-layout {
    grid-template-columns: 1fr;
  }
  .panel,
  .right-panel {
    display: none;
  }

  .toolbar {
    left: 12px;
  }

  #draw-quick-actions {
    left: 12px;
    right: 12px;
    top: 74px;
    width: auto;
    overflow-x: auto;
    white-space: nowrap;
  }

  #data-io-nav-panel {
    right: 14px;
    width: min(360px, 92vw);
  }

  #reports-panel {
    left: 12px;
    top: 120px;
    width: min(360px, 92vw);
  }

  #measure-panel {
    left: 12px;
    top: 120px;
    width: min(360px, 92vw);
  }

  #queries-panel {
    left: 12px;
    top: 120px;
    width: min(360px, 92vw);
  }

  #user-guide-panel,
  #shortcuts-panel {
    right: 14px;
    width: min(360px, 92vw);
  }

  .form-grid-2,
  .form-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Premium UI pass */
body {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(1000px 600px at 15% -10%, rgba(35, 198, 240, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(124, 58, 237, 0.10), transparent 60%),
    #0a111b;
}

.panel,
.right-panel,
#user-dropdown,
#reports-panel,
#measure-panel,
#queries-panel,
#data-io-nav-panel,
#tenant-users-nav-panel,
#user-guide-panel,
#shortcuts-panel {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(18, 28, 42, 0.86), rgba(14, 22, 34, 0.9));
  border: 1px solid rgba(84, 120, 150, 0.28);
  box-shadow: 0 16px 34px rgba(2, 8, 18, 0.45);
}

.panel h2,
.right-panel h3,
.panel-head h3 {
  color: #f4fbff;
  font-weight: 700;
}

.topbar {
  background: rgba(9, 17, 27, 0.58);
  border: 1px solid rgba(73, 110, 141, 0.25);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}

.topbar input {
  background: transparent;
  color: #e8f4ff;
}

.topbar button {
  background: linear-gradient(135deg, #18b9dd 0%, #0f92b5 100%);
}

.toolbar {
  gap: 10px;
}

.toolbtn {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: #d8f8ff;
  background: linear-gradient(180deg, rgba(15, 34, 46, 0.88), rgba(8, 24, 36, 0.92));
  border: 1px solid rgba(72, 124, 151, 0.44);
  box-shadow: 0 10px 20px rgba(1, 10, 18, 0.35);
  display: grid;
  place-items: center;
  font-size: 14px;
}

.toolbtn:hover {
  border-color: rgba(86, 191, 229, 0.7);
  color: #ffffff;
  transform: translateY(-1px);
}

#open-menu {
  min-height: 38px;
  min-width: 38px;
  padding: 8px 10px;
}

#user-dropdown .btn-primary {
  font-weight: 600;
}

#user-dropdown .btn-primary i {
  width: 14px;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #20c5e8 0%, #129dbe 100%);
  border: 1px solid #1ab2d3;
}

.btn-muted {
  background: linear-gradient(180deg, rgba(29, 41, 58, 0.9), rgba(20, 31, 45, 0.92));
  color: #d1deeb;
  border-color: rgba(67, 88, 110, 0.75);
}

.tree-item {
  background: linear-gradient(180deg, rgba(11, 67, 86, 0.72), rgba(9, 53, 69, 0.78));
  border: 1px solid rgba(37, 127, 155, 0.45);
}

/* Reference style reset (closer to Basarsoft) */
body {
  background: #f4f7fb;
}

.brand-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #d5e0ea;
  background: rgba(255, 255, 255, 0.94);
  color: #2d5a7d;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.12);
  text-decoration: none;
  cursor: pointer;
}

.brand-badge-logo {
  width: 124px;
  height: auto;
  display: block;
}

.brand-badge span {
  letter-spacing: 0.2px;
  color: #0e2a42;
}

.topbar {
  top: 14px;
  width: min(520px, 56vw);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #d6dee7;
  border-radius: 9px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
}

.topbar input {
  color: #475569;
}

.topbar button {
  background: #1ec8be;
}

.toolbar {
  left: 10px;
  top: 146px;
}

.toolbtn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid #6ec4da;
  background: #ffffff;
  color: #1e7e9a;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.12);
}

.toolbtn:hover {
  background: #e6f8ff;
}

#open-menu {
  background: #0ea5b7;
  border-color: #0c98a9;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.28);
}

#user-dropdown {
  width: 240px;
  background: #ffffff;
  border: 1px solid #d6e0e8;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
}

#user-dropdown .menu-title {
  color: #0f172a;
  border-bottom-color: #e2e8f0;
}

#user-dropdown .btn-primary {
  color: #334155;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
}

#user-dropdown .btn-primary.btn-muted {
  border-color: transparent;
}

#user-dropdown .btn-primary:hover {
  background: #f1f5f9;
  transform: none;
}

#logout {
  border-top: 1px solid #e2e8f0 !important;
  margin-top: 10px !important;
  padding-top: 10px !important;
  border-radius: 0 0 8px 8px;
}

#reports-panel,
#measure-panel,
#queries-panel,
#data-io-nav-panel,
#tenant-users-nav-panel,
#user-guide-panel,
#shortcuts-panel {
  background: #ffffff;
  color: #1f2937;
  border-color: #d5e1ea;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.16);
}

#reports-panel .panel-head h3,
#measure-panel .panel-head h3,
#queries-panel .panel-head h3,
#data-io-nav-panel .panel-head h3,
#tenant-users-nav-panel .panel-head h3,
#user-guide-panel .panel-head h3,
#shortcuts-panel .panel-head h3 {
  color: #0f172a;
}

/* Clean premium final layout */
:root {
  --ui-bg: #f4f7fb;
  --ui-card: #ffffff;
  --ui-border: #d9e2ec;
  --ui-text: #0f172a;
  --ui-muted: #64748b;
  --ui-primary: #0ea5b7;
  --ui-primary-dark: #0b8a99;
}

body {
  background: var(--ui-bg);
  color: var(--ui-text);
}

.panel,
.right-panel {
  background: #1f2937;
  border-color: #2f3d4f;
  box-shadow: none;
}

.panel h2,
.right-panel h3 {
  color: #f8fafc;
}

.right-panel p {
  color: #cbd5e1;
}

.toolbar {
  left: 10px;
  top: 150px;
  gap: 8px;
}

.toolbtn {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid #8bd3e6;
  background: #ffffff;
  color: #1d728a;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.12);
  display: grid;
  place-items: center;
  font-size: 13px;
}

#user-dropdown,
#reports-panel,
#measure-panel,
#queries-panel,
#data-io-nav-panel,
#tenant-users-nav-panel,
#user-guide-panel,
#shortcuts-panel {
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  color: var(--ui-text);
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
}

#user-dropdown {
  width: 250px;
}

#user-dropdown .btn-primary {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 8px;
}

/* Left tool panels */
#reports-panel,
#measure-panel,
#queries-panel {
  left: 56px;
  right: auto;
  top: 120px;
  width: min(320px, 88vw);
}

/* User-menu driven panels stay on right */
#data-io-nav-panel,
#tenant-users-nav-panel,
#user-guide-panel,
#shortcuts-panel {
  right: 14px;
  left: auto;
  top: 64px;
  width: min(360px, 92vw);
}

#data-io-nav-panel .action-row .input,
#tenant-users-nav-panel .input {
  background: #f8fafc;
  border-color: #d7e2ec;
  color: #0f172a;
}

#data-io-nav-panel .btn-primary,
#tenant-users-nav-panel .btn-primary,
#user-guide-panel .btn-primary,
#shortcuts-panel .btn-primary,
#reports-panel .btn-primary,
#measure-panel .btn-primary,
#queries-panel .btn-primary {
  background: linear-gradient(135deg, #20c5e8 0%, #10a3c4 100%);
  border-color: #13a8c7;
  color: #03212a;
}

#data-io-nav-panel .btn-muted,
#tenant-users-nav-panel .btn-muted,
#reports-panel .btn-muted,
#measure-panel .btn-muted,
#queries-panel .btn-muted {
  background: #334155;
  border-color: #334155;
  color: #e2e8f0;
}

@media (max-width: 992px) {
  #reports-panel,
  #measure-panel,
  #queries-panel,
  #data-io-nav-panel,
  #tenant-users-nav-panel,
  #user-guide-panel,
  #shortcuts-panel {
    left: 12px;
    right: auto;
    width: min(360px, 92vw);
    top: 120px;
  }
}

/* Final stable menu/toolbar polish */
.user-menu {
  position: fixed !important;
  top: 12px !important;
  right: 12px !important;
  z-index: 1600 !important;
}

#open-menu {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  border-radius: 50% !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  transform: none !important;
}

#open-menu:hover,
#open-menu:active {
  transform: none !important;
}

#user-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  width: 260px !important;
}

#user-dropdown .btn-primary {
  transform: none !important;
}

.toolbtn i {
  font-size: 14px;
}

/* Basarsoft-like map-first layout */
body .map-layout {
  grid-template-columns: 1fr !important;
}

body .map-layout .panel,
body .map-layout .right-panel {
  position: absolute;
  top: 120px;
  z-index: 1200;
  max-height: calc(100vh - 140px);
  overflow: auto;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

body .map-layout .panel {
  left: 56px;
  width: min(340px, 92vw);
  display: none;
}

body .map-layout .right-panel {
  right: 14px;
  width: min(300px, 92vw);
  display: none;
}

.toolbar .toolbtn.is-tree {
  background: #4b2adf;
  color: #ffffff;
  border-color: #3d22b8;
}

/* Compact hierarchy panel (less visual bulk as items grow) */
body .map-layout .panel {
  padding: 10px;
}

body .map-layout .panel h2 {
  font-size: 20px;
  line-height: 1.2;
  margin: 0 0 8px;
}

body .map-layout .panel > .input {
  padding: 7px 9px;
  margin-bottom: 6px;
  font-size: 13px;
}

body .map-layout #add-root-node {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 13px;
}

body .map-layout #tree-list {
  margin-top: 8px !important;
  max-height: calc(100vh - 260px);
  overflow: auto;
}

body .map-layout #tree-list .tree-item {
  padding: 8px 9px;
  margin-bottom: 7px;
  border-radius: 8px;
  font-size: 13px;
}

body .map-layout #tree-list .tree-item strong {
  font-size: 15px;
  line-height: 1.2;
}

body .map-layout #tree-list .tree-item small {
  font-size: 11px;
}

body .map-layout #tree-list .tree-item .btn-primary {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 11px;
}

/* Start focus settings panel */
#default-focus-panel {
  position: absolute;
  top: 64px;
  right: 14px;
  z-index: 12;
  width: min(420px, 94vw);
  max-height: calc(100vh - 86px);
  overflow: auto;
  display: none;
  padding: 12px;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #d5e1ea;
  border-radius: 12px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.16);
}

#default-focus-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

#default-focus-panel .panel-head h3 {
  margin: 0;
  color: #0f172a;
}

@media (max-width: 992px) {
  #default-focus-panel {
    left: 12px;
    right: auto;
    width: min(360px, 92vw);
    top: 120px;
  }
}

/* Premium icon polish (global) */
.brand-badge i {
  font-size: 14px;
  color: #0b7b8e;
}

#search-btn i {
  font-size: 14px;
  line-height: 1;
}

.toolbtn i {
  font-size: 13px;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.45));
}

#open-menu i {
  font-size: 17px;
}

#user-dropdown .btn-primary {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
}

#user-dropdown .btn-primary i {
  width: 18px;
  height: 18px;
  min-width: 18px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  border-radius: 999px;
  color: #0f4f63;
  background: linear-gradient(180deg, #eef7fb, #e3f0f7);
  border: 1px solid #c7ddea;
}

/* Hierarchy visual refinement (smaller text + softer colors) */
body .map-layout .panel {
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7fc 100%);
  border: 1px solid #d7e2ee;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

body .map-layout .panel h2 {
  font-size: 17px;
  color: #1e293b;
}

body .map-layout .panel > .input {
  font-size: 12px;
  padding: 6px 9px;
  background: #ffffff;
  border: 1px solid #d1deec;
  color: #334155;
}

body .map-layout #add-root-node {
  min-height: 28px;
  font-size: 12px;
  border-radius: 9px;
}

body .map-layout #tree-list .tree-item {
  background: linear-gradient(180deg, #ecf6ff 0%, #e4f1fc 100%);
  border: 1px solid #c6dcec;
  box-shadow: none;
  font-size: 12px;
  padding: 7px 8px;
}

body .map-layout #tree-list .tree-item strong {
  font-size: 13px;
  color: #1f3447;
}

body .map-layout #tree-list .tree-item small {
  font-size: 11px;
  color: #5f7386;
}

body .map-layout #tree-list .tree-item .btn-primary {
  min-height: 23px;
  font-size: 10.5px;
  padding: 3px 7px;
}

body .map-layout #tree-list .tree-node .node-label {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
}

body .map-layout #tree-list .tree-node .node-label:hover {
  background: rgba(30, 78, 115, 0.1);
}

body .map-layout #tree-list .tree-item.is-target-node {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3) inset;
}

body .map-layout #tree-list .tree-toggle {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid #86a9bf;
  background: linear-gradient(180deg, #ffffff 0%, #edf4f9 100%);
  color: #274257;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}

body .map-layout #tree-list .tree-toggle i {
  line-height: 1;
}

body .map-layout #tree-list .tree-toggle.is-collapsed {
  background: linear-gradient(180deg, #ddf8f5 0%, #baf0eb 100%);
  border-color: #1ec8be;
  color: #0f766e;
}

body .map-layout #tree-list .tree-toggle.is-expanded {
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #60a5fa;
  color: #1e40af;
}

/* UI dialogs */
.ui-dialog-root {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: none;
}

.ui-dialog-root.is-open {
  display: block;
}

.ui-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
}

.ui-dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, 92vw);
  background: #ffffff;
  border: 1px solid #d5e1ea;
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(2, 8, 18, 0.45);
  padding: 14px;
}

.ui-dialog-title {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.ui-dialog-message {
  color: #334155;
  margin-bottom: 10px;
}

.ui-dialog-body {
  margin-bottom: 10px;
}

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

.ui-tree-picker {
  max-height: 320px;
  overflow: auto;
  border: 1px solid #d7e2ec;
  border-radius: 8px;
  background: #f8fbff;
  padding: 6px;
}

.ui-tree-group {
  font-size: 11px;
  font-weight: 700;
  color: #3b5368;
  padding: 6px 6px 4px;
  border-top: 1px solid #d9e5f0;
}

.ui-tree-group:first-child {
  border-top: 0;
  padding-top: 2px;
}

.ui-tree-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border-radius: 6px;
  cursor: pointer;
}

.ui-tree-option:hover {
  background: #eaf2fb;
}

.ui-tree-option input {
  margin: 0;
}

.ui-tree-option span {
  font-size: 13px;
  color: #1f3447;
}

.ui-tree-group-block + .ui-tree-group-block {
  margin-top: 4px;
}

.ui-tree-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eaf1f8;
  border-radius: 6px;
  min-height: 28px;
  padding: 0 6px;
}

.ui-tree-group-toggle {
  width: 22px;
  flex: 0 0 22px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  color: #3b5368;
  cursor: pointer;
}

.ui-tree-group-toggle:hover {
  background: #dbe7f3;
}

.ui-tree-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  color: #3b5368;
}

.ui-tree-group-label input {
  margin: 0;
}

.ui-tree-group-items {
  padding-top: 4px;
}

.ui-tree-group-chevron {
  width: 12px;
  display: inline-block;
  text-align: center;
}

body .map-layout #tree-list .tree-toggle:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Fixed root colors: safe=green, restricted=red */
body .map-layout #tree-list .tree-item.group-safe-root {
  background: linear-gradient(180deg, #e8f7ed 0%, #dcf0e4 100%);
  border-color: #9ad0ad;
}

body .map-layout #tree-list .tree-item.group-safe-root strong {
  color: #1f5d38;
}

body .map-layout #tree-list .tree-item.group-safe-root .tree-toggle.is-collapsed {
  background: linear-gradient(180deg, #d7f2e1 0%, #bde7cd 100%);
  border-color: #68b488;
  color: #1f6a42;
}

body .map-layout #tree-list .tree-item.group-safe-root .tree-toggle.is-expanded {
  background: linear-gradient(180deg, #c9ebd6 0%, #b4e1c5 100%);
  border-color: #55a879;
  color: #1a5d3a;
}

body .map-layout #tree-list .tree-item.group-restricted-root {
  background: linear-gradient(180deg, #fdecec 0%, #f8dddd 100%);
  border-color: #e2aaaa;
}

body .map-layout #tree-list .tree-item.group-restricted-root strong {
  color: #8a2f2f;
}

body .map-layout #tree-list .tree-item.group-restricted-root .tree-toggle.is-collapsed {
  background: linear-gradient(180deg, #f8d8d8 0%, #f1c0c0 100%);
  border-color: #d98a8a;
  color: #922f2f;
}

body .map-layout #tree-list .tree-item.group-restricted-root .tree-toggle.is-expanded {
  background: linear-gradient(180deg, #f5caca 0%, #edb2b2 100%);
  border-color: #cf7272;
  color: #852828;
}
