/* Mac OS 8 «Platinum»: тёплый серый, тонкие рамки, скруглённые кнопки. */
:root {
  color-scheme: light;  /* тема подменяет: от неё зависят полосы прокрутки */
  /* Базовая тема — платина Mac OS 8. Всё оформление живёт в этих переменных,
     тема подменяет их на лету, поэтому в правилах ниже литералов цвета нет. */
  --face: #dddddd;         /* корпус окна, строки меню, диалогов */
  --face-dim: #cccccc;
  --light: #ffffff;        /* блик фаски — свет всегда сверху слева */
  --shadow: #999999;
  --shadow-deep: #777777;
  --frame: #000000;        /* внешняя рамка окна */
  --edge: #5a5a5a;         /* рамка вокруг «вдавленных» полей и кнопок */
  --ink: #000000;
  --ink-soft: #444444;
  --ink-dim: #808080;
  --hint: #666666;         /* подписи, единицы, пояснения */
  --paper: #ffffff;        /* содержимое: списки, текст, таблицы, карточки */
  --paper-alt: #f6f5f2;    /* чередование строк */
  --line: #c4c4c4;         /* разделители */
  --line-strong: #9a968e;  /* подчёркивание шапки таблицы */
  --line-soft: #f0f0f0;
  --sel: #b6c7de;          /* выделение в списках — светло-синее, текст чёрный */
  --sel-menu: #3f5f95;     /* подсветка пункта меню */
  --on-sel: #ffffff;       /* текст поверх подсветки */
  --accent: #3a5b8c;
  --accent-deep: #1b2f52;
  --warn: #8a1c1c;
  --desk: #7d8ca4;         /* рабочий стол и его плетение */
  --desk-weave: #74839b;
  --desk-ink: #ffffff;
  --menu-face: #f2f2f2;
  --bar-a: #ffffff;        /* строка меню сверху */
  --bar-b: #eeeeee;
  --bar-c: #dcdcdc;
  --strip-a: #ffffff;      /* полоска диска над списком файлов */
  --strip-b: #e2e2e2;
  --title-stripe-a: #ffffff;  /* полосатый заголовок окна */
  --title-stripe-b: #cfcfcf;
  --title-edge: #6a6a6a;
  --btn-a: #ffffff;        /* кнопки и значки-кнопки */
  --btn-b: #d2d2d2;
  --btn-press-a: #a9b6c9;
  --btn-press-b: #cdd6e2;
  --knob-a: #ffffff;       /* боксы заголовка */
  --knob-b: #c8c8c8;
  --knob-press-a: #b0b0b0;
  --knob-press-b: #d8d8d8;
  --card-a: #ffffff;       /* карточки прогноза */
  --card-b: #eeeeee;
  --card-hi: #dfe6f0;
  --head-a: #f4f2ee;       /* шапка таблицы */
  --head-b: #dedad2;
  --canvas: #8e8e8e;       /* подложка под рисунком и PDF */
  --check: #c9c9c9;        /* шахматка прозрачности */
  --gauge-a: #4a6fa5;      /* полоса загрузки */
  --gauge-b: #7b9ac9;
  --drop: #c9dcf3;         /* цель перетаскивания */
  --drop-strong: #a9c6ea;
  --focus-ring: rgba(58, 91, 140, .35);
}


* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: Charcoal, Geneva, "Lucida Grande", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; }

/* ------------------------------------------------------------------ строка меню */

#menubar {
  flex: none;
  height: 20px;
  display: flex;
  align-items: stretch;
  padding-left: 6px;
  background: linear-gradient(var(--bar-a) 0%, var(--bar-b) 55%, var(--bar-c) 100%);
  border-bottom: 1px solid var(--frame);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .18);
  user-select: none;
  z-index: 500;
}

.mb-item {
  display: flex;
  align-items: center;
  padding: 0 9px;
  cursor: default;
  white-space: nowrap;
}

.mb-item:hover, .mb-item.open { background: var(--sel-menu); color: var(--on-sel); }
/* Значок системы: «://» вместо картинки — цвет наследуется, поэтому на
   подсветке он инвертируется вместе с остальным пунктом. */
.mb-logo {
  padding: 0 11px;
  font-weight: bold;
  font-size: 14px;
  letter-spacing: .5px;
}
.mb-name { font-weight: bold; }

