/* ===== TNT韭菜日记 — Platinum ===========================================
   The Mac OS 8 "Platinum" desk: grey windows outlined in black with a hard
   2px shadow, a striped title bar with a close box, a sunken white frame,
   a platinum strip above and a status line below, rounded push buttons and
   lavender highlights. Every surface is drawn from the tokens below.
   ======================================================================= */

/* ---------- Tokens ---------- */
:root {
  --black: #262626;
  --g200: #eee;
  --g300: #ddd;
  --g400: #ccc;
  --g500: #bbb;
  --g600: #999;
  --g700: #808080;
  --g800: #666;
  --hl: #333399;          /* links, the chart's first series, menu highlight */
  --lav: #ccf;     /* selection, bars */
  --lav-ring: #9999fe;    /* keyboard focus */
  --orange: #ff6600;      /* the chart's second series */
  --balloon: #ffffcc;     /* help balloons and tooltips */

  --up: #007a00;
  --down: #c00000;

  /* Aliases still referenced from inline styles in app.js */
  --accent-green: var(--up);
  --accent-red: var(--down);
  --win-navy: var(--hl);

  --font-chrome: "Charcoal", "Chicago", "Geneva", "Lucida Grande", "Lucida Sans", Verdana,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-data: Monaco, Menlo, Consolas, "DejaVu Sans Mono", "PingFang SC", "Microsoft YaHei", monospace;
  --font-heading: var(--font-chrome);

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* Reusable edges */
  --raised: inset 1px 1px 0 rgba(255, 255, 255, .6), inset -1px -1px 0 #aaa;
  --sunken-edge: -1px -1px 0 var(--g600), 1px 1px 0 #fff;
  --btn-face: inset 1px 1px 0 var(--g300), inset -1px -1px 0 #777,
    inset 2px 2px 0 #fff, inset -2px -2px 0 #aaa;
  --btn-pressed: inset 1px 1px 0 #444, inset -1px -1px 0 #888,
    inset 2px 2px 0 #555, inset -2px -2px 0 #777;
}

/* Geneva has one weight; borrow Lucida Grande's bold so headings read bold. */
@font-face { font-family: "Geneva"; font-weight: normal; src: local("Geneva"); }
@font-face { font-family: "Geneva"; font-weight: bold; src: local("Lucida Grande Bold"), local("LucidaGrande-Bold"); }

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  padding: 24px 12px 48px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: var(--g400);
  color: var(--black);
  font: 12px/1.45 var(--font-chrome);
  cursor: default;
  overflow-x: hidden;
}

a { color: var(--hl); }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

::selection { background: var(--lav); color: var(--black); }

/* ---------- The desk ---------- */
.desk {
  max-width: 672px;  /* 70% of the old 960px */
  margin: 0 auto;
}

/* ---------- Window ---------- */
.window {
  position: relative;
  background: var(--g400);
  border: 1px solid var(--black);
  box-shadow: 2px 2px 0 var(--black);
  margin: 0 0 22px;
}

.window::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5), inset -1px -1px 0 var(--g600), inset 1px 1px 0 #fff;
}

/* ---------- Title bar: stripes either side of the name ---------- */
.title-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 19px;
  padding: 3px 4px 2px;
  background: var(--g400);
  user-select: none;
  -webkit-user-select: none;
}

.title-bar::before,
.title-bar::after {
  content: "";
  flex: 1;
  min-width: 8px;
  height: 12px;
  background-color: var(--g300);
  background-image: linear-gradient(#fff, #fff 50%, #777 50%, #777);
  background-size: 100% 2px;
  background-repeat: repeat;
  box-shadow: inset 1px 0 0 #fff, inset -1px 0 0 #777;
}

.title-bar-text {
  max-width: 70%;
  padding: 0 2px;
  background: var(--g400);
  color: var(--black);
  font-size: 12px;
  font-weight: bold;
  line-height: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Site mark either side of the main window title. The favicon is pixel art,
   so it stays crisp when scaled down by an exact factor. */
/* The main title is a row of site marks instead of text. */
.title-bar-text--marks {
  gap: 4px;
}

.title-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  image-rendering: pixelated;
}

/* The main window title is a row so the marks and the text line up. */
#main-window > .title-bar .title-bar-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* The close box sits at the left, ahead of the first stripe. */
.title-bar-controls,
.title-bar > .tbox {
  order: -1;
  display: flex;
  flex: none;
}

.tbox,
.title-bar-controls button {
  display: block;
  position: relative;
  flex: none;
  width: 13px;
  height: 13px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  cursor: default;
  background: linear-gradient(135deg, #9a9a9a 0%, #f1f1f1 100%) 50% / 9px 9px no-repeat;
  box-shadow: inset 1px 1px 0 var(--g700), inset -1px -1px 0 #fff,
    inset 0 0 0 2px var(--black), inset 3px 3px 0 #fff, inset -3px -3px 0 var(--g700);
}

.title-bar-controls button { font-size: 0; color: transparent; }

.title-bar-controls button:active::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 1;
  background-image: linear-gradient(135deg, #353535cc 0%, #9c9c9ccc 100%);
}

.title-bar-controls button:focus-visible {
  outline: 2px solid var(--lav-ring);
  outline-offset: 1px;
}

/* ---------- Frame: the sunken white page inside a window ---------- */
.frame,
.window-body {
  margin: 0 4px 4px;
  border: 1px solid var(--black);
  background: #fff;
  box-shadow: var(--sunken-edge);
  min-width: 0;
}

/* A window whose status line sits under its frame shares the seam. */
.window-body:has(+ .status-bar) { margin-bottom: 0; }

/* ---------- Strip: platinum toolbar along the top of a frame ---------- */
.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--black);
  background: var(--g300);
  box-shadow: var(--raised);
}

.strip .fill { flex: 1 1 auto; min-width: 8px; }

