/* ============================================================================
   Application shell — topbar + sidebar + canvas.
   ----------------------------------------------------------------------------
   Lifted from the inline `eb-*` block in app/templates/building_os.html, which
   is the best-looking surface in the product, so the maintenance module stops
   being a visibly different application bolted onto the side of it. The CMMS
   pages previously carried their own top module bar and their own stat cards,
   which is why moving between /building-os and /maintenance felt like leaving
   one product for another.

   Same namespace and the same values, so the two shells cannot drift while
   building_os.html still defines its own copy. That page is 800 lines with five
   modals wired to it by id, so pointing it at this file is a separate change
   with its own risk — worth doing, not worth bundling into a redesign.

   No colour is defined here. Every value is a glass_theme.css token.
   ========================================================================== */

*{box-sizing:border-box}
html,body{margin:0;padding:0;max-width:100%;overflow-x:hidden}
body.eb-body{
  background:var(--bg)!important;
  font-family:var(--font);
  color:var(--text-2)!important; font-size:14px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
.eb-app{display:flex;flex-direction:column;min-height:100vh}

/* glass_theme.css line 201 sets `a { color: var(--accent) !important }`, which
   outranks Bootstrap's own `.btn-primary { color: #fff }`. The result is that
   any <a> styled as a filled Bootstrap button renders its label in the same
   colour as its own background and vanishes -- a blank blue rectangle. Fixed
   here rather than at the one call site that hit it, because the next person to
   write `<a class="btn btn-primary">` would hit it again with no clue why. */
a.btn-primary, a.btn-success, a.btn-danger, a.btn-info, a.btn-warning, a.btn-dark,
a.btn-secondary { color: var(--on-fill) !important; }

/* ---- topbar ---- */
.eb-top{
  display:flex;align-items:center;gap:18px;padding:11px 20px;flex-wrap:wrap;
  background:var(--surface);border-bottom:1px solid var(--border);
  position:sticky;top:0;z-index:1030;
}
.eb-brand{display:flex;align-items:center;gap:11px;flex:0 0 auto;text-decoration:none;min-width:0}
.eb-brand img{height:22px;width:auto;max-width:none;display:block;flex:0 0 auto}
.eb-brand-sep{width:1px;height:18px;background:var(--border-strong);flex:0 0 auto}
.eb-brand-name{font-weight:650;font-size:15px;color:var(--text)!important;letter-spacing:-.011em;white-space:nowrap}

.eb-search{position:relative;flex:1 1 260px;max-width:420px;min-width:180px}
.eb-search i{position:absolute;left:14px;top:50%;transform:translateY(-50%);color:var(--text-3);font-size:13px}
.eb-search input{
  width:100%;height:38px;border-radius:var(--r-pill);border:1px solid var(--border-strong)!important;
  background:var(--surface-2)!important;padding:0 16px 0 38px;font-size:14px;color:var(--text)!important;
}
.eb-search input:focus{background:var(--surface)!important}

.eb-top-right{display:flex;align-items:center;gap:10px;margin-left:auto}
.eb-icon-btn{
  position:relative;width:38px;height:38px;border-radius:50%;border:1px solid var(--border-strong);
  background:var(--surface);color:var(--text-2);cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:background .15s ease,color .15s ease;
}
.eb-icon-btn:hover{background:var(--surface-2);color:var(--text)}
/* The count on a topbar action, e.g. currently-unlocked doors. */
.eb-badge{
  position:absolute;top:-3px;right:-3px;min-width:18px;height:18px;padding:0 5px;
  border-radius:var(--r-pill);background:var(--danger);color:var(--on-fill);
  font-size:10px;font-weight:700;display:flex;align-items:center;justify-content:center;
  border:2px solid var(--surface);
}
/* .eb-viewonly deliberately stays in building_os.html. I added a version here
   while converting that page and it was wrong -- a full-width banner, where the
   real design is a floating pill in the bottom-right corner. Only one page has
   a view-only mode, so the rule belongs with it until a second one does. */
.eb-user{
  display:flex;align-items:center;gap:10px;padding:4px 10px 4px 4px;border-radius:var(--r-pill);
  border:1px solid transparent;background:none;cursor:pointer;font-family:inherit;
}
.eb-user:hover{background:var(--surface-2);border-color:var(--border)}
.eb-avatar{
  width:34px;height:34px;border-radius:50%;background:var(--accent);color:var(--on-fill);
  font-weight:650;font-size:13px;display:flex;align-items:center;justify-content:center;flex:0 0 auto;
}
.eb-user-txt{text-align:left;line-height:1.25;min-width:0}
.eb-user-name{font-size:13px;font-weight:600;color:var(--text);white-space:nowrap}
.eb-user-sub{font-size:11px;color:var(--text-3);white-space:nowrap}

/* ---- body / sidebar ---- */
.eb-mid{display:flex;flex:1;min-height:0}
.eb-side-nav{
  width:208px;flex:0 0 208px;background:var(--surface);border-right:1px solid var(--border);
  padding:14px 10px;display:flex;flex-direction:column;gap:2px;
}
.eb-nav-item{
  display:flex;align-items:center;gap:11px;padding:9px 12px;border-radius:var(--r-sm);
  color:var(--text-2)!important;text-decoration:none;font-size:14px;font-weight:500;
  transition:background .12s ease;
}
.eb-nav-item:hover{background:var(--surface-2)}
.eb-nav-item.is-active{background:var(--accent);color:var(--on-fill)!important;font-weight:600}
.eb-nav-item.is-active i{color:var(--on-fill)}
.eb-nav-item i{width:16px;text-align:center;flex:0 0 auto}
.eb-nav-spacer{flex:1}

/* A labelled group, so the maintenance sections read as part of the same nav
   rather than a second menu competing with it. */
.eb-nav-label{
  font-size:10px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;
  color:var(--text-3);padding:14px 12px 5px;
}
.eb-nav-sub{padding-left:12px;font-size:13px}
/* The count of things waiting. Sits right-aligned in the row so the nav answers
   "is there anything for me" without opening anything. */
.eb-nav-count{
  margin-left:auto;min-width:20px;height:19px;padding:0 6px;border-radius:var(--r-pill);
  background:var(--surface-3);color:var(--text-2);font-size:11px;font-weight:650;
  display:inline-flex;align-items:center;justify-content:center;font-variant-numeric:tabular-nums;
}
.eb-nav-item.is-active .eb-nav-count{background:rgba(255,255,255,.22);color:var(--on-fill)}
.eb-nav-count.is-warn{background:var(--danger-soft);color:var(--danger)}

/* ---- canvas ---- */
.eb-canvas{flex:1;min-width:0;background:var(--bg);padding:22px 24px 34px}
.eb-inner{max-width:1360px;margin:0 auto}
.eb-head{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-bottom:14px}
.eb-h1{font-size:24px;font-weight:650;color:var(--text)!important;margin:0;letter-spacing:-.022em}
.eb-sub{font-size:13px;color:var(--text-3);margin:2px 0 0}

/* ---- controls ---- */
.eb-seg{display:inline-flex;gap:6px;flex-wrap:wrap}
.eb-seg button{
  border:1px solid var(--border-strong);background:var(--surface);color:var(--text-2);
  border-radius:var(--r-pill);padding:6px 14px;font-size:13px;font-weight:500;cursor:pointer;
  white-space:nowrap;font-family:inherit;transition:background .12s ease;
}
.eb-seg button:hover{background:var(--surface-2);color:var(--text)}
.eb-seg button.is-on{background:var(--accent);color:var(--on-fill);border-color:var(--accent);font-weight:600}

.eb-pill{
  display:inline-flex;align-items:center;gap:8px;border:1px solid var(--border-strong);background:var(--surface);
  border-radius:var(--r-pill);padding:6px 14px;font-size:13px;font-weight:500;color:var(--text-2);
}
.eb-pill.is-static{cursor:default;font-family:var(--mono);font-size:12px}

/* Counts as pills rather than as a row of large cards. Five cards took a
   quarter of the screen to say five numbers; these say the same thing in one
   line and double as the filter control. */
.eb-statbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0;margin-bottom:14px}
.eb-statpill{
  display:inline-flex;align-items:center;gap:9px;
  border:1px solid var(--border-strong);background:var(--surface);
  border-radius:var(--r-pill);padding:6px 7px 6px 14px;
  font-family:inherit;font-size:13px;font-weight:500;color:var(--text-2);
  cursor:pointer;white-space:nowrap;
  transition:background .12s ease,border-color .12s ease,color .12s ease;
}
.eb-statpill:hover{background:var(--surface-2);color:var(--text);border-color:var(--text-3)}
.eb-statpill.is-on{background:var(--accent);border-color:var(--accent);color:var(--on-fill)}
.eb-sp-val{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:26px;height:24px;padding:0 8px;border-radius:var(--r-pill);
  background:var(--surface-2);border:1px solid var(--border);
  color:var(--text);font-weight:650;font-size:13px;
  font-variant-numeric:tabular-nums;transition:background .12s ease;
}
.eb-statpill:hover .eb-sp-val{background:var(--surface)}
.eb-statpill.is-on .eb-sp-val{background:rgba(255,255,255,.2);border-color:transparent;color:var(--on-fill)}
.eb-sp-val.is-warn{background:var(--danger-soft);border-color:var(--danger-line);color:var(--danger)}