.mb-clock {
  margin-left: auto;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-left: 1px solid var(--line);
  cursor: default;
}

/* ------------------------------------------------------------------ рабочий стол */

#desktop {
  position: relative;
  flex: 1;
  min-height: 0;
  background-color: var(--desk);
  background-image:
    linear-gradient(45deg, var(--desk-weave) 25%, transparent 25%, transparent 75%, var(--desk-weave) 75%),
    linear-gradient(45deg, var(--desk-weave) 25%, transparent 25%, transparent 75%, var(--desk-weave) 75%);
  background-size: 4px 4px;
  background-position: 0 0, 2px 2px;
  overflow: hidden;
}

#desk-icons, #desk-trash {
  position: absolute;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1;
}

#desk-icons { top: 12px; }
#desk-trash { bottom: 14px; }

.deskicon {
  width: 82px;
  text-align: center;
  color: var(--desk-ink);
  cursor: default;
  user-select: none;
}

.deskicon > div { display: grid; place-items: center; }

.deskicon span {
  display: inline-block;
  margin-top: 2px;
  padding: 0 3px;
  font-size: 11px;
  border-radius: 2px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .55);
}

/* ------------------------------------------------------------------ окна */

.window {
  position: absolute;
  background: var(--face);
  border: 1px solid var(--frame);
  border-radius: 2px;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .35), 3px 3px 7px rgba(0, 0, 0, .25);
  display: flex;
  flex-direction: column;
  min-width: 240px;
}

.window.hidden { display: none; }
.window.shaded { height: auto !important; }
.window.shaded .frame { display: none; }

.window .frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 0;
  border-top: 1px solid var(--frame);
}

/* Заголовок в полоску — визитная карточка Platinum. */
.titlebar {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 19px;
  flex: none;
  padding: 0 5px;
  background:
    repeating-linear-gradient(var(--title-stripe-a) 0 1px, var(--title-stripe-b) 1px 2px);
  color: var(--ink);
  font-weight: bold;
  user-select: none;
  cursor: default;
}

.window.inactive .titlebar { background: var(--face); color: var(--ink-dim); }
.window.inactive .macbtn { visibility: hidden; }

.cap-wrap { flex: 1; display: flex; justify-content: center; overflow: hidden; }

.caption {
  padding: 0 8px;
  background: var(--face);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.macbtns { display: flex; gap: 5px; }

.macbtn {
  width: 12px;
  height: 12px;
  flex: none;
  border: 1px solid var(--edge);
  border-radius: 2px;
  background: linear-gradient(var(--knob-a), var(--knob-b));
  box-shadow: inset -1px -1px 0 rgba(0, 0, 0, .12);
  cursor: default;
  position: relative;
}

.macbtn:active { background: linear-gradient(var(--knob-press-a), var(--knob-press-b)); }
.macbtn.zoom::after {
  content: '';
  position: absolute;
  left: 1px; top: 1px;
  width: 5px; height: 5px;
  border: 1px solid var(--title-edge);
}
.macbtn.shade::after {
  content: '';
  position: absolute;
  left: 1px; right: 1px; top: 4px;
  height: 2px;
  border-top: 1px solid var(--title-edge);
  border-bottom: 1px solid var(--title-edge);
}

/* ------------------------------------------------------------------ рельеф */

.raised {
  border: 1px solid var(--shadow-deep);
  background: linear-gradient(var(--light), var(--face));
}

.sunken {
  border: 1px solid var(--shadow-deep);
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .18);
  background: var(--paper);
}

/* ------------------------------------------------------------------ выпадающие меню */

.menu {
  position: absolute;
  z-index: 600;
  background: var(--menu-face);
  border: 1px solid var(--frame);
  border-radius: 0 0 4px 4px;
  box-shadow: 2px 3px 6px rgba(0, 0, 0, .35);
  padding: 3px 0;
  min-width: 170px;
}

.menu div {
  padding: 3px 22px 3px 16px;
  white-space: nowrap;
  cursor: default;
}

.menu div:hover:not(.disabled) { background: var(--sel-menu); color: var(--on-sel); }
.menu div.disabled { color: var(--ink-dim); }
.menu hr { border: none; border-top: 1px solid var(--line); margin: 3px 6px; }
.menu div.checked, .menu div.unchecked { padding-left: 0; }
.menu div.checked::before { content: '✓'; display: inline-block; width: 16px; text-align: center; }
.menu div.unchecked::before { content: ''; display: inline-block; width: 16px; }