.strip .online {
  margin-left: auto;
  font-size: 11px;
  color: #333;
  white-space: nowrap;
}

/* The main window carries no FX badge and no status line. */
.nav-strip .online,
.window.main > .frame > .status-bar { display: none; }

/* ---------- Status line ---------- */
.status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 3px 8px;
  border-top: 1px solid var(--black);
  background: var(--g300);
  box-shadow: var(--raised);
  font-size: 11px;
  color: #333;
  min-height: 20px;
}

.status-bar > :last-child:not(:first-child) { margin-left: auto; }

.window > .status-bar {
  margin: 0 4px 4px;
  border: 1px solid var(--black);
  border-top: 0;
}

.status-bar-field {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Main window: navigation + the page's head ---------- */
.nav-strip .btn.tab { min-width: 64px; }

.hero--admin { display: none; }
.desk:has(#page-admin.active) .hero--home { display: none; }
.desk:has(#page-admin.active) .hero--admin { display: block; }

/* ---------- Pages ---------- */
.page { display: none; }
.page.active { display: block; animation: page-in 120ms steps(3, end); }

@keyframes page-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Panels are windows; nothing extra beyond the window itself. */
.panel { min-width: 0; }

/* ---------- Push buttons ---------- */
.btn,
.win-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 58px;
  min-height: 20px;
  padding: 2px 13px;
  background: var(--g300);
  color: var(--black);
  border: 1px solid var(--black);
  border-radius: 3px;
  box-shadow: var(--btn-face);
  font-family: var(--font-chrome);
  font-size: 12px;
  font-weight: bold;
  line-height: 14px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.btn:not(:disabled):active,
.win-btn:not(:disabled):active {
  background: var(--g800);
  color: #fff;
  box-shadow: var(--btn-pressed);
}

/* The button the dialog is for wears the default ring. */
.btn.default,
.win-btn.default {
  outline: 2px solid var(--black);
  outline-offset: 1px;
  border-radius: 4px;
  margin: 0 3px;
}

.btn:focus-visible,
.win-btn:focus-visible {
  outline: 2px solid var(--lav-ring);
  outline-offset: 1px;
}

.btn:disabled,
.win-btn:disabled {
  color: #777;
  border-color: #888;
  box-shadow: none;
}

/* Segmented tabs: the one in force wears the pressed look. */
.btn.tab {
  min-width: 0;
  padding: 2px 8px;
}

.btn.tab.active,
.btn.tab.on,
.win-btn--active,
.md-tab-btn.active {
  background: var(--g800);
  color: #fff;
  box-shadow: var(--btn-pressed);
}

.win-btn--danger {
  min-width: 0;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--down);
}

/* ---------- Fields ---------- */
.win-input,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="date"],
select,
textarea {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  min-height: 22px;
  padding: 2px 5px;
  background: #fff;
  color: var(--black);
  border: 1px solid var(--black);
  border-radius: 0;
  box-shadow: var(--sunken-edge);
  font-family: var(--font-chrome);
  font-size: 12px;
  line-height: 16px;
}

textarea { line-height: 1.5; }

.win-input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--lav-ring);
  outline-offset: 1px;
}

input[type="file"] {
  font-size: 11px;
}

/* Checkbox: a white box with a black edge, an X when checked. */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 12px;
  height: 12px;
  margin: 0 6px 0 0;
  border: 1px solid var(--black);
  background: #fff;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 var(--g500);
  vertical-align: -2px;
  cursor: default;
}

input[type="checkbox"]:checked {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 1.5l7 7M8.5 1.5l-7 7' stroke='%23262626' stroke-width='1.6'/%3E%3C/svg%3E") center / 10px 10px no-repeat;
}

input[type="checkbox"]:active { background-color: var(--g600); }

/* Radio button: a white circle with a black edge, a black dot when on. */
input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 12px;
  height: 12px;
  margin: 0 6px 0 0;
  border: 1px solid var(--black);
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 1px 1px 0 var(--g300);
  vertical-align: -2px;
  cursor: default;
}

input[type="radio"]:checked {
  background: radial-gradient(circle, var(--black) 0 2.5px, #fff 3px);
}

input[type="radio"]:active { background-color: var(--g600); }

input[type="radio"]:focus-visible {
  outline: 2px solid var(--lav-ring);
  outline-offset: 1px;
}

input[type="radio"]:disabled,
input[type="radio"]:disabled + label { opacity: 0.5; }

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--lav-ring);
  outline-offset: 1px;
}

.form-group { margin-bottom: var(--sp-3); }

.form-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: bold;
  color: var(--black);
}

/* ---------- Dashboard tiles ---------- */
/* A metrics strip in the style of a stats dashboard: hairline rules between
   cells, a muted label, a big value and a small second line. */
.stats-frame {
  width: 100%;
  margin: 8px 0 10px;
  /* Only a bottom rule, in the same light tone as the vertical dividers. */
  border-bottom: 1px solid var(--g300);
}

