/* ArisDesk — "Blueprint ink on a reading-room page"
   Референс: Making Software (ui.gradientdeck.com).
   Бумага #fbfbfb, один цвет — кобальт #103dff, пиксельный моно для лейблов,
   сериф-италик для слоганов, 1px hairlines, key-cap кнопки, точечные лидеры. */

@import url('https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --paper: #fbfbfb;
  --ink: #16161a;
  --blue: #103dff;
  --blue-ink: #0b2bb8;
  --hairline: #dcdcd6;
  --hairline-dark: #b9b9b2;
  --soft: #f1f1ec;
  --muted: #6d6d66;
  --danger: #c92a2a;
  --ok: #1a7f37;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --pixel: "Silkscreen", var(--mono);
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(rgba(16, 61, 255, 0.05) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--mono);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 12px; min-height: 18px; margin-top: 8px; }
.hint { font-size: 11px; margin-top: 14px; letter-spacing: 0.02em; }

code {
  font-family: var(--mono);
  background: var(--soft);
  border: 1px solid var(--hairline);
  padding: 0 4px;
  font-size: 12px;
}

.screen { height: 100%; display: flex; flex-direction: column; }

/* шапка: волосяная линия + пиксельный вордмарк */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
}
.topbar .brand { margin: 0; }
.spacer { flex: 1; }

.brand {
  font-family: var(--pixel);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin: 0 0 2px;
}
.brand span { color: var(--blue); }
.brand span::after {
  content: "▮";
  color: var(--blue);
  animation: blink 1.2s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.brand.small { font-size: 14px; }

/* кнопки: key-cap с фаской */
button {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.05s, box-shadow 0.05s;
}
button:hover { background: var(--soft); }
button:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }

button.primary {
  background: var(--blue);
  border-color: var(--blue-ink);
  color: #fff;
  box-shadow: 2px 2px 0 rgba(11, 43, 184, 0.55);
}
button.primary:hover { background: var(--blue-ink); }
button.primary:active { box-shadow: 0 0 0 rgba(11, 43, 184, 0.55); }

button.ghost { box-shadow: none; border-color: var(--hairline-dark); background: transparent; }
button.ghost:hover { border-color: var(--ink); background: #fff; }

button.danger {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
  box-shadow: 2px 2px 0 var(--danger);
}
button.danger:hover { background: var(--danger); color: #fff; }

button.primary.big {
  width: 100%;
  padding: 15px;
  font-size: 13px;
  margin-top: 16px;
}

.alt-providers {
  display: flex;
  gap: 10px;
  border-top: 1px dotted var(--hairline-dark);
  padding-top: 12px;
  margin-top: 4px;
}
.alt-providers button { flex: 1; text-transform: none; letter-spacing: 0.04em; }

.round-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

/* логин: карточка-титульный лист */
#screen-login { align-items: center; justify-content: center; }
.card {
  width: 400px;
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 3px;
  box-shadow: 4px 4px 0 rgba(22, 22, 26, 0.14);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card .brand { font-size: 20px; margin-bottom: 4px; }

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--ink);
  margin: 0 0 14px;
  line-height: 1.35;
}

.card .hint { border-top: 1px dotted var(--hairline-dark); padding-top: 10px; }

.server-details { margin-top: 14px; font-size: 12px; }
.server-details summary { cursor: pointer; user-select: none; }
.server-details label { margin-top: 8px; }
.server-details input { width: 100%; margin-bottom: 6px; }

label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-top: 10px;
}

input {
  font-family: var(--mono);
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  padding: 9px 11px;
  font-size: 13px;
  outline: none;
}
input:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
input::placeholder { color: var(--hairline-dark); }

/* бейджи и статусы */
.badge {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--hairline-dark);
  border-radius: 2px;
  padding: 3px 9px;
  color: var(--ink);
  background: #fff;
  font-variant-numeric: tabular-nums;
}
.dot { width: 7px; height: 7px; border-radius: 1px; background: var(--ok); }

/* главный экран: рельс слева (как в AnyDesk) + контент на всю ширину */
.shell { display: flex; height: 100%; }

.rail {
  width: 200px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--ink);
  padding: 14px 12px;
}
.rail-brand { margin-bottom: 2px; }
.rail-user { font-size: 11px; padding-bottom: 12px; border-bottom: 1px dotted var(--hairline-dark); margin-bottom: 10px; overflow: hidden; text-overflow: ellipsis; }