/* ---- cards ---- */
.eb-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);overflow:hidden;box-shadow:var(--shadow-sm)}
.eb-card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 16px;border-bottom:1px solid var(--border);flex-wrap:wrap}
.eb-card-title{font-size:15px;font-weight:650;color:var(--text)!important;margin:0}
.eb-card-sub{font-size:12px;color:var(--text-3)}
.eb-card-body{padding:16px}
.eb-card-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 16px;border-top:1px solid var(--border);flex-wrap:wrap}
.eb-count{font-size:12px;color:var(--text-3)}
.eb-sec-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:26px 0 12px}
.eb-sec-title{font-size:18px;font-weight:650;color:var(--text)!important;margin:0;letter-spacing:-.015em}
.eb-sec-link{font-size:13px;font-weight:600;color:var(--accent)!important;text-decoration:none}
.eb-grid2{display:grid;grid-template-columns:repeat(auto-fit,minmax(360px,1fr));gap:14px}
.eb-grid3{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:14px}

@media (max-width: 860px){
  .eb-side-nav{
    width:100%;flex:1 1 100%;border-right:none;border-bottom:1px solid var(--border);
    flex-direction:row;overflow-x:auto;padding:8px 10px;gap:4px;
  }
  .eb-mid{flex-direction:column}
  .eb-nav-spacer,.eb-nav-label{display:none}
  .eb-nav-item{white-space:nowrap;padding:8px 11px}
  .eb-nav-sub{padding-left:11px}
  .eb-canvas{padding:16px 13px 30px}
  .eb-h1{font-size:21px}
  .eb-brand-name{display:none}
}
/* Phone. Lifted from building_os.html when its inline copy of the shell was
   removed -- these were always shell rules, they just lived on one page. */
@media (max-width: 560px){
  .eb-user-txt{display:none}
  .eb-brand img{height:19px}
  .eb-statbar{width:100%}
  .eb-statpill{flex:1 1 auto;justify-content:space-between}
}