.stats-row {
  display: grid;
  /* Four tiles per row, always — no auto-fit reflowing to 3 or 5. */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.stat-box {
  min-width: 0;
  padding: 10px 14px 11px;
  border-left: 1px solid var(--g300);
  border-top: 1px solid var(--g300);
  text-align: center;
}



/* The frame already draws the outer edge; the first column and row add none. */
.stat-box:nth-child(4n + 1) {
  border-left: 0;
}

.stat-box:nth-child(-n + 4) {
  border-top: 0;
}

.stat-box__label {
  font-size: 11px;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-box__value {
  font-size: 18px;
  font-weight: bold;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.stat-box__value.up { color: var(--up); }
.stat-box__value.down { color: var(--down); }

/* Fixed steps, not viewport-relative: a vw-sized value outgrew its cell once
   the window hit its max width, and the clipping depended on the browser's
   fallback font. */
@media (max-width: 900px) {
  .stat-box__value { font-size: 17px; }
}

@media (max-width: 760px) {
  .stat-box__value { font-size: 16px; }
}

/* ---------- Chart ---------- */
.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
  padding: 8px 12px 4px;
  background: #fff;
  touch-action: pan-y;
}

.win98-chart-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  user-select: none;
}

/* A help balloon: pale yellow, black edge, hard shadow. */
.win98-tooltip {
  display: none;
  position: absolute;
  z-index: 10;
  pointer-events: none;
  padding: 4px 8px;
  background: var(--balloon);
  border: 1px solid var(--black);
  box-shadow: 2px 2px 0 var(--black);
  font-family: var(--font-chrome);
  font-size: 11px;
  line-height: 1.45;
  color: var(--black);
  white-space: nowrap;
}

.win98-tooltip__date {
  font-weight: bold;
  border-bottom: 1px solid var(--g500);
  margin-bottom: 2px;
  padding-bottom: 1px;
}

.win98-tooltip__val {
  font-family: var(--font-data);
  font-weight: bold;
  color: var(--hl);
}

.win98-tooltip__val--fx { color: #c45000; }

/* ---------- Rows: tables drawn as lines on the white page ---------- */
.rows { padding: 6px 12px 8px; }

.data-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  padding: 2px 4px;
  border-top: 1px solid var(--g300);
  font-size: 12px;
}

.data-card:last-child { border-bottom: 1px solid var(--g300); }

.data-card:not(.data-card--header):hover { background: var(--lav); }

.data-card--header {
  border-top: 0;
  border-bottom: 1px solid var(--black);
  min-height: 20px;
  font-size: 11px;
  color: #555;
  font-weight: normal;
}

.data-card--header:hover { background: none; }

.data-card__date,
.data-card__val,
.data-card__change,
.data-card__change-val,
.data-card__change-pct {
  flex: 1 1 0%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.data-card:not(.data-card--header) .data-card__date { font-family: var(--font-data); font-size: 11px; color: #333; }
.data-card:not(.data-card--header) .data-card__val,
.data-card:not(.data-card--header) .data-card__change-val,
.data-card:not(.data-card--header) .data-card__change-pct { font-family: var(--font-data); font-size: 11px; font-weight: bold; }

.data-card__val,
.data-card__change,
.data-card__change-val,
.data-card__change-pct { text-align: right; }

/* Daily asset log: columns are weighted by content so a long NAV is not clipped. */
#home-table .data-card__date { flex-grow: 1.15; }
#home-table .data-card__val { flex-grow: 1.35; }
#home-table .data-card__change-val,
#home-table .data-card__change-pct { flex-grow: 1; }

/* Asset log and investment log: every column centred. */
#home-table .data-card > span,
#investor-cards .investor-card--header > span,
#investor-cards .investor-card__header > span { text-align: center; }

/* Asset log: a coloured marker leads each row, like the Live list. */
.data-card__dot {
  flex: 0 0 11px;
  width: 11px;
  height: 11px;
  border: 1px solid #555;
  border-radius: 50%;
  background: var(--dot, transparent);
}

.data-card--header .data-card__dot { visibility: hidden; }

.val-up { color: var(--up); }
.val-down { color: var(--down); }
.val-flat { color: var(--g700); }

/* Statements: date, then the title. */
.statement-list .col-date {
  flex: 0 0 96px;
  text-align: left;
}

.statement-list .col-desc {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.statement-list .data-card:not(.data-card--header) .col-desc {
  font-family: var(--font-chrome);
  font-size: 12px;
  font-weight: normal;
}

.statement-list .statement-row__action { flex: 0 0 auto; }

.statement-row { cursor: pointer; }

.clickable-desc { color: var(--hl); }

.statement-row:hover .clickable-desc { text-decoration: underline; }

.statement-row.active,
.statement-row.active:hover {
  background: var(--g800);
  color: #fff;
}

.statement-row.active .col-desc,
.statement-row.active .col-date,
.statement-row.active .clickable-desc {
  color: #fff;
}

/* ---------- Investment log ---------- */
#investor-cards { font-size: 12px; }

.investor-card { border-top: 1px solid var(--g300); }
.investor-card:last-child { border-bottom: 1px solid var(--g300); }
.investor-card:hover { background: var(--lav); }

.investor-card__header,
.investor-card--header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  padding: 2px 4px;
}

.investor-card--header > span {
  flex: 1 1 0%;
  min-width: 0;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.investor-card--header > span:nth-child(2) { text-align: left; }

/* Same leading-marker slot as the daily asset log's coloured dot. */
.investor-card__avatar {
  flex: 0 0 16px;
  width: 16px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 14px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.investor-card--header > .investor-card__avatar {
  flex: 0 0 16px;
}

.investor-card__name,
.investor-card__amount,
.investor-card__pnl {
  flex: 1 1 0%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.investor-card__name { font-weight: bold; }

.investor-card__amount,
.investor-card__pnl {
  text-align: right;
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

/* Investment log: columns are weighted by content (names are short, the CNY
   P&L is the longest) and header and rows share the same weights so they line up. */
#investor-cards .investor-card__name,
#investor-cards .investor-card--header > span:nth-child(2) { flex-grow: 0.8; }
#investor-cards .investor-card__amount,
#investor-cards .investor-card--header > span:nth-child(3) { flex-grow: 1.1; }
#investor-cards .investor-card__pnl,
#investor-cards .investor-card--header > span:nth-child(n+4) { flex-grow: 1.25; }

.investor-card__pnl.pnl-up { color: var(--up); }
.investor-card__pnl.pnl-down { color: var(--down); }

.investor-card__details {
  padding: 2px 4px 6px;
  overflow-x: auto;
}

.detail-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.4;
  background: #fff;
}

.detail-table th,
.detail-table td,
.data-table th,
.data-table td {
  border: 1px solid var(--g600);
  padding: 3px 6px;
  text-align: left;
  vertical-align: middle;
}

.detail-table td,
.data-table td {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}

.detail-table th,
.data-table th {
  background: var(--g300);
  font-weight: bold;
  white-space: nowrap;
}

.data-table-wrap { overflow: auto; max-height: 340px; }

/* ---------- Leftover helpers ---------- */
.col-date { white-space: nowrap; }
.col-desc { word-break: break-word; }
.col-file { width: 90px; text-align: center; }

.thumb-img {
  display: inline-block;
  width: 44px;
  height: 44px;
  object-fit: cover;
  vertical-align: middle;
  background: #fff;
  border: 1px solid var(--black);
  cursor: pointer;
}

.pdf-badge {
  display: inline-flex;
  padding: 1px 6px;
  border: 1px solid var(--black);
  border-radius: 3px;
  background: var(--g300);
  box-shadow: var(--btn-face);
  color: var(--black);
  font-size: 11px;
  font-weight: bold;
  text-decoration: none;
}

.geek-console-light {
  padding: 8px;
  overflow-x: auto;
  font-family: var(--font-data);
  font-size: 11px;
}

.file-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 12px;
  background: var(--g300);
  border-bottom: 1px solid var(--black);
  box-shadow: var(--raised);
}

.file-toolbar__hint {
  margin-left: auto;
  font-size: 11px;
  color: #555;
}

/* ---------- Admin ---------- */
.admin-row,
.admin-toolbar-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fff;
}

/* Pull-down menus: platinum, black edge, drop shadow, blue highlight. */
.admin-add-dropdown {
  position: absolute;
  top: calc(100% - 8px);
  left: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 170px;
  padding: 3px 0;
  background: var(--g300);
  border: 1px solid var(--black);
  box-shadow: 2px 2px 0 var(--black), var(--raised);
}

#admin-del-dropdown { left: 120px; }

.admin-add-dropdown .win-btn {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  min-height: 20px;
  padding: 2px 16px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-weight: normal;
  text-align: left;
}

.admin-add-dropdown .win-btn:hover,
.admin-add-dropdown .win-btn:not(:disabled):active {
  background: var(--hl);
  color: #fff;
  box-shadow: none;
}

#admin-del-dropdown .win-btn:not(:hover) { color: var(--down); }

.admin-data-list {
  padding: 6px 12px 8px;
  font-size: 12px;
}

.admin-data-list .data-card { font-size: 11px; }

/* ---------- Tree view: Finder-style disclosure triangles ---------- */
ul.tree-view {
  margin: 0;
  padding: 2px 0;
  list-style: none;
  font-size: 12px;
}

ul.tree-view li { list-style: none; }

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

.admin-tree li { margin-top: 1px; }

ul.tree-view details > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  padding: 1px 2px;
  list-style: none;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

ul.tree-view details > summary::-webkit-details-marker { display: none; }
ul.tree-view details > summary::marker { content: ""; }

ul.tree-view details > summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  margin: 0 2px 0 1px;
  border-left: 6px solid var(--black);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 80ms steps(2, end);
}

ul.tree-view details[open] > summary::before { transform: rotate(90deg); }

ul.tree-view details > summary:hover { background: var(--g200); }

.admin-tree__count {
  font-family: var(--font-data);
  font-size: 11px;
  color: #555;
}

.admin-tree__rows {
  display: flex;
  flex-direction: column;
  margin: 1px 0 4px;
  padding-left: 18px;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  padding: 1px 6px;
  border-top: 1px solid var(--g300);
  font-family: var(--font-data);
  font-size: 11px;
}

.tree-row:last-child { border-bottom: 1px solid var(--g300); }
.tree-row:hover { background: var(--lav); }

.tree-row__date { color: #333; }
.tree-row__value { font-weight: bold; }

.tree-row__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-chrome);
  font-size: 12px;
}

.tree-row--investor .tree-row__title {
  flex: 0 0 auto;
  overflow: visible;
  text-overflow: clip;
}

.tree-row__size { color: #555; }
.tree-row__action { flex: none; }

.tree-row .win-btn,
.popup-list__item .win-btn {
  min-width: 0;
  min-height: 18px;
  padding: 1px 8px;
  font-size: 11px;
}

.tree-log {
  padding: 4px 6px;
  border-top: 1px solid var(--g300);
  font-size: 12px;
}

.tree-log:last-child { border-bottom: 1px solid var(--g300); }
.tree-log:hover { background: var(--g200); }

.tree-log__cat {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-log__action { margin-top: 2px; }

.tree-log__time {
  display: block;
  margin-top: 2px;
  font-family: var(--font-data);
  font-size: 10px;
  color: #555;
}

.tree-log__body {
  margin-top: 2px;
  font-family: var(--font-data);
  font-size: 11px;
  color: #333;
  word-break: break-all;
}

/* ---------- Dashboard switch ---------- */
.dash-switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 20px;
}

/* One holding field per row, no matter how wide the admin panel gets. */
#holdings-visible-list {
  grid-template-columns: 1fr;
}

.dash-switch {
  display: flex;
  align-items: center;
  min-height: 20px;
}

.dash-switch label { font-size: 12px; }

/* ---------- Theme switch ---------- */
.theme-admin {
  padding: 4px 6px;
}

.theme-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.theme-option {
  display: flex;
  align-items: center;
  min-height: 20px;
}

.theme-option label { font-size: 12px; }

/* Win98-only markup (the classic "[x]" panel headers in the hero). */
.win98-only { display: none !important; }

/* ---------- Welcome popup admin ---------- */
.popup-admin {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 12px;
}

.popup-admin__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.popup-admin__row--gallery-head {
  justify-content: space-between;
  margin-top: var(--sp-2);
}

.popup-admin__label { font-size: 12px; font-weight: bold; }

.popup-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--g300);
  border: 1px solid var(--black);
  box-shadow: var(--raised);
}