/* ------------------------------------------------------------------ кнопки и поля */

button {
  font: inherit;
  min-width: 74px;
  padding: 3px 14px;
  color: var(--ink);
  background: linear-gradient(var(--btn-a), var(--btn-b));
  border: 1px solid var(--edge);
  border-radius: 7px;
  box-shadow: inset 0 1px 0 var(--light), 0 1px 0 rgba(0, 0, 0, .12);
  cursor: default;
}

button:active:not(:disabled) {
  background: linear-gradient(var(--btn-press-a), var(--btn-press-b));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25);
}

button:disabled { color: var(--ink-dim); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Кнопка по умолчанию обведена, как в Mac OS. */
button.default {
  box-shadow: inset 0 1px 0 var(--light), 0 0 0 2px var(--edge), 0 1px 0 rgba(0, 0, 0, .12);
  font-weight: bold;
}

input[type=text], input[type=password] {
  font: inherit;
  padding: 3px 5px;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 2px;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .15);
  outline: none;
  width: 100%;
}

input:focus { border-color: var(--accent); box-shadow: inset 1px 1px 0 rgba(0,0,0,.15), 0 0 0 2px var(--focus-ring); }
label { user-select: none; }

/* ------------------------------------------------------------------ диспетчер файлов */

.drivebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  background: linear-gradient(var(--face), var(--face-dim));
  border-bottom: 1px solid var(--shadow);
  user-select: none;
  flex: none;
}

.drive {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 5px;
  border: 1px solid var(--shadow-deep);
  border-radius: 4px;
  background: linear-gradient(var(--strip-a), var(--strip-b));
}

.drivebar .path { margin-left: auto; color: var(--ink-soft); }

.toolbtn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 22px;
  border: 1px solid var(--edge);
  border-radius: 5px;
  background: linear-gradient(var(--btn-a), var(--btn-b));
  box-shadow: inset 0 1px 0 var(--light);
  cursor: default;
}

.toolbtn:active { background: linear-gradient(var(--btn-press-a), var(--btn-press-b)); }

.toolbtn.on {
  background: linear-gradient(var(--btn-press-a), var(--btn-press-b));
  box-shadow: inset 0 1px 2px var(--shadow-deep);
}

.toolgroup { display: flex; gap: 2px; }

.panes {
  flex: 1;
  display: flex;
  gap: 6px;
  padding: 6px;
  min-height: 0;
}

.tree {
  width: 184px;
  flex: none;
  overflow: auto;
  padding: 4px 2px;
  user-select: none;
  border-radius: 2px;
}

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

.tree .node.active { background: var(--sel); }

.listwrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 2px;
  overflow: hidden;
}

.listwrap.dragover { outline: 2px solid var(--accent); outline-offset: -3px; }

.listhead {
  display: flex;
  background: linear-gradient(var(--light), var(--face-dim));
  border-bottom: 1px solid var(--shadow-deep);
  user-select: none;
  flex: none;
}

.listhead span {
  padding: 3px 6px;
  border-right: 1px solid var(--line);
  overflow: hidden;
  white-space: nowrap;
  font-weight: bold;
}

.rows { flex: 1; overflow: auto; background: var(--paper); }

.row {
  display: flex;
  align-items: center;
  white-space: nowrap;
  cursor: default;
  border-bottom: 1px solid var(--line-soft);
}

.row > span { padding: 3px 6px; overflow: hidden; text-overflow: ellipsis; }
.row.selected { background: var(--sel); }
.row .name { display: flex; align-items: center; gap: 6px; }

.col-name { flex: 1; min-width: 0; }
.col-size { width: 92px; text-align: right; flex: none; }
.col-date { width: 132px; flex: none; }
.col-user { width: 110px; flex: none; overflow: hidden; text-overflow: ellipsis; }

.empty { padding: 16px; color: var(--ink-dim); }

/* Вид «Как значки»: сетка плиток, у картинок вместо значка — миниатюра. */
.iconview .listhead { display: none; }

.iconview .rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  align-content: start;
  gap: 4px;
  padding: 8px;
}

.iconview .empty { grid-column: 1 / -1; }

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  border-radius: 3px;
  cursor: default;
  user-select: none;
  min-width: 0;
}

.tile-art {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 3px;
}