.rail-nav { display: flex; flex-direction: column; gap: 4px; }
.rail-btn {
  text-align: left;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 13px;
  padding: 8px 12px;
  border-color: transparent;
  box-shadow: none;
  background: transparent;
}
.rail-btn:hover { background: var(--soft); border-color: transparent; }
.rail-btn.active {
  background: var(--blue);
  border-color: var(--blue-ink);
  color: #fff;
}

.rail-bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dotted var(--hairline-dark);
}
.rail-self-id { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 4px 0 6px; }
.rail-bottom .online-row { margin-top: 6px; }
.rail-logout { width: 100%; margin-top: 12px; }

.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 18px 22px; overflow: auto; }

.top-row {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
}
.top-row .connect-card { flex: 1.4; min-width: 0; }
.top-row .desk-card--self { flex: 1; min-width: 300px; }
.desk-card {
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 14px 18px;
}
.card-label, .list-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 12px;
}
/* точечный лидер как в референсе */
.card-label::after, .list-title::after {
  content: "";
  flex: 1;
  border-bottom: 1px dotted var(--hairline-dark);
}

.self-id {
  font-family: var(--pixel);
  font-size: 24px;
  line-height: 1;
  color: var(--blue);
  margin: 2px 0 8px;
}
.desk-card--self .online-row { margin-top: 8px; }
.self-meta { font-size: 11px; }
.online-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.online-row .dot { box-shadow: 0 0 0 2px rgba(26, 127, 55, 0.15); }

.connect-row { display: flex; gap: 10px; align-items: center; }
.connect-row input {
  flex: 1;
  font-size: 15px;
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
}
.connect-hint { font-size: 12px; min-height: 16px; margin-top: 8px; }

/* списки устройств — во всю ширину */
.list-section { margin-bottom: 18px; }
.list-empty { font-size: 12px; padding: 2px 0; }
.device-list { display: flex; flex-direction: column; gap: 8px; }
.device {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--hairline-dark);
  border-radius: 3px;
  padding: 9px 14px;
}
.device:hover { border-color: var(--ink); }
.device-id {
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--blue);
  min-width: 118px;
}
.device .meta { flex: 1; min-width: 0; }
.device .name { font-weight: 600; font-size: 13px; }
.device .sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.device .round-btn { width: 32px; height: 32px; min-width: 32px; font-size: 14px; }

/* сессия */
#screen-session { height: 100%; position: relative; }
.viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(rgba(16, 61, 255, 0.06) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--soft);
  overflow: hidden;
  border-top: 1px solid var(--hairline);
}
#remote-canvas {
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--ink);
  background: #fff;
  box-shadow: 6px 6px 0 rgba(22, 22, 26, 0.14);
  cursor: crosshair;
}
#agent-preview {
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--ink);
  background: #000;
}

/* боковые панели */
.side-panel {
  position: absolute;
  top: 52px;
  right: 12px;
  bottom: 12px;
  width: 340px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(22, 22, 26, 0.14);
  overflow: hidden;
}
.side-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ink);
  font-family: var(--pixel);
  font-size: 11px;
}
.side-panel header button { box-shadow: none; border-color: var(--hairline-dark); padding: 2px 8px; }
.apps-list {
  flex: 1;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
}
.app-item {
  text-align: left;
  padding: 6px 9px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none;
  border-color: transparent;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
}
.app-item:hover { background: var(--soft); border-color: transparent; }
.fs-path {
  padding: 8px 12px;
  font-size: 11px;
  border-bottom: 1px dotted var(--hairline-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fs-footer { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--hairline); }
.fs-footer button { flex: none; }
.fs-progress { font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.fs-size { color: var(--muted); font-size: 10px; margin-left: auto; padding-left: 8px; flex: none; }
.row-inner { display: flex; align-items: center; gap: 6px; width: 100%; }

#apps-panel.hidden, #fs-panel.hidden { display: none !important; }
#apps-panel footer { padding: 10px 12px; border-top: 1px solid var(--hairline); }
#apps-panel footer button { width: 100%; }

/* модалка */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(22, 22, 26, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none !important; }
.modal-card {
  width: 430px;
  background: #fff;
  border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(22, 22, 26, 0.2);
  padding: 24px;
}
.modal-title { font-family: var(--pixel); font-size: 14px; margin-bottom: 10px; color: var(--blue); }
.modal-note { font-size: 11px; margin: 10px 0 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* тост: key-cap */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 18px;
  z-index: 50;
  box-shadow: 3px 3px 0 rgba(16, 61, 255, 0.8);
}