.popup-queue__title {
  font-size: 12px;
  font-weight: bold;
  white-space: pre-line;
}

.popup-queue__list {
  max-height: 160px;
  overflow-y: auto;
  padding: 4px 8px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--black);
  box-shadow: var(--sunken-edge);
  font-family: var(--font-data);
  font-size: 11px;
}

.popup-queue__list span { color: var(--g700); }

.popup-queue__actions {
  display: flex;
  gap: 12px;
}

.popup-list {
  min-height: 60px;
  list-style: none;
}

/* The 60px floor keeps a populated gallery from jumping; an empty one needs no reserve. */
.popup-list:has(> .popup-list__empty:only-child) {
  min-height: 0;
}

.popup-list__tree { list-style: none; }

.popup-list__item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  grid-template-rows: 40px;
  align-items: center;
  gap: var(--sp-2);
  padding: 3px 6px;
  border-top: 1px solid var(--g300);
  font-size: 12px;
}

.popup-list__item:last-child { border-bottom: 1px solid var(--g300); }
.popup-list__item:hover { background: var(--lav); }

.popup-list__thumb {
  display: block;
  width: 56px;
  height: 40px;
  max-width: 56px;
  max-height: 40px;
  object-fit: contain;
  overflow: hidden;
  background: var(--lav);
  border: 1px solid var(--black);
}

