/* ============================================================
   ZELVOR CLOUD - console shell + shared view components
   The SPA shell (sidebar, topbar, content) plus the component
   library every view module renders with (page headers, stat
   cards, data-grid toolbars, tabs, trees, wizards, meters).
   ============================================================ */

/* ------------------------------ app layout -------------------------------- */
.hx-app { display: grid; grid-template-columns: var(--hx-sidebar-w) 1fr; min-height: 100vh; background: var(--hx-bg); }
.hx-main { display: flex; flex-direction: column; min-width: 0; }
.hx-content { flex: 1; padding: 22px 26px 60px; min-width: 0; max-width: 1400px; width: 100%; margin: 0 auto; }
.hx-content:focus { outline: none; }

/* ------------------------------- sidebar ---------------------------------- */
.hx-sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--hx-bg-2);
  border-right: 1px solid var(--hx-line); display: flex; flex-direction: column; z-index: 40;
}
.hx-sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 0 18px; height: var(--hx-topbar-h); border-bottom: 1px solid var(--hx-line); flex: none; }
.hx-logo { width: 30px; height: 30px; border-radius: 9px; background: var(--hx-gradient); display: grid; place-items: center; flex: none; box-shadow: 0 4px 14px -4px rgba(91,140,255,.7); }
.hx-logo svg { color: #fff; }
.hx-brand__name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.hx-brand__name span { color: var(--hx-accent-2); }
.hx-sidebar__nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.hx-navgroup { margin-bottom: 4px; }
.hx-navgroup__label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--hx-text-mute); padding: 12px 10px 5px; font-weight: 650; }
.hx-navlink {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px;
  color: var(--hx-text-dim); font-size: 13.5px; font-weight: 500; transition: background .13s, color .13s; position: relative;
}
.hx-navlink:hover { background: var(--hx-panel-2); color: var(--hx-text); }
.hx-navlink .ico { flex: none; opacity: .85; }
.hx-navlink.is-active { background: var(--hx-accent-soft); color: var(--hx-text); font-weight: 600; }
.hx-navlink.is-active .ico { color: var(--hx-accent); opacity: 1; }
.hx-navlink.is-active::before { content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; border-radius: 3px; background: var(--hx-gradient); }
.hx-navlink__badge { margin-left: auto; font-size: 11px; background: var(--hx-panel-3); color: var(--hx-text-dim); border-radius: 999px; padding: 1px 7px; font-weight: 600; }
.hx-sidebar__foot { padding: 12px; border-top: 1px solid var(--hx-line); flex: none; }
.hx-sidebar__usage { font-size: 11.5px; color: var(--hx-text-mute); margin-bottom: 8px; display: flex; justify-content: space-between; }

/* sidebar as drawer on small screens */
.hx-scrim--nav { display: none; }
.hx-sidebar__close { display: none; }

/* -------------------------------- topbar ---------------------------------- */
.hx-topbar {
  position: sticky; top: 0; z-index: 35; height: var(--hx-topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 20px; background: color-mix(in srgb, var(--hx-bg) 82%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hx-line);
}
@supports not (backdrop-filter: blur(4px)) { .hx-topbar { background: var(--hx-bg); } }
.hx-hamburger { display: none; background: none; border: 1px solid var(--hx-line); border-radius: 9px; padding: 7px; color: var(--hx-text); }
.hx-topbar__search { flex: 1; max-width: 420px; position: relative; }
.hx-topbar__search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--hx-text-mute); pointer-events: none; }
.hx-topbar__searchbtn {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 12px 8px 34px; border-radius: 10px;
  border: 1px solid var(--hx-line-strong); background: var(--hx-bg-2); color: var(--hx-text-mute); font-size: 13.5px; text-align: left;
}
.hx-topbar__searchbtn:hover { border-color: var(--hx-accent-line); }
.hx-topbar__searchbtn kbd { margin-left: auto; font-family: var(--hx-mono); font-size: 11px; background: var(--hx-panel-2); border: 1px solid var(--hx-line); border-radius: 5px; padding: 1px 6px; }
.hx-topbar__spacer { flex: 1; }
.hx-topbar__actions { display: flex; align-items: center; gap: 6px; }
.hx-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--hx-text-dim); position: relative; transition: background .13s, color .13s; }
.hx-iconbtn:hover { background: var(--hx-panel-2); color: var(--hx-text); }
.hx-iconbtn__badge { position: absolute; top: 5px; right: 5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px; background: var(--hx-danger); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; }