.tile-art svg { width: 40px; height: 40px; }

.tile-art .thumb {
  max-width: 80px;
  max-height: 80px;
  object-fit: contain;
  background: var(--paper-alt);
  border: 1px solid var(--line-strong);
  box-shadow: 1px 1px 0 var(--line);
}

.tile-name {
  max-width: 100%;
  padding: 0 4px;
  border-radius: 2px;
  font-size: 11px;
  line-height: 14px;
  text-align: center;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.tile.selected .tile-art { background: var(--sel); }
.tile.selected .tile-name { background: var(--sel-menu); color: var(--on-sel); }

.statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  flex: none;
  background: linear-gradient(var(--face), var(--face-dim));
  border-top: 1px solid var(--shadow);
}

.statusbar span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink-soft);
}

.statusbar .grow { flex: 1; }

/* ------------------------------------------------------------------ диалоги */

.dialog-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.dialog-row { display: flex; gap: 14px; align-items: flex-start; }
.dialog-buttons { display: flex; gap: 10px; justify-content: flex-end; padding-top: 2px; }
.field { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 6px; }
.error { color: var(--warn); min-height: 15px; }
.hint { color: var(--accent); }

/* Полосатый индикатор выполнения. */
.gauge {
  height: 16px;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 2px;
  display: flex;
  gap: 0;
  overflow: hidden;
}

.gauge i {
  flex: none;
  width: 10px;
  background: repeating-linear-gradient(-45deg, var(--gauge-a) 0 4px, var(--gauge-b) 4px 8px);
}

.gauge i:first-child { border-radius: 6px 0 0 6px; }

/* ------------------------------------------------------------------ блокнот */

.editor { flex: 1; display: flex; flex-direction: column; padding: 6px; min-height: 0; }

.editor textarea {
  flex: 1;
  min-height: 0;
  font-family: Monaco, "Courier New", Courier, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 2px;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .15);
  padding: 5px 6px;
  resize: none;
  outline: none;
  white-space: pre;
  overflow: auto;
  tab-size: 4;
}

.editor textarea.wrap { white-space: pre-wrap; word-break: break-word; }

/* ------------------------------------------------------------------ калькулятор */

.calc { flex: 1; display: flex; flex-direction: column; gap: 7px; padding: 9px; min-height: 0; }

.calc-display {
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .15);
  padding: 4px 8px;
  text-align: right;
  font-family: Monaco, "Courier New", monospace;
  font-size: 16px;
  line-height: 20px;
  height: 28px;
  overflow: hidden;
  white-space: nowrap;
}

.calc-top { display: flex; gap: 5px; align-items: stretch; }

.calc-mem {
  width: 26px;
  display: grid;
  place-items: center;
  font-weight: bold;
  color: var(--warn);
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 3px;
}

.calc-keys {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 1fr;
  gap: 5px;
  min-height: 0;
}

.calc-key { min-width: 0; padding: 2px; border-radius: 6px; }
.calc-key.op { color: var(--accent); font-weight: bold; }
.calc-key.mem { color: var(--hint); }
.calc-key.red { color: var(--warn); }
.calc-top .calc-key { flex: 1; }
.calc-top .calc-key.wide { flex: 2; }

/* ------------------------------------------------------------------ календарь */

.cal-head { display: flex; align-items: center; gap: 8px; padding: 8px 9px 4px; }
.cal-title { flex: 1; text-align: center; font-weight: bold; font-size: 13px; }
button.cal-nav { min-width: 30px; padding: 2px 8px; }
button.cal-today { min-width: 74px; padding: 2px 10px; }

.calendar { flex: 1; display: flex; padding: 4px 9px 8px; min-height: 0; }

.cal-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--edge);
  border-radius: 2px;
  overflow: hidden;
}

.cal-dow {
  display: grid;
  place-items: center;
  font-weight: bold;
  background: linear-gradient(var(--light), var(--face-dim));
}

.cal-day { display: grid; place-items: center; cursor: default; user-select: none; background: var(--paper); }
.cal-day.other { color: var(--ink-dim); }
.cal-day.today { font-weight: bold; color: var(--warn); }
.cal-day.picked { background: var(--sel); }

/* ------------------------------------------------------------------ часы */

.clock { flex: 1; display: grid; place-items: center; padding: 10px; min-height: 0; }
.clock svg { width: 100%; height: 100%; max-width: 200px; max-height: 200px; }