.popup-list__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-data);
  font-size: 11px;
}

.popup-list__empty {
  list-style: none;
  font-size: 11px;
  color: #777;
}

@media (max-width: 480px) {
  .popup-list__item { grid-template-columns: 44px minmax(0, 1fr); }
  .popup-list__del { grid-column: 1 / -1; justify-self: start; }
  .popup-list__thumb { width: 44px; height: 32px; }
}

/* ---------- Data change log ---------- */
.audit-log-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--g300);
  border-bottom: 1px solid var(--black);
  box-shadow: var(--raised);
}

.audit-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.audit-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 4px;
  border-top: 1px solid var(--g300);
  font-size: 12px;
}

.audit-card:hover { background: var(--g200); }

.audit-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.audit-card__time {
  font-family: var(--font-data);
  font-size: 10px;
  color: #555;
}

.audit-tag,
.audit-source {
  display: inline-block;
  padding: 0 4px;
  border: 1px solid var(--black);
  font-family: var(--font-data);
  font-size: 10px;
  line-height: 14px;
  text-transform: uppercase;
  color: var(--black);
  background: #fff;
}

.audit-tag--asset { background: #cfc; }
.audit-tag--investor { background: var(--lav); }
.audit-tag--statement { background: var(--balloon); }

.audit-action {
  padding: 0 4px;
  font-size: 11px;
  font-weight: bold;
}

.audit-action--create { color: var(--up); }
.audit-action--update { color: var(--hl); }
.audit-action--delete { color: var(--down); }

.audit-source {
  margin-left: auto;
  background: var(--g300);
  color: #333;
}

.audit-source--api { background: #ffcc99; font-weight: bold; }

.audit-card__body {
  padding: 4px 6px;
  font-family: var(--font-data);
  font-size: 11px;
  color: #333;
  word-break: break-all;
  background: var(--g200);
  border: 1px solid var(--g500);
}

/* ---------- Loading / empty ---------- */
.loading {
  padding: 24px;
  text-align: center;
  font-size: 11px;
  color: #777;
}

.loading::after {
  content: '';
  display: inline-block;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  0%, 100% { content: '_'; }
  50% { content: ' '; }
}

/* ---------- Dialogs ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(38, 38, 38, .45);
}

.modal-overlay.show { display: flex; }

#confirm-modal { z-index: 9100; }

.modal-window {
  width: 360px;
  max-width: 92vw;
  max-height: calc(100vh - 24px);
  margin: 0;
  display: flex;
  flex-direction: column;
}

.modal-window > .window-body { overflow-y: auto; }

.modal-body { padding: 16px; }

.modal-msg {
  margin-bottom: var(--sp-3);
  font-size: 12px;
}

.modal-input-wrap { margin-bottom: var(--sp-3); }

.modal-error {
  min-height: 16px;
  margin-bottom: var(--sp-2);
  font-size: 11px;
  font-weight: bold;
  color: var(--down);
}

/* Holding form: when one label wraps ("FX to USD (optional):") the inputs in that
   row would sit at different heights. Bottom-align each column's content. */
#holding-modal .form-group > div {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

/* Third row (currency / date / FX): the date control needs the most room. */
#holding-modal .form-group > div:has(#holding-price-as-of) { flex: 1.7 !important; }
#holding-modal .form-group > div:has(#holding-currency) { flex: 0.8 !important; }

.modal-btn-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

/* Delete picker */
.delpicker-window { width: 520px; max-width: 94vw; }

.delpicker-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.delpicker-count {
  font-size: 11px;
  color: #333;
}

.delpicker-list {
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: var(--sp-3);
  padding: 4px;
  background: #fff;
  border: 1px solid var(--black);
  box-shadow: var(--sunken-edge);
}

.delpicker-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 4px;
  font-family: var(--font-data);
  font-size: 11px;
  cursor: default;
}

.delpicker-row:hover { background: var(--g200); }

.delpicker-row.is-selected,
.delpicker-row.is-selected:hover { background: var(--lav); }

.delpicker-row__body {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.delpicker-row__thumb {
  flex: none;
  width: 44px;
  height: 32px;
  max-width: 44px;
  max-height: 32px;
  object-fit: contain;
  background: var(--lav);
  border: 1px solid var(--black);
}

.delpicker-row__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Confirm */
.confirm-window { width: 430px; }

.confirm-preview { margin-bottom: var(--sp-3); }
.confirm-preview:empty { display: none; }

.confirm-preview__card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: var(--g200);
  border: 1px solid var(--black);
  box-shadow: var(--sunken-edge);
  font-size: 12px;
}

.confirm-preview__card img {
  flex: none;
  width: 56px;
  height: 40px;
  object-fit: contain;
  background: var(--lav);
  border: 1px solid var(--black);
}

.confirm-preview__lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.confirm-preview__lines b { font-weight: bold; }

.confirm-preview__lines span {
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-data);
  font-size: 11px;
}

