/*
 * Microsoft Places — Tag Report (read-only)
 */

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  --ink:     #0A1D5F;
  --blue:    #0972CE;
  --teal:    #37C1CE;
  --vi:      #0972CE;
  --vi2:     #37C1CE;
  --snow:    #f7f8fb;
  --cloud:   #eef0f6;
  --mist:    #e2e4ef;
  --silver:  #abafc4;
  --surface: #ffffff;
  --text:    #1a1a2e;
  --muted:   #5a6278;
  --danger:  #d13438;
  --success: #107c10;
  --top-h:   56px;
  --filt-h:  52px;
  --rad:     8px;

  --c-building:   #0A1D5F;
  --c-floor:      #0972CE;
  --c-section:    #5a6278;
  --c-room:       #107c10;
  --c-workspace:  #8764b8;
  --c-desk:       #0e7d80;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
html, body { height: 100%; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--snow);
  overflow: hidden;
}

#app { display: flex; flex-direction: column; height: 100vh; }

#main-app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

[hidden] { display: none !important; }

/* ── Sign-in screen ─────────────────────────────────────────────────────────── */
#signin-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink);
  z-index: 100;
}
#signin-screen::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(55,193,206,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(55,193,206,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.signin-logo {
  position: absolute; top: 24px; left: 28px;
  height: 28px; width: auto;
  filter: brightness(0) invert(1);
  opacity: .9;
}
.signin-card {
  position: relative;
  background: var(--surface);
  border-radius: 14px;
  padding: 40px 44px;
  text-align: center;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.32);
}
.signin-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--teal); margin-bottom: 12px;
}
.signin-card h1 { font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.signin-card p  { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 28px; }

.btn-ms {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff;
  border: none; border-radius: 8px;
  padding: 14px 24px; font-family: inherit;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-ms:hover { background: #0d2470; }

/* ── Loading screen ─────────────────────────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: var(--ink); z-index: 90;
}
.loading-logo { height: 32px; width: auto; filter: brightness(0) invert(1); opacity: .85; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(55,193,206,.25);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-msg { font-size: 14px; color: rgba(255,255,255,.7); }

/* ── Error / Consent / Maintenance screens ──────────────────────────────────── */
#error-screen, #consent-screen, #maintenance-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--snow); z-index: 80;
}
.error-card {
  background: var(--surface); border-radius: 12px;
  padding: 40px; text-align: center; width: 100%; max-width: 420px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  border: 1px solid var(--mist);
}
.error-icon { margin-bottom: 16px; }
.error-card h2 { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.error-card p  { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 20px; }
.btn-retry {
  display: inline-block; padding: 10px 24px;
  background: var(--ink); color: #fff; border: none; border-radius: 6px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-retry:hover { background: #0d2470; }

#avispl-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); z-index: 100; overflow: hidden;
}
#avispl-screen::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(55,193,206,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(55,193,206,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
#avispl-screen::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #0972CE 0%, #37C1CE 100%);
}
.avispl-prompt-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.btn-avispl-continue {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; background: transparent;
  border: 1.5px solid rgba(255,255,255,.2); border-radius: 6px;
  color: var(--text); font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.btn-avispl-continue:hover { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.06); }

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
#topbar {
  display: flex; align-items: center; gap: 10px;
  height: var(--top-h); padding: 0 20px;
  background: var(--ink); flex-shrink: 0;
}
.tb-logo { height: 22px; width: auto; filter: brightness(0) invert(1); opacity: .9; }
.tb-divider { width: 1px; height: 20px; background: rgba(255,255,255,.18); margin: 0 4px; }
.tb-breadcrumb { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.tb-breadcrumb-parent { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.6); text-decoration: none; transition: color .15s; }
.tb-breadcrumb-parent:hover { color: rgba(255,255,255,.9); }
.tb-breadcrumb-sep { font-size: 13px; color: rgba(255,255,255,.35); }
.tb-title { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; }

.btn-back, .btn-signout, .btn-help {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 6px;
  font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.8);
  background: transparent; text-decoration: none; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.btn-back:hover, .btn-signout:hover, .btn-help:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ── Expiry badge + modal ─────────────────────────────────────────────────────── */
.user-expiry-badge {
  position: absolute; top: -2px; right: -2px; width: 14px; height: 14px;
  background: #d97706; color: #fff; border-radius: 50%;
  font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--ink); pointer-events: none; z-index: 1;
}
.expiry-modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,29,95,.45); z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.expiry-modal {
  background: #fff; border-radius: 12px; box-shadow: 0 8px 40px rgba(10,29,95,.18);
  padding: 28px; max-width: 400px; width: calc(100% - 48px);
  display: flex; flex-direction: column; gap: 12px;
}
.expiry-modal-icon {
  width: 40px; height: 40px; background: #fffbeb; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.expiry-modal h2 { font-size: 17px; font-weight: 700; color: #0A1D5F; margin: 0; }
.expiry-modal p  { font-size: 14px; color: #5a6278; line-height: 1.55; margin: 0; }
.expiry-modal a  { color: #0972CE; font-weight: 600; }
.expiry-modal .btn-expiry-ok {
  align-self: flex-end; background: #0972CE; color: #fff; border: none; border-radius: 6px;
  cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 20px; transition: background .15s; margin-top: 4px;
}
.expiry-modal .btn-expiry-ok:hover { background: #0762b0; }

/* ── User info chip + popover ────────────────────────────────────────────────── */
.user-info-wrap { position: relative; flex-shrink: 0; }
.btn-user-info {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px; color: rgba(255,255,255,.85); cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 500;
  padding: 4px 10px 4px 8px; transition: background .15s; white-space: nowrap;
}
.btn-user-info:hover { background: rgba(255,255,255,.18); }
.btn-user-info .user-chevron { opacity: .55; transition: transform .2s; }
.btn-user-info[aria-expanded="true"] .user-chevron { transform: rotate(180deg); }
.user-info-popover {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border: 1px solid #e2e4ef; border-radius: 8px;
  box-shadow: 0 4px 20px rgba(10,29,95,.12), 0 1px 4px rgba(0,0,0,.06);
  min-width: 260px; z-index: 200;
}
.uip-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px; border-bottom: 1px solid #f0f0f6; }
.uip-row:last-child { border-bottom: none; }
.uip-label { font-size: 10px; font-weight: 700; color: #5a6278; text-transform: uppercase; letter-spacing: .07em; }
.uip-value { font-size: 13px; color: #1a1a2e; word-break: break-all; }
.uip-mono  { font-family: monospace; font-size: 11px; }
.uip-expiry-ok   { color: #107c10; }
.uip-expiry-warn { color: #d97706; }
.uip-expiry-none { color: #5a6278; }

/* ── Maintenance banner ─────────────────────────────────────────────────────── */
.maintenance-banner {
  background: #fffbeb; border-bottom: 2px solid #fbbf24; color: #92400e;
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  font-size: 13px; font-weight: 500; flex-shrink: 0;
}
.maintenance-banner svg { flex-shrink: 0; }
.maintenance-banner-msg { flex: 1; }
.maintenance-banner-dismiss {
  background: transparent; border: 1px solid #f59e0b; border-radius: 4px; color: #92400e;
  font-family: inherit; font-size: 12px; font-weight: 600; padding: 3px 10px; cursor: pointer; flex-shrink: 0;
}
.maintenance-banner-dismiss:hover { background: #fef3c7; }

/* ── Read-only notice ──────────────────────────────────────────────────────── */
.tr-readonly-notice {
  display: flex; align-items: center; gap: 8px;
  background: #eef7fd; border-bottom: 1px solid #cfe6f7; color: var(--ink);
  padding: 8px 24px; font-size: 12.5px; flex-shrink: 0;
}
.tr-readonly-notice svg { flex-shrink: 0; color: var(--vi); }
.tr-readonly-notice code {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  background: rgba(9,114,206,.1); padding: 1px 5px; border-radius: 3px;
}
.tr-readonly-notice a { color: var(--vi); font-weight: 600; }

/* ── Filter bar ─────────────────────────────────────────────────────────────── */
#filterbar {
  height: var(--filt-h);
  background: var(--surface);
  border-bottom: 1px solid var(--mist);
  display: flex; align-items: center; padding: 0 24px; gap: 8px;
  flex-shrink: 0; overflow-x: auto; scrollbar-width: none;
}
#filterbar::-webkit-scrollbar { display: none; }
.filter-srch {
  display: flex; align-items: center; gap: 6px;
  background: var(--snow); border: 1px solid var(--mist); border-radius: 6px;
  padding: 0 10px; min-width: 220px; flex-shrink: 0; transition: border-color .15s;
}
.filter-srch:focus-within { border-color: var(--vi); }
.filter-srch svg { color: var(--silver); flex-shrink: 0; }
.filter-srch input {
  border: none; background: transparent; font-family: inherit; font-size: 13px;
  color: var(--text); outline: none; padding: 8px 0; width: 100%;
}
.filter-srch input::placeholder { color: var(--silver); }
.filter-sel {
  background: var(--snow); border: 1px solid var(--mist); border-radius: 6px;
  padding: 7px 30px 7px 10px; font-family: inherit; font-size: 13px; color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23abafc4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  cursor: pointer; min-width: 130px; flex-shrink: 0; transition: border-color .15s;
}
.filter-sel:focus { outline: 2px solid var(--vi); outline-offset: -1px; border-color: transparent; }
.filter-sel:hover { border-color: var(--vi); }
.btn-clear {
  background: transparent; border: 1px solid var(--mist); border-radius: 6px;
  padding: 7px 14px; font-family: inherit; font-size: 13px; color: var(--muted);
  cursor: pointer; flex-shrink: 0; transition: background .15s, color .15s; white-space: nowrap;
}
.btn-clear:hover { background: var(--cloud); color: var(--text); }
.filter-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.btn-tree-ctrl {
  background: transparent; border: none; padding: 6px 10px;
  font-family: inherit; font-size: 12px; font-weight: 500; color: var(--vi);
  cursor: pointer; border-radius: 5px; white-space: nowrap; transition: background .15s;
}
.btn-tree-ctrl:hover { background: var(--cloud); }

.btn-tm-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--mist); border-radius: 6px;
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
  margin: 16px 24px 0;
}
.btn-tm-secondary:hover { background: var(--cloud); border-color: var(--silver); }

/* ── Main body ──────────────────────────────────────────────────────────────── */
#app-body { flex: 1; overflow-y: auto; padding: 16px 24px 24px; }

.tm-empty { text-align: center; color: var(--muted); padding: 32px 14px; }

.tm-type-badge {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 3px 8px; border-radius: 4px; color: #fff;
}
.tm-type-building   { background: var(--c-building); }
.tm-type-floor       { background: var(--c-floor); }
.tm-type-section     { background: var(--c-section); }
.tm-type-room        { background: var(--c-room); }
.tm-type-workspace   { background: var(--c-workspace); }
.tm-type-desk        { background: var(--c-desk); }

/* ── Report table ──────────────────────────────────────────────────────────── */
.tm-list-wrap {
  background: var(--surface); border: 1px solid var(--mist); border-radius: 10px; overflow: hidden;
  max-width: 1200px; margin: 0 auto;
}
.tm-list { width: 100%; border-collapse: collapse; }
.tm-list thead th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
  padding: 10px 14px; background: var(--cloud); border-bottom: 1px solid var(--mist);
}
.tm-list tbody td { padding: 10px 14px; border-bottom: 1px solid var(--mist); vertical-align: middle; }
.tm-list tbody tr:last-child td { border-bottom: none; }
.tr-tag-row { cursor: pointer; transition: background .12s; }
.tr-tag-row:hover, .tr-tag-row:focus-visible { background: var(--snow); outline: none; }
.tr-tag-name { font-weight: 700; color: var(--ink); }

/* ── Drilldown (building groups + cards, same visual language as Tag Manager) ── */
.tr-drilldown-title { font-size: 17px; font-weight: 700; color: var(--ink); margin: 18px 24px 12px; }

.tm-group {
  background: var(--surface); border: 1px solid var(--mist); border-radius: 10px;
  overflow: hidden; margin: 0 24px 14px; max-width: 1352px;
}
.tm-group-header {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--ink); color: #fff;
}
.tm-group-name { font-size: 14px; font-weight: 600; flex: 1; }
.tm-group-count { font-size: 12px; opacity: .65; font-weight: 400; }

.tm-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding: 14px;
}
.tm-resource-card {
  background: var(--snow); border: 1px solid var(--mist); border-radius: 9px;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.tm-card-head { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.tm-card-name { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3; }
.tm-card-breadcrumb { font-size: 11px; color: var(--muted); margin-top: -4px; }

.tm-chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--cloud); color: var(--text);
  font-size: 12px; font-weight: 500;
  padding: 3px 10px; border-radius: 999px;
}
.tag-chip-highlight { background: rgba(9,114,206,.15); color: var(--vi); font-weight: 700; }

/* ── Help drawer ────────────────────────────────────────────────────────────── */
.help-backdrop {
  position: fixed; inset: 0; background: rgba(10,29,95,.35);
  backdrop-filter: blur(2px); z-index: 200; animation: fadeIn .2s ease;
}
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.help-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 95vw;
  background: var(--surface); z-index: 210; display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,.18); animation: slideIn .25s cubic-bezier(.4,0,.2,1);
}
.help-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 3px solid var(--teal); background: var(--ink); flex-shrink: 0;
}
.help-title { font-size: 15px; font-weight: 700; color: #fff; }
.help-close {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: transparent; border: none;
  border-radius: 6px; cursor: pointer; color: rgba(255,255,255,.6); transition: background .15s, color .15s;
}
.help-close:hover { background: rgba(255,255,255,.1); color: #fff; }
.help-body { flex: 1; overflow-y: auto; padding: 24px 20px; display: flex; flex-direction: column; gap: 24px; }
.help-section { display: flex; flex-direction: column; gap: 10px; }
.help-section-title { font-size: 13px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; }
.help-section p { font-size: 13px; color: var(--muted); line-height: 1.75; }
.help-list { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.help-list li { font-size: 13px; color: var(--muted); line-height: 1.65; }
.help-list strong { color: var(--text); }
.help-section code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px; background: var(--cloud); padding: 1px 5px; border-radius: 3px;
}

@media (max-width: 900px) {
  #filterbar { flex-wrap: wrap; height: auto; padding: 10px 24px; }
}
