:root {
  --aws:#ff9900; --gcp:#4285f4; --azure:#0078d4;
  --fg:#222; --muted:#888; --border:#ddd;
  --accent:#4285f4; --accent-soft:#e8f0fe;
  --radius:6px;
}
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--fg); background: #fafafa;
  padding: 12px; box-sizing: border-box;
  display: flex; flex-direction: column;
}

.topline { display: flex; align-items: baseline; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
h1 { font-size: 15px; margin: 0; font-weight: 600; }
.meta { color: var(--muted); font-size: 12px; }
.reset {
  margin-left: auto; font-size: 12px; color: var(--muted);
  cursor: pointer; background: white; border: 1px solid var(--border);
  padding: 4px 10px; font-family: inherit; border-radius: var(--radius);
}
.reset:hover { color: var(--fg); border-color: var(--fg); }

.err { color: #c0392b; font-size: 13px; padding: 8px; background: #fff; border-left: 3px solid #c0392b; margin-bottom: 8px; }
.stats { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; }
.stats b { color: var(--fg); font-weight: 600; }

#t { flex: 1; min-height: 400px; }

.badge { display:inline-block; padding:1px 6px; border-radius:3px; font-size:11px; font-weight:600; color:white; text-transform:uppercase; }
.badge-aws { background: var(--aws); color: #222; }
.badge-gcp { background: var(--gcp); }
.badge-azure { background: var(--azure); }

.price-hi { color: #c0392b; font-weight: 600; }
.price-lo { color: #7f8c8d; }
.price-cell { position: relative; display: block; height: 100%; }
.price-bar { position: absolute; left: 0; top: 2px; bottom: 2px; background: linear-gradient(to right, #e8f0fe, #fde8e8); border-radius: 2px; z-index: 0; pointer-events: none; }
.price-text { position: relative; z-index: 1; }

/* Tabulator — match page palette */
.tabulator { font-size: 12px; background: white; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tabulator .tabulator-header { background: white; border-bottom: 1px solid var(--border); }
.tabulator-header .tabulator-col { background: white; border-right: 1px solid #eee; padding: 6px 8px !important; }
.tabulator-header .tabulator-col:last-child { border-right: 0; }
.tabulator-header .tabulator-col-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 600; }
.tabulator-header .tabulator-col.tabulator-sortable:hover { background: #fafafa; }
.tabulator-row { border-bottom: 1px solid #f0f0f0; }
.tabulator-row.tabulator-row-even { background: white; }
.tabulator-row:hover { background: var(--accent-soft) !important; }
.tabulator-cell { padding: 6px 10px !important; border-right: 0 !important; }
.tabulator-header-filter { padding-top: 4px !important; }
.tabulator-cell.c-click { cursor: pointer; }
.tabulator-cell.c-click:hover { background: #dbe8ff !important; }

/* Multi-select filter input (matches page inputs) */
.msf { position: relative; width: 100%; }
.msf-input {
  width: 100%; box-sizing: border-box;
  font: inherit; font-size: 12px;
  padding: 5px 8px;
  background: white;
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--fg);
  transition: border-color 0.1s, box-shadow 0.1s;
  text-overflow: ellipsis;
}
.msf.active .msf-input { padding-right: 26px; }
.msf-input::placeholder { color: var(--muted); }
.msf-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.msf.active .msf-input { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); font-weight: 500; }
.msf-count {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  min-width: 16px; height: 16px; padding: 0 5px;
  background: var(--accent); color: white;
  font-size: 10px; font-weight: 700;
  border-radius: 8px;
  display: none; align-items: center; justify-content: center;
  cursor: pointer;
  line-height: 16px; text-align: center;
}
.msf.active .msf-count { display: inline-flex; }
.msf-count:hover { background: #c0392b; }
.msf-count:hover::after { content: " ×"; }

/* Popup */
.msf-pop {
  position: fixed;
  min-width: 240px; max-width: 360px; max-height: 340px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 10000;
  font-size: 12px;
  padding: 4px 0;
}
.msf-pop-head {
  padding: 6px 10px; font-size: 11px; color: var(--muted);
  border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center;
}
.msf-pop-head a { color: var(--accent); cursor: pointer; font-weight: 600; }
.msf-pop-head a:hover { text-decoration: underline; }
.msf-list { padding: 2px 0; }
.msf-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msf-item:hover { background: var(--accent-soft); }
.msf-item input { margin: 0; accent-color: var(--accent); }
.msf-item.checked { background: #f6faff; }
.msf-more { padding: 6px 10px; color: var(--muted); font-style: italic; font-size: 11px; }

/* Detail panel */
.detail {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(520px, 90vw);
  background: white;
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,0.08);
  z-index: 9000;
  display: flex; flex-direction: column;
  font-size: 12px;
}
.detail[hidden] { display: none; }
.detail-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.detail-title { font-weight: 600; font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-close {
  background: none; border: 0; font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 4px;
}
.detail-close:hover { color: var(--fg); }
.detail-sub {
  padding: 8px 16px; border-bottom: 1px solid #f0f0f0;
  color: var(--muted); font-size: 11px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.detail-sub b { color: var(--fg); font-weight: 600; }
.detail-body {
  flex: 1; overflow: auto;
  padding: 12px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  color: var(--fg);
}
.detail-body .loading { color: var(--muted); font-style: italic; font-family: inherit; }
.detail-body .k { color: #7b4aa6; }
.detail-body .s { color: #2c7a37; }
.detail-body .n { color: #b5593f; }
.detail-body .b { color: #b5593f; }
.detail-body .null { color: var(--muted); }

.row-details-cell { cursor: pointer; }
.row-details-cell:hover { background: var(--accent-soft) !important; }

/* Chevron affordance on the name cell to signal "click for details" */
.row-details-cell[tabulator-field="name"] {
  position: relative;
  padding-right: 22px !important;
}
.row-details-cell[tabulator-field="name"]::after {
  content: "›";
  position: absolute;
  right: 10px; top: 50%; transform: translateY(-55%);
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  transition: color 0.1s, transform 0.1s;
}
.row-details-cell[tabulator-field="name"]:hover::after {
  color: var(--accent);
  transform: translateY(-55%) translateX(2px);
}
.row-details-cell[tabulator-field="name"]:hover { color: var(--accent); }
