/*
 * Ретро-стиль exchanger — «японская техника 80-х» (решено 08.11).
 * Набор деталей для всех моих страниц: клавиши, кнопки с фиксацией, лампочки,
 * зелёные экранчики, лотки (сообщения выезжают снизу), верхнее меню.
 *
 * Шрифты лежат на своём сервере (assets/fonts), лицензия SIL OFL 1.1 — тексты лицензий рядом.
 * Значки — Lucide (ISC).
 */

@font-face { font-family: "Michroma"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/michroma-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Michroma"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/michroma-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Share Tech Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/share-tech-mono-latin.woff2) format("woff2"); }

:root {
  --h-body: #d9d4c7;      /* корпус */
  --h-plate: #e9e5da;     /* панель */
  --h-tray: #cdc7b9;      /* лоток */
  --h-dark: #2b2b2d;      /* тёмный пластик, текст */
  --h-orange: #ef6b1f;
  --h-edge: #8f897c;
  --h-mute: #6c675d;
  --h-lcd: #b6c79a;       /* зелёный экранчик */
  --h-lcd-ink: #26321a;
  --lamp-off: #8f8a7f;
  --lamp-green: #4ccf5a;
  --lamp-yellow: #f5c518;
  --lamp-orange: #ff8a2a;
  --lamp-red: #e5412d;
  --lamp-blue: #3fa9ff;
  --f-wide: "Michroma", "Eurostile", "Arial Black", sans-serif;
  --f-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: "Share Tech Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, .61, .36, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
body.retro-page {
  margin: 0; color: var(--h-dark); font: 15px/1.5 var(--f-body);
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.025) 0 1px, transparent 1px 3px), var(--h-body);
  min-height: 100vh; -webkit-text-size-adjust: 100%;
}
.r-wrap { max-width: 1000px; margin: 0 auto; padding-block: 22px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 16px; }
.ico { width: 16px; height: 16px; flex: none; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--h-orange); outline-offset: 3px; }
code { font-family: var(--f-mono); font-size: .95em; }

