:root {
  --ext-border: #99bbe8;
  --ext-header-a: #dfe8f6;
  --ext-header-b: #c7d8ee;
  --ext-navy: #15428b;
  --ext-bg: #dfe9f5;
  --grid-header-a: #f9f9f9;
  --grid-header-b: #e3e4e6;
  --grid-border: #d0d0d0;
  --chrome: #ece9d8;
  --chrome-dark: #aca899;
  --notice-red: #cc0000;
  --font-ui: Tahoma, "MS Sans Serif", Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-ui);
  font-size: 11px;
  color: #000;
}

/* ---------- desk + photo framing ---------- */

.desk {
  position: relative;
  min-height: 100vh;
  background: #0b0b0e;
}

.photo {
  width: 100%;
}

/* full-page grain, over everything including the desk */
.fx-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- monitor ---------- */

.monitor {
  position: relative;
}

.monitor-label {
  display: none;
}

.screen {
  position: relative;
  overflow: hidden;
  background: #000;
}

/* ---------- camera artifacts on the glass ---------- */

.fx-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  box-shadow: inset 0 0 130px rgba(0, 0, 0, 0.5);
}

.fx-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 11;
  background:
    radial-gradient(ellipse 380px 260px at 80% 6%,
      rgba(255, 255, 255, 0.40) 0%,
      rgba(255, 255, 255, 0.14) 40%,
      transparent 70%),
    linear-gradient(112deg,
      transparent 30%,
      rgba(255, 255, 255, 0.05) 42%,
      rgba(255, 255, 255, 0.13) 50%,
      rgba(255, 255, 255, 0.05) 58%,
      transparent 70%),
    radial-gradient(ellipse 60% 55% at 50% 48%,
      rgba(255, 253, 240, 0.10) 0%,
      transparent 65%),
    radial-gradient(ellipse 500px 380px at 8% 94%,
      rgba(255, 240, 210, 0.10) 0%,
      transparent 60%);
}

.fx-moire {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: 0.6;
  background:
    /* fine scanlines */
    repeating-linear-gradient(
      179deg,
      rgba(0, 0, 0, 0.045) 0px,
      rgba(0, 0, 0, 0.045) 1px,
      transparent 1px,
      transparent 3px
    );
}

/* faint chromatic fringing + photo softness on all screen content */
.browser {
  text-shadow:
    0.5px 0 0 rgba(255, 0, 0, 0.12),
    -0.5px 0 0 rgba(0, 200, 255, 0.12);
  filter: blur(0.28px) saturate(0.93) contrast(0.97) brightness(1.02);
}

/* ---------- IE6-style browser chrome ---------- */

.browser {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--chrome);
}