.clock-time {
  font-family: Monaco, "Courier New", monospace;
  font-size: 34px;
  font-weight: bold;
  color: var(--accent);
  text-align: center;
}

.clock-date { text-align: center; margin-top: 8px; color: var(--ink-soft); }

/* ------------------------------------------------------------------ просмотр рисунков */

.viewer { flex: 1; display: flex; padding: 6px; min-height: 0; }

.viewer-canvas {
  flex: 1;
  display: grid;
  place-items: center;
  overflow: auto;
  background: var(--canvas);
  border-radius: 2px;
  min-height: 0;
  min-width: 0;
}

.viewer-canvas img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background:
    linear-gradient(45deg, var(--check) 25%, transparent 25%, transparent 75%, var(--check) 75%),
    linear-gradient(45deg, var(--check) 25%, transparent 25%, transparent 75%, var(--check) 75%),
    var(--paper);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}

/* ------------------------------------------------------------------ просмотр PDF */

.pdfview {
  flex: 1;
  display: flex;
  margin: 6px;
  overflow: hidden;
  background: var(--canvas);
  border-radius: 2px;
  min-height: 0;
  min-width: 0;
}

.pdf-frame { flex: 1; border: none; background: var(--canvas); min-height: 0; min-width: 0; }

/* ------------------------------------------------------------------ таблица */

.csvwrap { flex: 1; overflow: auto; background: var(--paper); min-height: 0; min-width: 0; }

table.csv {
  border-collapse: collapse;
  font: inherit;
  white-space: nowrap;
}

table.csv th, table.csv td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-soft);
  padding: 3px 8px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.csv thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(var(--head-a), var(--head-b));
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
  font-weight: bold;
  cursor: default;
  user-select: none;
}

table.csv thead th:hover { background: linear-gradient(var(--btn-a), var(--head-a)); }

table.csv th.num, table.csv td.num { text-align: right; font-variant-numeric: tabular-nums; }

table.csv tbody tr:nth-child(even) { background: var(--paper-alt); }
table.csv tbody tr:hover { background: var(--sel); }

table.csv .csv-num {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 1%;
  text-align: right;
  color: var(--hint);
  background: var(--paper-alt);
  border-right: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

table.csv thead .csv-num { z-index: 2; }
table.csv td.picked { background: var(--sel-menu); color: var(--on-sel); }

/* ------------------------------------------------------------------ внешний вид */

.th-row { gap: 10px; padding: 7px 8px; white-space: normal; }
.th-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.th-name { font-weight: bold; }
.th-about { color: var(--hint); }
/* На выделенной строке серая подпись тонет — берём основные чернила. */
.row.selected .th-about { color: var(--ink-soft); }

.th-swatch {
  flex: none;
  width: 76px;
  padding: 4px;
  background: var(--desk);
  border: 1px solid var(--frame);
  border-radius: 2px;
}

.th-win {
  border: 1px solid var(--frame);
  background: var(--face);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .35);
}

.th-bar {
  height: 8px;
  background: repeating-linear-gradient(var(--title-stripe-a) 0 1px, var(--title-stripe-b) 1px 2px);
  border-bottom: 1px solid var(--title-edge);
}