/* region selector */
.hx-region { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--hx-line-strong); background: var(--hx-bg-2); color: var(--hx-text); font-size: 13px; font-weight: 550; }
.hx-region:hover { border-color: var(--hx-accent-line); }
.hx-region .ico { color: var(--hx-accent); }
.hx-region__code { font-family: var(--hx-mono); font-size: 12.5px; }

/* account menu */
.hx-avatar { width: 30px; height: 30px; border-radius: 9px; background: var(--hx-gradient); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.hx-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px; background: var(--hx-elev); border: 1px solid var(--hx-line-strong); border-radius: 12px; box-shadow: var(--hx-shadow-lg); padding: 6px; z-index: 60; }
.hx-menu__head { padding: 9px 11px 7px; border-bottom: 1px solid var(--hx-line); margin-bottom: 5px; }
.hx-menu__name { font-weight: 600; font-size: 13.5px; }
.hx-menu__mail { font-size: 12px; color: var(--hx-text-mute); overflow-wrap: anywhere; }
.hx-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 11px; border-radius: 8px; border: none; background: none; color: var(--hx-text-dim); font-size: 13.5px; text-align: left; }
.hx-menu__item:hover { background: var(--hx-panel-2); color: var(--hx-text); }
.hx-menu__item .ico { opacity: .8; }
.hx-menu__sep { height: 1px; background: var(--hx-line); margin: 5px 0; }
.hx-pop { position: relative; }

/* region dropdown list */
.hx-regionmenu { min-width: 250px; }
.hx-regionmenu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 11px; border-radius: 8px; border: none; background: none; color: var(--hx-text-dim); font-size: 13.5px; text-align: left; }
.hx-regionmenu__item:hover { background: var(--hx-panel-2); color: var(--hx-text); }
.hx-regionmenu__item.is-active { color: var(--hx-text); }
.hx-regionmenu__item.is-active .hx-regionmenu__check { color: var(--hx-accent); }
.hx-regionmenu__code { font-family: var(--hx-mono); font-size: 12px; color: var(--hx-text-mute); margin-left: auto; }

/* notifications panel */
.hx-notif { min-width: 320px; max-width: 360px; padding: 0; }
.hx-notif__head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--hx-line); }
.hx-notif__list { max-height: 340px; overflow-y: auto; }
.hx-notif__item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--hx-line); }
.hx-notif__item:last-child { border-bottom: none; }
.hx-notif__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.hx-notif__msg { font-size: 13px; }
.hx-notif__time { font-size: 11.5px; color: var(--hx-text-mute); }

/* ------------------------- shared view components -------------------------- */
.hx-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.hx-view-head__eyebrow { font-size: 12px; color: var(--hx-text-mute); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.hx-view-head h1 { font-size: 22px; letter-spacing: -.02em; }
.hx-view-head__sub { color: var(--hx-text-dim); font-size: 13.5px; margin-top: 5px; max-width: 620px; }
.hx-view-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.hx-breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--hx-text-mute); margin-bottom: 10px; flex-wrap: wrap; }
.hx-breadcrumb a:hover { color: var(--hx-text); }
.hx-breadcrumb .sep { opacity: .5; }