/* ---------- Welcome popup ---------- */
#welcome-modal.show { background: transparent; }

#welcome-modal.show::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(38, 38, 38, .45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: opacity 180ms ease-in;
}

#welcome-modal.closing::before { opacity: 0; }
#welcome-modal.closing { pointer-events: none; }

/* Closing zooms the window back into its title bar, as a window shade does. */
#welcome-modal.closing .welcome-modal { animation: welcome-roll-up 180ms steps(6, end) forwards; }

@keyframes welcome-roll-up {
  to { transform: scaleY(0.04); opacity: 0; }
}

.welcome-modal {
  width: auto;
  max-width: 92vw;
  transform-origin: top center;
  z-index: 1;
}

.welcome-modal__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
}

.welcome-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(448px, 68.8vw);
  transition: height 160ms ease-out;
}

.welcome-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: min(256px, 41.6vh);
  background: var(--lav);
  border: 1px solid var(--black);
  box-shadow: var(--sunken-edge);
  color: #333;
  font-size: 12px;
}

.welcome-placeholder--error { color: var(--down); }

.welcome-image {
  display: block;
  max-width: 100%;
  max-height: 56vh;
  width: auto;
  height: auto;
  background: var(--lav);
  border: 1px solid var(--black);
  box-shadow: var(--sunken-edge);
}

@keyframes welcome-swap-in {
  from { opacity: 0.3; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

.welcome-image--swap { animation: welcome-swap-in 200ms steps(5, end); }

.welcome-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.welcome-actions[hidden],
.welcome-image[hidden],
.welcome-placeholder[hidden] { display: none; }

.welcome-modal__btn {
  min-width: 128px;
  min-height: 24px;
  padding: 4px 14px;
  font-size: 13px;
}

.welcome-modal__btn--green,
.welcome-modal__btn--red {
  color: #fff;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .45), inset -1px -1px 0 rgba(0, 0, 0, .35),
    inset 2px 2px 0 rgba(255, 255, 255, .25), inset -2px -2px 0 rgba(0, 0, 0, .15);
}

.welcome-modal__btn--green { background: #2e8b2e; }
.welcome-modal__btn--red { background: #b22222; }

@media (prefers-reduced-motion: reduce) {
  #welcome-modal.show::before { transition: none; }
  #welcome-modal.closing .welcome-modal,
  .welcome-image--swap,
  .page.active { animation: none; }
  .welcome-stage { transition: none; }
}

/* ---------- Markdown editor ---------- */
.md-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--sp-2);
  padding: 6px 8px;
  background: var(--g300);
  border: 1px solid var(--black);
  box-shadow: var(--raised);
}

.md-btn {
  min-width: 26px;
  padding: 2px 6px;
  font-size: 11px;
}

.md-tab-btn {
  min-width: 0;
  padding: 2px 8px;
  font-size: 11px;
}

.md-editor-container {
  min-height: 260px;
  background: #fff;
  border: 1px solid var(--black);
  box-shadow: var(--sunken-edge);
}

.md-textarea {
  width: 100%;
  height: 280px;
  padding: var(--sp-2);
  resize: vertical;
  border: 0;
  box-shadow: none;
  outline: none;
  background: transparent;
  font-family: var(--font-data);
  font-size: 12px;
  line-height: 1.5;
}

.md-textarea:focus { outline: none; }

.md-preview-pane {
  height: 280px;
  overflow-y: auto;
  padding: var(--sp-3);
  background: #fff;
}

/* ---------- Statement reader ---------- */
.preview-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.statement-paper {
  min-height: 180px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 16px 18px;
  background: #fff;
  color: var(--black);
}

.statement-paper img {
  max-width: 100%;
  max-height: 45vh;
  object-fit: contain;
}

/* The reader sits inside the Statement window as a window of its own. */
.statement-window {
  margin: 4px 12px 14px;
  box-shadow: 2px 2px 0 var(--black);
}

.statement-window__body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.statement-window .status-bar-field { font-size: 11px; }

.statement-viewer__body {
  position: relative;
  min-height: 200px;
  overflow-x: hidden;
  background: #fff;
}

.statement-viewer__body .statement-paper {
  max-height: 480px;
  overflow-x: hidden;
  max-width: 100%;
}

.statement-viewer__body .markdown-body {
  overflow-x: hidden;
  max-width: 100%;
}

.statement-viewer__body .markdown-body img {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: initial !important;
  margin: 8px 0;
}

.statement-masked-blur {
  filter: blur(5px);
  opacity: 0.6;
  user-select: none;
  pointer-events: none;
  transition: filter 0.2s ease;
}

.statement-mask-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(204, 204, 204, .55);
}

/* An alert box: platinum, outlined, hard shadow. */
.statement-mask-card {
  width: 100%;
  max-width: 340px;
  padding: 16px 20px;
  text-align: center;
  background: var(--g300);
  border: 1px solid var(--black);
  box-shadow: 2px 2px 0 var(--black), var(--raised);
}

.statement-mask-icon { font-size: 26px; margin-bottom: 6px; }

.statement-mask-title {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: bold;
}

.statement-mask-desc {
  margin-bottom: 14px;
  font-size: 12px;
  line-height: 1.45;
  color: #333;
}

/* ---------- Markdown, set like the reference docs ---------- */
.markdown-body {
  font-family: var(--font-chrome);
  font-size: 13px;
  line-height: 1.55;
  color: var(--black);
  text-align: left;
  overflow-wrap: break-word;
}

.markdown-body > :first-child { margin-top: 0; }

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 16px 0 6px;
  font-weight: bold;
  line-height: 1.34;
}