.th-body {
  padding: 4px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.th-line { height: 3px; background: var(--line); }
.th-line.sel { background: var(--sel-menu); }

/* ------------------------------------------------------------------ изменение размера окна */

.window .rz { position: absolute; z-index: 5; }
.rz-n { top: -2px; left: 8px; right: 8px; height: 5px; cursor: ns-resize; }
.rz-s { bottom: -2px; left: 8px; right: 8px; height: 5px; cursor: ns-resize; }
.rz-e { right: -2px; top: 8px; bottom: 8px; width: 5px; cursor: ew-resize; }
.rz-w { left: -2px; top: 8px; bottom: 8px; width: 5px; cursor: ew-resize; }
.rz-ne { right: -2px; top: -2px; width: 12px; height: 12px; cursor: nesw-resize; }
.rz-nw { left: -2px; top: -2px; width: 12px; height: 12px; cursor: nwse-resize; }
.rz-se { right: -2px; bottom: -2px; width: 14px; height: 14px; cursor: nwse-resize; }
.rz-sw { left: -2px; bottom: -2px; width: 12px; height: 12px; cursor: nesw-resize; }

/* Уголок изменения размера рисуется, как в Mac OS. */
.window .rz-se::after {
  content: '';
  position: absolute;
  right: 3px; bottom: 3px;
  width: 8px; height: 8px;
  background:
    linear-gradient(135deg, transparent 0 45%, var(--hint) 45% 55%, transparent 55%),
    linear-gradient(135deg, transparent 0 70%, var(--hint) 70% 80%, transparent 80%);
}

body.resizing { user-select: none; }

svg { display: block; }

/* ------------------------------------------------------------------ погода */

.mb-spacer { flex: 1; }
.mb-weather { gap: 4px; }
.mb-weather .mb-art { display: inline-block; width: 15px; height: 15px; }
.mb-weather .mb-art svg { width: 15px; height: 15px; }
.mb-clock { margin-left: 0; }

.weather {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-height: 0;
  overflow: auto;
}

.w-place { font-weight: bold; font-size: 13px; }
.w-place span { font-weight: normal; color: var(--hint); }

.w-now { display: flex; align-items: center; gap: 14px; }
.w-art { width: 66px; height: 66px; flex: none; }
.w-art svg { width: 100%; height: 100%; }
.w-temp { font-size: 30px; font-weight: bold; line-height: 1.05; }
.w-text { margin-top: 2px; }
.w-feels { color: var(--hint); }

.w-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  padding: 8px 10px;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .12);
}

.w-cell { display: flex; justify-content: space-between; gap: 8px; }
.w-key { color: var(--hint); }

/* цикл восход-закат: дуга неба на той же белой карточке, что и подробности */
.w-sun {
  padding: 6px 8px 4px;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .12);
}

.w-sun-art { line-height: 0; }
.w-sun-art svg { display: block; width: 100%; height: auto; }
.w-sun-foot { display: flex; justify-content: space-between; gap: 8px; }

.w-days { display: flex; gap: 4px; }

.w-day {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 5px 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: linear-gradient(var(--card-a), var(--card-b));
}

.w-day.today { border-color: var(--edge); background: linear-gradient(var(--card-a), var(--card-hi)); }
.w-dow { font-size: 11px; color: var(--hint); }
.w-mini { height: 26px; }
.w-mini svg { width: 100%; height: 100%; }
.w-range { font-weight: bold; }
.w-range.dim { font-weight: normal; color: var(--hint); }

.w-updated { margin-top: auto; color: var(--hint); font-size: 11px; }

/* ------------------------------------------------------------------ записки */

.window.sticky {
  border: 1px solid var(--note-edge, #b8b84e);
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .18), 3px 4px 9px rgba(0, 0, 0, .22);
  min-width: 140px;
}