/* stat cards */
.hx-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.hx-stat { background: var(--hx-panel); border: 1px solid var(--hx-line); border-radius: var(--hx-radius); padding: 15px 16px; display: flex; flex-direction: column; gap: 3px; position: relative; overflow: hidden; }
.hx-stat__label { font-size: 12px; color: var(--hx-text-mute); display: flex; align-items: center; gap: 7px; }
.hx-stat__label .ico { color: var(--hx-accent); }
.hx-stat__value { font-size: 25px; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; }
.hx-stat__value small { font-size: 14px; color: var(--hx-text-dim); font-weight: 500; }
.hx-stat__delta { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.hx-stat__delta.up { color: var(--hx-ok); }
.hx-stat__delta.down { color: var(--hx-danger); }
.hx-stat__spark { position: absolute; right: 12px; bottom: 12px; opacity: .8; }

/* generic section card */
.hx-section { background: var(--hx-panel); border: 1px solid var(--hx-line); border-radius: var(--hx-radius); margin-bottom: 18px; overflow: hidden; }
.hx-section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--hx-line); flex-wrap: wrap; }
.hx-section__title { font-size: 15px; font-weight: 620; display: flex; align-items: center; gap: 8px; }
.hx-section__title .ico { color: var(--hx-accent); }
.hx-section__body { padding: 16px; }
.hx-section__body--flush { padding: 0; }
.hx-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.hx-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hx-colspan-2 { grid-column: span 2; }

/* data-grid toolbar */
.hx-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.hx-toolbar__search { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.hx-toolbar__search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--hx-text-mute); }
.hx-toolbar__search input { padding-left: 32px; }
.hx-toolbar__spacer { flex: 1; }
.hx-bulkbar { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--hx-accent-soft); border: 1px solid var(--hx-accent-line); border-radius: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.hx-bulkbar__count { font-weight: 600; font-size: 13.5px; }

/* row menu */
.hx-rowmenu { position: relative; }
.hx-checkbox { width: 16px; height: 16px; accent-color: var(--hx-accent); cursor: pointer; }

/* pagination */
.hx-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px 0; flex-wrap: wrap; }
.hx-pager__info { font-size: 12.5px; color: var(--hx-text-mute); }
.hx-pager__btns { display: flex; gap: 6px; }

/* tabs */
.hx-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hx-line); margin-bottom: 18px; overflow-x: auto; }
.hx-tab { padding: 9px 13px; border: none; background: none; color: var(--hx-text-dim); font-size: 13.5px; font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .13s, border-color .13s; }
.hx-tab:hover { color: var(--hx-text); }
.hx-tab.is-active { color: var(--hx-text); border-bottom-color: var(--hx-accent); }