/* ---------- верх: логотип и меню ---------- */
/* шапка + общие сообщения: лоток выезжает прямо из-под чёрной линии */
.r-head { display: grid; }
.r-head > .drawer .tray { margin: 0 12px; border-top: 0; }
.r-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px; border-bottom: 2px solid var(--h-dark); padding-bottom: 12px; }
.r-logo { display: flex; align-items: center; gap: 10px; font-family: var(--f-wide); letter-spacing: .18em; font-size: 16px; color: inherit; text-decoration: none; }
.stripes { display: inline-block; width: 46px; height: 12px; flex: none;
  background: linear-gradient(var(--h-orange) 0 3px, transparent 3px 4.5px, #f2a33a 4.5px 7.5px, transparent 7.5px 9px, #e8c547 9px); }
.r-nav { display: flex; gap: 8px 22px; align-items: center; flex-wrap: wrap; }
.r-nav a { color: #5f5b54; text-decoration: none; font-family: var(--f-wide); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; transition: color .2s; }
.r-nav a:hover { color: var(--h-dark); }
.r-nav a.on { color: var(--h-orange); }
/* пункт меню, которого ещё нет (Weddings, решено 08.11): серый, не нажимается */
.r-nav .off { color: #a39d90; font-family: var(--f-wide); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; cursor: default; }
/* логотип + чья страница */
.r-brand { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; min-width: 0; }
.r-who { font-family: var(--f-wide); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--h-mute);
  border-left: 1px solid var(--h-edge); padding-left: 12px; overflow-wrap: anywhere; }
/* я зашёл в чужой аккаунт: оранжевая полоска сверху (решено 08.11) */
.r-imp { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 10px 14px; border-radius: 3px;
  background: linear-gradient(#f58a45, var(--h-orange)); color: #fff; border: 1px solid #a9440f; box-shadow: 0 2px 0 #a9440f; font-weight: 600; }
.r-imp .key { margin-bottom: 4px; }
.rec { display: inline-flex; align-items: center; gap: 7px; font-family: var(--f-wide); font-size: 10px; letter-spacing: .16em; color: var(--h-mute); }
.rec::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--lamp-off); box-shadow: inset 0 1px 2px rgba(0,0,0,.35); }
.rec.on { color: #b8321e; }
.rec.on::before { background: var(--lamp-red); box-shadow: 0 0 8px var(--lamp-red); animation: r-pulse 1.6s ease-in-out infinite; }
.rec.hold::before { background: var(--lamp-red); opacity: .45; }
@keyframes r-pulse { 50% { opacity: .2; box-shadow: none; } }

/* ---------- подписи, панели, экранчики ---------- */
.r-lbl { font-family: var(--f-wide); font-size: 10px; letter-spacing: .2em; color: var(--h-mute); text-transform: uppercase; }
.r-h { font-family: var(--f-wide); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; margin: 6px 0 0; font-weight: 400; color: var(--h-mute); }
.plate { position: relative; z-index: 1; background: var(--h-plate); border: 1px solid #a9a395; border-radius: 3px;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #b8b2a4; padding: 14px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.plate.accent { border-top: 4px solid var(--h-orange); }
.plate.add { background: transparent; border-style: dashed; box-shadow: none; color: var(--h-mute); place-content: center; justify-items: center; gap: 6px;
  min-height: 130px; text-align: center; width: 100%; font: inherit; color: var(--h-mute); }
.plate.add:hover { color: var(--h-dark); border-color: var(--h-dark); }
.plate.add.open { border-style: solid; color: var(--h-dark); }
.unit { display: grid; min-width: 0; align-content: start; }
.p-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.p-name { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.p-sub { font-size: 12px; color: var(--h-mute); }
.p-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.push-right { margin-left: auto; }
.lcd { font-family: var(--f-mono); font-size: 13px; background: var(--h-lcd); color: var(--h-lcd-ink); padding: 4px 8px; border-radius: 2px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.3); font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; text-transform: uppercase; }
/* экранчик в две части: слева — значение, справа — лимит */
.lcd.split { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 10px; }
.lcd .lim { white-space: nowrap; }
/* «no limit» подсвечен — как инверсный сегмент на экранчике (решено 08.11) */
.lcd .lim.none { background: var(--h-lcd-ink); color: #d7f0a8; padding: 0 6px; border-radius: 2px; text-shadow: 0 0 6px rgba(190, 255, 120, .55); }
.lcd.warn { background: #e7c27a; color: #3b2a06; }
.lcd.full { background: #e3907a; color: #3b0d06; }
/* экранчик, который нажимается (решено 08.11): цвет экранчика, но с краем и тенью клавиши */
.lcd-key { font: inherit; font-family: var(--f-mono); font-size: 13px; line-height: 1.3; cursor: pointer; border: 1px solid rgba(0,0,0,.28);
  box-shadow: 0 3px 0 rgba(0,0,0,.28), 0 4px 5px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.4);
  transition: transform 70ms, box-shadow 70ms, filter .2s; margin-bottom: 3px; -webkit-tap-highlight-color: transparent; }
.lcd-key:hover { filter: brightness(1.05); }
.lcd-key.pr { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.28), inset 0 1px 3px rgba(0,0,0,.25); }
/* с фиксацией: нажат, пока открыт его лоток, и светится чуть ярче (решено 08.11) */
.lcd-key.down, .lcd-key.down:hover { transform: translateY(2px); filter: brightness(1.13) saturate(1.08); text-shadow: 0 0 5px rgba(255,255,255,.45);
  box-shadow: 0 1px 0 rgba(0,0,0,.28), inset 0 1px 3px rgba(0,0,0,.2), 0 0 11px rgba(200, 255, 140, .6); }
.lcd-key.warn.down { box-shadow: 0 1px 0 rgba(0,0,0,.28), inset 0 1px 3px rgba(0,0,0,.2), 0 0 11px rgba(255, 210, 110, .65); }
.lcd-key.full.down { box-shadow: 0 1px 0 rgba(0,0,0,.28), inset 0 1px 3px rgba(0,0,0,.2), 0 0 11px rgba(255, 140, 110, .6); }
.r-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.note { font-size: 12.5px; color: var(--h-mute); margin: 0; max-width: 70ch; }
.note b { color: var(--h-dark); font-weight: 600; }

/* тёмная панель с полоской (место на диске) */
.r-panel { position: relative; z-index: 1; background: var(--h-dark); color: #e9e5da; padding: 12px 14px; border-radius: 4px; display: grid; gap: 8px; }
.r-panel .r-lbl { color: #9d998f; }
.r-bar { background: #1b1b1c; height: 10px; position: relative; overflow: hidden; }
.r-bar i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, #f2a33a 0 6px, transparent 6px 8px); transition: width .6s var(--ease); }
.r-bar.warn i { background: repeating-linear-gradient(90deg, #ffcf4a 0 6px, transparent 6px 8px); }
.r-bar.full i { background: repeating-linear-gradient(90deg, var(--lamp-red) 0 6px, transparent 6px 8px); }
.r-nums { font-family: var(--f-mono); font-size: 14px; color: #f2a33a; font-variant-numeric: tabular-nums; }
.r-nums b { color: #ffd08a; font-weight: 400; }
.r-nums .lim.none { background: #f2a33a; color: var(--h-dark); padding: 0 6px; border-radius: 2px; }
.r-panel .warnline { font-family: var(--f-mono); font-size: 13px; color: #ffcf4a; }
.r-panel .warnline.full { color: #ff8b78; }

/* ---------- клавиша: нажимается и поднимается ---------- */
.key { border: 1px solid var(--h-edge); border-radius: 3px; padding: 8px 14px; font-size: 13px; line-height: 1.2; color: var(--h-dark); text-decoration: none;
  background: linear-gradient(#f6f3ec, #d3cec2); box-shadow: 0 4px 0 var(--h-edge), 0 5px 6px rgba(0,0,0,.16);
  transition: transform 70ms, box-shadow 70ms; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; margin-bottom: 4px; }
.key.pr { transform: translateY(3px); box-shadow: 0 1px 0 var(--h-edge), 0 1px 2px rgba(0,0,0,.2); }
.key.or { background: linear-gradient(#f58a45, var(--h-orange)); color: #fff; border-color: #a9440f; box-shadow: 0 4px 0 #a9440f, 0 5px 6px rgba(0,0,0,.16); font-weight: 600; }
.key.or.pr { box-shadow: 0 1px 0 #a9440f; }
.key.sm { padding: 5px 10px; font-size: 12.5px; box-shadow: 0 3px 0 var(--h-edge), 0 4px 5px rgba(0,0,0,.14); margin-bottom: 3px; }
.key.sm.pr { transform: translateY(2px); box-shadow: 0 1px 0 var(--h-edge); }
.key.red { color: #9b2a17; }
/* «Power»-клавиша: серая и неактивная, пока нельзя; когда можно — загорается тёплым светом (решено 08.11) */
.key.power { transition: transform 70ms, box-shadow .45s var(--ease), background .45s var(--ease), color .45s var(--ease), border-color .45s; }
.key.power:not(:disabled) { box-shadow: 0 3px 0 #a9440f, 0 0 14px rgba(255, 138, 42, .55), inset 0 1px 0 rgba(255, 230, 190, .55); }
.key.power:not(:disabled).pr { box-shadow: 0 1px 0 #a9440f, 0 0 10px rgba(255, 138, 42, .45); }
.key.power:disabled { opacity: 1; background: rgba(255, 255, 255, .22); color: rgba(43, 43, 45, .38); border-color: rgba(143, 137, 124, .45); font-weight: 400;
  box-shadow: 0 3px 0 rgba(143, 137, 124, .3); }

/* тёмная клавиша — для второго, «запасного» действия рядом с оранжевой (решено 08.11) */
.key.dark { background: linear-gradient(#4a4a4d, #2b2b2d); color: #e9e5da; border-color: #1b1b1c; box-shadow: 0 4px 0 #121213, 0 5px 6px rgba(0,0,0,.2); }
.key.dark.pr { box-shadow: 0 1px 0 #121213; }

/* кнопка на всю ширину */
.wide-btn { width: 100%; justify-content: center; }
.key:disabled { opacity: .5; }
.key:disabled.pr { transform: none; }

/* ---------- кнопка с фиксацией: полоска-лампочка сверху ---------- */
.latch { display: inline-grid; justify-items: center; gap: 6px; padding: 9px 16px 7px; border: 1px solid #1b1b1c; border-radius: 2px;
  background: linear-gradient(#4a4a4d, #2b2b2d); color: #e9e5da; font-family: var(--f-wide); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  box-shadow: 0 5px 0 #121213, 0 6px 8px rgba(0,0,0,.25); transition: transform 90ms, box-shadow 90ms; white-space: nowrap; margin-bottom: 5px; }
.latch.sm { padding: 7px 12px 5px; gap: 5px; font-size: 9px; box-shadow: 0 4px 0 #121213, 0 5px 6px rgba(0,0,0,.22); margin-bottom: 4px; }
.latch .led { width: 22px; height: 4px; border-radius: 2px; background: #5d5a54; transition: background .2s, box-shadow .2s; }
.latch.sm .led { width: 16px; height: 3px; }
.latch.down { transform: translateY(4px); box-shadow: 0 1px 0 #121213, inset 0 2px 4px rgba(0,0,0,.5); }
.latch.pr:not(.down) { transform: translateY(5px); box-shadow: 0 0 0 #121213; }
.latch.down .led { background: var(--lamp-green); box-shadow: 0 0 8px var(--lamp-green); }
.latch.yellow.down .led { background: var(--lamp-yellow); box-shadow: 0 0 9px var(--lamp-yellow); }
.latch.orange.down .led { background: var(--lamp-orange); box-shadow: 0 0 9px var(--lamp-orange); }
.latch:disabled { opacity: .5; }
/* светлый рычаг (как клавиша, но с фиксацией и лампочкой) */
.latch.light { background: linear-gradient(#f6f3ec, #d3cec2); color: var(--h-dark); border-color: var(--h-edge); font-size: 10px;
  box-shadow: 0 5px 0 var(--h-edge), 0 6px 8px rgba(0,0,0,.16); }
.latch.light .led { background: #b5afa2; }
.latch.light.down .led { background: var(--lamp-green); box-shadow: 0 0 8px var(--lamp-green); }
.latch.light.down { box-shadow: 0 1px 0 var(--h-edge), inset 0 2px 4px rgba(0,0,0,.22); }
.latch.light.pr:not(.down) { box-shadow: 0 0 0 var(--h-edge); }

/* кнопки карточки: Active и Settings рядом одной высоты, под ними — во всю их ширину (решено 08.11) */
.ctl { display: inline-grid; grid-template-columns: repeat(2, minmax(118px, 1fr)); gap: 6px 8px; justify-self: center; max-width: 100%; }
.ctl > form { margin: 0; display: grid; min-width: 0; }
.ctl .latch, .ctl .key { width: 100%; justify-content: center; }
.ctl .wide { grid-column: 1 / -1; }

/* ---------- лампочка рядом с клавишей (Link, Copy) ---------- */
.lamp { width: 11px; height: 11px; border-radius: 50%; background: var(--lamp-off); box-shadow: inset 0 1px 2px rgba(0,0,0,.4), 0 0 0 2px #cfc9bb; flex: none; transition: background .2s, box-shadow .2s; }
.lamp.green { background: var(--lamp-green); box-shadow: 0 0 9px var(--lamp-green), 0 0 0 2px #cfc9bb; }
.lamp.red { background: var(--lamp-red); box-shadow: 0 0 9px var(--lamp-red), 0 0 0 2px #cfc9bb; }
.lamp.blue { background: var(--lamp-blue); box-shadow: 0 0 9px var(--lamp-blue), 0 0 0 2px #cfc9bb; }
.tray.dark .lamp.green, .tray.dark .lamp.red, .tray.dark .lamp.blue { box-shadow: 0 0 9px currentColor; }
.tray.dark .lamp.green { color: var(--lamp-green); }
.tray.dark .lamp.red { color: var(--lamp-red); }
.tray.dark .lamp.blue { color: var(--lamp-blue); }
.lamp.orange { background: var(--lamp-orange); box-shadow: 0 0 9px var(--lamp-orange), 0 0 0 2px #cfc9bb; animation: r-pulse 1.4s ease-in-out infinite; }
.keylamp { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- лоток: выезжает снизу из-под панели ---------- */
.drawer { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--ease); }
.drawer.open { grid-template-rows: 1fr; }
.drawer > .dr-in { overflow: hidden; min-height: 0; }
.drawer .tray { transform: translateY(-100%); transition: transform .4s var(--ease); }
.drawer.open .tray { transform: none; }
/* лоток, который надо показать сразу открытым, без выезда (после обновления блока) */
.drawer.no-anim, .drawer.no-anim .tray { transition: none; }
/* то же для содержимого лотка внутри лотка (например, окно нового пароля у гостя) */
.drawer > .dr-in > .slide-in { transform: translateY(-100%); transition: transform .4s var(--ease); }
.drawer.open > .dr-in > .slide-in { transform: none; }
.tray { margin: 0 12px; background: linear-gradient(var(--h-tray), #d6d0c3); border: 1px solid #a9a395; border-top: 0; border-radius: 0 0 4px 4px;
  box-shadow: inset 0 6px 6px -4px rgba(0,0,0,.28), 0 2px 0 #b8b2a4; padding: 12px; display: grid; gap: 12px; font-size: 13.5px; }
.tray.dark { background: linear-gradient(#232325, #2b2b2d); border-color: #1b1b1c; color: #e9e5da; box-shadow: inset 0 6px 6px -4px rgba(0,0,0,.6); }
.tray .mono, .mono { font-family: var(--f-mono); font-size: 13.5px; letter-spacing: .02em; }
.tray-msg { display: flex; align-items: flex-start; gap: 10px; }
.tray-msg .lamp { margin-top: 4px; box-shadow: none; }
.tray-msg .x { margin-left: auto; border: 0; background: transparent; color: inherit; font-size: 18px; line-height: 1; padding: 0 2px; opacity: .7; }
.tray-sec + .tray-sec { border-top: 1px solid #b3ad9f; padding-top: 12px; }
.tray-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tray-head .r-lbl { color: var(--h-dark); }

/* поля ввода внутри лотков */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > label, .field > .lbl { font-family: var(--f-wide); font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--h-mute); }
.retro-page input[type="text"], .retro-page input[type="password"], .retro-page input[type="number"] {
  width: 100%; font: 15px/1.3 var(--f-body); padding: 8px 10px; color: var(--h-dark);
  background: #f6f3ec; border: 1px solid var(--h-edge); border-radius: 2px; box-shadow: inset 0 1px 3px rgba(0,0,0,.18); }
.retro-page input:focus { outline: 2px solid var(--h-orange); outline-offset: 0; }
.retro-page input::placeholder { color: #a39d90; }
.retro-page .pw-wrap > .pw-eye { color: var(--h-dark); }

@media (max-width: 560px) {
  .r-nav { gap: 6px 16px; }
  .r-nav a { font-size: 11px; }
  .tray { margin: 0 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ряд кнопок с фиксацией (выбор одного из нескольких) */
.seg { display: flex; flex-wrap: wrap; gap: 4px 6px; }