.window.sticky .titlebar.sticky-bar {
  height: 14px;
  padding: 0 3px;
  gap: 3px;
  background: var(--note-bar, #f0f07a);
  border-bottom: 1px solid rgba(0, 0, 0, .15);
  font-weight: normal;
}

.window.sticky.inactive .titlebar.sticky-bar { background: var(--note-bar, #f0f07a); }
.window.sticky.inactive .macbtn { visibility: visible; }

.window.sticky .macbtn {
  width: 9px;
  height: 9px;
  border-radius: 1px;
  border-color: rgba(0, 0, 0, .45);
  background: linear-gradient(#ffffff, #dcdcc0);
}

.window.sticky .macbtn.shade::after { top: 3px; }
.window.sticky .frame { border-top: none; }
.window.sticky .cap-wrap { flex: 1; }

.note-body { flex: 1; display: flex; padding: 4px 6px 7px; min-height: 0; }

.note-body textarea {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-family: Geneva, Charcoal, "Lucida Grande", Helvetica, sans-serif;
  font-size: 12px;
  line-height: 1.4;
  color: #33322a;
  padding: 0;
  overflow: auto;
}

.window.sticky.note-yellow { background: #fdfd96; --note-bar: #f2f279; --note-edge: #b3b34a; }
.window.sticky.note-pink   { background: #ffd3e2; --note-bar: #ffbdd4; --note-edge: #c98da2; }
.window.sticky.note-green  { background: #cdf5c0; --note-bar: #b6eca4; --note-edge: #83b573; }
.window.sticky.note-blue   { background: #cfe6ff; --note-bar: #b7d8ff; --note-edge: #7ba3cf; }
.window.sticky.note-purple { background: #e6d9ff; --note-bar: #d8c6ff; --note-edge: #a48fcd; }
.window.sticky.note-grey   { background: #ececec; --note-bar: #dedede; --note-edge: #a8a8a8; }

/* ------------------------------------------------------------------ проигрыватель */

.player {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 10px;
  min-height: 0;
}

.pl-now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pl-art { width: 44px; height: 44px; flex: none; display: grid; place-items: center; }
.pl-art svg { width: 100%; height: 100%; }

.pl-title {
  font-weight: bold;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-sub { color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pl-time { display: flex; align-items: center; gap: 8px; }
.pl-time > span { width: 38px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.pl-time > span:last-child { text-align: right; }

.slider { position: relative; flex: 1; height: 14px; cursor: default; user-select: none; }

.slider::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 5px;
  height: 4px;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 2px;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .18);
}

.sl-fill {
  position: absolute;
  left: 1px; top: 6px;
  height: 3px;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
}

.sl-knob {
  position: absolute;
  top: 0;
  left: 0;
  width: 11px;
  height: 14px;
  margin-left: -5px;
  background: linear-gradient(var(--btn-a), var(--btn-b));
  border: 1px solid var(--edge);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 var(--light);
}

.pl-controls { display: flex; align-items: center; gap: 6px; }
button.pl-btn { min-width: 42px; padding: 3px 8px; font-size: 13px; line-height: 1.1; }
.pl-vol-label { margin-left: auto; color: var(--hint); }
.pl-volume { flex: none; width: 86px; }
.pl-list { flex: 1; min-height: 0; }

/* ------------------------------------------------------------------ события календаря */

.calendar { flex: 3 1 0; min-height: 150px; }
.cal-day { position: relative; }
.cal-day > span { line-height: 1; }

.cal-dot {
  position: absolute;
  bottom: 3px;
  left: 50%;
  margin-left: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-day.picked .cal-dot { background: var(--accent-deep); }
.cal-day.today .cal-dot { background: var(--warn); }

.cal-events {
  flex: 2 1 0;
  min-height: 70px;
  margin: 0 9px 4px;
  border-radius: 2px;
  overflow: hidden;
}

.cal-events .row { align-items: baseline; }
.ev-time { width: 46px; flex: none; padding: 3px 6px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ev-note { padding: 3px 6px; color: var(--hint); }

.field-top { align-items: start; }

textarea.dlg-text {
  font: inherit;
  min-height: 64px;
  padding: 4px 6px;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 2px;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .15);
  outline: none;
  resize: none;
  width: 100%;
}

/* ------------------------------------------------------------------ перенос и выделение */

.row { user-select: none; }

.row.droptarget,
.tile.droptarget,
.tree .node.droptarget {
  background: var(--drop);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.row.selected.droptarget,
.tile.selected.droptarget { background: var(--drop-strong); }

/* ------------------------------------------------------------------ справочник vPIC */

.vp-top {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 6px 5px;
  background: linear-gradient(var(--light), var(--face));
  border-bottom: 1px solid var(--shadow);
}

/* Разделы справочника — закладки, как в диалогах Mac OS 8. */
.vp-tabs { display: flex; gap: 3px; flex-wrap: wrap; }

.vp-tab {
  padding: 2px 11px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: linear-gradient(var(--btn-a), var(--btn-b));
  box-shadow: inset 0 1px 0 var(--light);
  cursor: default;
  user-select: none;
}

.vp-tab:active { background: linear-gradient(var(--btn-press-a), var(--btn-press-b)); }

.vp-tab.on {
  background: linear-gradient(var(--btn-press-a), var(--btn-press-b));
  box-shadow: inset 0 1px 2px var(--shadow-deep);
  font-weight: bold;
}

.vp-search { display: flex; gap: 6px; align-items: center; }
.vp-search .vp-query { flex: 1; min-width: 0; }
.vp-search .vp-year { flex: none; width: 62px; text-align: center; }
.vp-search button { min-width: 0; padding: 3px 12px; flex: none; }

.vp-body {
  flex: 1;
  overflow: auto;
  margin: 6px;
  min-height: 0;
  border-radius: 2px;
}

/* Таблица выдачи: ширины столбцов задаёт сервер, текст переносится —
   в описаниях и списках заводов строки бывают длинные. */
table.vp-table {
  width: 100%;
  border-collapse: collapse;
  font: inherit;
  table-layout: fixed;
}

table.vp-table th, table.vp-table td {
  padding: 3px 8px;
  text-align: left;
  vertical-align: top;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
}

table.vp-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(var(--head-a), var(--head-b));
  border-bottom: 1px solid var(--line-strong);
  font-weight: bold;
  cursor: default;
  user-select: none;
}

table.vp-table th.num, table.vp-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.vp-table tbody tr:nth-child(even) { background: var(--paper-alt); }
table.vp-table tbody tr:hover { background: var(--card-hi); }
table.vp-table tbody tr.sel { background: var(--sel); }
table.vp-table tbody tr.can-open td:first-child { font-weight: bold; }

.vp-card { display: flex; flex-direction: column; }

/* Сам номер — крупно и моноширинно: его сверяют по знакам. */
.vp-vin {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: linear-gradient(var(--card-a), var(--card-b));
  border-bottom: 1px solid var(--line);
}

.vp-vin-code {
  font-family: Monaco, "Courier New", monospace;
  font-size: 17px;
  letter-spacing: 1.5px;
  color: var(--accent-deep);
}

.vp-vin.bad .vp-vin-code { color: var(--warn); }
.vp-vin-note { color: var(--hint); }

.vp-warn {
  padding: 7px 10px;
  color: var(--warn);
  background: var(--paper-alt);
  border-bottom: 1px solid var(--line);
}

.vp-warn.big { border: none; background: none; padding: 16px; }

.vp-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--line-soft);
}

.vp-fact {
  display: flex;
  gap: 8px;
  padding: 3px 9px;
  background: var(--paper);
  min-width: 0;
}

.vp-fact-k { color: var(--hint); flex: none; min-width: 96px; }
.vp-fact-v { overflow-wrap: anywhere; }

/* По подчёркнутому значению можно уйти в поиск того же в справочнике. */
.vp-jump { color: var(--accent); text-decoration: underline; cursor: default; }
.vp-jump:hover { color: var(--accent-deep); }

.vp-descriptor { padding: 5px 10px; color: var(--hint); border-bottom: 1px solid var(--line-soft); }

.vp-group {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 3px 10px;
  font-weight: bold;
  background: linear-gradient(var(--strip-a), var(--strip-b));
  border-top: 1px solid var(--shadow);
  border-bottom: 1px solid var(--line-strong);
  user-select: none;
}

/* В карточке липкая строка одна — название раздела; шапки таблиц под ней
   стоят на месте, иначе две липкие строки налезают друг на друга. */
.vp-card table.vp-table thead th { position: static; }

.vp-title { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; }
.vp-title-main { font-size: 15px; font-weight: bold; }
.vp-title-sub { color: var(--hint); }

.vp-stat-db { color: var(--hint); }

/* ------------------------------------------------------------------ избранное */

/* Звёздочка стоит рядом с именем и не мешает обрезке длинных названий. */
.fav-star {
  flex: none;
  margin-left: 5px;
  color: #d9a318;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .12);
  font-size: 12px;
  line-height: 1;
}

/* На плитке звезда садится в угол значка. */
.tile-art { position: relative; }

.tile-art .fav-star {
  position: absolute;
  right: 2px;
  bottom: 2px;
  margin: 0;
  font-size: 14px;
}

/* Отметка на исчезнувший файл: видно, что она есть, но толку от неё нет. */
.row.gone .col-name,
.row.gone .col-date { color: var(--ink-dim); font-style: italic; }
.row.gone.selected .col-name,
.row.gone.selected .col-date { color: var(--ink-soft); }

/* ------------------------------------------------------------------ дерево: раскрытие ветвей */

/* Треугольник в стиле Mac OS: вправо — свёрнуто, вниз — раскрыто.
   Рисуем рамками, чтобы не зависеть от шрифта и его глифов. */
.tree .twist {
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: -1px;
  position: relative;
  cursor: default;
}

.tree .twist:not(.blank)::before {
  content: '';
  position: absolute;
  left: 1px;
  top: 0;
  border: 4.5px solid transparent;
  border-left-color: var(--ink-soft);
  transform-origin: 3px 4.5px;
  transition: transform .08s linear;
}

.tree .twist.open::before { transform: rotate(90deg); }

/* На выделенной ветви треугольник не должен теряться. */
.tree .node.active .twist::before { border-left-color: var(--ink); }