/* meters / bars */
.hx-meter { height: 8px; border-radius: 999px; background: var(--hx-panel-3); overflow: hidden; }
.hx-meter__fill { height: 100%; border-radius: 999px; background: var(--hx-gradient); transition: width .4s; }
.hx-meter__fill.warn { background: linear-gradient(90deg, var(--hx-warn), #f59e0b); }
.hx-meter__fill.danger { background: linear-gradient(90deg, var(--hx-danger), #ef4444); }
.hx-meter__fill.ok { background: linear-gradient(90deg, var(--hx-ok), #10b981); }
.hx-meterrow { display: grid; grid-template-columns: 90px 1fr 54px; align-items: center; gap: 12px; font-size: 12.5px; }
.hx-meterrow__val { text-align: right; color: var(--hx-text-dim); font-variant-numeric: tabular-nums; }

/* metric tiles for detail views */
.hx-metric { background: var(--hx-panel-2); border: 1px solid var(--hx-line); border-radius: 12px; padding: 13px 14px; }
.hx-metric__label { font-size: 11.5px; color: var(--hx-text-mute); }
.hx-metric__value { font-size: 19px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* wizard */
.hx-wizard__steps { display: flex; gap: 4px; margin-bottom: 22px; flex-wrap: wrap; }
.hx-wstep { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 10px; color: var(--hx-text-mute); font-size: 13px; font-weight: 550; }
.hx-wstep__num { width: 22px; height: 22px; border-radius: 50%; background: var(--hx-panel-3); color: var(--hx-text-dim); display: grid; place-items: center; font-size: 12px; font-weight: 650; flex: none; }
.hx-wstep.is-active { color: var(--hx-text); background: var(--hx-accent-soft); }
.hx-wstep.is-active .hx-wstep__num { background: var(--hx-gradient); color: #fff; }
.hx-wstep.is-done .hx-wstep__num { background: var(--hx-ok); color: #04120b; }
.hx-wstep.is-done { color: var(--hx-text-dim); }
.hx-wizard__foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--hx-line); flex-wrap: wrap; }

/* selectable option cards (regions, images, plans) */
.hx-opts { display: grid; gap: 12px; }
.hx-opts--2 { grid-template-columns: 1fr 1fr; }
.hx-opts--3 { grid-template-columns: repeat(3, 1fr); }
.hx-opts--4 { grid-template-columns: repeat(4, 1fr); }
.hx-opt { text-align: left; background: var(--hx-panel-2); border: 1.5px solid var(--hx-line); border-radius: 12px; padding: 13px 14px; color: var(--hx-text); transition: border-color .13s, background .13s; position: relative; display: block; width: 100%; }
.hx-opt:hover { border-color: var(--hx-line-strong); background: var(--hx-panel-3); }
.hx-opt.is-selected { border-color: var(--hx-accent); background: var(--hx-accent-soft); }
.hx-opt.is-selected::after { content: "✓"; position: absolute; top: 9px; right: 11px; color: var(--hx-accent); font-weight: 700; }
.hx-opt__name { font-weight: 600; font-size: 14px; }
.hx-opt__meta { font-size: 12px; color: var(--hx-text-dim); margin-top: 3px; }
.hx-opt__price { font-family: var(--hx-mono); font-size: 13px; color: var(--hx-accent-2); margin-top: 6px; }

/* slider */
.hx-slider { width: 100%; accent-color: var(--hx-accent); }
.hx-sliderrow { display: grid; grid-template-columns: 1fr; gap: 6px; }
.hx-sliderrow__top { display: flex; justify-content: space-between; font-size: 13px; }
.hx-sliderrow__val { font-family: var(--hx-mono); color: var(--hx-accent-2); }

/* price summary bar */
.hx-pricebar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; background: var(--hx-panel-2); border: 1px solid var(--hx-line-strong); border-radius: 14px; margin-top: 18px; flex-wrap: wrap; }
.hx-pricebar__total { font-size: 24px; font-weight: 700; }
.hx-pricebar__total small { font-size: 14px; color: var(--hx-text-dim); font-weight: 500; }

/* vSphere-style inventory tree */
.hx-tree { font-size: 13.5px; }
.hx-tree__node { }
.hx-tree__row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.hx-tree__row:hover { background: var(--hx-panel-2); }
.hx-tree__row.is-active { background: var(--hx-accent-soft); }
.hx-tree__toggle { width: 16px; display: inline-flex; color: var(--hx-text-mute); transition: transform .12s; flex: none; }
.hx-tree__toggle.is-open { transform: rotate(90deg); }
.hx-tree__ico { color: var(--hx-text-dim); display: inline-flex; flex: none; }
.hx-tree__children { padding-left: 18px; }
.hx-tree__label { flex: 1; }
.hx-tree__count { font-size: 11px; color: var(--hx-text-mute); }

/* logs */
.hx-logbox { background: #05070d; border: 1px solid var(--hx-line); border-radius: 12px; font-family: var(--hx-mono); font-size: 12.5px; line-height: 1.65; padding: 12px 14px; height: 320px; overflow-y: auto; color: #c8d2e4; }
.hx-logbox .lvl-info { color: #8fb8ff; }
.hx-logbox .lvl-warn { color: #fbbf24; }
.hx-logbox .lvl-err { color: #ff9c9c; }
.hx-logbox .ts { color: var(--hx-text-mute); }

/* progress modal (migrate / provision) */
.hx-progress { text-align: center; padding: 8px 4px; }
.hx-progress__bar { height: 8px; border-radius: 999px; background: var(--hx-panel-3); overflow: hidden; margin: 16px 0 10px; }
.hx-progress__fill { height: 100%; background: var(--hx-gradient); width: 0; transition: width .4s ease; }
.hx-progress__label { font-size: 13px; color: var(--hx-text-dim); font-family: var(--hx-mono); }

/* activity feed */
.hx-feed { display: flex; flex-direction: column; }
.hx-feed__item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hx-line); }
.hx-feed__item:last-child { border-bottom: none; }
.hx-feed__ico { width: 30px; height: 30px; border-radius: 9px; background: var(--hx-panel-2); display: grid; place-items: center; color: var(--hx-accent); flex: none; }
.hx-feed__msg { font-size: 13.5px; }
.hx-feed__meta { font-size: 12px; color: var(--hx-text-mute); margin-top: 1px; }

/* checklist */
.hx-checklist { display: flex; flex-direction: column; gap: 2px; }
.hx-checkitem { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; }
.hx-checkitem:hover { background: var(--hx-panel-2); }
.hx-checkitem__box { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--hx-line-strong); display: grid; place-items: center; flex: none; color: transparent; }
.hx-checkitem.is-done .hx-checkitem__box { background: var(--hx-ok); border-color: var(--hx-ok); color: #04120b; }
.hx-checkitem.is-done .hx-checkitem__label { color: var(--hx-text-mute); text-decoration: line-through; }
.hx-checkitem__label { flex: 1; font-size: 13.5px; }

/* world / region map */
.hx-map { width: 100%; height: auto; background: var(--hx-bg-2); border-radius: 12px; }
.hx-map__land { fill: var(--hx-panel-3); }
.hx-map__pin { fill: var(--hx-accent); }
.hx-map__pin-ring { fill: none; stroke: var(--hx-accent); opacity: .5; }
.hx-map__label { fill: var(--hx-text-dim); font-size: 9px; font-family: var(--hx-font); }

/* status grid (status.html + monitoring) */
.hx-statusgrid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.hx-statusgrid th { padding: 8px; text-align: center; font-size: 11px; color: var(--hx-text-mute); font-weight: 600; }
.hx-statusgrid td { padding: 6px 8px; text-align: center; }
.hx-statuscell { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.hx-statuscell--ok { background: var(--hx-ok); }
.hx-statuscell--warn { background: var(--hx-warn); }
.hx-statuscell--down { background: var(--hx-danger); }

/* ------------------------------- responsive ------------------------------- */
@media (max-width: 1024px) {
  .hx-app { grid-template-columns: 1fr; }
  .hx-sidebar {
    position: fixed; left: 0; top: 0; width: 280px; max-width: 84vw; transform: translateX(-102%);
    transition: transform .24s cubic-bezier(.2,.8,.2,1); box-shadow: var(--hx-shadow-lg);
  }
  .hx-app.nav-open .hx-sidebar { transform: translateX(0); }
  .hx-sidebar__close { display: inline-flex; }
  .hx-scrim--nav { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(3,6,12,0.6); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .hx-app.nav-open .hx-scrim--nav { opacity: 1; pointer-events: auto; }
  .hx-hamburger { display: inline-flex; }
  .hx-grid2, .hx-grid3 { grid-template-columns: 1fr; }
  .hx-colspan-2 { grid-column: auto; }
  .hx-opts--3, .hx-opts--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .hx-content { padding: 16px 15px 50px; }
  .hx-topbar { padding: 0 13px; gap: 8px; }
  .hx-topbar__search { display: none; }
  .hx-region__city { display: none; }
  .hx-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hx-stat__value { font-size: 21px; }
  .hx-opts--2, .hx-opts--3, .hx-opts--4 { grid-template-columns: 1fr; }
  .hx-view-head h1 { font-size: 19px; }
  .hx-meterrow { grid-template-columns: 72px 1fr 46px; }
}
@media (max-width: 420px) {
  .hx-stats { grid-template-columns: 1fr; }
}
.hx-sidebar__close { position: absolute; top: 14px; right: 12px; background: none; border: 1px solid var(--hx-line); border-radius: 8px; padding: 6px; color: var(--hx-text-dim); }