.browser-titlebar {
  background: linear-gradient(180deg, #0a246a 0%, #3a6ea5 8%, #0a246a 100%);
  background: linear-gradient(90deg, #0058ee 0%, #3f8cf3 50%, #0058ee 100%);
  color: #fff;
  font-weight: bold;
  font-size: 11px;
  padding: 4px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.browser-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-controls {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.bc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 16px;
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(180deg, #6ea5f0 0%, #2a63c9 100%);
  border: 1px solid #fff;
  border-radius: 3px;
}

.bc-close {
  background: linear-gradient(180deg, #f0906e 0%, #d2491f 100%);
}

.browser-menubar {
  display: flex;
  gap: 14px;
  padding: 3px 8px;
  background: var(--chrome);
  border-bottom: 1px solid var(--chrome-dark);
}

.browser-navbar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  background: var(--chrome);
  border-bottom: 1px solid var(--chrome-dark);
}

.nav-glyph {
  font-size: 13px;
  color: #2a5c2a;
}

.nav-glyph.dim {
  color: #999;
}

.address-label {
  color: #444;
  margin-left: 6px;
}

.address-bar {
  flex: 1;
  background: #fff;
  border: 1px solid #7f9db9;
  padding: 2px 6px;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #000;
}

.go-btn {
  color: #2a5c2a;
  font-weight: bold;
}

/* ---------- portal ---------- */

.portal {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--ext-bg);
  border: 1px solid var(--chrome-dark);
  border-top: none;
  min-height: 0;
}

.xks-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  align-items: center;
  padding: 4px 8px;
  background: linear-gradient(180deg, #fdfdfd 0%, #e8eef7 100%);
  border-bottom: 1px solid var(--ext-border);
  font-size: 11px;
  color: #15428b;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  cursor: default;
  white-space: nowrap;
}

.tool:hover {
  background: #dfe8f6;
  outline: 1px solid var(--ext-border);
}

.tool.active {
  background: #c7d8ee;
  outline: 1px solid var(--ext-border);
  font-weight: bold;
}

/* tiny colored icon squares — read as icons at photo distance */
.ico {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.i-home     { background: linear-gradient(135deg, #f5d76e, #b8860b); }
.i-myxks    { background: linear-gradient(135deg, #4a90d9, #15428b); }
.i-admin    { background: linear-gradient(135deg, #c94a4a, #7a1010); }
.i-users    { background: linear-gradient(135deg, #7ec97e, #2e7d32); }
.i-search   { background: linear-gradient(135deg, #e8e8e8, #9e9e9e); }
.i-workflow { background: linear-gradient(135deg, #b087d6, #5e35a1); }
.i-results  { background: linear-gradient(135deg, #f0a860, #c05f00); }
.i-finger   { background: linear-gradient(135deg, #80cbc4, #00695c); }
.i-tag      { background: linear-gradient(135deg, #f48fb1, #ad1457); }
.i-stats    { background: linear-gradient(135deg, #90caf9, #1565c0); }
.i-task     { background: linear-gradient(135deg, #ce93d8, #6a1b9a); }
.i-map      { background: linear-gradient(135deg, #a5d6a7, #1b5e20); }
.i-help     { background: linear-gradient(135deg, #64b5f6, #0d47a1); }
.i-folder   { background: linear-gradient(180deg, #ffe9a8, #e8b931); }
.i-star     { background: linear-gradient(135deg, #ffe082, #ff8f00); }
.i-doc      { background: linear-gradient(180deg, #ffffff, #cfd8dc); }

.notice {
  padding: 3px 8px;
  font-weight: bold;
  color: var(--notice-red);
  background: #fff;
  border-bottom: 1px solid var(--ext-border);
}

/* ---------- main split: nav tree + content ---------- */

.portal-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

.navtree {
  width: 185px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--ext-border);
  display: flex;
  flex-direction: column;
}

.navtree-header {
  background: linear-gradient(180deg, var(--ext-header-a), var(--ext-header-b));
  border-bottom: 1px solid var(--ext-border);
  color: var(--ext-navy);
  font-weight: bold;
  padding: 4px 8px;
}

.tree {
  list-style: none;
  margin: 0;
  padding: 6px 4px;
}

.tree ul {
  list-style: none;
  margin: 0;
  padding-left: 16px;
}

.tree-node {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  white-space: nowrap;
  cursor: default;
}

.tree-node:hover {
  background: #dfe8f6;
}

.tree-selected {
  background: #c7d8ee;
  outline: 1px dotted var(--ext-navy);
  font-weight: bold;
  cursor: pointer;
}

.redact-inline {
  color: #000;
  letter-spacing: -1px;
}

/* ---------- content column ---------- */

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 8px;
  gap: 8px;
}

.subject-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--ext-border);
  padding: 7px 10px;
}

.sh-grid {
  display: grid;
  grid-template-columns: repeat(3, auto 1fr);
  gap: 3px 8px;
  flex: 1;
}

.sh-label {
  font-weight: bold;
  white-space: nowrap;
}

.sh-value {
  min-width: 60px;
}

.sh-strong {
  font-weight: bold;
  color: var(--ext-navy);
}

.score-badge {
  background: linear-gradient(180deg, #66d055 0%, #2f9e1f 100%);
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  padding: 8px 14px;
  border: 1px solid #1d6f12;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

/* ---------- portlets ---------- */

.portlets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: start;
}

.portlet {
  background: #fff;
  border: 1px solid var(--ext-border);
}

.portlet-header {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, var(--ext-header-a), var(--ext-header-b));
  border-bottom: 1px solid var(--ext-border);
  padding: 4px 6px;
}

.portlet-title {
  flex: 1;
  color: var(--ext-navy);
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portlet-btn {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-family: var(--font-ui);
  color: var(--ext-navy);
  background: #fff;
  border: 1px solid var(--ext-border);
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.portlet.collapsed .portlet-body,
.portlet.collapsed .portlet-footer {
  display: none;
}

.portlet-body {
  overflow-x: auto;
}

.grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.grid-table th {
  background: linear-gradient(180deg, var(--grid-header-a), var(--grid-header-b));
  border: 1px solid var(--grid-border);
  border-top: none;
  font-weight: normal;
  text-align: left;
  padding: 2px 6px;
  color: #333;
}

.grid-table td {
  border: 1px solid #e6e6e6;
  padding: 2px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.grid-table tr:nth-child(even) td {
  background: #f7f9fc;
}

.grid-table a {
  color: #1a4fa0;
}

.redact-cell {
  display: inline-block;
  background: #000;
  height: 10px;
  width: 90px;
  vertical-align: middle;
}

.subject-photo {
  display: block;
  margin: 10px auto;
  width: 150px;
  max-width: 90%;
  border: 1px solid var(--grid-border);
  padding: 3px;
  background: #fff;
}

.noimage-box {
  margin: 10px auto;
  width: 110px;
  height: 125px;
  border: 1px solid var(--grid-border);
  background: repeating-linear-gradient(45deg, #f4f4f4 0 8px, #ececec 8px 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #888;
  font-size: 10px;
  padding: 6px;
}

.profile-text {
  padding: 8px;
}

.portlet-footer {
  display: flex;
  align-items: center;
  gap: 5px;
  border-top: 1px solid var(--grid-border);
  background: linear-gradient(180deg, #fbfbfb, #ececec);
  padding: 2px 6px;
  color: #444;
}

.pf-glyph {
  color: #3b6ca8;
  font-size: 10px;
}

.pf-glyph.dim {
  color: #aaa;
}

.pf-page {
  display: inline-block;
  background: #fff;
  border: 1px solid #b5b8c8;
  padding: 0 5px;
  margin: 0 2px;
}

.pf-count {
  margin-left: auto;
  white-space: nowrap;
}

/* ---------- status bar ---------- */

.portal-statusbar {
  display: flex;
  justify-content: space-between;
  padding: 3px 8px;
  background: var(--chrome);
  border-top: 1px solid var(--chrome-dark);
  color: #333;
}

/* ---------- bluescreen easter egg ---------- */

.bsod {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: #0000aa;
  color: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  cursor: default;
}

.bsod[hidden] {
  display: none;
}

.bsod-text {
  margin: 0;
  padding: 6vh 24px 24px;
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  max-width: 720px;
}

/* ---------- small screens ---------- */

@media (max-width: 720px) {
  .browser-titlebar,
  .browser-menubar,
  .browser-navbar {
    display: none;
  }

  .portal {
    border: none;
  }

  .portal-main {
    flex-direction: column;
  }

  .navtree {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--ext-border);
  }

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

  .sh-grid {
    grid-template-columns: auto 1fr;
  }
}