.markdown-body h1 {
  font-size: 1.3em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--black);
}

.markdown-body h2 {
  font-size: 1.12em;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--g300);
}

.markdown-body h3 { font-size: 1em; }
.markdown-body h4 { font-size: 1em; color: #555; }

.markdown-body p { margin: 0 0 8px; }

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 8px;
  padding-left: 20px;
}

.markdown-body li { margin: 0 0 4px; }

.markdown-body a { color: var(--hl); }

.markdown-body hr {
  margin: 12px 0;
  border: 0;
  border-top: 1px solid var(--g600);
  border-bottom: 1px solid #fff;
}

.markdown-body blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  background: #f0f0ff;
  border-left: 3px solid var(--hl);
  color: #333;
}

.markdown-body code {
  padding: 0 3px;
  background: var(--g200);
  border: 1px solid var(--g300);
  font-family: var(--font-data);
  font-size: 0.88em;
}

/* Code blocks are the terminal: black, sunk into the page. */
.markdown-body pre {
  margin: 8px 0;
  padding: 8px 10px;
  overflow-x: auto;
  background: #000;
  color: #fff;
  border: 1px solid var(--black);
  box-shadow: var(--sunken-edge);
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.5;
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: inherit;
}

.markdown-body table {
  width: 100%;
  margin: 8px 0;
  border-collapse: collapse;
  font-size: 0.92em;
  line-height: 1.4;
}

.markdown-body th,
.markdown-body td {
  padding: 3px 6px;
  border: 1px solid var(--g600);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: var(--g300);
  font-weight: bold;
  white-space: nowrap;
}

.markdown-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  background: var(--lav);
  border: 1px solid var(--black);
  box-shadow: var(--sunken-edge);
}

/* ---------- On-screen keypad ---------- */
.virtual-keyboard-box {
  margin: 10px 0 12px;
  padding: 8px;
  background: var(--g300);
  border: 1px solid var(--black);
  box-shadow: var(--raised);
  user-select: none;
  -webkit-user-select: none;
}

.vk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--g500);
}

.vk-title { font-size: 11px; font-weight: bold; }

.vk-toggle-btn {
  min-width: 0;
  padding: 1px 8px;
  font-size: 11px;
}

.vk-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vk-row {
  display: flex;
  gap: 3px;
  width: 100%;
}

.vk-key {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0;
  font-family: var(--font-data);
  font-size: 13px;
}

.vk-key--action { font-family: var(--font-chrome); font-size: 11px; }

/* ---------- Toast ---------- */
.win98-toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.win98-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
  max-width: 380px;
  padding: 8px 12px;
  pointer-events: auto;
  background: var(--g300);
  border: 1px solid var(--black);
  box-shadow: 2px 2px 0 var(--black), var(--raised);
  font-size: 12px;
  animation: toast-in 160ms steps(4, end);
}

.win98-toast--success { border-left: 5px solid var(--up); }
.win98-toast--error { border-left: 5px solid var(--down); }
.win98-toast--info { border-left: 5px solid var(--hl); }

.win98-toast__icon { flex-shrink: 0; font-size: 15px; }

.win98-toast__msg {
  flex: 1;
  line-height: 1.35;
  word-break: break-word;
}

.win98-toast.fade-out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Platinum scroll bars (WebKit / Blink) ---------- */
::-webkit-scrollbar { width: 16px; height: 16px; }

::-webkit-scrollbar-track {
  background: var(--g500);
  box-shadow: inset 1px 1px 0 #888, inset -1px -1px 0 var(--g300);
}

::-webkit-scrollbar-thumb {
  border: 1px solid var(--black);
  background: var(--lav) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h7v1H0zM0 2h7v1H0zM0 4h7v1H0zM0 6h7v1H0z' fill='%236666cc'/%3E%3Cpath d='M1 1h7v1H1zM1 3h7v1H1zM1 5h7v1H1zM1 7h7v1H1z' fill='%23fff'/%3E%3C/svg%3E") center / 8px 8px no-repeat;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #99c;
}

::-webkit-scrollbar-thumb:active { background-color: #aaf; }

::-webkit-scrollbar-button:single-button {
  display: block;
  width: 16px;
  height: 16px;
  border: 1px solid var(--black);
  background-color: var(--g300);
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #999;
}

::-webkit-scrollbar-button:single-button:active { background-color: var(--g600); }

::-webkit-scrollbar-button:single-button:vertical:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h1v1h1v1h1v1h1v1H0V3h1V2h1V1h1z' fill='%23262626'/%3E%3C/svg%3E");
}

::-webkit-scrollbar-button:single-button:vertical:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h7v1H6v1H5v1H4v1H3V3H2V2H1V1H0z' fill='%23262626'/%3E%3C/svg%3E");
}

::-webkit-scrollbar-button:single-button:horizontal:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='7' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h1v7H3V6H2V5H1V4H0V3h1V2h1V1h1z' fill='%23262626'/%3E%3C/svg%3E");
}

::-webkit-scrollbar-button:single-button:horizontal:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='7' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1h1v1h1v1h1v1H3v1H2v1H1v1H0z' fill='%23262626'/%3E%3C/svg%3E");
}

::-webkit-scrollbar-corner { background: var(--g300); }

/* Firefox only: it has no pseudo-elements for scroll bars. */
@-moz-document url-prefix() {
  * { scrollbar-color: var(--lav) var(--g500); }
}

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  body { padding: 12px 8px 32px; }

  .window { margin-bottom: 16px; }

  .title-bar-text { max-width: 80%; }

  .strip { padding: 6px 8px; }
  .rows,
  .admin-data-list { padding: 4px 8px 6px; }

  .stats-frame { width: auto; max-width: 100%; margin: 6px 0 8px; }
  #home-table .data-card { gap: 4px; padding: 2px 2px; }
  .investor-card__header,
  .investor-card--header { gap: 4px; padding: 2px 2px; }
  .investor-card--header > span { font-size: 10px; }
  /* Role matrix: fit the phone instead of scrolling sideways. */
  .holdings-matrix {
    min-width: 0;
    font-size: 11px;
  }

  .holdings-matrix th,
  .holdings-matrix td {
    padding: 2px;
  }

  .holdings-matrix .holdings-policy {
    min-width: 0;
    width: 100%;
  }

  .stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-box { padding: 6px 4px 7px; }
  .stat-box__label { font-size: 9px; }
  .stat-box__value { font-size: 11px; line-height: 1.3; }

  .chart-container { height: 230px; padding: 6px 6px 2px; }

  .data-card { gap: 6px; }

  .statement-list .col-date { flex-basis: 84px; }

  .dash-switch-grid { grid-template-columns: 1fr; }

  .modal-window {
    width: 95vw !important;
    max-width: 95vw !important;
  }

  .modal-body { padding: 12px 10px; }

  .statement-window { margin: 4px 6px 10px; }
  .statement-paper { padding: 12px 10px; }

  .welcome-actions { flex-wrap: wrap; width: 100%; }
  .welcome-modal__btn { min-width: 0; flex: 1 1 104px; }

  .markdown-body table { display: block; overflow-x: auto; max-width: 100%; }
  .markdown-body img { max-width: 100% !important; height: auto !important; }
  .markdown-body pre { max-width: 100%; }

  .win98-toast-container { left: 12px; right: 12px; bottom: 16px; }
  .win98-toast { min-width: 0; max-width: none; }
}

@media (max-width: 480px) {
  .vk-key { height: 36px; font-size: 14px; }
  .vk-row { gap: 2px; }
}


/* ---------- Holdings ---------- */
.holdings-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Last write time under the home holdings table: small and quiet. */
.holdings-updated {
  margin-top: 4px;
  font-family: var(--font-data);
  font-size: 10px;
  text-align: right;
  color: #777;
}

.holdings-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  background: #fff;
  font-family: var(--font-data);
  font-size: 11px;
}

.holdings-table th,
.holdings-table td {
  border-bottom: 1px solid var(--g400);
  padding: 2px 6px;
  white-space: nowrap;
}

.holdings-table th {
  background: var(--g300);
  border-bottom: 1px solid var(--black);
  color: var(--black);
  font-family: var(--font-chrome);
  font-weight: 700;
  text-align: center;
}

.holdings-table tbody tr:nth-child(odd) td {
  background: #fff;
}

.holdings-table tbody tr:nth-child(even) td {
  background: #f6f6f6;
}

.holdings-table tbody tr:hover td {
  background: var(--lav);
}

.holdings-name,
.holdings-matrix__locked {
  color: var(--g800);
}

.holdings-masked {
  color: var(--g700);
}

.holdings-matrix {
  background: #fff;
  border-collapse: collapse;
}

.holdings-matrix th,
.holdings-matrix td {
  border: 1px solid var(--g500);
}


/* Holdings column alignment and cell details (shared markup, Platinum palette) */
.holdings-table .holdings-sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
}

.holdings-table thead .holdings-sticky {
  z-index: 3;
  background: var(--g300);
}

.holdings-cell--left,
.holdings-table th.holdings-cell--left {
  text-align: left;
}

.holdings-cell--right,
.holdings-table th.holdings-cell--right {
  text-align: right;
}

.holdings-cell--center,
.holdings-table th.holdings-cell--center {
  text-align: center;
}

.holdings-symbol {
  font-weight: 700;
  color: var(--hl);
}

.holdings-name {
  display: block;
  margin: 0 auto;
  max-width: 160px;
  overflow: hidden;
  color: var(--g800);
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
}

.holdings-masked {
  color: var(--g700);
  letter-spacing: 2px;
  user-select: none;
  -webkit-user-select: none;
}

.holdings-pct {
  font-size: 10px;
  opacity: 0.75;
}

.holdings-symbol--cash {
  color: var(--g800);
}

.holdings-cash-emoji {
  font-family: var(--font-data);
  font-size: 14px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0;
}

/* Today's NAV row is priced from the live holdings table, not the daily log. */
.data-card__val--holdings {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Holdings admin */
.holdings-admin {
  padding: var(--sp-2);
}

.holdings-admin__label {
  margin: 8px 0 6px;
  font-size: 12px;
}

.holdings-matrix-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.holdings-matrix {
  width: 100%;
  min-width: 480px;
  background: #fff;
  font-family: var(--font-data);
  font-size: 12px;
}

.holdings-matrix th,
.holdings-matrix td {
  padding: 2px 4px;
  text-align: center;
}

.holdings-matrix th:first-child,
.holdings-matrix td:first-child {
  text-align: left;
}

.holdings-policy {
  min-width: 64px;
}

.holdings-visible-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.holdings-order-btns {
  display: flex;
  gap: 2px;
}

.holdings-order-btn {
  min-width: 20px;
  min-height: 16px;
  padding: 0 3px;
  font-size: 11px;
  line-height: 14px;
}

.holdings-form-hint {
  margin: 4px 0 8px;
  color: var(--g800);
  font-size: 11px;
  line-height: 1.4;
}

.tree-row--holding .tree-row__title {
  flex: 1;
}

.tree-row__action {
  white-space: nowrap;
}

/* Admin panels: an empty error line must not reserve a blank band under the controls. */
.popup-admin .modal-error:empty,
.holdings-admin .modal-error:empty {
  display: none;
}
